aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.monitor/.classpath1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.monitor/build.properties3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/SdkToolsLocator.java2
-rwxr-xr-xeclipse/scripts/create_all_symlinks.sh7
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java17
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java47
8 files changed, 89 insertions, 3 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/.classpath b/eclipse/plugins/com.android.ide.eclipse.monitor/.classpath
index 9642053..1be4b68 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/.classpath
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/.classpath
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry exported="true" kind="lib" path="libs/sdkuilib.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF
index 2a2a405..047072b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Require-Bundle: org.eclipse.ui,
com.android.ide.eclipse.base
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
-Bundle-ClassPath: .
+Bundle-ClassPath: .,
+ libs/sdkuilib.jar
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/build.properties b/eclipse/plugins/com.android.ide.eclipse.monitor/build.properties
index 44471de..a2a2a99 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/build.properties
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/build.properties
@@ -7,4 +7,5 @@ bin.includes = META-INF/,\
plugin_customization.ini,\
plugin.properties,\
images/,\
- splash.bmp
+ splash.bmp,\
+ libs/sdkuilib.jar
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java b/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java
index 27fcdd9..5f87813 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java
@@ -18,7 +18,11 @@ package com.android.ide.eclipse.monitor;
import com.android.ide.eclipse.monitor.SdkToolsLocator.SdkInstallStatus;
import com.android.prefs.AndroidLocation;
+import com.android.sdklib.ISdkLog;
+import com.android.sdklib.NullSdkLog;
+import com.android.sdklib.SdkManager;
import com.android.sdkstats.SdkStatsService;
+import com.android.sdkuilib.internal.repository.sdkman2.AdtUpdateDialog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -55,6 +59,14 @@ public class MonitorApplication implements IApplication {
}
MonitorPlugin.getDefault().setSdkPath(sdkPath);
+ // install platform tools if necessary
+ ISdkLog sdkLog = new NullSdkLog();
+ SdkManager manager = SdkManager.createManager(sdkPath, sdkLog);
+ if (manager.getPlatformToolsVersion() == null) {
+ AdtUpdateDialog window = new AdtUpdateDialog(new Shell(display), sdkLog, sdkPath);
+ window.installPlatformTools();
+ }
+
// If this is the first time using ddms or adt, open up the stats service
// opt out dialog, and request user for permissions.
// Note that the actual ping is performed in MonitorStartup
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/SdkToolsLocator.java b/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/SdkToolsLocator.java
index ba87c7b..19e1a43 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/SdkToolsLocator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/SdkToolsLocator.java
@@ -73,7 +73,7 @@ public class SdkToolsLocator {
}
public SdkInstallStatus isValidInstallation() {
- List<String> executables = Arrays.asList(getAdbLocation(),
+ List<String> executables = Arrays.asList(
getTraceViewLocation(),
getHprofConvLocation());
diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh
index 1bfa946..134a1b8 100755
--- a/eclipse/scripts/create_all_symlinks.sh
+++ b/eclipse/scripts/create_all_symlinks.sh
@@ -188,6 +188,13 @@ TV_LIBS="traceview"
LIBS="$LIBS $TV_LIBS"
CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS"
+### MONITOR ###
+
+MONITOR_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.monitor/libs"
+MONITOR_LIBS="sdkuilib"
+
+LIBS="$LIBS $MONITOR_LIBS"
+CP_FILES="$CP_FILES @:$MONITOR_DEST $MONITOR_LIBS"
### SDKMANAGER ###
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
index 0f55eeb..21a2332 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
@@ -17,6 +17,7 @@
package com.android.sdklib;
import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.io.FileWrapper;
@@ -30,6 +31,7 @@ import com.android.sdklib.internal.repository.NullTaskMonitor;
import com.android.sdklib.internal.repository.archives.Archive;
import com.android.sdklib.internal.repository.packages.ExtraPackage;
import com.android.sdklib.internal.repository.packages.Package;
+import com.android.sdklib.internal.repository.packages.PlatformToolPackage;
import com.android.sdklib.repository.PkgProps;
import com.android.util.Pair;
@@ -364,6 +366,21 @@ public class SdkManager {
return extraVersions;
}
+ /** Returns the platform tools version if installed, null otherwise. */
+ public @Nullable String getPlatformToolsVersion() {
+ LocalSdkParser parser = new LocalSdkParser();
+ Package[] packages = parser.parseSdk(mOsSdkPath, this, LocalSdkParser.PARSE_PLATFORM_TOOLS,
+ new NullTaskMonitor(new NullSdkLog()));
+
+ for (Package pkg : packages) {
+ if (pkg instanceof PlatformToolPackage && pkg.isLocal()) {
+ return pkg.getRevision().toShortString();
+ }
+ }
+
+ return null;
+ }
+
// -------- private methods ----------
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java
index ba9bce7..8e66c63 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java
@@ -130,6 +130,34 @@ public class AdtUpdateDialog extends SwtBaseDialog {
}
/**
+ * Displays the update dialog and triggers installation of platform-tools package.
+ * <p/>
+ * Callers must not try to reuse this dialog after this call.
+ *
+ * @return A boolean indicating whether the installation was successful (meaning the package
+ * was either already present, or got installed or updated properly) and a {@link File}
+ * with the path to the root folder of the package. The file is null when the boolean
+ * is false, otherwise it should point to an existing valid folder.
+ * @wbp.parser.entryPoint
+ */
+ public Pair<Boolean, File> installPlatformTools() {
+ mPackageFilter = createPlatformToolsFilter();
+ open();
+
+ File installPath = null;
+ if (mResultPaths != null) {
+ for (Entry<Package, File> entry : mResultPaths.entrySet()) {
+ if (entry.getKey() instanceof ExtraPackage) {
+ installPath = entry.getValue();
+ break;
+ }
+ }
+ }
+
+ return Pair.of(mResultCode, installPath);
+ }
+
+ /**
* Displays the update dialog and triggers installation of the requested platform
* package with the specified API level.
* <p/>
@@ -337,6 +365,25 @@ public class AdtUpdateDialog extends SwtBaseDialog {
};
}
+ private PackageFilter createPlatformToolsFilter() {
+ return new PackageFilter() {
+ @Override
+ boolean accept(Package pkg) {
+ return pkg instanceof PlatformToolPackage;
+ }
+
+ @Override
+ void visit(Package pkg) {
+ // nop
+ }
+
+ @Override
+ int installFlags() {
+ return UpdaterData.TOOLS_MSG_UPDATED_FROM_ADT;
+ }
+ };
+ }
+
public static PackageFilter createPlatformFilter(final int apiLevel) {
return new PackageFilter() {
int mApiLevel = apiLevel;