diff options
author | Googler <noreply@google.com> | 2017-04-07 18:37:55 +0000 |
---|---|---|
committer | Jakob Buchgraber <buchgr@google.com> | 2017-04-10 11:44:34 +0200 |
commit | f298e49adb95b039f3426cdaf74949a440146b0d (patch) | |
tree | 32281829620309b61d6447bf3a548158af2e8297 | |
parent | e27cd7d215fac245bb567ac77ead6388f49b3610 (diff) |
Pass --keep-main-dex flag to rex when multidex mode is set to legacy
RELNOTES: None
PiperOrigin-RevId: 152523635
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java index e640555cc2..65c1669fe1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java @@ -541,9 +541,11 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory { finalProguardMap = proguardOutput.getMapping(); } // the Rex flag --keep-main-dex is used to support builds with API level below 21 that do not - // support native multi-dex. The blaze flag main_dex_list is set in this case so it is used to - // determine whether or not to pass the flag to Rex - if (ruleContext.attributes().isAttributeValueExplicitlySpecified("main_dex_list")) { + // support native multi-dex. This flag indicates to Rex to use the main_dex_list file which + // can be provided by the user via the main_dex_list attribute or created automatically + // when multidex mode is set to legacy. + if (ruleContext.attributes().isAttributeValueExplicitlySpecified("main_dex_list") + || getMultidexMode(ruleContext) == MultidexMode.LEGACY) { rexActionBuilder.addArgument("--keep-main-dex"); } ruleContext.registerAction(rexActionBuilder.build(ruleContext)); |