diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-10-21 16:09:28 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-10-21 16:09:28 -0400 |
commit | d9df9a3176187ced0b33af2301a1f80ec2d126b2 (patch) | |
tree | d06b47e147110f9f9bd77807673a1b7510b79dc6 /sdkmanager/app | |
parent | 2de259a4ec21b954eede5489a41cab7965cf8403 (diff) | |
parent | 5ffaec4a2ca90d40d63d01aedbed7980c835938f (diff) | |
download | sdk-d9df9a3176187ced0b33af2301a1f80ec2d126b2.zip sdk-d9df9a3176187ced0b33af2301a1f80ec2d126b2.tar.gz sdk-d9df9a3176187ced0b33af2301a1f80ec2d126b2.tar.bz2 |
Merge change I235da4a8 into eclair-sdk
* changes:
SDK android "update project" must not require --target parameter.
Diffstat (limited to 'sdkmanager/app')
-rw-r--r-- | sdkmanager/app/src/com/android/sdkmanager/Main.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java index 84195d1..55d4357 100644 --- a/sdkmanager/app/src/com/android/sdkmanager/Main.java +++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java @@ -291,11 +291,11 @@ public class Main { // get the target and try to resolve it. int targetId = resolveTargetName(mSdkCommandLine.getParamTargetId()); IAndroidTarget[] targets = mSdkManager.getTargets(); - if (targetId < 1 || targetId > targets.length) { + if (targetId == INVALID_TARGET_ID || targetId > targets.length) { errorAndExit("Target id is not valid. Use '%s list targets' to get the target ids.", SdkConstants.androidCmdName()); } - IAndroidTarget target = targets[targetId - 1]; + IAndroidTarget target = targets[targetId - 1]; // target id is 1-based ProjectCreator creator = new ProjectCreator(mOsSdkFolder, mSdkCommandLine.isVerbose() ? OutputLevel.VERBOSE : @@ -462,14 +462,18 @@ public class Main { private void updateProject() { // get the target and try to resolve it. IAndroidTarget target = null; - int targetId = resolveTargetName(mSdkCommandLine.getParamTargetId()); - if (targetId >= 0) { + String targetStr = mSdkCommandLine.getParamTargetId(); + // For "update project" the target parameter is optional so having null is acceptable. + // However if there's a value, it must be valid. + if (targetStr != null) { IAndroidTarget[] targets = mSdkManager.getTargets(); - if (targetId < 1 || targetId > targets.length) { - errorAndExit("Target id is not valid. Use '%s list targets' to get the target ids.", + int targetId = resolveTargetName(targetStr); + if (targetId == INVALID_TARGET_ID || targetId > targets.length) { + errorAndExit("Target id '%1$s' is not valid. Use '%2$s list targets' to get the target ids.", + targetStr, SdkConstants.androidCmdName()); } - target = targets[targetId - 1]; + target = targets[targetId - 1]; // target id is 1-based } ProjectCreator creator = new ProjectCreator(mOsSdkFolder, @@ -715,15 +719,15 @@ public class Main { private void createAvd() { // find a matching target int targetId = resolveTargetName(mSdkCommandLine.getParamTargetId()); - IAndroidTarget target = null; + IAndroidTarget[] targets = mSdkManager.getTargets(); - if (targetId >= 1 && targetId <= mSdkManager.getTargets().length) { - target = mSdkManager.getTargets()[targetId-1]; // target it is 1-based - } else { + if (targetId == INVALID_TARGET_ID || targetId > targets.length) { errorAndExit("Target id is not valid. Use '%s list targets' to get the target ids.", SdkConstants.androidCmdName()); } + IAndroidTarget target = targets[targetId-1]; // target id is 1-based + try { boolean removePrevious = mSdkCommandLine.getFlagForce(); AvdManager avdManager = new AvdManager(mSdkManager, mSdkLog); |