aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-11-11 17:47:27 -0800
committerAndroid Code Review <code-review@android.com>2010-11-11 17:47:27 -0800
commit95436227df1c9d228c21872eaa99157e6222121d (patch)
tree2fc1e2e34d88632857f20b3586078ccea39122e8
parentd6c3d2b33c09c1fc16605f19689409b818345e3c (diff)
parentad11cf8ec9e9efcbfdb42e426a08af5423d28a3f (diff)
downloadsdk-95436227df1c9d228c21872eaa99157e6222121d.zip
sdk-95436227df1c9d228c21872eaa99157e6222121d.tar.gz
sdk-95436227df1c9d228c21872eaa99157e6222121d.tar.bz2
Merge "Change the adbLocation ddms extension to provide more tools location." into tools_r8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AndroidConstants.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/ToolsLocator.java (renamed from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdbLocator.java)14
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/plugin.xml2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/schema/toolsLocator.exsd (renamed from eclipse/plugins/com.android.ide.eclipse.ddms/schema/adbLocator.exsd)12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java84
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/IToolsLocator.java (renamed from eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/IAdbLocator.java)16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.pdt/plugin.xml4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/PdtPlugin.java42
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/internal/AdbLocator.java12
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserManifestTest.java1
12 files changed, 139 insertions, 64 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
index 59bc496..6482ffb 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
@@ -789,9 +789,9 @@
</propertyTester>
</extension>
<extension
- point="com.android.ide.eclipse.ddms.adbLocator">
+ point="com.android.ide.eclipse.ddms.toolsLocator">
<locator
- class="com.android.ide.eclipse.adt.AdbLocator">
+ class="com.android.ide.eclipse.adt.ToolsLocator">
</locator>
</extension>
<extension
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 44a9be5..b6ebfdd 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
@@ -226,7 +226,8 @@ public class AdtPlugin extends AbstractUIPlugin {
if (AdtPrefs.PREFS_SDK_DIR.equals(event.getProperty())) {
// finally restart adb, in case it's a different version
- DdmsPlugin.setAdb(getOsAbsoluteAdb(), true /* startAdb */);
+ DdmsPlugin.setToolsLocation(getOsAbsoluteAdb(), true /* startAdb */,
+ getOsAbsoluteHprofConv(), getOsAbsoluteTraceview());
// get the SDK location and build id.
if (checkSdkLocationAndId()) {
@@ -349,6 +350,11 @@ public class AdtPlugin extends AbstractUIPlugin {
return getOsSdkFolder() + getOsRelativeEmulator();
}
+ public static String getOsAbsoluteHprofConv() {
+ return getOsSdkFolder() + SdkConstants.OS_SDK_TOOLS_FOLDER +
+ AndroidConstants.FN_HPROF_CONV;
+ }
+
/** Returns the absolute proguard path */
public static String getOsAbsoluteProguard() {
return getOsSdkFolder() + getOsRelativeProguard();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AndroidConstants.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AndroidConstants.java
index b1ccc28..a26374c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AndroidConstants.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AndroidConstants.java
@@ -120,6 +120,10 @@ public class AndroidConstants {
(SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ?
"traceview.exe" : "traceview"; //$NON-NLS-1$ //$NON-NLS-2$
+ public final static String FN_HPROF_CONV =
+ (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) ?
+ "hprof-conv.exe" : "hprof-conv"; //$NON-NLS-1$ //$NON-NLS-2$
+
/** Absolute path of the workspace root, i.e. "/" */
public final static String WS_ROOT = WS_SEP;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdbLocator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/ToolsLocator.java
index 9c87f26..987acaf 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdbLocator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/ToolsLocator.java
@@ -16,15 +16,23 @@
package com.android.ide.eclipse.adt;
-import com.android.ide.eclipse.ddms.IAdbLocator;
+import com.android.ide.eclipse.ddms.IToolsLocator;
/**
- * Implementation of the com.android.ide.ddms.adbLocator extension point.
+ * Implementation of the com.android.ide.ddms.toolsLocator extension point.
*
*/
-public class AdbLocator implements IAdbLocator {
+public class ToolsLocator implements IToolsLocator {
public String getAdbLocation() {
return AdtPlugin.getOsAbsoluteAdb();
}
+
+ public String getHprofConvLocation() {
+ return AdtPlugin.getOsAbsoluteHprofConv();
+ }
+
+ public String getTraceViewLocation() {
+ return AdtPlugin.getOsAbsoluteTraceview();
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.ddms/plugin.xml
index 4fe6786..02d570e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension-point id="adbLocator" name="ADB Locator" schema="schema/adbLocator.exsd"/>
+ <extension-point id="toolsLocator" name="Tools Locator" schema="schema/toolsLocator.exsd"/>
<extension-point id="debuggerConnector" name="Debugger Connector" schema="schema/debuggerConnector.exsd"/>
<extension-point id="sourceRevealer" name="Source Revealer" schema="schema/sourceRevealer.exsd"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/schema/adbLocator.exsd b/eclipse/plugins/com.android.ide.eclipse.ddms/schema/toolsLocator.exsd
index e2c246c..da51921 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/schema/adbLocator.exsd
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/schema/toolsLocator.exsd
@@ -3,10 +3,10 @@
<schema targetNamespace="com.android.ide.eclipse.ddms" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
- <meta.schema plugin="com.android.ide.eclipse.ddms" id="adbLocator" name="ADB Locator"/>
+ <meta.schema plugin="com.android.ide.eclipse.ddms" id="toolsLocator" name="Tools Locator"/>
</appInfo>
<documentation>
- Extension Point to provide the location of adb to DDMS.
+ Extension Point to provide the location of SDK Tools to DDMS.
</documentation>
</annotation>
@@ -18,7 +18,7 @@
</documentation>
<appInfo>
- <meta.attribute kind="java" basedOn=":com.android.ide.eclipse.ddms.IAdbLocator"/>
+ <meta.attribute kind="java" basedOn=":com.android.ide.eclipse.ddms.IToolsLocator"/>
</appInfo>
</annotation>
</attribute>
@@ -76,8 +76,8 @@
<meta.section type="examples"/>
</appInfo>
<documentation>
- &lt;extension point=&quot;com.android.ide.eclipse.ddms.adbLocator&quot;&gt;
- &lt;locator class=&quot;com.android.ide.eclipse.adt.AdbLocator&quot;/&gt;
+ &lt;extension point=&quot;com.android.ide.eclipse.ddms.toolsLocator&quot;&gt;
+ &lt;locator class=&quot;com.android.ide.eclipse.adt.ToolsLocator&quot;/&gt;
&lt;/extension&gt;
</documentation>
</annotation>
@@ -87,7 +87,7 @@
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
- The class must implement com.android.ide.ddms.IAdbLocator.
+ The class must implement com.android.ide.ddms.IToolsLocator.
</documentation>
</annotation>
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
index 7d2c36b..4ce8d00 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
@@ -18,7 +18,6 @@ package com.android.ide.eclipse.ddms;
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.Client;
-import com.android.ddmlib.DdmConstants;
import com.android.ddmlib.DdmPreferences;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
@@ -256,16 +255,21 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
// get the available adb locators
IConfigurationElement[] elements = findConfigElements(
- "com.android.ide.eclipse.ddms.adbLocator"); //$NON-NLS-1$
+ "com.android.ide.eclipse.ddms.toolsLocator"); //$NON-NLS-1$
- IAdbLocator[] locators = instantiateAdbLocators(elements);
+ IToolsLocator[] locators = instantiateToolsLocators(elements);
- for (IAdbLocator locator : locators) {
+ for (IToolsLocator locator : locators) {
try {
String adbLocation = locator.getAdbLocation();
- if (adbLocation != null) {
+ String traceviewLocation = locator.getTraceViewLocation();
+ String hprofConvLocation = locator.getHprofConvLocation();
+ if (adbLocation != null && traceviewLocation != null &&
+ hprofConvLocation != null) {
// checks if the location is valid.
- if (setAdbLocation(adbLocation)) {
+ if (setToolsLocation(adbLocation, hprofConvLocation,
+ traceviewLocation)) {
+
AndroidDebugBridge.createBridge(sAdbLocation,
true /* forceNewBridge */);
@@ -311,9 +315,9 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
*
* @return an array of all locators found, or an empty array if none were found.
*/
- private IAdbLocator[] instantiateAdbLocators(IConfigurationElement[] configElements)
+ private IToolsLocator[] instantiateToolsLocators(IConfigurationElement[] configElements)
throws CoreException {
- ArrayList<IAdbLocator> list = new ArrayList<IAdbLocator>();
+ ArrayList<IToolsLocator> list = new ArrayList<IToolsLocator>();
if (configElements.length > 0) {
// only use the first one, ignore the others.
@@ -321,12 +325,12 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
// instantiate the clas
Object obj = configElement.createExecutableExtension("class"); //$NON-NLS-1$
- if (obj instanceof IAdbLocator) {
- list.add((IAdbLocator) obj);
+ if (obj instanceof IToolsLocator) {
+ list.add((IToolsLocator) obj);
}
}
- return list.toArray(new IAdbLocator[list.size()]);
+ return list.toArray(new IToolsLocator[list.size()]);
}
/**
@@ -413,7 +417,7 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
return sAdbLocation;
}
- public static String getToolsFolder() {
+ public static String getToolsFolder2() {
return sToolsFolder;
}
@@ -424,24 +428,23 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
/**
* Stores the adb location. This returns true if the location is an existing file.
*/
- private static boolean setAdbLocation(String adbLocation) {
- File adb = new File(adbLocation);
- if (adb.isFile()) {
- sAdbLocation = adbLocation;
-
- File toolsFolder = adb.getParentFile();
- sToolsFolder = toolsFolder.getAbsolutePath();
+ private static boolean setToolsLocation(String adbLocation, String hprofConvLocation,
+ String traceViewLocation) {
- File hprofConverter = new File(toolsFolder, DdmConstants.FN_HPROF_CONVERTER);
- sHprofConverter = hprofConverter.getAbsolutePath();
-
- File traceview = new File(toolsFolder, DdmConstants.FN_TRACEVIEW);
- DdmUiPreferences.setTraceviewLocation(traceview.getAbsolutePath());
+ File adb = new File(adbLocation);
+ File hprofConverter = new File(hprofConvLocation);
+ File traceview = new File(traceViewLocation);
- return true;
+ if (adb.isFile() == false || hprofConverter.isFile() == false ||
+ traceview.isFile() == false) {
+ return false;
}
- return false;
+ sAdbLocation = adbLocation;
+ sHprofConverter = hprofConverter.getAbsolutePath();
+ DdmUiPreferences.setTraceviewLocation(traceview.getAbsolutePath());
+
+ return true;
}
/**
@@ -449,21 +452,20 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
* @param adb location of adb
* @param startAdb flag to start adb
*/
- public static void setAdb(String adb, boolean startAdb) {
- if (adb != null) {
- if (setAdbLocation(adb)) {
-
- // starts the server in a thread in case this is blocking.
- if (startAdb) {
- new Thread() {
- @Override
- public void run() {
- // create and start the bridge
- AndroidDebugBridge.createBridge(sAdbLocation,
- false /* forceNewBridge */);
- }
- }.start();
- }
+ public static void setToolsLocation(String adbLocation, boolean startAdb,
+ String hprofConvLocation, String traceViewLocation) {
+
+ if (setToolsLocation(adbLocation, hprofConvLocation, traceViewLocation)) {
+ // starts the server in a thread in case this is blocking.
+ if (startAdb) {
+ new Thread() {
+ @Override
+ public void run() {
+ // create and start the bridge
+ AndroidDebugBridge.createBridge(sAdbLocation,
+ false /* forceNewBridge */);
+ }
+ }.start();
}
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/IAdbLocator.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/IToolsLocator.java
index c31dfc4..5b53db3 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/IAdbLocator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/IToolsLocator.java
@@ -17,13 +17,25 @@
package com.android.ide.eclipse.ddms;
/**
- * Classes which implement this interface provides the location of ADB.
+ * Classes which implement this interface provides the location of various SDK tools.
*/
-public interface IAdbLocator {
+public interface IToolsLocator {
/**
* Queries the location of ADB
* @return A full OS path to the location of adb.
*/
String getAdbLocation();
+
+ /**
+ * Queries the location of Traceview
+ * @return A full OS path to the location of traceview
+ */
+ String getTraceViewLocation();
+
+ /**
+ * Queries the location of hprof-conv
+ * @return A full OS path to the location of hprof-conv.
+ */
+ String getHprofConvLocation();
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.pdt/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.pdt/plugin.xml
index 179d393..b2d622a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.pdt/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.pdt/plugin.xml
@@ -9,9 +9,9 @@
name="Android"/>
</extension>
<extension
- point="com.android.ide.eclipse.ddms.adbLocator">
+ point="com.android.ide.eclipse.ddms.toolsLocator">
<locator
- class="com.android.ide.eclipse.pdt.internal.AdbLocator">
+ class="com.android.ide.eclipse.pdt.internal.ToolsLocator">
</locator>
</extension>
<extension
diff --git a/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/PdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/PdtPlugin.java
index c74737b..298678a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/PdtPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/PdtPlugin.java
@@ -53,7 +53,8 @@ public class PdtPlugin extends AbstractUIPlugin {
// if the SDK changed, we have to do some extra work
if (PrefPage.PREFS_DEVTREE_DIR.equals(event.getProperty())) {
// restart adb, in case it's a different version
- DdmsPlugin.setAdb(getAdbLocation(), true /* startAdb */);
+ DdmsPlugin.setToolsLocation(getAdbLocation(), true /* startAdb */,
+ getHprofConvLocation(), getTraceViewLocation());
}
}
});
@@ -80,10 +81,46 @@ public class PdtPlugin extends AbstractUIPlugin {
* Returns the location of adb or <code>null</code> if unknown.
*/
public static String getAdbLocation() {
+ String devTreeBin = getDevTreeOutBin();
+
+ if (devTreeBin != null && devTreeBin.length() > 0) {
+ return devTreeBin + "adb"; //$NON-NLS-1$
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the location of hprof-conv or <code>null</code> if unknown.
+ */
+ public static String getHprofConvLocation() {
+ String devTreeBin = getDevTreeOutBin();
+
+ if (devTreeBin != null && devTreeBin.length() > 0) {
+ return devTreeBin + "hprof-conv"; //$NON-NLS-1$
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the location of traceview or <code>null</code> if unknown.
+ */
+ public static String getTraceViewLocation() {
+ String devTreeBin = getDevTreeOutBin();
+
+ if (devTreeBin != null && devTreeBin.length() > 0) {
+ return devTreeBin + "traceview"; //$NON-NLS-1$
+ }
+
+ return null;
+ }
+
+ private static String getDevTreeOutBin() {
String devTree = getDevTree();
if (devTree != null && devTree.length() > 0) {
- return devTree + "/out/host/" + currentPlatform() + "/bin/adb"; //$NON-NLS-1$ //$NON-NLS-2$
+ return devTree + "/out/host/" + currentPlatform() + "/bin/"; //$NON-NLS-1$ //$NON-NLS-2$
}
return null;
@@ -105,5 +142,4 @@ public class PdtPlugin extends AbstractUIPlugin {
return ""; //$NON-NLS-1$
}
-
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/internal/AdbLocator.java b/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/internal/AdbLocator.java
index 45d1002..4576ded 100644
--- a/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/internal/AdbLocator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.pdt/src/com/android/ide/eclipse/pdt/internal/AdbLocator.java
@@ -16,15 +16,23 @@
package com.android.ide.eclipse.pdt.internal;
-import com.android.ide.eclipse.ddms.IAdbLocator;
+import com.android.ide.eclipse.ddms.IToolsLocator;
import com.android.ide.eclipse.pdt.PdtPlugin;
/**
* Implementation of the com.android.ide.ddms.adbLocator extension point.
*/
-public class AdbLocator implements IAdbLocator {
+public class AdbLocator implements IToolsLocator {
public String getAdbLocation() {
return PdtPlugin.getAdbLocation();
}
+
+ public String getHprofConvLocation() {
+ return PdtPlugin.getHprofConvLocation();
+ }
+
+ public String getTraceViewLocation() {
+ return PdtPlugin.getTraceViewLocation();
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserManifestTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserManifestTest.java
index 6ee9223..955b2d0 100755
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserManifestTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserManifestTest.java
@@ -16,7 +16,6 @@
package com.android.ide.eclipse.adt.internal.resources;
-
import com.android.ide.eclipse.tests.AdtTestData;
import java.util.Arrays;