diff options
author | Benoit Lamarche <benoitlamarche@google.com> | 2015-04-07 17:27:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-07 17:27:43 +0000 |
commit | ab1774c05909eb572ca607c20aa2831a884e10a5 (patch) | |
tree | 067f5af36dd95b732289e5f91be77a2d5212681a /dx/src | |
parent | f052d52e8b28d1b0053cdd6a80b9ce9de5c729d8 (diff) | |
parent | dff33a1061ef7ac40fc7035bfbcd7e2512a3ca30 (diff) | |
download | android_dalvik-ab1774c05909eb572ca607c20aa2831a884e10a5.tar.gz android_dalvik-ab1774c05909eb572ca607c20aa2831a884e10a5.tar.bz2 android_dalvik-ab1774c05909eb572ca607c20aa2831a884e10a5.zip |
Merge "Do not keep the DexFile field in Main between runs" into lmp-mr1-dev
Diffstat (limited to 'dx/src')
-rw-r--r-- | dx/src/com/android/dx/command/dexer/Main.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/dx/src/com/android/dx/command/dexer/Main.java b/dx/src/com/android/dx/command/dexer/Main.java index 563a93c39..06ffcedef 100644 --- a/dx/src/com/android/dx/command/dexer/Main.java +++ b/dx/src/com/android/dx/command/dexer/Main.java @@ -224,6 +224,7 @@ public class Main { * @return 0 if success > 0 otherwise. */ public static int run(Arguments arguments) throws IOException { + // Reset the error count to start fresh. errors.set(0); // empty the list, so that tools that load dx and keep it around @@ -497,7 +498,7 @@ public class Main { if (args.minimalMainDex) { // start second pass directly in a secondary dex file. - createDexFile(); + rotateDexFile(); } // remaining files @@ -572,10 +573,6 @@ public class Main { } private static void createDexFile() { - if (outputDex != null) { - dexOutputArrays.add(writeDex()); - } - outputDex = new DexFile(args.dexOptions); if (args.dumpWidth != 0) { @@ -583,6 +580,14 @@ public class Main { } } + private static void rotateDexFile() { + if (outputDex != null) { + dexOutputArrays.add(writeDex()); + } + + createDexFile(); + } + /** * Processes one pathname element. * @@ -718,7 +723,7 @@ public class Main { && ((maxMethodIdsInDex > args.maxNumberOfIdxPerDex) || (maxFieldIdsInDex > args.maxNumberOfIdxPerDex))) { DexFile completeDex = outputDex; - createDexFile(); + rotateDexFile(); assert (completeDex.getMethodIds().items().size() <= numMethodIds + MAX_METHOD_ADDED_DURING_DEX_CREATION) && (completeDex.getFieldIds().items().size() <= numFieldIds + |