diff options
7 files changed, 44 insertions, 4 deletions
diff --git a/anttasks/src/com/android/ant/DexExecTask.java b/anttasks/src/com/android/ant/DexExecTask.java index 9882fe9..3ccc87d 100644 --- a/anttasks/src/com/android/ant/DexExecTask.java +++ b/anttasks/src/com/android/ant/DexExecTask.java @@ -43,6 +43,7 @@ public class DexExecTask extends SingleDependencyTask { private String mDexedLibs; private boolean mVerbose = false; private boolean mNoLocals = false; + private boolean mForceJumbo = false; private List<Path> mPathInputs; private List<FileSet> mFileSetInputs; @@ -83,6 +84,10 @@ public class DexExecTask extends SingleDependencyTask { mNoLocals = nolocals; } + public void setForceJumbo(boolean forceJumbo) { + mForceJumbo = forceJumbo; + } + /** * Returns an object representing a nested <var>path</var> element. */ @@ -242,6 +247,10 @@ public class DexExecTask extends SingleDependencyTask { task.createArg().setValue("--verbose"); } + if (mForceJumbo) { + task.createArg().setValue("--force-jumbo"); + } + task.createArg().setValue("--output"); task.createArg().setValue(output); 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 e9cee47..cbbb1b7 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 @@ -218,4 +218,6 @@ public class AdtConstants { /** Documentation marker for elements, attributes etc that should be hidden */ public static final String DOC_HIDE = "@hide"; //$NON-NLS-1$ + + public static final String DEX_OPTIONS_FORCEJUMBO = "dex.force.jumbo"; //$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 b485a1a..5ffe2b3 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 @@ -108,6 +108,7 @@ public class BuildHelper { private final IProject mProject; private final AndroidPrintStream mOutStream; private final AndroidPrintStream mErrStream; + private final boolean mForceJumbo; private final boolean mVerbose; private final boolean mDebugMode; @@ -139,12 +140,14 @@ public class BuildHelper { public BuildHelper(@NonNull IProject project, @NonNull AndroidPrintStream outStream, @NonNull AndroidPrintStream errStream, - boolean debugMode, boolean verbose, ResourceMarker resMarker) throws CoreException { + boolean forceJumbo, boolean debugMode, + boolean verbose, ResourceMarker resMarker) throws CoreException { mProject = project; mOutStream = outStream; mErrStream = errStream; mDebugMode = debugMode; mVerbose = verbose; + mForceJumbo = forceJumbo; gatherPaths(resMarker); } @@ -739,7 +742,7 @@ public class BuildHelper { } int res = wrapper.run(dexedLibPath, Collections.singleton(input), - mVerbose, mOutStream, mErrStream); + mForceJumbo, mVerbose, mOutStream, mErrStream); if (res != 0) { // output error message and mark the project. @@ -767,6 +770,7 @@ public class BuildHelper { int res = wrapper.run(osOutFilePath, finalInputPaths, + mForceJumbo, mVerbose, mOutStream, mErrStream); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/DexWrapper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/DexWrapper.java index 710d257..1c7c2e3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/DexWrapper.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/DexWrapper.java @@ -53,6 +53,7 @@ public final class DexWrapper { private Field mArgVerbose; private Field mArgJarOutput; private Field mArgFileNames; + private Field mArgForceJumbo; private Field mConsoleOut; private Field mConsoleErr; @@ -92,6 +93,7 @@ public final class DexWrapper { mArgJarOutput = argClass.getField("jarOutput"); //$NON-NLS-1$ mArgFileNames = argClass.getField("fileNames"); //$NON-NLS-1$ mArgVerbose = argClass.getField("verbose"); //$NON-NLS-1$ + mArgForceJumbo = argClass.getField("forceJumbo"); //$NON-NLS-1$ mConsoleOut = consoleClass.getField("out"); //$NON-NLS-1$ mConsoleErr = consoleClass.getField("err"); //$NON-NLS-1$ @@ -140,6 +142,7 @@ public final class DexWrapper { * * @param osOutFilePath the OS path to the outputfile (classes.dex * @param osFilenames list of input source files (.class and .jar files) + * @param forceJumbo force jumbo mode. * @param verbose verbose mode. * @param outStream the stdout console * @param errStream the stderr console @@ -147,13 +150,15 @@ public final class DexWrapper { * @throws CoreException */ public synchronized int run(String osOutFilePath, Collection<String> osFilenames, - boolean verbose, PrintStream outStream, PrintStream errStream) throws CoreException { + boolean forceJumbo, boolean verbose, + PrintStream outStream, PrintStream errStream) throws CoreException { assert mRunMethod != null; assert mArgConstructor != null; assert mArgOutName != null; assert mArgJarOutput != null; assert mArgFileNames != null; + assert mArgForceJumbo != null; assert mArgVerbose != null; assert mConsoleOut != null; assert mConsoleErr != null; @@ -175,6 +180,7 @@ public final class DexWrapper { mArgOutName.set(args, osOutFilePath); mArgFileNames.set(args, osFilenames.toArray(new String[osFilenames.size()])); mArgJarOutput.set(args, osOutFilePath.endsWith(SdkConstants.DOT_JAR)); + mArgForceJumbo.set(args, forceJumbo); mArgVerbose.set(args, verbose); // call the run method 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 738a5bf..4f5c31e 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 @@ -378,6 +378,7 @@ public class PostCompilerBuilder extends BaseBuilder { } BuildHelper helper = new BuildHelper(project, mOutStream, mErrStream, + false /*jumbo mode doesn't matter here*/, true /*debugMode*/, AdtPrefs.getPrefs().getBuildVerbosity() == BuildVerbosity.VERBOSE, mResourceMarker); @@ -481,8 +482,12 @@ public class PostCompilerBuilder extends BaseBuilder { // we need to test all three, as we may need to make the final package // but not the intermediary ones. if (mPackageResources || mConvertToDex || mBuildFinalPackage) { + String forceJumboStr = projectState.getProperty( + AdtConstants.DEX_OPTIONS_FORCEJUMBO); + Boolean b = Boolean.valueOf(forceJumboStr); BuildHelper helper = new BuildHelper(project, mOutStream, mErrStream, + b.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 fb8742d..d048f43 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 @@ -123,13 +123,19 @@ public final class ExportHelper { } }); + ProjectState projectState = Sdk.getProjectState(project); + + // get the jumbo mode option + String forceJumboStr = projectState.getProperty(AdtConstants.DEX_OPTIONS_FORCEJUMBO); + Boolean b = Boolean.valueOf(forceJumboStr); + BuildHelper helper = new BuildHelper(project, fakeStream, fakeStream, + b.booleanValue(), debugMode, false /*verbose*/, null /*resourceMarker*/); // get the list of library projects - ProjectState projectState = Sdk.getProjectState(project); List<IProject> libProjects = projectState.getFullLibraryProjects(); // Step 1. Package the resources. diff --git a/files/ant/build.xml b/files/ant/build.xml index 9210c66..699fb58 100644 --- a/files/ant/build.xml +++ b/files/ant/build.xml @@ -58,6 +58,13 @@ --> <property name="aapt.ignore.assets" value="" /> + <!-- dex force jumbo options, to be used when dex merging fails with + UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.util.DexException: Cannot handle conversion to jumbo index! + at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:103) + ... + --> + <property name="dex.force.jumbo" value="false" /> + <!-- compilation options --> <property name="java.encoding" value="UTF-8" /> <property name="java.target" value="1.5" /> @@ -277,6 +284,7 @@ output="${intermediate.dex.file}" dexedlibs="${out.dexed.absolute.dir}" nolocals="@{nolocals}" + forceJumbo="${dex.force.jumbo}" verbose="${verbose}"> <path path="${out.dex.input.absolute.dir}"/> <path refid="out.dex.jar.input.ref" /> |