Updating Framework Support

This commit is contained in:
Connor Tumbleson
2015-04-19 10:29:28 -05:00
committed by Connor Tumbleson
parent 466319ad51
commit daa1e1d753
4 changed files with 41 additions and 9 deletions

View File

@ -48,7 +48,7 @@ public class Main {
// cli parser
CommandLineParser parser = new PosixParser();
CommandLine commandLine = null;
CommandLine commandLine;
// load options
_Options();
@ -57,7 +57,7 @@ public class Main {
commandLine = parser.parse(allOptions, args, false);
} catch (ParseException ex) {
System.err.println(ex.getMessage());
usage(commandLine);
usage();
return;
}
@ -86,6 +86,9 @@ public class Main {
} else if (opt.equalsIgnoreCase("if") || opt.equalsIgnoreCase("install-framework")) {
cmdInstallFramework(commandLine);
cmdFound = true;
} else if (opt.equalsIgnoreCase("u") || opt.equalsIgnoreCase("update-framework")) {
cmdUpdateFramework(commandLine);
cmdFound = true;
} else if (opt.equalsIgnoreCase("publicize-resources")) {
cmdPublicizeResources(commandLine);
cmdFound = true;
@ -97,7 +100,7 @@ public class Main {
if (commandLine.hasOption("version")) {
_version();
} else {
usage(commandLine);
usage();
}
}
}
@ -107,7 +110,7 @@ public class Main {
int paraCount = cli.getArgList().size();
String apkName = (String) cli.getArgList().get(paraCount - 1);
File outDir = null;
File outDir;
// check for options
if (cli.hasOption("s") || cli.hasOption("no-src")) {
@ -224,8 +227,7 @@ public class Main {
new Androlib(apkOptions).build(new File(appDirName), outFile);
}
private static void cmdInstallFramework(CommandLine cli)
throws AndrolibException {
private static void cmdInstallFramework(CommandLine cli) throws AndrolibException {
int paraCount = cli.getArgList().size();
String apkName = (String) cli.getArgList().get(paraCount - 1);
@ -239,14 +241,26 @@ public class Main {
new Androlib(apkOptions).installFramework(new File(apkName));
}
private static void cmdPublicizeResources(CommandLine cli)
throws AndrolibException {
private static void cmdPublicizeResources(CommandLine cli) throws AndrolibException {
int paraCount = cli.getArgList().size();
String apkName = (String) cli.getArgList().get(paraCount - 1);
new Androlib().publicizeResources(new File(apkName));
}
private static void cmdUpdateFramework(CommandLine cli) throws AndrolibException {
ApkOptions apkOptions = new ApkOptions();
if (cli.hasOption("f") || cli.hasOption("force")) {
apkOptions.forceDeleteFramework = true;
}
if (cli.hasOption("p") || cli.hasOption("frame-path")) {
apkOptions.frameworkFolderLocation = cli.getOptionValue("p");
}
new Androlib(apkOptions).updateFramework();
}
private static void _version() {
System.out.println(Androlib.getVersion());
}
@ -426,7 +440,7 @@ public class Main {
}
}
private static void usage(CommandLine commandLine) {
private static void usage() {
// load basicOptions
_Options();