Allows run app from gradle for debugging purposes (#3179)

Co-authored-by: Connor Tumbleson <iBotPeaches@users.noreply.github.com>
This commit is contained in:
sv99 2023-07-20 13:03:47 +03:00 committed by GitHub
parent ca07a0a56c
commit e3e2a7e1d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -42,17 +42,24 @@ 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'
}
}
task cleanOutputDirectory(type: Delete) {
tasks.register('cleanOutputDirectory', Delete) {
delete fileTree(dir: jar.getDestinationDirectory().getAsFile(), exclude: "apktool-cli-all.jar")
}
task proguard(type: ProGuardTask, dependsOn: shadowJar) {
tasks.register('proguard', ProGuardTask) {
dependsOn shadowJar
injars shadowJar.getArchiveFile()
// Java 9 and prior uses merged package for runtime, later uses split jmod files.

View File

@ -183,7 +183,8 @@ public class Main {
outDir = new File(outName);
}
ApkDecoder decoder = new ApkDecoder(config, new ExtFile(apkName));
ExtFile apkFile = new ExtFile(apkName);
ApkDecoder decoder = new ApkDecoder(config, apkFile);
try {
decoder.decode(outDir);
@ -195,7 +196,7 @@ public class Main {
+ "already exists. Use -f switch if you want to overwrite it.");
System.exit(1);
} catch (InFileNotFoundException ex) {
System.err.println("Input file (" + apkName + ") " + "was not found or was not readable.");
System.err.println("Input file (" + apkFile.getAbsolutePath() + ") " + "was not found or was not readable.");
System.exit(1);
} catch (CantFindFrameworkResException ex) {
System.err