From 90488d48e1bf21729e657aeeb423a2e385f106ec Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 23 Mar 2019 09:47:40 +1100 Subject: [PATCH] Add Git hash to build name --- build.gradle | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 83939a7..87be269 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,15 @@ else { def DISTRIBUTION_DIR = file("dist") def PATH_IN_ZIP = "${project.name}" +def getGitHash = { + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-parse', '--short', 'HEAD' + standardOutput = stdout + } + return stdout.toString().trim() +} + repositories { mavenCentral() } @@ -52,7 +61,7 @@ dependencies { } task buildExtension (type: Zip, overwrite: true) { - baseName "${project.name}".replace(' ', '_') + "-${project.version}" + baseName "${project.name}".replace(' ', '_') + "-${project.version}-${getGitHash()}" extension 'zip' destinationDir DISTRIBUTION_DIR version ''