feat: added automatic generation for versionCode
This commit is contained in:
+11
-1
@@ -4,6 +4,16 @@ plugins {
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
fun generateVersionCode(): Int {
|
||||
return try {
|
||||
val process = ProcessBuilder("git", "rev-list", "--count", "HEAD").start()
|
||||
|
||||
"${process.inputStream.bufferedReader().readText().trim()}0".toInt() // 0 at end for mobile
|
||||
} catch (e: Exception) {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "ru.omni_devel.cards"
|
||||
compileSdk = 36
|
||||
@@ -12,7 +22,7 @@ android {
|
||||
applicationId = "ru.omni_devel.cards"
|
||||
minSdk = 30
|
||||
targetSdk = 36
|
||||
versionCode = 80 // 0 at end for mobile
|
||||
versionCode = generateVersionCode()
|
||||
versionName = "2.3.1"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
+11
-1
@@ -4,6 +4,16 @@ plugins {
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
fun generateVersionCode(): Int {
|
||||
return try {
|
||||
val process = ProcessBuilder("git", "rev-list", "--count", "HEAD").start()
|
||||
|
||||
"${process.inputStream.bufferedReader().readText().trim()}1".toInt() // 0 at end for WearOS
|
||||
} catch (e: Exception) {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "ru.omni_devel.cards"
|
||||
compileSdk = 36
|
||||
@@ -12,7 +22,7 @@ android {
|
||||
applicationId = "ru.omni_devel.cards"
|
||||
minSdk = 30
|
||||
targetSdk = 36
|
||||
versionCode = 71 // 1 at end for WearOS
|
||||
versionCode = generateVersionCode()
|
||||
versionName = "1.3.0"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user