-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move build functions from Androlib to the ApkBuilder (#3103)
- Loading branch information
Showing
45 changed files
with
458 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import brut.androlib.exceptions.CantFindFrameworkResException; | ||
import brut.androlib.exceptions.InFileNotFoundException; | ||
import brut.androlib.exceptions.OutDirExistsException; | ||
import brut.androlib.res.AndrolibResources; | ||
import brut.common.BrutException; | ||
import brut.directory.DirectoryException; | ||
import brut.directory.ExtFile; | ||
|
@@ -32,6 +33,9 @@ | |
import java.io.IOException; | ||
import java.util.logging.*; | ||
|
||
/** | ||
* Main entry point of the apktool. | ||
*/ | ||
public class Main { | ||
public static void main(String[] args) throws BrutException { | ||
|
||
|
@@ -174,10 +178,9 @@ private static void cmdDecode(CommandLine cli, Config config) throws AndrolibExc | |
} | ||
|
||
ApkDecoder decoder = new ApkDecoder(config, new ExtFile(apkName)); | ||
decoder.setOutDir(outDir); | ||
|
||
try { | ||
decoder.decode(); | ||
decoder.decode(outDir); | ||
} catch (OutDirExistsException ex) { | ||
System.err | ||
.println("Destination directory (" | ||
|
@@ -259,7 +262,7 @@ private static void cmdBuild(CommandLine cli, Config config) { | |
if (cli.hasOption("a") || cli.hasOption("aapt")) { | ||
config.aaptVersion = AaptManager.getAaptVersion(cli.getOptionValue("a")); | ||
} | ||
new Androlib(config).build(new File(appDirName), outFile); | ||
new ApkBuilder(config, new ExtFile(appDirName)).build(outFile); | ||
} catch (BrutException ex) { | ||
System.err.println(ex.getMessage()); | ||
System.exit(1); | ||
|
@@ -268,23 +271,23 @@ private static void cmdBuild(CommandLine cli, Config config) { | |
|
||
private static void cmdInstallFramework(CommandLine cli, Config config) throws AndrolibException { | ||
String apkName = getLastArg(cli); | ||
new Androlib(config).installFramework(new File(apkName)); | ||
new AndrolibResources(config).installFramework(new File(apkName)); | ||
} | ||
|
||
private static void cmdListFrameworks(CommandLine cli, Config config) throws AndrolibException { | ||
new Androlib(config).listFrameworks(); | ||
new AndrolibResources(config).listFrameworkDirectory(); | ||
} | ||
|
||
private static void cmdPublicizeResources(CommandLine cli, Config config) throws AndrolibException { | ||
String apkName = getLastArg(cli); | ||
new Androlib(config).publicizeResources(new File(apkName)); | ||
new AndrolibResources(config).publicizeResources(new File(apkName)); | ||
} | ||
|
||
private static void cmdEmptyFrameworkDirectory(CommandLine cli, Config config) throws AndrolibException { | ||
if (cli.hasOption("f") || cli.hasOption("force")) { | ||
config.forceDeleteFramework = true; | ||
} | ||
new Androlib(config).emptyFrameworkDirectory(); | ||
new AndrolibResources(config).emptyFrameworkDirectory(); | ||
} | ||
|
||
private static String getLastArg(CommandLine cli) { | ||
|
@@ -293,7 +296,7 @@ private static String getLastArg(CommandLine cli) { | |
} | ||
|
||
private static void _version() { | ||
System.out.println(Androlib.getVersion()); | ||
System.out.println(ApktoolProperties.getVersion()); | ||
} | ||
|
||
private static void _Options() { | ||
|
@@ -549,7 +552,7 @@ private static void usage() { | |
|
||
// print out license info prior to formatter. | ||
System.out.println( | ||
"Apktool v" + Androlib.getVersion() + " - a tool for reengineering Android apk files\n" + | ||
"Apktool v" + ApktoolProperties.getVersion() + " - a tool for reengineering Android apk files\n" + | ||
"with smali v" + ApktoolProperties.get("smaliVersion") + | ||
" and baksmali v" + ApktoolProperties.get("baksmaliVersion") + "\n" + | ||
"Copyright 2010 Ryszard Wiśniewski <[email protected]>\n" + | ||
|
Oops, something went wrong.