cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [3/4] android commit: Make plugin .gradle extensions run at the same point as build-extras.gradle
Date Mon, 26 Jan 2015 21:28:50 GMT
Make plugin .gradle extensions run at the same point as build-extras.gradle

This lets them change cdv* property defaults, and allows modifying
values at the end as well.


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/98f90340
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/98f90340
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/98f90340

Branch: refs/heads/4.0.x
Commit: 98f90340f365a553c089946859926fc07338125d
Parents: a4c9bf7
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Jan 26 16:26:11 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Jan 26 16:26:57 2015 -0500

----------------------------------------------------------------------
 bin/templates/project/build.gradle | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/98f90340/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index ed4fd12..b697665 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -60,11 +60,11 @@ ext {
     apply from: 'CordovaLib/cordova.gradle'
     // The value for android.compileSdkVersion.
     if (!project.hasProperty('cdvCompileSdkVersion')) {
-        cdvCompileSdkVersion = privateHelpers.getProjectTarget()
+        cdvCompileSdkVersion = null;
     }
     // The value for android.buildToolsVersion.
     if (!project.hasProperty('cdvBuildToolsVersion')) {
-        cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
+        cdvBuildToolsVersion = null;
     }
     // Sets the versionCode to the given value.
     if (!project.hasProperty('cdvVersionCode')) {
@@ -76,7 +76,7 @@ ext {
     }
     // Whether to build architecture-specific APKs.
     if (!project.hasProperty('cdvBuildMultipleApks')) {
-        cdvBuildMultipleApks = false
+        cdvBuildMultipleApks = null
     }
     // .properties files to use for release signing.
     if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
@@ -90,13 +90,28 @@ ext {
     if (!project.hasProperty('cdvBuildArch')) {
         cdvBuildArch = null
     }
+
+    // Plugin gradle extensions can append to this to have code run at the end.
+    cdvPluginPostBuildExtras = []
 }
 
+// PLUGIN GRADLE EXTENSIONS START
+// PLUGIN GRADLE EXTENSIONS END
+
 def hasBuildExtras = file('build-extras.gradle').exists()
 if (hasBuildExtras) {
     apply from: 'build-extras.gradle'
 }
 
+// Set property defaults after extension .gradle files.
+if (ext.cdvCompileSdkVersion == null) {
+    ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
+}
+if (ext.cdvBuildToolsVersion == null) {
+    ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
+}
+ext.cdvBuildMultipleApks = !!cdvBuildMultipleApks;
+
 def computeBuildTargetName(debugBuild) {
     def ret = 'assemble'
     if (cdvBuildMultipleApks && cdvBuildArch) {
@@ -135,9 +150,6 @@ task cdvPrintProps << {
     }
 }
 
-// PLUGIN GRADLE EXTENSIONS START
-// PLUGIN GRADLE EXTENSIONS END
-
 android {
     sourceSets {
         main {
@@ -278,6 +290,10 @@ def addSigningProps(propsFilePath, signingConfig) {
     }
 }
 
+for (def func : cdvPluginPostBuildExtras) {
+    func()
+}
+
 // This can be defined within build-extras.gradle as:
 //     ext.postBuildExtras = { ... code here ... }
 if (hasProperty('postBuildExtras')) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message