feat: show the build's commit hash under About

A short, faded commit hash next to the version in Settings > About, so a bug
report can name the exact build. Baked into BuildConfig at build time from
`git rev-parse HEAD` (fixed 7 chars, so the same commit always yields the
same value and the APK stays reproducible); empty, and hidden, on a build
with no git metadata such as a source tarball.
This commit is contained in:
austinried
2026-10-09 18:06:38 +00:00
parent 0a3e839da0
commit 7bbc29a1d6
2 changed files with 24 additions and 1 deletions
+14
View File
@@ -14,6 +14,19 @@ ktlint {
version.set(libs.versions.ktlint.get())
}
val commitHash: String =
runCatching {
providers
.exec {
commandLine("git", "rev-parse", "HEAD")
workingDir = rootProject.layout.projectDirectory.asFile
isIgnoreExitValue = true
}.standardOutput.asText
.get()
.trim()
.take(7)
}.getOrDefault("")
android {
namespace = "com.subtracks"
compileSdk = 37
@@ -25,6 +38,7 @@ android {
targetSdk = 37
versionCode = 13
versionName = "3.0.0"
buildConfigField("String", "COMMIT_HASH", "\"$commitHash\"")
}
buildFeatures {