Skip to content

Commit 69c3951

Browse files
committed
build: migrate to modern maven publish
1 parent 9916ac1 commit 69c3951

File tree

2 files changed

+36
-60
lines changed

2 files changed

+36
-60
lines changed

build.gradle.kts

Lines changed: 32 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ val gitBranch: String? by lazy {
3737
}
3838

3939
if ("release" !in gradle.startParameter.taskNames) {
40-
val hash = this.gitDescribe
40+
val hash = gitDescribe
4141

4242
if (hash == null) {
4343
gitRevision = "dirty"
@@ -56,8 +56,7 @@ if ("release" !in gradle.startParameter.taskNames) {
5656

5757
plugins {
5858
`java-library`
59-
`maven-publish`
60-
signing
59+
id("com.vanniktech.maven.publish") version "0.30.0"
6160
}
6261

6362
allprojects {
@@ -90,75 +89,48 @@ subprojects {
9089
)
9190

9291
if (project.name in mavenProjects) {
93-
apply(plugin = "maven-publish")
94-
apply(plugin = "signing")
92+
apply(plugin = "com.vanniktech.maven.publish")
9593

96-
java {
97-
withJavadocJar()
98-
withSourcesJar()
99-
}
94+
mavenPublishing {
95+
publishToMavenCentral()
96+
signAllPublications()
10097

101-
publishing {
102-
repositories {
103-
maven {
104-
url = if (suffix.contains("SNAPSHOT")) {
105-
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
106-
} else {
107-
uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
108-
}
109-
credentials {
110-
username = (project.properties["ossrhUsername"] ?: "").toString()
111-
password = (project.properties["ossrhPassword"] ?: "").toString()
98+
coordinates("org.apktool", project.name, apktoolVersion)
99+
100+
pom {
101+
name.set("Apktool")
102+
description.set("A tool for reverse engineering Android apk files.")
103+
url.set("https://apktool.org")
104+
105+
licenses {
106+
license {
107+
name.set("The Apache License 2.0")
108+
url.set("https://opensource.org/licenses/Apache-2.0")
112109
}
113110
}
114-
}
115-
publications {
116-
register("mavenJava", MavenPublication::class) {
117-
from(components["java"])
118-
groupId = "org.apktool"
119-
artifactId = project.name
120-
version = apktoolVersion
121-
122-
pom {
123-
name = "Apktool"
124-
description = "A tool for reverse engineering Android apk files."
125-
url = "https://apktool.org"
126-
127-
licenses {
128-
license {
129-
name = "The Apache License 2.0"
130-
url = "https://opensource.org/licenses/Apache-2.0"
131-
}
132-
}
133-
developers {
134-
developer {
135-
id = "iBotPeaches"
136-
name = "Connor Tumbleson"
137-
138-
}
139-
developer {
140-
id = "brutall"
141-
name = "Ryszard Wiśniewski"
142-
143-
}
144-
}
145-
scm {
146-
connection = "scm:git:git://github.com/iBotPeaches/Apktool.git"
147-
developerConnection = "scm:git:[email protected]:iBotPeaches/Apktool.git"
148-
url = "https://github.com/iBotPeaches/Apktool"
149-
}
111+
developers {
112+
developer {
113+
id.set("iBotPeaches")
114+
name.set("Connor Tumbleson")
115+
email.set("[email protected]")
150116
}
117+
developer {
118+
id.set("brutall")
119+
name.set("Ryszard Wiśniewski")
120+
email.set("[email protected]")
121+
}
122+
}
123+
scm {
124+
connection.set("scm:git:git://github.com/iBotPeaches/Apktool.git")
125+
developerConnection.set("scm:git:[email protected]:iBotPeaches/Apktool.git")
126+
url.set("https://github.com/iBotPeaches/Apktool")
151127
}
152128
}
153129
}
154130

155131
tasks.withType<Javadoc>() {
156132
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
157133
}
158-
159-
signing {
160-
sign(publishing.publications["mavenJava"])
161-
}
162134
}
163135
}
164136

gradle/libs.versions.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ r8 = "8.13.17"
1010
smali = "b6365a84f4" # https://github.com/google/smali/issues/100
1111
xmlpull = "1.1.3.1"
1212
xmlunit = "2.11.0"
13+
maven-publish = "0.30.0"
1314

1415
[libraries]
1516
baksmali = { module = "com.github.iBotPeaches.smali:smali-baksmali", version.ref = "baksmali" }
@@ -23,3 +24,6 @@ r8 = { module = "com.android.tools:r8", version.ref = "r8" }
2324
smali = { module = "com.github.iBotPeaches.smali:smali", version.ref = "smali" }
2425
xmlpull = { module = "xmlpull:xmlpull", version.ref = "xmlpull" }
2526
xmlunit = { module = "org.xmlunit:xmlunit-legacy", version.ref = "xmlunit" }
27+
28+
[plugins]
29+
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }

0 commit comments

Comments
 (0)