mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-11 06:59:24 +01:00
Switch to Proguard Gradle
This commit is contained in:
parent
b8016ae6ef
commit
0003d56389
@ -52,16 +52,13 @@ processResources.inputs.property('version', version)
|
||||
processResources.expand('version': version)
|
||||
|
||||
// build a jar containing all dependencies
|
||||
jar {
|
||||
task fatJar (type: Jar) {
|
||||
from sourceSets.main.output
|
||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
|
||||
manifest {
|
||||
attributes("Main-Class": "org.jf.baksmali.main")
|
||||
}
|
||||
|
||||
doLast {
|
||||
//ant.symlink(link: file("${destinationDir}/baksmali.jar"), resource: archivePath, overwrite: true)
|
||||
}
|
||||
}
|
||||
|
||||
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {
|
||||
|
@ -82,7 +82,7 @@ subprojects {
|
||||
stringtemplate: 'org.antlr:stringtemplate:3.2.1',
|
||||
commons_cli: 'commons-cli:commons-cli:1.2',
|
||||
jflex: 'de.jflex:jflex:1.4.3',
|
||||
proguard: 'net.sf.proguard:proguard-base:5.2'
|
||||
proguard_gradle: 'net.sf.proguard:proguard-gradle:5.1'
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -141,17 +141,17 @@ task generateJflexSource(type: JavaExec) {
|
||||
compileJava.dependsOn generateParserAntlrSource, generateTreeWalkerAntlrSource, generateJflexSource
|
||||
compileTestJava.dependsOn generateTestAntlrSource
|
||||
|
||||
processResources.inputs.property('version', version)
|
||||
processResources.expand('version': version)
|
||||
|
||||
// build a jar containing all dependencies
|
||||
jar {
|
||||
task fatJar (type: Jar) {
|
||||
from sourceSets.main.output
|
||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
|
||||
manifest {
|
||||
attributes("Main-Class": "org.jf.smali.main")
|
||||
}
|
||||
|
||||
doLast {
|
||||
// ant.symlink(link: file("${destinationDir}/smali.jar"), resource: archivePath, overwrite: true)
|
||||
}
|
||||
}
|
||||
|
||||
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {
|
||||
|
@ -15,13 +15,18 @@
|
||||
*/
|
||||
apply plugin: 'eu.appsatori.fatjar'
|
||||
|
||||
configurations {
|
||||
proguard
|
||||
dependencies {
|
||||
compile project(':brut.apktool:apktool-lib')
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':brut.apktool:apktool-lib')
|
||||
proguard depends.proguard
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath depends.proguard_gradle
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {
|
||||
@ -36,26 +41,25 @@ task cleanOutputDirectory(type: Delete) {
|
||||
delete fileTree(dir: jar.destinationDir.getPath(), exclude: "apktool-cli.jar")
|
||||
}
|
||||
|
||||
task proguard(type: JavaExec, dependsOn: fatJar) {
|
||||
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {
|
||||
def outFile = jar.destinationDir.getPath() + '/' + "apktool" + '-' + project.apktool_version + '-small' + '.' + jar.extension
|
||||
inputs.file jar.archivePath
|
||||
outputs.file outFile
|
||||
|
||||
classpath = configurations.proguard
|
||||
main = 'proguard.ProGuard'
|
||||
args '-injars ' + "${jar.archivePath}" + ' (!META-INF/LICENSE.txt,!META-INF/NOTICE.txt,!README)'
|
||||
args "-outjars ${outFile}"
|
||||
args "-libraryjars ${System.properties['java.home']}/lib/rt.jar"
|
||||
args '-dontobfuscate'
|
||||
args '-dontoptimize'
|
||||
args '-keep public class brut.apktool.Main { public static void main(java.lang.String[]); }'
|
||||
args '-keep class org.yaml.snakeyaml.** { public protected private *; }'
|
||||
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
|
||||
args '-dontwarn com.google.common.base.**'
|
||||
args '-dontwarn com.google.common.collect.**'
|
||||
args '-dontwarn com.google.common.util.**'
|
||||
args '-dontwarn javax.xml.xpath.**'
|
||||
args '-dontnote **'
|
||||
injars fatJar.archivePath
|
||||
outjars outFile
|
||||
|
||||
libraryjars "${System.properties['java.home']}/lib/rt.jar"
|
||||
|
||||
dontobfuscate
|
||||
dontoptimize
|
||||
|
||||
keep 'public class brut.apktool.Main { public static void main(java.lang.String[]); }'
|
||||
keep 'class org.yaml.snakeyaml.** { public protected private *; }'
|
||||
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 '**'
|
||||
}
|
||||
|
||||
proguard.dependsOn cleanOutputDirectory
|
||||
|
@ -97,7 +97,6 @@ subprojects {
|
||||
guava: 'com.google.guava:guava:14.0',
|
||||
jflex: 'de.jflex:jflex:1.4.3',
|
||||
junit: 'junit:junit:4.6',
|
||||
proguard: 'net.sf.proguard:proguard-base:5.2',
|
||||
proguard_gradle: 'net.sf.proguard:proguard-gradle:5.1',
|
||||
snakeyaml: 'org.yaml:snakeyaml:1.12',
|
||||
xmlpull: 'xpp3:xpp3:1.1.4c',
|
||||
@ -105,10 +104,6 @@ subprojects {
|
||||
]
|
||||
}
|
||||
|
||||
jar {
|
||||
version = jarVersion
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user