Merge pull request #1243 from Hy4ri/fix/reproducible-git-sha
fix: stabilize embedded git SHA for reproducible APKs
This commit is contained in:
1 file changed
+4
-3
@@ -26,11 +26,12 @@ android {
|
|||||||
versionCode = (project.findProperty("versionCode") as? String)?.toIntOrNull() ?: 1
|
versionCode = (project.findProperty("versionCode") as? String)?.toIntOrNull() ?: 1
|
||||||
versionName = (project.findProperty("versionName") as? String) ?: "1.0-dev"
|
versionName = (project.findProperty("versionName") as? String) ?: "1.0-dev"
|
||||||
|
|
||||||
// Embed git commit SHA for the About card in Settings
|
// Use a fixed prefix: git --short varies with the checkout's object graph
|
||||||
|
// (shallow GitHub Actions vs. full F-Droid clone), breaking reproducible APKs.
|
||||||
val gitSha =
|
val gitSha =
|
||||||
providers.exec {
|
providers.exec {
|
||||||
commandLine("git", "rev-parse", "--short", "HEAD")
|
commandLine("git", "rev-parse", "HEAD")
|
||||||
}.standardOutput.asText.get().trim()
|
}.standardOutput.asText.get().trim().take(7)
|
||||||
buildConfigField("String", "GIT_SHA", "\"$gitSha\"")
|
buildConfigField("String", "GIT_SHA", "\"$gitSha\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user