aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/app
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-09-15 16:14:02 -0700
committerXavier Ducrohet <xav@android.com>2011-09-28 13:51:05 -0700
commit981fb61d258d58d91a98734ffcfa7242ded90632 (patch)
tree6441b0aedef00ec91c2347fa004c709422f4b201 /sdkmanager/app
parent8760c8e3ad680c4bcba25701eea2fd3b403db055 (diff)
downloadsdk-981fb61d258d58d91a98734ffcfa7242ded90632.zip
sdk-981fb61d258d58d91a98734ffcfa7242ded90632.tar.gz
sdk-981fb61d258d58d91a98734ffcfa7242ded90632.tar.bz2
Cherrypick 0a6192 from master. do not merge.
Add support to make identity files from the command line. Change-Id: Ieb11a6ac46790f244786a20ede930768946abc91
Diffstat (limited to 'sdkmanager/app')
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java42
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java52
2 files changed, 68 insertions, 26 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index 4bf8867..4e5c0fb 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -31,6 +31,7 @@ import com.android.sdklib.internal.avd.AvdInfo;
import com.android.sdklib.internal.avd.AvdManager;
import com.android.sdklib.internal.avd.HardwareProperties;
import com.android.sdklib.internal.avd.HardwareProperties.HardwareProperty;
+import com.android.sdklib.internal.build.MakeIdentity;
import com.android.sdklib.internal.project.ProjectCreator;
import com.android.sdklib.internal.project.ProjectProperties;
import com.android.sdklib.internal.project.ProjectCreator.OutputLevel;
@@ -254,6 +255,9 @@ public class Main {
} else if (SdkCommandLine.OBJECT_LIB_PROJECT.equals(directObject)) {
createProject(true /*library*/);
+ } else if (SdkCommandLine.OBJECT_IDENTITY.equals(directObject)) {
+ createIdentity();
+
}
} else if (SdkCommandLine.VERB_UPDATE.equals(verb)) {
if (SdkCommandLine.OBJECT_AVD.equals(directObject)) {
@@ -1260,6 +1264,44 @@ public class Main {
}
}
+
+ private void createIdentity() {
+ String account = (String) mSdkCommandLine.getValue(
+ SdkCommandLine.VERB_CREATE,
+ SdkCommandLine.OBJECT_IDENTITY,
+ SdkCommandLine.KEY_ACCOUNT);
+
+ String keystorePath = (String) mSdkCommandLine.getValue(
+ SdkCommandLine.VERB_CREATE,
+ SdkCommandLine.OBJECT_IDENTITY,
+ SdkCommandLine.KEY_KEYSTORE);
+
+ String aliasName = (String) mSdkCommandLine.getValue(
+ SdkCommandLine.VERB_CREATE,
+ SdkCommandLine.OBJECT_IDENTITY,
+ SdkCommandLine.KEY_ALIAS);
+
+ String keystorePass = (String) mSdkCommandLine.getValue(
+ SdkCommandLine.VERB_CREATE,
+ SdkCommandLine.OBJECT_IDENTITY,
+ SdkCommandLine.KEY_STOREPASS);
+
+ String aliasPass = (String) mSdkCommandLine.getValue(
+ SdkCommandLine.VERB_CREATE,
+ SdkCommandLine.OBJECT_IDENTITY,
+ SdkCommandLine.KEY_KEYPASS);
+
+ MakeIdentity mi = new MakeIdentity(account, keystorePath, keystorePass,
+ aliasName, aliasPass);
+
+ try {
+ mi.make(System.out, mSdkLog);
+ } catch (Exception e) {
+ errorAndExit("Unexpected error: %s", e.getMessage());
+ }
+ }
+
+
/**
* Prompts the user to setup a hardware config for a Platform-based AVD.
* @throws IOException
diff --git a/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java b/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
index 387cd6f..5be7d38 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
@@ -55,6 +55,7 @@ class SdkCommandLine extends CommandLineProcessor {
public static final String OBJECT_TEST_PROJECT = "test-project"; //$NON-NLS-1$
public static final String OBJECT_LIB_PROJECT = "lib-project"; //$NON-NLS-1$
public static final String OBJECT_ADB = "adb"; //$NON-NLS-1$
+ public static final String OBJECT_IDENTITY = "identity"; //$NON-NLS-1$
public static final String ARG_ALIAS = "alias"; //$NON-NLS-1$
public static final String ARG_ACTIVITY = "activity"; //$NON-NLS-1$
@@ -84,6 +85,11 @@ class SdkCommandLine extends CommandLineProcessor {
public static final String KEY_COMPACT = "compact"; //$NON-NLS-1$
public static final String KEY_EOL_NULL = "null"; //$NON-NLS-1$
public static final String KEY_ABI = "abi"; //$NON-NLS-1$
+ public static final String KEY_ACCOUNT = "account"; //$NON-NLS-1$
+ public static final String KEY_KEYSTORE = "keystore"; //$NON-NLS-1$
+ public static final String KEY_ALIAS = "alias"; //$NON-NLS-1$
+ public static final String KEY_STOREPASS = "storepass"; //$NON-NLS-1$
+ public static final String KEY_KEYPASS = "keypass"; //$NON-NLS-1$
/**
* Action definitions for SdkManager command line.
@@ -148,6 +154,9 @@ class SdkCommandLine extends CommandLineProcessor {
{ VERB_UPDATE, OBJECT_SDK,
"Updates the SDK by suggesting new platforms to install if available." },
+
+ { VERB_CREATE, OBJECT_IDENTITY,
+ "Creates an identity file." },
};
public SdkCommandLine(ISdkLog logger) {
@@ -355,20 +364,6 @@ class SdkCommandLine extends CommandLineProcessor {
VERB_CREATE, OBJECT_LIB_PROJECT, "k", KEY_PACKAGE, //$NON-NLS-1$
"Android package name for the library.", null);
- // --- create export-project ---
-/*
- * disabled until the feature is officially supported.
-
- define(Mode.STRING, true,
- VERB_CREATE, OBJECT_EXPORT_PROJECT, "p", KEY_PATH, //$NON-NLS-1$
- "Location path of new project.", null);
- define(Mode.STRING, false,
- VERB_CREATE, OBJECT_EXPORT_PROJECT, "n", KEY_NAME, //$NON-NLS-1$
- "Project name.", null);
- define(Mode.STRING, true,
- VERB_CREATE, OBJECT_EXPORT_PROJECT, "k", KEY_PACKAGE, //$NON-NLS-1$
- "Package name.", null);
-*/
// --- update project ---
define(Mode.STRING, true,
@@ -406,19 +401,24 @@ class SdkCommandLine extends CommandLineProcessor {
VERB_UPDATE, OBJECT_LIB_PROJECT, "t", KEY_TARGET_ID, //$NON-NLS-1$
"Target ID to set for the project.", null);
- // --- update export project ---
-/*
- * disabled until the feature is officially supported.
+ // --- create identity file ---
+
define(Mode.STRING, true,
- VERB_UPDATE, OBJECT_EXPORT_PROJECT, "p", KEY_PATH, //$NON-NLS-1$
- "Location path of the project.", null);
- define(Mode.STRING, false,
- VERB_UPDATE, OBJECT_EXPORT_PROJECT, "n", KEY_NAME, //$NON-NLS-1$
- "Project name.", null);
- define(Mode.BOOLEAN, false,
- VERB_UPDATE, OBJECT_EXPORT_PROJECT, "f", KEY_FORCE, //$NON-NLS-1$
- "Force replacing the build.xml file.", false);
-*/
+ VERB_CREATE, OBJECT_IDENTITY, "a", KEY_ACCOUNT, //$NON-NLS-1$
+ "The publisher account.", null);
+ define(Mode.STRING, true,
+ VERB_CREATE, OBJECT_IDENTITY, "s", KEY_KEYSTORE, //$NON-NLS-1$
+ "The keystore path.", null);
+ define(Mode.STRING, true,
+ VERB_CREATE, OBJECT_IDENTITY, "k", KEY_ALIAS, //$NON-NLS-1$
+ "The key alias.", null);
+ define(Mode.STRING, true,
+ VERB_CREATE, OBJECT_IDENTITY, "p", KEY_STOREPASS, //$NON-NLS-1$
+ "The keystore password.", null);
+ define(Mode.STRING, true,
+ VERB_CREATE, OBJECT_IDENTITY, "w", KEY_KEYPASS, //$NON-NLS-1$
+ "The alias password.", null);
+
}
@Override