From 6ba873faec0d165b74acfecf1533f58433d431e9 Mon Sep 17 00:00:00 2001 From: Rohit Agrawal Date: Thu, 21 Apr 2016 16:29:58 -0700 Subject: AAPT: ProGuard config for components in main dex. Create an analogue of "aapt -G" which outputs a proguard configuration that keeps only components which need to be in the main dex. BUG: 27383099 Change-Id: Ic18c8c563794ff27a5598a214111d1b446a005f1 (cherry picked from commit 86229cb622fccde8ab8cbe85eead91a34313a708) --- tools/aapt/Main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/aapt/Main.cpp') diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp index bcf0d5e53c07..28bdf44b08bd 100644 --- a/tools/aapt/Main.cpp +++ b/tools/aapt/Main.cpp @@ -67,6 +67,7 @@ void usage(void) " [--max-res-version VAL] \\\n" " [-I base-package [-I base-package ...]] \\\n" " [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n" + " [-D main-dex-class-list-file] \\\n" " [-S resource-sources [-S resource-sources ...]] \\\n" " [-F apk-file] [-J R-file-dir] \\\n" " [--product product1,product2,...] \\\n" @@ -120,6 +121,7 @@ void usage(void) " localization=\"suggested\"\n" " -A additional directory in which to find raw asset files\n" " -G A file to output proguard options into.\n" + " -D A file to output proguard options for the main dex into.\n" " -F specify the apk file to output\n" " -I add an existing package to base include set\n" " -J specify where to output R.java resource constant definitions\n" @@ -385,6 +387,17 @@ int main(int argc, char* const argv[]) convertPath(argv[0]); bundle.setProguardFile(argv[0]); break; + case 'D': + argc--; + argv++; + if (!argc) { + fprintf(stderr, "ERROR: No argument supplied for '-D' option\n"); + wantUsage = true; + goto bail; + } + convertPath(argv[0]); + bundle.setMainDexProguardFile(argv[0]); + break; case 'I': argc--; argv++; -- cgit v1.2.3-59-g8ed1b