Adding conditional code into Gradle, this is a bit dirty since we can't explicitly test it but we'll just have to rely on jasmine

This commit is contained in:
Joe Bowser 2017-06-13 10:36:00 -07:00
parent 33feb00e8f
commit c74192d578
2 changed files with 9 additions and 3 deletions

View File

@ -98,10 +98,12 @@ if (hasBuildExtras) {
// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
ext.cdvCompileSdkVersion = project.ext.defaultCompileSdkVersion
ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
//ext.cdvCompileSdkVersion = project.ext.defaultCompileSdkVersion
}
if (ext.cdvBuildToolsVersion == null) {
ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
//ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
}
if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) {
ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties'

View File

@ -29,7 +29,11 @@ String doEnsureValueExists(filePath, props, key) {
String doGetProjectTarget() {
def props = new Properties()
file('project.properties').withReader { reader ->
def propertiesFile = 'project.properties';
if(!(file(propertiesFile).exists())) {
propertiesFile = '../project.properties';
}
file(propertiesFile).withReader { reader ->
props.load(reader)
}
return doEnsureValueExists('project.properties', props, 'target')