aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/app/src/com/android
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2009-09-28 16:25:45 -0700
committerXavier Ducrohet <xav@android.com>2009-09-28 16:30:13 -0700
commite9959a3e3c98b7e603d609b765ac4b1b99f38567 (patch)
treee901d04c0b441c0b9326b629aa4260703b799e24 /sdkmanager/app/src/com/android
parent0ac5ad8f688eec8b2b4f3a31a5575a872ffbb116 (diff)
downloadsdk-e9959a3e3c98b7e603d609b765ac4b1b99f38567.zip
sdk-e9959a3e3c98b7e603d609b765ac4b1b99f38567.tar.gz
sdk-e9959a3e3c98b7e603d609b765ac4b1b99f38567.tar.bz2
Add support for 'android update test-project'.
This is only to be used to update the location of the main project. To update other properties, 'update project' can be used. Change-Id: I96ff44295460c7e331953263abccea17108d5a70
Diffstat (limited to 'sdkmanager/app/src/com/android')
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java26
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java8
2 files changed, 29 insertions, 5 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index c691af7..201c2fe 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -239,6 +239,10 @@ public class Main {
SdkCommandLine.OBJECT_PROJECT.equals(directObject)) {
updateProject();
+ } else if (SdkCommandLine.VERB_UPDATE.equals(verb) &&
+ SdkCommandLine.OBJECT_TEST_PROJECT.equals(directObject)) {
+ updateTestProject();
+
} else if (verb == null && directObject == null) {
showMainWindow();
@@ -345,7 +349,12 @@ public class Main {
if (parentProject.isAbsolute() == false) {
// if the path is not absolute, we need to resolve it based on the
// destination path of the project
- parentProject = new File(projectDir, pathToMainProject);
+ try {
+ parentProject = new File(projectDir, pathToMainProject).getCanonicalFile();
+ } catch (IOException e) {
+ errorAndExit("Unable to resolve Main project's directory: %1$s",
+ pathToMainProject);
+ }
}
if (parentProject.isDirectory() == false) {
@@ -491,6 +500,21 @@ public class Main {
}
/**
+ * Updates an existing test project with a new path to the main project.
+ */
+ private void updateTestProject() {
+ ProjectCreator creator = new ProjectCreator(mOsSdkFolder,
+ mSdkCommandLine.isVerbose() ? OutputLevel.VERBOSE :
+ mSdkCommandLine.isSilent() ? OutputLevel.SILENT :
+ OutputLevel.NORMAL,
+ mSdkLog);
+
+ String projectDir = getProjectLocation(mSdkCommandLine.getParamLocationPath());
+
+ creator.updateTestProject(projectDir, mSdkCommandLine.getParamTestProjectMain());
+ }
+
+ /**
* Adjusts the project location to make it absolute & canonical relative to the
* working directory, if any.
*
diff --git a/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java b/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
index 35bbd0d..27afd48 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
@@ -192,10 +192,10 @@ class SdkCommandLine extends CommandLineProcessor {
VERB_UPDATE, OBJECT_PROJECT,
"p", KEY_PATH,
"Location path of the project", null);
- define(Mode.STRING, true,
+ define(Mode.STRING, false,
VERB_UPDATE, OBJECT_PROJECT,
"t", KEY_TARGET_ID,
- "Target id to set for the project", -1);
+ "Target id to set for the project", null);
define(Mode.STRING, false,
VERB_UPDATE, OBJECT_PROJECT,
"n", KEY_NAME,
@@ -214,7 +214,7 @@ class SdkCommandLine extends CommandLineProcessor {
define(Mode.STRING, true,
VERB_UPDATE, OBJECT_TEST_PROJECT,
"m", KEY_MAIN_PROJECT,
- "Location path of the project to test", null);
+ "Location path of the project to test, relative to the new project", null);
}
@Override
@@ -290,6 +290,6 @@ class SdkCommandLine extends CommandLineProcessor {
/** Helper to retrieve the --main value. */
public String getParamTestProjectMain() {
- return ((String) getValue(null, OBJECT_TEST_PROJECT, KEY_MAIN_PROJECT));
+ return ((String) getValue(null, null, KEY_MAIN_PROJECT));
}
}