summaryrefslogtreecommitdiff
path: root/tools/aapt/Main.cpp
diff options
context:
space:
mode:
authorEric Fischer <enf@google.com>2010-09-15 15:59:21 -0700
committerEric Fischer <enf@google.com>2010-09-23 10:32:47 -0700
commit90964040cabfc67f92a7c3322a02401bb6f8ae82 (patch)
tree52f1ce1de971a071026a12e145837e015e60d26a /tools/aapt/Main.cpp
parent89647b1172cdf40a3681922150122b0bd2ea83f1 (diff)
Add an aapt option to allow string variations for different devices.
The --product option to aapt is a comma-separated list of characteristics of the device being built for. For example, --product nosdcard,grayscale for a device with no SD card and a grayscale screen. Strings can specify a product="characteristic" option to cause that version of the string to be used only for that type of device. All such strings should also specify, at the end of the block, product="default", which will be used if none of the variations match. For example: <string name="choose" product="bw">Choose black or white</string> <string name="choose" product="grayscale">Choose a shade of gray</string> <string name="choose" product="default">Choose a color</string> The default characteristic will also be used when no --product option is specified. Change-Id: Ie6c1505599e02e15b7818e8be6ec47bc6ce71aaa
Diffstat (limited to 'tools/aapt/Main.cpp')
-rw-r--r--tools/aapt/Main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 71c023d93448..739b01f40d24 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -67,6 +67,7 @@ void usage(void)
" [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
" [-S resource-sources [-S resource-sources ...]] "
" [-F apk-file] [-J R-file-dir] \\\n"
+ " [--product product1,product2,...] \\\n"
" [raw-files-dir [raw-files-dir] ...]\n"
"\n"
" Package the android resources. It will read assets and resources that are\n"
@@ -154,6 +155,9 @@ void usage(void)
" components target the given package. Useful when used in\n"
" conjunction with --rename-manifest-package to fix tests against\n"
" a package that has been renamed.\n"
+ " --product\n"
+ " Specifies which variant to choose for strings that have\n"
+ " product variants\n"
" --utf16\n"
" changes default encoding for resources to UTF-16. Only useful when API\n"
" level is set to 7 or higher where the default encoding is UTF-8.\n");
@@ -484,6 +488,15 @@ int main(int argc, char* const argv[])
bundle.setInstrumentationPackageNameOverride(argv[0]);
} else if (strcmp(cp, "-auto-add-overlay") == 0) {
bundle.setAutoAddOverlay(true);
+ } else if (strcmp(cp, "-product") == 0) {
+ argc--;
+ argv++;
+ if (!argc) {
+ fprintf(stderr, "ERROR: No argument supplied for '--product' option\n");
+ wantUsage = true;
+ goto bail;
+ }
+ bundle.setProduct(argv[0]);
} else {
fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
wantUsage = true;