Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A4CA817D74 for ; Thu, 9 Oct 2014 20:22:33 +0000 (UTC) Received: (qmail 14953 invoked by uid 500); 9 Oct 2014 20:22:33 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 14908 invoked by uid 500); 9 Oct 2014 20:22:33 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 14887 invoked by uid 99); 9 Oct 2014 20:22:33 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Oct 2014 20:22:33 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 38FF7D522; Thu, 9 Oct 2014 20:22:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: naika@apache.org To: commits@cordova.apache.org Date: Thu, 09 Oct 2014 20:22:33 -0000 Message-Id: <995ed03a271d45f086b33f7f05adbb0f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/19] git commit: CB-7512 Make key password optional & prompt for it when missing Repository: cordova-amazon-fireos Updated Branches: refs/heads/master e95f47a8d -> 30afdfff4 CB-7512 Make key password optional & prompt for it when missing Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/68a92cec Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/68a92cec Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/68a92cec Branch: refs/heads/master Commit: 68a92cec14ae6bd27f5fb39310ee342104f38dfc Parents: e95f47a Author: Andrew Grieve Authored: Wed Sep 17 15:29:57 2014 -0400 Committer: Prabhjot Singh Committed: Mon Oct 6 14:39:34 2014 +0530 ---------------------------------------------------------------------- bin/templates/project/build.gradle | 49 +++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/68a92cec/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') } } - --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org