Skip to content

Commit

Permalink
CB-3445: Read project.properties to configure gradle libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
clelland committed Aug 20, 2014
1 parent 94943a9 commit b6c5a5f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
1 change: 0 additions & 1 deletion bin/lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
16 changes: 14 additions & 2 deletions bin/templates/project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
7 changes: 0 additions & 7 deletions bin/templates/project/libraries.gradle

This file was deleted.

19 changes: 18 additions & 1 deletion bin/templates/project/settings.gradle
Original file line number Diff line number Diff line change
@@ -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 ':'

0 comments on commit b6c5a5f

Please sign in to comment.