mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 17:10:15 +08:00
CB-7980: Add 9 to versionCode for minSdk 20+ if not multiarch
This commit is contained in:
parent
4859f8f759
commit
9d3c13065b
@ -56,7 +56,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
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
|
compileSdkVersion cordova.cordovaSdkVersion
|
||||||
@ -82,6 +82,8 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (getIntFromManifest("minSdkVersion") >= 20) {
|
||||||
|
defaultConfig.versionCode += 9
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@ -163,9 +165,9 @@ gradle.taskGraph.whenReady { taskGraph ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getVersionCodeFromManifest() {
|
def getIntFromManifest(name) {
|
||||||
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
|
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())
|
def matcher = pattern.matcher(manifestFile.getText())
|
||||||
matcher.find()
|
matcher.find()
|
||||||
return Integer.parseInt(matcher.group(1))
|
return Integer.parseInt(matcher.group(1))
|
||||||
|
Loading…
Reference in New Issue
Block a user