/** * Copyright 2014 Ryszard Wiśniewski * * 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: 'com.github.johnrengelman.shadow' dependencies { compile depends.commons_cli compile project(':brut.apktool:apktool-lib') } buildscript { repositories { mavenCentral() } dependencies { classpath depends.proguard_gradle } } jar { manifest { attributes 'Main-Class' : 'brut.apktool.Main' } } task cleanOutputDirectory(type: Delete) { delete fileTree(dir: jar.destinationDir.getPath(), exclude: "apktool-cli-all.jar") } task proguard(type: proguard.gradle.ProGuardTask, dependsOn: shadowJar) { injars shadowJar.archivePath // Java 9 and prior uses merged package for runtime, later uses split jmod files. if (System.getProperty("java.version").startsWith('1.')) { libraryjars "${System.properties['java.home']}/lib/rt.jar" } else { libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class' } dontobfuscate dontoptimize keep 'public 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 '**' def outFile = jar.destinationDir.getPath() + '/' + "apktool" + '-' + project.apktool_version + '-small' + '.' + jar.extension outjars outFile } proguard.dependsOn cleanOutputDirectory tasks.getByPath(':release').dependsOn(proguard)