mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-25 19:27:35 +01:00
Use the proguard plugin for gradle
Conflicts: brut.apktool.smali/baksmali/build.gradle brut.apktool.smali/smali/build.gradle build.gradle
This commit is contained in:
parent
46d2fb899f
commit
b8016ae6ef
@ -28,9 +28,14 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
configurations {
|
buildscript {
|
||||||
proguard
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath depends.proguard_gradle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -41,8 +46,6 @@ dependencies {
|
|||||||
|
|
||||||
testCompile depends.junit
|
testCompile depends.junit
|
||||||
testCompile project(':brut.apktool.smali:smali')
|
testCompile project(':brut.apktool.smali:smali')
|
||||||
|
|
||||||
proguard depends.proguard
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources.inputs.property('version', version)
|
processResources.inputs.property('version', version)
|
||||||
@ -61,23 +64,22 @@ jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task proguard(type: JavaExec, dependsOn: jar) {
|
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {
|
||||||
def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
|
def outFile = fatJar.destinationDir.getPath() + '/' + fatJar.baseName + '-' + fatJar.version + '-small' + '.' + fatJar.extension
|
||||||
inputs.file jar.archivePath
|
|
||||||
outputs.file outFile
|
|
||||||
|
|
||||||
classpath = configurations.proguard
|
injars fatJar.archivePath
|
||||||
main = 'proguard.ProGuard'
|
outjars outFile
|
||||||
args '-injars ' + jar.archivePath
|
|
||||||
args '-outjars ' + outFile
|
libraryjars "${System.properties['java.home']}/lib/rt.jar"
|
||||||
args '-libraryjars ' + System.properties['java.home'] + '/lib/rt.jar'
|
|
||||||
args '-keepattributes Signature'
|
dontobfuscate
|
||||||
args '-dontobfuscate'
|
dontoptimize
|
||||||
args '-dontoptimize'
|
|
||||||
args '-keep public class org.jf.baksmali.main { public static void main(java.lang.String[]); }'
|
keep 'public class org.jf.baksmali.main { public static void main(java.lang.String[]); }'
|
||||||
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
|
keepclassmembers 'enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
|
||||||
args '-dontwarn com.google.common.**'
|
|
||||||
args '-dontnote com.google.common.**'
|
dontwarn 'com.google.common.**'
|
||||||
|
dontnote 'com.google.common.**'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.getByPath(':release').dependsOn(proguard)
|
tasks.getByPath(':release').dependsOn(proguard)
|
||||||
|
@ -32,7 +32,15 @@
|
|||||||
configurations {
|
configurations {
|
||||||
antlr3
|
antlr3
|
||||||
jflex
|
jflex
|
||||||
proguard
|
}
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath depends.proguard_gradle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.antlrSource = 'src/main/antlr3'
|
ext.antlrSource = 'src/main/antlr3'
|
||||||
@ -75,7 +83,6 @@ dependencies {
|
|||||||
|
|
||||||
antlr3 depends.antlr
|
antlr3 depends.antlr
|
||||||
jflex depends.jflex
|
jflex depends.jflex
|
||||||
proguard depends.proguard
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task generateParserAntlrSource(type: JavaExec) {
|
task generateParserAntlrSource(type: JavaExec) {
|
||||||
@ -147,25 +154,23 @@ jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources.inputs.property('version', version)
|
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {
|
||||||
processResources.expand('version': version)
|
def outFile = fatJar.destinationDir.getPath() + '/' + fatJar.baseName + '-' +
|
||||||
|
fatJar.version + '-small' + '.' + fatJar.extension
|
||||||
|
|
||||||
task proguard(type: JavaExec, dependsOn: jar) {
|
injars fatJar.archivePath
|
||||||
def outFile = jar.destinationDir.getPath() + '/' + jar.baseName + '-' + jar.version + '-small' + '.' + jar.extension
|
outjars outFile
|
||||||
inputs.file jar.archivePath
|
|
||||||
outputs.file outFile
|
|
||||||
|
|
||||||
classpath = configurations.proguard
|
libraryjars "${System.properties['java.home']}/lib/rt.jar"
|
||||||
main = 'proguard.ProGuard'
|
|
||||||
args "-injars ${jar.archivePath}(!**/TestStringTemplate*.class)"
|
dontobfuscate
|
||||||
args "-outjars ${outFile}"
|
dontoptimize
|
||||||
args "-libraryjars ${System.properties['java.home']}/lib/rt.jar"
|
|
||||||
args '-dontobfuscate'
|
keep 'public class org.jf.smali.main { public static void main(java.lang.String[]); }'
|
||||||
args '-dontoptimize'
|
keepclassmembers 'enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
|
||||||
args '-keep public class org.jf.smali.main { public static void main(java.lang.String[]); }'
|
|
||||||
args '-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }'
|
dontwarn 'com.google.common.**'
|
||||||
args '-dontwarn com.google.common.**'
|
dontnote 'com.google.common.**'
|
||||||
args '-dontnote com.google.common.**'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.getByPath(':release').dependsOn(proguard)
|
tasks.getByPath(':release').dependsOn(proguard)
|
||||||
|
@ -98,12 +98,17 @@ subprojects {
|
|||||||
jflex: 'de.jflex:jflex:1.4.3',
|
jflex: 'de.jflex:jflex:1.4.3',
|
||||||
junit: 'junit:junit:4.6',
|
junit: 'junit:junit:4.6',
|
||||||
proguard: 'net.sf.proguard:proguard-base:5.2',
|
proguard: 'net.sf.proguard:proguard-base:5.2',
|
||||||
|
proguard_gradle: 'net.sf.proguard:proguard-gradle:5.1',
|
||||||
snakeyaml: 'org.yaml:snakeyaml:1.12',
|
snakeyaml: 'org.yaml:snakeyaml:1.12',
|
||||||
xmlpull: 'xpp3:xpp3:1.1.4c',
|
xmlpull: 'xpp3:xpp3:1.1.4c',
|
||||||
xmlunit: 'xmlunit:xmlunit:1.3',
|
xmlunit: 'xmlunit:xmlunit:1.3',
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
version = jarVersion
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user