Set pre-release app version and append a git-based debug suffix.
Made-with: Cursor
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.hilt.android)
|
||||
@@ -5,7 +7,19 @@ plugins {
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
}
|
||||
|
||||
android {
|
||||
fun gitCommitCount(): String {
|
||||
return runCatching {
|
||||
val process = ProcessBuilder("git", "rev-list", "--count", "HEAD")
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
val output = process.inputStream.bufferedReader().use { it.readText().trim() }
|
||||
if (process.waitFor() == 0 && output.isNotBlank()) output else "local"
|
||||
}.getOrElse { "local" }
|
||||
}
|
||||
|
||||
val debugBuildId = gitCommitCount()
|
||||
|
||||
extensions.configure<ApplicationExtension> {
|
||||
namespace = "org.db3.airmq"
|
||||
compileSdk {
|
||||
version = release(36) {
|
||||
@@ -18,12 +32,16 @@ android {
|
||||
minSdk = 24
|
||||
targetSdk = 36
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
versionName = "3.0.0-pre"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
versionNameSuffix = "_debug_$debugBuildId"
|
||||
}
|
||||
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
|
||||
Reference in New Issue
Block a user