commit 718a969219bd9165eecd7a8bc06682efb0d163e2
parent 9948981d41de26fa4dcb245e1848b5771773157a
Author: Antoine A <>
Date: Mon, 27 Nov 2023 20:51:27 +0000
Add git hash to version string
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
@@ -37,7 +37,14 @@ idea {
}
task versionFile() {
- new File("${projectDir}/util/src/main/resources", "version.txt").text = getRootProject().version
+ def stdout = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'rev-parse', '--short', 'HEAD'
+ standardOutput = stdout
+ }
+ def gitHash = stdout.toString().trim()
+ def version = getRootProject().version
+ new File("${projectDir}/util/src/main/resources", "version.txt").text = "v$version-git-$gitHash"
}
// See: https://stackoverflow.com/questions/24936781/gradle-plugin-project-version-number