fixes #427, correctly handles --frame-path on build

This commit is contained in:
Connor Tumbleson 2013-03-14 16:50:27 -05:00
parent ba00d532c6
commit 69ee710e30
4 changed files with 19 additions and 6 deletions

View File

@ -5,6 +5,7 @@ v1.5.3 (TBA)
-Updated to Gradle 1.4
-Updated known bytes for configurations to 38 (from addition of layout direction)
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks Rodrigo Chiossi)
-Fixed (issue #427) - Correctly handles `--frame-path` on [b]uild
v1.5.2 (Released February 2 - 2013) Codename: Bug Fixes
-Fixed (issue #299) - output smali filename errors to screen during rebuild instead of filestream

View File

@ -120,7 +120,9 @@ public class Main {
decoder.setKeepBrokenResources(true);
} else if ("--frame-path".equals(opt)) {
i++;
System.out.println("Using Framework Directory: " + args[i]);
if (i >= args.length) {
throw new InvalidArgsError();
}
decoder.setFrameworkDir(args[i]);
} else {
throw new InvalidArgsError();
@ -172,6 +174,8 @@ public class Main {
private static void cmdBuild(String[] args) throws BrutException {
Androlib instance = new Androlib();
// hold all the fields
HashMap<String, Boolean> flags = new HashMap<String, Boolean>();
flags.put("forceBuildAll", false);
@ -199,6 +203,9 @@ public class Main {
} else if ("-a".equals(opt) || "--aapt".equals(opt)) {
mAaptPath = args[i + 1];
skip = 1;
} else if ("--frame-path".equals(opt)) {
i++;
instance.setFrameworkFolder(args[i]);
} else if ("-o".equals(opt) || "--original".equals(opt)) {
if (args.length >= 4) {
throw new InvalidArgsError();
@ -227,7 +234,7 @@ public class Main {
throw new InvalidArgsError();
}
new Androlib().build(new File(appDirName), outFile, flags, mOrigApk,
instance.build(new File(appDirName), outFile, flags, mOrigApk,
mAaptPath);
}
@ -331,6 +338,8 @@ public class Main {
+ " Build in debug mode. Check project page for more info.\n"
+ " -a, --aapt\n"
+ " Loads aapt from specified location.\n"
+ " --frame-path <dir>\n"
+ " Use the specified directory for framework files\n"
+ "\n"
+ " if|install-framework <framework.apk> [<tag>] --frame-path [<location>] \n"
+ " Install framework file to your system.\n"

View File

@ -534,6 +534,10 @@ public class Androlib {
public void setApkFile(File apkFile) {
mOrigApkFile = new ExtFile(apkFile);
}
public void setFrameworkFolder(String path) {
mAndRes.setFrameworkFolder(path);
}
private ExtFile mOrigApkFile = null;
private String mAaptPath = null;

View File

@ -704,12 +704,11 @@ final public class AndrolibResources {
path = sFrameworkFolder;
} else if (System.getProperty("os.name").equals("Mac OS X")) {
// store in user-home, for Mac OS X
path = System.getProperty("user.home") + File.separatorChar
+ "Library/apktool/framework";
path = System.getProperty("user.home") + File.separatorChar + "Library/apktool/framework";
} else {
path = System.getProperty("user.home") + File.separatorChar
+ "apktool" + File.separatorChar + "framework";
path = System.getProperty("user.home") + File.separatorChar + "apktool" + File.separatorChar + "framework";
}
File dir = new File(path);
if (!dir.exists()) {
if (!dir.mkdirs()) {