mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-16 08:21:04 +08:00
CB-7980: Add 9 to versionCode for minSdk 20+ if not multiarch
This commit is contained in:
parent
931a996dab
commit
9224ab1592
@ -73,7 +73,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
|
||||||
@ -99,6 +99,8 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (getIntFromManifest("minSdkVersion") >= 20) {
|
||||||
|
defaultConfig.versionCode += 9
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@ -179,9 +181,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…
x
Reference in New Issue
Block a user