diff options
author | Josiah Gaskin <josiahgaskin@google.com> | 2011-06-06 17:00:35 -0700 |
---|---|---|
committer | Josiah Gaskin <josiahgaskin@google.com> | 2011-07-20 15:20:26 -0700 |
commit | 8a39da80b33691b0c82458c3b7727e13ff71277e (patch) | |
tree | b6fa94370ecb2dba85d5fdb45c83729cef8708e1 /tools/aapt/Main.cpp | |
parent | 1e24ccbdd56a45c8bb5f2eba94af5aecd2d02554 (diff) |
Added Caching for PreProcessed PNGs
Added a cache management system for pre-processed PNG files
along with unit tests. The cache system will be used if
the --no-crunch flag is passed to AAPT during the package
phase. The cache can be updated by a call to 'aapt crunch'
(see usage statement). Also put in benchmarking code.
Change-Id: I58271fb2ee2f5f9075fd74d4ff6f15e7afabd05c
Diffstat (limited to 'tools/aapt/Main.cpp')
-rw-r--r-- | tools/aapt/Main.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp index 9887268abd7e..5135787050f9 100644 --- a/tools/aapt/Main.cpp +++ b/tools/aapt/Main.cpp @@ -83,6 +83,9 @@ void usage(void) " %s a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]\n" " Add specified files to Zip-compatible archive.\n\n", gProgName); fprintf(stderr, + " %s c[runch] [-v] -S resource-sources ... -C output-folder ...\n" + " Do PNG preprocessing and store the results in output folder.\n\n", gProgName); + fprintf(stderr, " %s v[ersion]\n" " Print program version.\n\n", gProgName); fprintf(stderr, @@ -190,6 +193,7 @@ int handleCommand(Bundle* bundle) case kCommandAdd: return doAdd(bundle); case kCommandRemove: return doRemove(bundle); case kCommandPackage: return doPackage(bundle); + case kCommandCrunch: return doCrunch(bundle); default: fprintf(stderr, "%s: requested command not yet supported\n", gProgName); return 1; @@ -227,6 +231,8 @@ int main(int argc, char* const argv[]) bundle.setCommand(kCommandRemove); else if (argv[1][0] == 'p') bundle.setCommand(kCommandPackage); + else if (argv[1][0] == 'c') + bundle.setCommand(kCommandCrunch); else { fprintf(stderr, "ERROR: Unknown command '%s'\n", argv[1]); wantUsage = true; @@ -397,6 +403,17 @@ int main(int argc, char* const argv[]) convertPath(argv[0]); bundle.addResourceSourceDir(argv[0]); break; + case 'C': + argc--; + argv++; + if (!argc) { + fprintf(stderr, "ERROR: No argument supplied for '-C' option\n"); + wantUsage = true; + goto bail; + } + convertPath(argv[0]); + bundle.setCrunchedOutputDir(argv[0]); + break; case '0': argc--; argv++; @@ -523,7 +540,9 @@ int main(int argc, char* const argv[]) bundle.setProduct(argv[0]); } else if (strcmp(cp, "-non-constant-id") == 0) { bundle.setNonConstantId(true); - } else { + } else if (strcmp(cp, "-no-crunch") == 0) { + bundle.setUseCrunchCache(true); + }else { fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp); wantUsage = true; goto bail; |