CB-7980: Add 9 to versionCode for minSdk 20+ if not multiarch

This commit is contained in:
Mark Koudritsky 2014-11-06 15:38:48 -05:00
parent 4859f8f759
commit 9d3c13065b

View File

@ -56,7 +56,7 @@ android {
}
defaultConfig {
versionCode Integer.parseInt(System.env.ANDROID_VERSION_CODE ?: ("" + getVersionCodeFromManifest() + "0"))
versionCode Integer.parseInt(System.env.ANDROID_VERSION_CODE ?: ("" + getIntFromManifest("versionCode") + "0"))
}
compileSdkVersion cordova.cordovaSdkVersion
@ -82,6 +82,8 @@ android {
}
}
}
} else if (getIntFromManifest("minSdkVersion") >= 20) {
defaultConfig.versionCode += 9
}
compileOptions {
@ -163,9 +165,9 @@ gradle.taskGraph.whenReady { taskGraph ->
}
}
def getVersionCodeFromManifest() {
def getIntFromManifest(name) {
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def pattern = Pattern.compile(name + "=\"(\\d+)\"")
def matcher = pattern.matcher(manifestFile.getText())
matcher.find()
return Integer.parseInt(matcher.group(1))