You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by na...@apache.org on 2014/10/02 20:17:58 UTC
[24/29] git commit: CB-7512 Add gradle environment vars for signing
apks
CB-7512 Add gradle environment vars for signing apks
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/db03c8b0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/db03c8b0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/db03c8b0
Branch: refs/heads/master
Commit: db03c8b0b294a7280047beed8ebae3b244412c71
Parents: 420e72b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 16 13:01:25 2014 -0400
Committer: Prabhjot Singh <pr...@amazon.com>
Committed: Wed Sep 17 22:42:13 2014 +0530
----------------------------------------------------------------------
bin/templates/project/build.gradle | 41 +++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/db03c8b0/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index e76634f..a1f74b9 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -89,6 +89,26 @@ android {
targetCompatibility JavaVersion.VERSION_1_7
}
+ if (System.env.RELEASE_SIGNING_PROPERTIES_FILE) {
+ signingConfigs {
+ release {
+ // These must be set or Gradle will complain (even if they are overridden).
+ keyAlias = ""
+ keyPassword = ""
+ storeFile = null
+ storePassword = ""
+ }
+ }
+ buildTypes {
+ release {
+ signingConfig signingConfigs.release
+ }
+ }
+ addSigningProps(System.env.RELEASE_SIGNING_PROPERTIES_FILE, signingConfigs.release)
+ }
+ if (System.env.DEBUG_SIGNING_PROPERTIES_FILE) {
+ addSigningProps(System.env.DEBUG_SIGNING_PROPERTIES_FILE, signingConfigs.debug)
+ }
}
task wrapper(type: Wrapper) {
@@ -113,3 +133,24 @@ def getProjectList() {
}
return projects
}
+
+def ensureValueExists(filePath, props, key) {
+ if (props.get(key) == null) {
+ throw new GradleException(filePath + ': Missing key required "' + key + '"')
+ }
+ return props.get(key)
+}
+
+def addSigningProps(propsFilePath, signingConfig) {
+ def propsFile = file(propsFilePath)
+ propsFile.withReader { reader ->
+ def props = new Properties()
+ props.load(reader)
+ signingConfig.keyAlias = ensureValueExists(propsFilePath, props, 'keyAlias')
+ signingConfig.keyPassword = ensureValueExists(propsFilePath, props, 'keyPassword')
+ signingConfig.storeFile = RelativePath.parse(true, ensureValueExists(propsFilePath, props, 'storeFile')).getFile(propsFile.getParentFile())
+ signingConfig.storePassword = ensureValueExists(propsFilePath, props, 'storePassword')
+ }
+}
+
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org