summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Lamarche <benoitlamarche@google.com>2014-12-17 16:59:26 +0100
committerBenoit Lamarche <benoitlamarche@google.com>2015-04-07 18:58:10 +0200
commitdff33a1061ef7ac40fc7035bfbcd7e2512a3ca30 (patch)
tree205871cc7f6b0cb2175d0e87f9f5abffebf7d4fb
parent008da7d42d529761ab85b8e92d3dd366f1fad195 (diff)
downloadandroid_dalvik-dff33a1061ef7ac40fc7035bfbcd7e2512a3ca30.tar.gz
android_dalvik-dff33a1061ef7ac40fc7035bfbcd7e2512a3ca30.tar.bz2
android_dalvik-dff33a1061ef7ac40fc7035bfbcd7e2512a3ca30.zip
Do not keep the DexFile field in Main between runs
Bug: 18486731 (cherry picked from commit bb404aa9c531c2e1d27b4f7c6d2b03c2b50fb871) Change-Id: I048f6064cc49c78df21a1c42316761502a0a5366
-rw-r--r--dx/src/com/android/dx/command/dexer/Main.java17
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 4a3d1952f..84baa935b 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 +