mirror of
https://github.com/revanced/Apktool.git
synced 2024-08-28 18:16:41 +02:00
* Simple straitforward yaml serialization with minimal needed functionality * Consolidate ApkInfo tests in the package brut.androlib.apk, unify interface YamlReader and add ApkInfoSerializationTest read -> write -> read test * remove dependencies from snakeyaml * remove unused methods * correct indent test value * correct style with curly braces * add test item with hieroglyph
101 lines
3.8 KiB
Groovy
101 lines
3.8 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
|
|
*
|
|
* https://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.
|
|
*/
|
|
import proguard.gradle.ProGuardTask
|
|
|
|
buildscript {
|
|
dependencies {
|
|
repositories {
|
|
mavenCentral()
|
|
gradlePluginPortal()
|
|
}
|
|
|
|
classpath(depends.proguard_gradle) {
|
|
exclude group: 'com.android.tools.build'
|
|
}
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'com.github.johnrengelman.shadow'
|
|
id 'application'
|
|
}
|
|
|
|
dependencies {
|
|
implementation depends.commons_cli
|
|
implementation project(':brut.apktool:apktool-lib')
|
|
}
|
|
|
|
application {
|
|
mainClass = 'brut.apktool.Main'
|
|
}
|
|
|
|
tasks.named('run') {
|
|
// run from root directory
|
|
// otherwise run from brut.apktool/apktool-cli
|
|
workingDir = file(System.getProperty('user.dir'))
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'Main-Class': 'brut.apktool.Main'
|
|
}
|
|
}
|
|
|
|
tasks.register('cleanOutputDirectory', Delete) {
|
|
delete fileTree(dir: jar.getDestinationDirectory().getAsFile(), exclude: "apktool-cli-all.jar")
|
|
}
|
|
|
|
tasks.register('proguard', ProGuardTask) {
|
|
dependsOn shadowJar
|
|
injars shadowJar.getArchiveFile()
|
|
|
|
// Java 9 and prior uses merged package for runtime, later uses split jmod files.
|
|
if (JavaVersion.current() <= JavaVersion.VERSION_1_8) {
|
|
libraryjars "${System.properties['java.home']}/lib/jce.jar"
|
|
libraryjars "${System.properties['java.home']}/lib/rt.jar"
|
|
} else {
|
|
libraryjars "${System.properties['java.home']}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
libraryjars "${System.properties['java.home']}/jmods/java.compiler.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
libraryjars "${System.properties['java.home']}/jmods/java.logging.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
libraryjars "${System.properties['java.home']}/jmods/java.xml.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
libraryjars "${System.properties['java.home']}/jmods/java.desktop.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
libraryjars "${System.properties['java.home']}/jmods/java.sql.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
libraryjars "${System.properties['java.home']}/jmods/java.scripting.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
|
|
libraryjars "${System.properties['java.home']}/jmods/jdk.unsupported.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 '**'
|
|
// between Java 1.8 and 1.9, the signature of `flip()` changed, which trips up proguard.
|
|
|
|
def outPath = jar.getDestinationDirectory().getAsFile().get().toString()
|
|
def extension = jar.archiveExtension.get().toString()
|
|
def outFile = outPath + '/' + "apktool" + '-' + project.apktool_version + '-small' + '.' + extension
|
|
outjars outFile
|
|
}
|
|
|
|
proguard.dependsOn cleanOutputDirectory
|
|
tasks.getByPath(':release').dependsOn(proguard)
|