calculate android build numbers from version
This commit is contained in:
parent
cd28745025
commit
dab84063e2
1 changed files with 8 additions and 1 deletions
|
|
@ -14,6 +14,13 @@ if (keystorePropertiesFile.exists()) {
|
|||
}
|
||||
}
|
||||
|
||||
fun versionCodeOf(versionName: String): Int {
|
||||
val parts = versionName.split("-", limit = 2)
|
||||
val (major, minor, patch) = parts[0].split(".").map(String::toInt)
|
||||
val preRelease = parts.getOrNull(1)?.let { Regex("\\d+").find(it)?.value?.toInt() ?: 0 } ?: 999
|
||||
return major * 100_000_000 + minor * 1_000_000 + patch * 10_000 + preRelease
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "nexus.federated.nexus"
|
||||
compileSdk = 36
|
||||
|
|
@ -31,7 +38,7 @@ android {
|
|||
minSdk = 29
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
|
||||
versionCode = flutter.versionCode
|
||||
versionCode = versionCodeOf(flutter.versionName!!)
|
||||
versionName = flutter.versionName
|
||||
|
||||
multiDexEnabled = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue