You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/09/17 21:32:21 UTC
[1/3] android commit: CB-7512 Make key password optional & prompt for
it when missing
Repository: cordova-android
Updated Branches:
refs/heads/4.0.x 6bdc01290 -> c32bcca67
refs/heads/master ac34bf1e5 -> cb442364c
CB-7512 Make key password optional & prompt for it when missing
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/cb442364
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/cb442364
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/cb442364
Branch: refs/heads/4.0.x
Commit: cb442364caa9dc3f686417f8208fe493daaf6a55
Parents: ac34bf1
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 17 15:29:57 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 17 15:29:57 2014 -0400
----------------------------------------------------------------------
bin/templates/project/build.gradle | 49 +++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/cb442364/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index a1f74b9..96ea009 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -18,6 +18,7 @@
*/
import java.util.regex.Pattern
+import groovy.swing.SwingBuilder
ext.cordova = {}
apply from: 'cordova.gradle', to: ext.cordova
@@ -115,6 +116,49 @@ task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}
+def promptForPassword(msg) {
+ if (System.console() == null) {
+ def ret = null
+ new SwingBuilder().edt {
+ dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
+ vbox {
+ label(text: msg)
+ def input = passwordField()
+ button(defaultButton: true, text: 'OK', actionPerformed: {
+ ret = input.password;
+ dispose();
+ })
+ }
+ }
+ }
+ if (!ret) {
+ throw new GradleException('User canceled build')
+ }
+ return new String(ret)
+ } else {
+ return System.console().readPassword('\n' + msg);
+ }
+}
+
+task promptForReleaseKeyPassword {
+ if (!System.env.RELEASE_SIGNING_PROPERTIES_FILE) {
+ return;
+ }
+ if (!android.signingConfigs.release.storePassword) {
+ android.signingConfigs.release.storePassword = promptForPassword('Enter key store password: ')
+ println('set to:' + android.signingConfigs.release.storePassword)
+ }
+ if (!android.signingConfigs.release.keyPassword) {
+ android.signingConfigs.release.keyPassword = promptForPassword('Enter key password: ');
+ }
+}
+
+tasks.whenTaskAdded { task ->
+ if (task.name == 'validateReleaseSigning') {
+ task.dependsOn promptForReleaseKeyPassword
+ }
+}
+
def getVersionCodeFromManifest() {
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
@@ -147,10 +191,9 @@ def addSigningProps(propsFilePath, signingConfig) {
def props = new Properties()
props.load(reader)
signingConfig.keyAlias = ensureValueExists(propsFilePath, props, 'keyAlias')
- signingConfig.keyPassword = ensureValueExists(propsFilePath, props, 'keyPassword')
+ signingConfig.keyPassword = props.get('keyPassword')
signingConfig.storeFile = RelativePath.parse(true, ensureValueExists(propsFilePath, props, 'storeFile')).getFile(propsFile.getParentFile())
- signingConfig.storePassword = ensureValueExists(propsFilePath, props, 'storePassword')
+ signingConfig.storePassword = props.get('storePassword')
}
}
-
[3/3] android commit: Merge branch 'master' into 4.0.x (gradle
optional password)
Posted by ag...@apache.org.
Merge branch 'master' into 4.0.x (gradle optional password)
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/c32bcca6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/c32bcca6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/c32bcca6
Branch: refs/heads/4.0.x
Commit: c32bcca67b72e8a0359aae822e1f3a502a87a9bb
Parents: 6bdc012 cb44236
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 17 15:30:20 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 17 15:30:20 2014 -0400
----------------------------------------------------------------------
bin/templates/project/build.gradle | 49 +++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[2/3] android commit: CB-7512 Make key password optional & prompt for
it when missing
Posted by ag...@apache.org.
CB-7512 Make key password optional & prompt for it when missing
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/cb442364
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/cb442364
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/cb442364
Branch: refs/heads/master
Commit: cb442364caa9dc3f686417f8208fe493daaf6a55
Parents: ac34bf1
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 17 15:29:57 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 17 15:29:57 2014 -0400
----------------------------------------------------------------------
bin/templates/project/build.gradle | 49 +++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/cb442364/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index a1f74b9..96ea009 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -18,6 +18,7 @@
*/
import java.util.regex.Pattern
+import groovy.swing.SwingBuilder
ext.cordova = {}
apply from: 'cordova.gradle', to: ext.cordova
@@ -115,6 +116,49 @@ task wrapper(type: Wrapper) {
gradleVersion = '1.12'
}
+def promptForPassword(msg) {
+ if (System.console() == null) {
+ def ret = null
+ new SwingBuilder().edt {
+ dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
+ vbox {
+ label(text: msg)
+ def input = passwordField()
+ button(defaultButton: true, text: 'OK', actionPerformed: {
+ ret = input.password;
+ dispose();
+ })
+ }
+ }
+ }
+ if (!ret) {
+ throw new GradleException('User canceled build')
+ }
+ return new String(ret)
+ } else {
+ return System.console().readPassword('\n' + msg);
+ }
+}
+
+task promptForReleaseKeyPassword {
+ if (!System.env.RELEASE_SIGNING_PROPERTIES_FILE) {
+ return;
+ }
+ if (!android.signingConfigs.release.storePassword) {
+ android.signingConfigs.release.storePassword = promptForPassword('Enter key store password: ')
+ println('set to:' + android.signingConfigs.release.storePassword)
+ }
+ if (!android.signingConfigs.release.keyPassword) {
+ android.signingConfigs.release.keyPassword = promptForPassword('Enter key password: ');
+ }
+}
+
+tasks.whenTaskAdded { task ->
+ if (task.name == 'validateReleaseSigning') {
+ task.dependsOn promptForReleaseKeyPassword
+ }
+}
+
def getVersionCodeFromManifest() {
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
@@ -147,10 +191,9 @@ def addSigningProps(propsFilePath, signingConfig) {
def props = new Properties()
props.load(reader)
signingConfig.keyAlias = ensureValueExists(propsFilePath, props, 'keyAlias')
- signingConfig.keyPassword = ensureValueExists(propsFilePath, props, 'keyPassword')
+ signingConfig.keyPassword = props.get('keyPassword')
signingConfig.storeFile = RelativePath.parse(true, ensureValueExists(propsFilePath, props, 'storeFile')).getFile(propsFile.getParentFile())
- signingConfig.storePassword = ensureValueExists(propsFilePath, props, 'storePassword')
+ signingConfig.storePassword = props.get('storePassword')
}
}
-