aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@google.com>2014-06-21 15:33:30 -0700
committerXavier Ducrohet <xav@google.com>2014-06-21 16:18:19 -0700
commit4c68450b4c94ac7fa102b6c62a1028e9b12dca2e (patch)
tree065b6326a17d76f4f3532ce356a0821e006cb7d0 /eclipse/plugins
parentb554f97341e9ac128bcf23df74667c53fdafb670 (diff)
downloadsdk-4c68450b4c94ac7fa102b6c62a1028e9b12dca2e.tar.gz
sdk-4c68450b4c94ac7fa102b6c62a1028e9b12dca2e.tar.bz2
sdk-4c68450b4c94ac7fa102b6c62a1028e9b12dca2e.zip
Fix zipalign/hprof-conv issue in ADT.
These files are now in plat-tools. also make tools 23 depend on that new plat-tools and adt/tools 23 require each other. Change-Id: Icdcf3b9f7f0787d385a930f7ebecfcf7049eb3e0
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ExportHelper.java24
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/ExportWizard.java16
4 files changed, 29 insertions, 25 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
index c53fdb0b3..f7ef41fe3 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
@@ -378,11 +378,6 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
return SdkConstants.OS_SDK_PLATFORM_TOOLS_FOLDER + SdkConstants.FN_ADB;
}
- /** Returns the zipalign path relative to the sdk folder */
- public static String getOsRelativeZipAlign() {
- return SdkConstants.OS_SDK_TOOLS_FOLDER + SdkConstants.FN_ZIPALIGN;
- }
-
/** Returns the emulator path relative to the sdk folder */
public static String getOsRelativeEmulator() {
return SdkConstants.OS_SDK_TOOLS_FOLDER + SdkConstants.FN_EMULATOR;
@@ -398,11 +393,6 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
return getOsSdkFolder() + getOsRelativeAdb();
}
- /** Returns the absolute zipalign path */
- public static String getOsAbsoluteZipAlign() {
- return getOsSdkFolder() + getOsRelativeZipAlign();
- }
-
/** Returns the absolute traceview path */
public static String getOsAbsoluteTraceview() {
return getOsSdkFolder() + SdkConstants.OS_SDK_TOOLS_FOLDER +
@@ -415,7 +405,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
}
public static String getOsAbsoluteHprofConv() {
- return getOsSdkFolder() + SdkConstants.OS_SDK_TOOLS_FOLDER +
+ return getOsSdkFolder() + SdkConstants.OS_SDK_PLATFORM_TOOLS_FOLDER +
AdtConstants.FN_HPROF_CONV;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java
index 5f5232f03..19d933d1f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java
@@ -51,7 +51,7 @@ public final class VersionCheck {
/**
* The minimum version of the SDK Tools that this version of ADT requires.
*/
- private final static FullRevision MIN_TOOLS_REV = new FullRevision(22, 6, 2, 0);
+ private final static FullRevision MIN_TOOLS_REV = new FullRevision(23, 0, 0, 0);
/**
* Pattern to get the minimum plugin version supported by the SDK. This is read from
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 816859091..56e0c0938 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
@@ -133,15 +133,7 @@ public final class ExportHelper {
String dexMergerStr = projectState.getProperty(AdtConstants.DEX_OPTIONS_DISABLE_MERGER);
Boolean dexMerger = Boolean.valueOf(dexMergerStr);
- BuildToolInfo buildToolInfo = projectState.getBuildToolInfo();
- if (buildToolInfo == null) {
- buildToolInfo = Sdk.getCurrent().getLatestBuildTool();
- }
-
- if (buildToolInfo == null) {
- throw new CoreException(new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
- "No Build Tools installed in the SDK."));
- }
+ BuildToolInfo buildToolInfo = getBuildTools(projectState);
BuildHelper helper = new BuildHelper(
projectState,
@@ -339,6 +331,20 @@ public final class ExportHelper {
}
}
+ public static BuildToolInfo getBuildTools(ProjectState projectState)
+ throws CoreException {
+ BuildToolInfo buildToolInfo = projectState.getBuildToolInfo();
+ if (buildToolInfo == null) {
+ buildToolInfo = Sdk.getCurrent().getLatestBuildTool();
+ }
+
+ if (buildToolInfo == null) {
+ throw new CoreException(new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
+ "No Build Tools installed in the SDK."));
+ }
+ return buildToolInfo;
+ }
+
/**
* Exports an unsigned release APK after prompting the user for a location.
*
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/ExportWizard.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/ExportWizard.java
index 0583bfc78..170da6d33 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/ExportWizard.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/ExportWizard.java
@@ -18,10 +18,14 @@ package com.android.ide.eclipse.adt.internal.wizards.export;
import com.android.annotations.Nullable;
import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.internal.utils.FingerprintUtils;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
import com.android.ide.eclipse.adt.internal.project.ExportHelper;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
+import com.android.sdklib.BuildToolInfo;
+import com.android.sdklib.BuildToolInfo.PathId;
import com.android.sdklib.internal.build.DebugKeyProvider.IKeyGenOutput;
import com.android.sdklib.internal.build.KeystoreHelper;
import com.android.utils.GrabProcessOutput;
@@ -290,10 +294,14 @@ public final class ExportWizard extends Wizard implements IExportWizard {
// check the private key/certificate again since it may have been created just above.
if (mPrivateKey != null && mCertificate != null) {
+ // check whether we can run zipalign.
boolean runZipAlign = false;
- String path = AdtPlugin.getOsAbsoluteZipAlign();
- File zipalign = new File(path);
- runZipAlign = zipalign.isFile();
+
+ ProjectState projectState = Sdk.getProjectState(mProject);
+ BuildToolInfo buildToolInfo = ExportHelper.getBuildTools(projectState);
+
+ String zipAlignPath = buildToolInfo.getPath(PathId.ZIP_ALIGN);
+ runZipAlign = zipAlignPath != null && new File(zipAlignPath).isFile();
File apkExportFile = mDestinationFile;
if (runZipAlign) {
@@ -307,7 +315,7 @@ public final class ExportWizard extends Wizard implements IExportWizard {
// align if we can
if (runZipAlign) {
- String message = zipAlign(path, apkExportFile, mDestinationFile);
+ String message = zipAlign(zipAlignPath, apkExportFile, mDestinationFile);
if (message != null) {
displayError(message);
return false;