Apktool/brut.apktool/apktool-cli/build.gradle
2014-10-23 18:14:48 -05:00

62 lines
2.1 KiB
Groovy

/**
* Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'eu.appsatori.fatjar'
configurations {
proguard
}
dependencies {
compile project(':brut.apktool:apktool-lib')
proguard depends.proguard
}
gradle.taskGraph.whenReady {
fatJar {
manifest {
attributes("Main-Class": "brut.apktool.Main")
}
}
}
task cleanOutputDirectory(type: Delete) {
delete fileTree(dir: jar.destinationDir.getPath(), exclude: "apktool-cli.jar")
}
task proguard(type: JavaExec, 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 **'
}
proguard.dependsOn cleanOutputDirectory
tasks.getByPath(':release').dependsOn(proguard)