mirror of
https://github.com/revanced/Apktool.git
synced 2025-04-30 22:24:25 +02:00
feat: support for maven publish (snapshot/release)
This commit is contained in:
parent
619c17bdb0
commit
36b59a0553
99
build.gradle
99
build.gradle
@ -31,8 +31,9 @@ plugins {
|
|||||||
|
|
||||||
apply from: 'gradle/functions.gradle'
|
apply from: 'gradle/functions.gradle'
|
||||||
|
|
||||||
def apktoolversion_major = '2.5.1'
|
group = 'org.apktool'
|
||||||
def apktoolversion_minor = 'SNAPSHOT'
|
version = '2.5.1'
|
||||||
|
def suffix = 'SNAPSHOT'
|
||||||
|
|
||||||
defaultTasks 'build', 'shadowJar', 'proguard'
|
defaultTasks 'build', 'shadowJar', 'proguard'
|
||||||
|
|
||||||
@ -68,25 +69,28 @@ allprojects {
|
|||||||
gradle.startParameter.excludedTaskNames += "licenseTest"
|
gradle.startParameter.excludedTaskNames += "licenseTest"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def apktoolVersion = 'unspecified'
|
||||||
if (!('release' in gradle.startParameter.taskNames)) {
|
if (!('release' in gradle.startParameter.taskNames)) {
|
||||||
def hash = getCheckedOutGitCommitHash()
|
def hash = getCheckedOutGitCommitHash()
|
||||||
|
|
||||||
if (hash == null) {
|
if (hash == null) {
|
||||||
project.ext.set("hash", "dirty")
|
project.ext.set("hash", "dirty")
|
||||||
project.ext.set("apktool_version", apktoolversion_major + "-dirty")
|
project.ext.set("apktool_version", version + "-dirty")
|
||||||
println "Building SNAPSHOT (no .git folder found)"
|
println "Building SNAPSHOT (no .git folder found)"
|
||||||
} else {
|
} else {
|
||||||
project.ext.set("hash", hash)
|
project.ext.set("hash", hash)
|
||||||
project.ext.set("apktool_version", apktoolversion_major + "-" + hash + "-SNAPSHOT")
|
project.ext.set("apktool_version", version + "-" + hash + "-SNAPSHOT")
|
||||||
|
apktoolVersion = version + "-dev"
|
||||||
println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash
|
println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
project.ext.set("hash", "")
|
project.ext.set("hash", "")
|
||||||
if (apktoolversion_minor.length() > 0) {
|
if (suffix.length() > 0) {
|
||||||
project.ext.set("apktool_version", apktoolversion_major + "-" + apktoolversion_minor)
|
project.ext.set("apktool_version", version + "-" + suffix)
|
||||||
} else {
|
} else {
|
||||||
project.ext.set("apktool_version", apktoolversion_major)
|
project.ext.set("apktool_version", version)
|
||||||
}
|
}
|
||||||
|
apktoolVersion = version
|
||||||
println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version
|
println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +111,10 @@ build.doFirst {
|
|||||||
task release {
|
task release {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used for publishing snapshot builds to maven.
|
||||||
|
task snapshot {
|
||||||
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
@ -135,4 +143,81 @@ subprojects {
|
|||||||
exceptionFormat = 'full'
|
exceptionFormat = 'full'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (project.name == 'apktool-lib') {
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
apply plugin: 'signing'
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
groupId = 'org.apktool'
|
||||||
|
artifactId = project.name
|
||||||
|
version = apktoolVersion
|
||||||
|
|
||||||
|
versionMapping {
|
||||||
|
usage('java-api') {
|
||||||
|
fromResolutionOf('runtimeClasspath')
|
||||||
|
}
|
||||||
|
usage('java-runtime') {
|
||||||
|
fromResolutionResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pom {
|
||||||
|
name = 'Apktool'
|
||||||
|
description = 'A tool for reverse engineering Android apk files.'
|
||||||
|
url = 'https://apktool.org'
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = 'The Apache License 2.0'
|
||||||
|
url = 'https://opensource.org/licenses/Apache-2.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'iBotPeaches'
|
||||||
|
name = 'Connor Tumbleson'
|
||||||
|
email = 'connor.tumbleson@gmail.com'
|
||||||
|
}
|
||||||
|
developer {
|
||||||
|
id = 'brutall'
|
||||||
|
name = 'Ryszard Wiśniewski'
|
||||||
|
email = 'brut.alll@gmail.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection = 'scm:git:git://github.com/iBotPeaches/Apktool.git'
|
||||||
|
developerConnection = 'scm:git:git@github.com:iBotPeaches/Apktool.git'
|
||||||
|
url = 'https://ibotpeaches.github.io/Apktool'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
|
||||||
|
credentials {
|
||||||
|
username ossrhUsername
|
||||||
|
password ossrhPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
required { gradle.taskGraph.hasTask('publish') }
|
||||||
|
sign(publishing.publications["mavenJava"])
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.getByPath(':release').dependsOn(publish);
|
||||||
|
tasks.getByPath(':snapshot').dependsOn(publish);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user