mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user