diff options
author | Xavier Ducrohet <xav@google.com> | 2014-06-21 23:34:20 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2014-06-21 23:34:20 +0000 |
commit | edbe9171d2586fcd4083c5a9d848ab27d2e7c72e (patch) | |
tree | d2ee08adb45b7ce3812216ac0b02ebd572902340 /eclipse | |
parent | 7ad5f75b8f72dad11109aaa1c9d87795fd44c823 (diff) | |
parent | 220621089bd6a7cfac2c3d1a0fa8aeeffc94391b (diff) | |
download | sdk-edbe9171d2586fcd4083c5a9d848ab27d2e7c72e.zip sdk-edbe9171d2586fcd4083c5a9d848ab27d2e7c72e.tar.gz sdk-edbe9171d2586fcd4083c5a9d848ab27d2e7c72e.tar.bz2 |
Merge "Fix zipalign/hprof-conv issue in ADT." into idea133
automerge: 2206210
* commit '220621089bd6a7cfac2c3d1a0fa8aeeffc94391b':
Fix zipalign/hprof-conv issue in ADT.
Diffstat (limited to 'eclipse')
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 c53fdb0..f7ef41f 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 5f5232f..19d933d 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 8168590..56e0c09 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 0583bfc..170da6d 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; |