From 4caadd24b910835419ccc3f98293fe5c86d549d3 Mon Sep 17 00:00:00 2001 From: beetzung Date: Sat, 28 Feb 2026 23:03:54 +0100 Subject: [PATCH] Set pre-release app version and append a git-based debug suffix. Made-with: Cursor --- app/build.gradle.kts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 513c737..f35eecc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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 { 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(