aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools
diff options
context:
space:
mode:
authorGravatar ajmichael <ajmichael@google.com>2017-06-22 21:07:34 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-06-26 18:30:45 +0200
commit73c4c0ec81bace888fe6592dbc58f16c79975418 (patch)
tree302c7aa29fca384169a624104b3d404e8843a558 /src/tools
parent505b78cf7cceba8088b0f1153832201373d5e8ad (diff)
Make it an error to pass --multidex=off with --main-dex-list or
--minimal-main-dex. This matches dx's behavior. Previously, DexFileMerger would override --multidex=off with --multidex=minimal if either --main-dex-list or --minimal-main-dex were passed. RELNOTES: Incremental dexing errors on combination of --multidex=off and either --main-dex-list or --minimal-main-dex. PiperOrigin-RevId: 159858242
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/android/java/com/google/devtools/build/android/dexer/DexFileMerger.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/dexer/DexFileMerger.java b/src/tools/android/java/com/google/devtools/build/android/dexer/DexFileMerger.java
index 0a68efb110..ebfb1ec1f2 100644
--- a/src/tools/android/java/com/google/devtools/build/android/dexer/DexFileMerger.java
+++ b/src/tools/android/java/com/google/devtools/build/android/dexer/DexFileMerger.java
@@ -96,7 +96,6 @@ class DexFileMerger {
defaultValue = "null",
category = "multidex",
converter = ExistingPathConverter.class,
- implicitRequirements = "--multidex=minimal",
help = "List of classes to be placed into \"main\" classes.dex file."
)
public Path mainDexListFile;
@@ -105,7 +104,6 @@ class DexFileMerger {
name = "minimal-main-dex",
defaultValue = "false",
category = "multidex",
- implicitRequirements = "--multidex=minimal",
help =
"If true, *only* classes listed in --main_dex_list file are placed into \"main\" "
+ "classes.dex file."
@@ -156,6 +154,16 @@ class DexFileMerger {
@VisibleForTesting
static void buildMergedDexFiles(Options options) throws IOException {
+ if (!options.multidexMode.isMultidexAllowed()) {
+ checkArgument(
+ options.mainDexListFile == null,
+ "--main-dex-list is only supported with multidex enabled, but mode is: %s",
+ options.multidexMode);
+ checkArgument(
+ !options.minimalMainDex,
+ "--minimal-main-dex is only supported with multidex enabled, but mode is: %s",
+ options.multidexMode);
+ }
ImmutableSet<String> classesInMainDex = options.mainDexListFile != null
? ImmutableSet.copyOf(Files.readAllLines(options.mainDexListFile, UTF_8))
: null;
@@ -172,10 +180,6 @@ class DexFileMerger {
if (classesInMainDex == null) {
processDexFiles(zip, out, Predicates.<ZipEntry>alwaysTrue());
} else {
- // Options parser should be making sure of this but let's be extra-safe as other modes
- // might result in classes from main dex list ending up in files other than classes.dex
- checkArgument(options.multidexMode == MultidexStrategy.MINIMAL, "Only minimal multidex "
- + "mode is supported with --main_dex_list, but mode is: %s", options.multidexMode);
// To honor --main_dex_list make two passes:
// 1. process only the classes listed in the given file
// 2. process the remaining files