From 833f3ccbc8f4dd1ec8abb9121988b99ff34ec4c1 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 18 Jun 2014 15:06:01 -0700 Subject: AAPT support for feature splits This change allows the developer to add a base package for which to build a feature split. The generated resource types will begin after the base APK's defined types so as not to collide or override resources. Multiple features can be generated by first choosing an arbitrary order for the features. Then for each feature, the base APK and any preceding features are specified with the --feature-of flags. So with a base APK 'A' and features, 'B', and 'C', 'B' would be built with aapt package [...] --feature-of A [...] and 'C' would be built with aapt package [...] --feature-of A --feature-of B [...] Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780 --- tools/aapt/Main.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tools/aapt/Main.cpp') diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp index 322d86c6cd5c..736ae26d7796 100644 --- a/tools/aapt/Main.cpp +++ b/tools/aapt/Main.cpp @@ -71,6 +71,7 @@ void usage(void) " [--product product1,product2,...] \\\n" " [-c CONFIGS] [--preferred-configurations CONFIGS] \\\n" " [--split CONFIGS [--split CONFIGS]] \\\n" + " [--feature-of package [--feature-after package]] \\\n" " [raw-files-dir [raw-files-dir] ...] \\\n" " [--output-text-symbols DIR]\n" "\n" @@ -167,6 +168,14 @@ void usage(void) " --split\n" " Builds a separate split APK for the configurations listed. This can\n" " be loaded alongside the base APK at runtime.\n" + " --feature-of\n" + " Builds a split APK that is a feature of the apk specified here. Resources\n" + " in the base APK can be referenced from the the feature APK.\n" + " --feature-after\n" + " An app can have multiple Feature Split APKs which must be totally ordered.\n" + " If --feature-of is specified, this flag specifies which Feature Split APK\n" + " comes before this one. The first Feature Split APK should not define\n" + " anything here.\n" " --rename-manifest-package\n" " Rewrite the manifest so that its package name is the package name\n" " given here. Relative class names (for example .Foo) will be\n" @@ -583,6 +592,24 @@ int main(int argc, char* const argv[]) goto bail; } bundle.addSplitConfigurations(argv[0]); + } else if (strcmp(cp, "-feature-of") == 0) { + argc--; + argv++; + if (!argc) { + fprintf(stderr, "ERROR: No argument supplied for '--feature-of' option\n"); + wantUsage = true; + goto bail; + } + bundle.setFeatureOfPackage(argv[0]); + } else if (strcmp(cp, "-feature-after") == 0) { + argc--; + argv++; + if (!argc) { + fprintf(stderr, "ERROR: No argument supplied for '--feature-after' option\n"); + wantUsage = true; + goto bail; + } + bundle.setFeatureAfterPackage(argv[0]); } else if (strcmp(cp, "-rename-manifest-package") == 0) { argc--; argv++; -- cgit v1.2.3-59-g8ed1b