diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-12-16 23:57:17 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-12-16 23:57:17 +0100 |
commit | 1571a1ce69e73948a06fa4a4610f96c1eba417f4 (patch) | |
tree | 0024e1b5e9825f97d80dc1447c42d2a283bce3df | |
parent | b13d27cbe42cdf6d6f3861bbb6914b9e41fc83fa (diff) | |
download | debian-packages-1571a1ce69e73948a06fa4a4610f96c1eba417f4.tar.gz debian-packages-1571a1ce69e73948a06fa4a4610f96c1eba417f4.zip |
Add git hash instead of timestamp to package version
-rw-r--r-- | build.gradle | 12 |
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) } + |