[android] Fix publishing to Maven Central

This commit is contained in:
Mario Zechner 2024-07-24 20:05:34 +02:00
parent 14d21f8409
commit 5de003cb8f
4 changed files with 65 additions and 12 deletions

View File

@ -71,6 +71,5 @@ dependencies {
debugImplementation(libs.androidx.ui.test.manifest)
implementation(project(":spine-android"))
// Run `./gradlew publishToMavenLocal` in `spine-android` to use from local maven repo.
// implementation("com.esotericsoftware:spine-android:4.2")
// implementation("com.esotericsoftware.spine:spine-android:4.2.2-SNAPSHOT")
}

View File

@ -62,7 +62,7 @@ fun AnimationState(nav: NavHostController) {
controller.skeleton.setScaleX(0.5f)
controller.skeleton.setScaleY(0.5f)
controller.skeleton.findSlot("gun")?.color = Color(1f, 0f, 0f, 1f)
controller.skeleton.findSlot("gun")?.color?.set(Color(1f, 0f, 0f, 1f))
controller.animationStateData.setDefaultMix(0.2f)
controller.animationState.setAnimation(0, "walk", true).setListener(object : AnimationState.AnimationStateListener {

View File

@ -24,11 +24,11 @@ dependencyResolutionManagement {
}
rootProject.name = "Spine Android Examples"
includeBuild("../spine-libgdx") {
dependencySubstitution {
substitute(module("com.esotericsoftware.spine:spine-libgdx")).using(project(":spine-libgdx"))
}
}
//includeBuild("../spine-libgdx") {
// dependencySubstitution {
// substitute(module("com.esotericsoftware.spine:spine-libgdx")).using(project(":spine-libgdx"))
// }
//}
//includeBuild("../../libgdx") {
// dependencySubstitution {
// substitute(module("com.badlogicgames.gdx:gdx")).using(project(":gdx"))

View File

@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.androidLibrary)
`maven-publish`
signing
}
android {
@ -39,16 +40,47 @@ dependencies {
androidTestImplementation(libs.androidx.espresso.core)
}
val libraryVersion = "4.2.2-SNAPSHOT" // Update this as needed
tasks.register<Jar>("sourceJar") {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs)
}
afterEvaluate {
publishing {
publications {
create<MavenPublication>("mavenLocal") {
groupId = "com.esotericsoftware"
artifactId = "spine-android"
version = "4.2"
create<MavenPublication>("release") {
artifact(tasks.getByName("bundleReleaseAar"))
artifact(tasks.getByName("sourceJar"))
groupId = "com.esotericsoftware.spine"
artifactId = "spine-android"
version = libraryVersion
pom {
packaging = "aar"
name.set("spine-android")
description.set("Spine Runtime for Android")
url.set("https://github.com/esotericsoftware/spine-runtimes")
licenses {
license {
name.set("Spine Runtimes License")
url.set("http://esotericsoftware.com/spine-runtimes-license")
}
}
developers {
developer {
name.set("Esoteric Software")
email.set("contact@esotericsoftware.com")
}
}
scm {
url.set(pom.url.get())
connection.set("scm:git:${url.get()}.git")
developerConnection.set("scm:git:${url.get()}.git")
}
withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations.api.get().dependencies.forEach { dependency ->
@ -68,8 +100,30 @@ afterEvaluate {
}
}
}
}
}
}
repositories {
maven {
name = "SonaType"
url = uri(if (libraryVersion.endsWith("-SNAPSHOT")) {
"https://oss.sonatype.org/content/repositories/snapshots"
} else {
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
})
credentials {
username = project.findProperty("ossrhUsername") as String?
password = project.findProperty("ossrhPassword") as String?
}
}
}
}
signing {
useGpgCmd()
sign(publishing.publications["release"])
}
}