aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2012-09-21 14:02:10 -0700
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-09-21 14:02:11 -0700
commit225fe918975d7a87daebd5f37afa60a46075699d (patch)
treee70d051babd4092a42c73285bed9c68078fc473d /eclipse/plugins
parent944abd952560b2a40474cabad2d2ad786172164b (diff)
parent98b631c6b3765be96b3707ba7aa54d52b10f4872 (diff)
downloadsdk-225fe918975d7a87daebd5f37afa60a46075699d.zip
sdk-225fe918975d7a87daebd5f37afa60a46075699d.tar.gz
sdk-225fe918975d7a87daebd5f37afa60a46075699d.tar.bz2
Merge "Pre-dexed libraries."
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java53
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/DexWrapper.java3
2 files changed, 53 insertions, 3 deletions
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 f3a3d57..5fb6660 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
@@ -23,6 +23,7 @@ import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AndroidPrintStream;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
+import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.prefs.AndroidLocation.AndroidLocationException;
import com.android.sdklib.IAndroidTarget;
@@ -694,14 +695,62 @@ public class BuildHelper {
mOutStream.setPrefix(CONSOLE_PREFIX_DX);
mErrStream.setPrefix(CONSOLE_PREFIX_DX);
- if (mVerbose) {
+ IFolder binFolder = BaseProjectHelper.getAndroidOutputFolder(javaProject.getProject());
+ File binFile = binFolder.getLocation().toFile();
+ File dexedLibs = new File(binFile, "dexedLibs");
+ if (dexedLibs.exists() == false) {
+ dexedLibs.mkdir();
+ }
+
+ // replace the libs by their dexed versions (dexing them if needed.)
+ List<String> finalInputPaths = new ArrayList<String>(inputPaths.size());
+ if (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()) {
+ finalInputPaths.add(input);
+ } else if (inputFile.isFile()) {
+ File dexedLib = new File(dexedLibs, inputFile.getName());
+ String dexedLibPath = dexedLib.getAbsolutePath();
+
+ if (dexedLib.isFile() == false ||
+ dexedLib.lastModified() < inputFile.lastModified()) {
+
+ if (mVerbose) {
+ mOutStream.println("Pre-Dexing " + input);
+ }
+
+ if (dexedLib.isFile()) {
+ dexedLib.delete();
+ }
+
+ int res = wrapper.run(dexedLibPath, Collections.singleton(input),
+ mVerbose, mOutStream, mErrStream);
+
+ if (res != 0) {
+ // output error message and mark the project.
+ String message = String.format(Messages.Dalvik_Error_d, res);
+ throw new DexException(message);
+ }
+ }
+
+ finalInputPaths.add(dexedLibPath);
+ }
+ }
+ }
+
+ if (mVerbose) {
+ for (String input : finalInputPaths) {
mOutStream.println("Input: " + input);
}
}
int res = wrapper.run(osOutFilePath,
- inputPaths,
+ finalInputPaths,
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 015d230..d786c04 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
@@ -16,6 +16,7 @@
package com.android.ide.eclipse.adt.internal.build;
+import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.AdtPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -173,7 +174,7 @@ public final class DexWrapper {
Object args = mArgConstructor.newInstance();
mArgOutName.set(args, osOutFilePath);
mArgFileNames.set(args, osFilenames.toArray(new String[osFilenames.size()]));
- mArgJarOutput.set(args, false);
+ mArgJarOutput.set(args, osOutFilePath.endsWith(AdtConstants.DOT_JAR));
mArgVerbose.set(args, verbose);
// call the run method