mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-04 03:39:24 +01:00
342ff67a4c
* feat: initial migration to kotlin * feat: initial migration to kotlin * fix: wire up dependencies * fix: Deprecated tag for kotlin detection * refactor: put all modules into sub-projects * fix: include jar file (android framework) * fix: add version message/info * fix: wire up version/gitrev to properties * fix: wire up proguard on cli * fix: wire up proguard * fix: wire up output cleaning command * fix: drop license header on gradle files - fully rewritten from scratch by myself - no longer including license header on build files * fix: add compile utf8/flags for java8 * refactor: remove unneeded curly braces * feat: progress towards maven-publish * build: publish to maven * docs: update documentation * refactor: prevent implicit order by removal of afterEvaluate * build: remove unused license plugin
75 lines
2.1 KiB
Plaintext
75 lines
2.1 KiB
Plaintext
import proguard.gradle.ProGuardTask
|
|
|
|
val commonsCliVersion: String by rootProject.extra
|
|
val apktoolVersion: String by rootProject.extra
|
|
|
|
plugins {
|
|
id("com.github.johnrengelman.shadow")
|
|
application
|
|
}
|
|
|
|
// Buildscript is deprecated, but the alternative approach does not support expanded properties
|
|
// https://github.com/gradle/gradle/issues/9830
|
|
// So we must hard-code the version here.
|
|
buildscript {
|
|
dependencies {
|
|
// Proguard doesn't support plugin DSL - https://github.com/Guardsquare/proguard/issues/225
|
|
classpath("com.guardsquare:proguard-gradle:7.3.2")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation("commons-cli:commons-cli:$commonsCliVersion")
|
|
implementation(project(":brut.apktool:apktool-lib"))
|
|
}
|
|
|
|
application {
|
|
mainClass.set("brut.apktool.Main")
|
|
|
|
tasks.run.get().workingDir = file(System.getProperty("user.dir"))
|
|
}
|
|
|
|
tasks.withType<Jar> {
|
|
manifest {
|
|
attributes["Main-Class"] = "brut.apktool.Main"
|
|
}
|
|
}
|
|
|
|
tasks.register<Delete>("cleanOutputDirectory") {
|
|
delete(fileTree("build/libs") {
|
|
exclude("apktool-cli-all.jar")
|
|
})
|
|
}
|
|
|
|
tasks.register<ProGuardTask>("proguard") {
|
|
dependsOn("cleanOutputDirectory")
|
|
dependsOn("shadowJar")
|
|
injars(tasks.named("shadowJar").get().outputs.files)
|
|
|
|
val javaHome = System.getProperty("java.home")
|
|
if (JavaVersion.current() <= JavaVersion.VERSION_1_8) {
|
|
libraryjars("$javaHome/lib/jce.jar")
|
|
libraryjars("$javaHome/lib/rt.jar")
|
|
} else {
|
|
libraryjars(mapOf("jarfilter" to "!**.jar", "filter" to "!module-info.class"),
|
|
{
|
|
"$javaHome/jmods/"
|
|
}
|
|
)
|
|
}
|
|
|
|
dontobfuscate()
|
|
dontoptimize()
|
|
|
|
keep("class brut.apktool.Main { public static void main(java.lang.String[]); }")
|
|
keepclassmembers("enum * { public static **[] values(); public static ** valueOf(java.lang.String); }")
|
|
dontwarn("com.google.common.base.**")
|
|
dontwarn("com.google.common.collect.**")
|
|
dontwarn("com.google.common.util.**")
|
|
dontwarn("javax.xml.xpath.**")
|
|
dontnote("**")
|
|
|
|
val outPath = "build/libs/apktool-cli-$apktoolVersion.jar"
|
|
outjars(outPath)
|
|
}
|