added ability to use --frame-path during install of frameworks

This commit is contained in:
Connor Tumbleson 2013-01-18 08:19:19 -06:00
parent 5a4ffe6ca0
commit cb5bad5555
4 changed files with 25 additions and 8 deletions

View File

@ -7,6 +7,7 @@ v1.5.2 (TBA)
-Fixed (issue #394) - Prevented duplicated files in final jar which saved around 1.2mb. -Fixed (issue #394) - Prevented duplicated files in final jar which saved around 1.2mb.
-Added Proguard to drop final jar size from 6.2mb to 2.6mb. -Added Proguard to drop final jar size from 6.2mb to 2.6mb.
-Fixed (issue #395) - Added check for "aapt" in unit-tests. -Fixed (issue #395) - Added check for "aapt" in unit-tests.
-Added ability to use "--frame-path" on [if|install-framework]
v1.5.1 PR3 (Released December 23 - 2012) Codename: Pre Release 3 v1.5.1 PR3 (Released December 23 - 2012) Codename: Pre Release 3
-Reverted "Prevents removal of <uses-sdk> on decompile, but then throws warning on rebuild (issue #366)" -Reverted "Prevents removal of <uses-sdk> on decompile, but then throws warning on rebuild (issue #366)"

View File

@ -226,11 +226,23 @@ public class Main {
private static void cmdInstallFramework(String[] args) private static void cmdInstallFramework(String[] args)
throws AndrolibException { throws AndrolibException {
String tag = null; String tag = null;
String frame_path = null;
int i = 0;
switch (args.length) { switch (args.length) {
case 4:
if (args[2].equalsIgnoreCase("--frame-path")) {
i++;
} else {
throw new InvalidArgsError();
}
case 3:
frame_path = args[2 + i];
case 2: case 2:
tag = args[1]; if (!(args[1].equalsIgnoreCase("--frame-path"))) {
tag = args[1];
}
case 1: case 1:
new Androlib().installFramework(new File(args[0]), tag); new Androlib().installFramework(new File(args[0]), tag,frame_path);
return; return;
} }
@ -305,7 +317,7 @@ public class Main {
// " -o, --original\n" + // " -o, --original\n" +
// " Build resources into original APK. Retains signature." + // " Build resources into original APK. Retains signature." +
"\n" + "\n" +
" if|install-framework <framework.apk> [<tag>]\n" + " if|install-framework <framework.apk> [<tag>] --frame-path [<location>] \n" +
" Install framework file to your system.\n" + " Install framework file to your system.\n" +
"\n" + "\n" +
"For additional info, see: http://code.google.com/p/android-apktool/" + "For additional info, see: http://code.google.com/p/android-apktool/" +

View File

@ -493,8 +493,9 @@ public class Androlib {
mAndRes.publicizeResources(arscFile); mAndRes.publicizeResources(arscFile);
} }
public void installFramework(File frameFile, String tag) public void installFramework(File frameFile, String tag, String frame_path)
throws AndrolibException { throws AndrolibException {
mAndRes.setFrameworkFolder(frame_path);
mAndRes.installFramework(frameFile, tag); mAndRes.installFramework(frameFile, tag);
} }

View File

@ -648,11 +648,11 @@ final public class AndrolibResources {
private File getFrameworkDir() throws AndrolibException { private File getFrameworkDir() throws AndrolibException {
String path; String path;
/* if a framework path was specified on the command line, use it */ // if a framework path was specified on the command line, use it
if (sFrameworkFolder != null) { if (sFrameworkFolder != null) {
path = sFrameworkFolder; path = sFrameworkFolder;
} else if (System.getProperty("os.name").equals("Mac OS X")) { } else if (System.getProperty("os.name").equals("Mac OS X")) {
/* store in user-home, for Mac OS X */ // store in user-home, for Mac OS X
path = System.getProperty("user.home") + File.separatorChar path = System.getProperty("user.home") + File.separatorChar
+ "Library/apktool/framework"; + "Library/apktool/framework";
} else { } else {
@ -663,8 +663,7 @@ final public class AndrolibResources {
if (!dir.exists()) { if (!dir.exists()) {
if (!dir.mkdirs()) { if (!dir.mkdirs()) {
if (sFrameworkFolder != null) { if (sFrameworkFolder != null) {
System.out.println("Can't create Framework directory: " System.out.println("Can't create Framework directory: " + dir);
+ dir);
} }
throw new AndrolibException("Can't create directory: " + dir); throw new AndrolibException("Can't create directory: " + dir);
} }
@ -680,6 +679,10 @@ final public class AndrolibResources {
throw new AndrolibException(ex); throw new AndrolibException(ex);
} }
} }
public void setFrameworkFolder(String path) {
sFrameworkFolder = path;
}
// TODO: dirty static hack. I have to refactor decoding mechanisms. // TODO: dirty static hack. I have to refactor decoding mechanisms.
public static boolean sKeepBroken = false; public static boolean sKeepBroken = false;