diff options
6 files changed, 29 insertions, 9 deletions
diff --git a/anttasks/src/com/android/ant/DexExecTask.java b/anttasks/src/com/android/ant/DexExecTask.java index 3ccc87d..e33da32 100644 --- a/anttasks/src/com/android/ant/DexExecTask.java +++ b/anttasks/src/com/android/ant/DexExecTask.java @@ -44,6 +44,7 @@ public class DexExecTask extends SingleDependencyTask { private boolean mVerbose = false; private boolean mNoLocals = false; private boolean mForceJumbo = false; + private boolean mDisableDexMerger = false; private List<Path> mPathInputs; private List<FileSet> mFileSetInputs; @@ -88,6 +89,10 @@ public class DexExecTask extends SingleDependencyTask { mForceJumbo = forceJumbo; } + public void setDisableDexMerger(boolean disableMerger) { + mDisableDexMerger = disableMerger; + } + /** * Returns an object representing a nested <var>path</var> element. */ @@ -119,7 +124,7 @@ public class DexExecTask extends SingleDependencyTask { private void preDexLibraries(List<File> inputs) { - if (inputs.size() == 1) { + if (mDisableDexMerger || inputs.size() == 1) { // only one input, no need to put a pre-dexed version, even if this path is // just a jar file (case for proguard'ed builds) return; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java index f83bd3c..edfc30c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java @@ -18,9 +18,9 @@ package com.android.ide.eclipse.adt; import static com.android.SdkConstants.DOT_AIDL; import static com.android.SdkConstants.DOT_DEP; +import static com.android.SdkConstants.DOT_FS; import static com.android.SdkConstants.DOT_JAVA; import static com.android.SdkConstants.DOT_RS; -import static com.android.SdkConstants.DOT_FS; import com.android.SdkConstants; import com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder; @@ -223,4 +223,5 @@ public class AdtConstants { public static final String DOC_HIDE = "@hide"; //$NON-NLS-1$ public static final String DEX_OPTIONS_FORCEJUMBO = "dex.force.jumbo"; //$NON-NLS-1$ + public static final String DEX_OPTIONS_DISABLE_MERGER = "dex.disable.merger"; //$NON-NLS-1$ } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java index 5ffe2b3..c94ef9a 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java @@ -109,6 +109,7 @@ public class BuildHelper { private final AndroidPrintStream mOutStream; private final AndroidPrintStream mErrStream; private final boolean mForceJumbo; + private final boolean mDisableDexMerger; private final boolean mVerbose; private final boolean mDebugMode; @@ -140,7 +141,7 @@ public class BuildHelper { public BuildHelper(@NonNull IProject project, @NonNull AndroidPrintStream outStream, @NonNull AndroidPrintStream errStream, - boolean forceJumbo, boolean debugMode, + boolean forceJumbo, boolean disableDexMerger, boolean debugMode, boolean verbose, ResourceMarker resMarker) throws CoreException { mProject = project; mOutStream = outStream; @@ -148,6 +149,7 @@ public class BuildHelper { mDebugMode = debugMode; mVerbose = verbose; mForceJumbo = forceJumbo; + mDisableDexMerger = disableDexMerger; gatherPaths(resMarker); } @@ -712,13 +714,12 @@ public class BuildHelper { // replace the libs by their dexed versions (dexing them if needed.) List<String> finalInputPaths = new ArrayList<String>(inputPaths.size()); - if (inputPaths.size() == 1) { + if (mDisableDexMerger || inputPaths.size() == 1) { // only one input, no need to put a pre-dexed version, even if this path is // just a jar file (case for proguard'ed builds) finalInputPaths.addAll(inputPaths); } else { - for (String input : inputPaths) { File inputFile = new File(input); if (inputFile.isDirectory()) { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java index 3dfcd1e..6e3dce3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java @@ -372,6 +372,7 @@ public class PostCompilerBuilder extends BaseBuilder { BuildHelper helper = new BuildHelper(project, mOutStream, mErrStream, false /*jumbo mode doesn't matter here*/, + false /*dex merger doesn't matter here*/, true /*debugMode*/, AdtPrefs.getPrefs().getBuildVerbosity() == BuildVerbosity.VERBOSE, mResourceMarker); @@ -477,10 +478,16 @@ public class PostCompilerBuilder extends BaseBuilder { if (mPackageResources || mConvertToDex || mBuildFinalPackage) { String forceJumboStr = projectState.getProperty( AdtConstants.DEX_OPTIONS_FORCEJUMBO); - Boolean b = Boolean.valueOf(forceJumboStr); + Boolean jumbo = Boolean.valueOf(forceJumboStr); + + String dexMergerStr = projectState.getProperty( + AdtConstants.DEX_OPTIONS_DISABLE_MERGER); + Boolean dexMerger = Boolean.valueOf(dexMergerStr); + BuildHelper helper = new BuildHelper(project, mOutStream, mErrStream, - b.booleanValue(), + jumbo.booleanValue(), + dexMerger.booleanValue(), true /*debugMode*/, AdtPrefs.getPrefs().getBuildVerbosity() == BuildVerbosity.VERBOSE, mResourceMarker); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java index d048f43..d215f2f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java @@ -127,11 +127,15 @@ public final class ExportHelper { // get the jumbo mode option String forceJumboStr = projectState.getProperty(AdtConstants.DEX_OPTIONS_FORCEJUMBO); - Boolean b = Boolean.valueOf(forceJumboStr); + Boolean jumbo = Boolean.valueOf(forceJumboStr); + + String dexMergerStr = projectState.getProperty(AdtConstants.DEX_OPTIONS_DISABLE_MERGER); + Boolean dexMerger = Boolean.valueOf(dexMergerStr); BuildHelper helper = new BuildHelper(project, fakeStream, fakeStream, - b.booleanValue(), + jumbo.booleanValue(), + dexMerger.booleanValue(), debugMode, false /*verbose*/, null /*resourceMarker*/); diff --git a/files/ant/build.xml b/files/ant/build.xml index e3ae78a..058b45d 100644 --- a/files/ant/build.xml +++ b/files/ant/build.xml @@ -64,6 +64,7 @@ ... --> <property name="dex.force.jumbo" value="false" /> + <property name="dex.disable.merger" value="false" /> <!-- compilation options --> <property name="java.encoding" value="UTF-8" /> @@ -285,6 +286,7 @@ dexedlibs="${out.dexed.absolute.dir}" nolocals="@{nolocals}" forceJumbo="${dex.force.jumbo}" + disableDexMerger="${dex.disable.merger}" verbose="${verbose}"> <path path="${out.dex.input.absolute.dir}"/> <path refid="out.dex.jar.input.ref" /> |