summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle12
1 files changed, 11 insertions, 1 deletions
diff --git a/build.gradle b/build.gradle
index d35d0bb..8087483 100644
--- a/build.gradle
+++ b/build.gradle
@@ -21,6 +21,15 @@ ext {
sshReindexCommand = 'cd public_html/public/debian && make'
}
+final getGitHash = { File file ->
+ final hashStdOut = new ByteArrayOutputStream()
+ exec {
+ commandLine "git", "log", "-n", "1", "--format=format:%h", file.path
+ standardOutput = hashStdOut
+ }
+ return hashStdOut.toString().trim()
+}
+
allprojects {
configurations {
sshAntTask
@@ -111,7 +120,7 @@ subprojects {
project.afterEvaluate {
ospackage.version = project.version
- ospackage.release = "${new Date().format("yyyyMMdd")}T${new Date().format("HHmmss")}"
+ ospackage.release = "${getGitHash(project.projectDir)}"
}
final activatorExtension = [
@@ -152,3 +161,4 @@ subprojects {
tasks.getByName('buildDeb').dependsOn(activatorTask)
tasks.getByName('buildRpm').dependsOn(activatorTask)
}
+