You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/08/20 17:42:21 UTC
android commit: CB-3445: Read project.properties to configure gradle
libraries
Repository: cordova-android
Updated Branches:
refs/heads/master 94943a9a8 -> b6c5a5fc9
CB-3445: Read project.properties to configure gradle libraries
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b6c5a5fc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b6c5a5fc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b6c5a5fc
Branch: refs/heads/master
Commit: b6c5a5fc9a274135d373285855120dfbecbac8fd
Parents: 94943a9
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Aug 20 10:44:48 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Aug 20 11:42:04 2014 -0400
----------------------------------------------------------------------
bin/lib/create.js | 1 -
bin/templates/project/build.gradle | 16 ++++++++++++++--
bin/templates/project/libraries.gradle | 7 -------
bin/templates/project/settings.gradle | 19 ++++++++++++++++++-
4 files changed, 32 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b6c5a5fc/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 0e929e3..c4c6f1b 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -122,7 +122,6 @@ function copyBuildRules(projectPath) {
shell.cp('-f', path.join(srcDir, 'custom_rules.xml'), projectPath);
shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
- shell.cp('-f', path.join(srcDir, 'libraries.gradle'), projectPath);
shell.cp('-f', path.join(srcDir, 'settings.gradle'), projectPath);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b6c5a5fc/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index 4b34e48..dcebbc5 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -15,9 +15,10 @@ buildscript {
ext.multiarch=false
dependencies {
- compile project(':CordovaLib')
+ for (subproject in getProjectList()) {
+ compile project(subproject)
+ }
}
-apply from: 'libraries.gradle'
android {
sourceSets {
@@ -79,3 +80,14 @@ def getVersionCodeFromManifest() {
matcher.find()
return Integer.parseInt(matcher.group(1))
}
+
+def getProjectList() {
+ def manifestFile = file("project.properties")
+ def pattern = Pattern.compile("android.library.reference.(\\d+)\\s*=\\s*(.*)")
+ def matcher = pattern.matcher(manifestFile.getText())
+ def projects = []
+ while (matcher.find()) {
+ projects.add(":" + matcher.group(2).replace("/",":"))
+ }
+ return projects
+}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b6c5a5fc/bin/templates/project/libraries.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/libraries.gradle b/bin/templates/project/libraries.gradle
deleted file mode 100644
index f497543..0000000
--- a/bin/templates/project/libraries.gradle
+++ /dev/null
@@ -1,7 +0,0 @@
-dependencies {
-// This file contains no plugins by default.
-// To add a third-party library project, add a line to this file like
-// compile project(':library_dir_name')
-}
-// If multiple ndk architectures are provided, uncomment this line
-//ext.multiarch=true
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b6c5a5fc/bin/templates/project/settings.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/settings.gradle b/bin/templates/project/settings.gradle
index b938ccc..baa1714 100644
--- a/bin/templates/project/settings.gradle
+++ b/bin/templates/project/settings.gradle
@@ -1 +1,18 @@
-include ':CordovaLib', ':'
+import java.util.regex.Pattern
+
+def getProjectList() {
+ def manifestFile = file("project.properties")
+ def pattern = Pattern.compile("android.library.reference.(\\d+)\\s*=\\s*(.*)")
+ def matcher = pattern.matcher(manifestFile.getText())
+ def projects = []
+ while (matcher.find()) {
+ projects.add(":" + matcher.group(2).replace("/",":"))
+ }
+ return projects
+}
+
+for (subproject in getProjectList()) {
+ include subproject
+}
+
+include ':'