From eb9f07f8197ef5135da5aa8df0dc537dc28f7154 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 12 Jun 2019 15:58:04 +0100 Subject: [PATCH] JAL-3299 Fixed gitHash and gitBranch definitions in build.gradle --- build.gradle | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 9fbcd38..0ae4e5c 100644 --- a/build.gradle +++ b/build.gradle @@ -417,32 +417,29 @@ def getDate(format) { return date.format(format) } -task setGitHash(type: Exec) { - workingDir = jalviewDir - commandLine "git", "rev-parse", "--short", "HEAD" - standardOutput = new ByteArrayOutputStream() - project.ext.gitHash = { - return standardOutput.toString().trim() +task setGitVals { + def hashStdOut = new ByteArrayOutputStream() + exec { + commandLine "git", "rev-parse", "--short", "HEAD" + standardOutput = hashStdOut } -} -task setGitBranch(type: Exec) { - workingDir = jalviewDir - commandLine "git", "rev-parse", "--abbrev-ref", "HEAD" - standardOutput = new ByteArrayOutputStream() - project.ext.gitBranch = { - return standardOutput.toString().trim() + def branchStdOut = new ByteArrayOutputStream() + exec { + commandLine "git", "rev-parse", "--abbrev-ref", "HEAD" + standardOutput = branchStdOut } -} -task setGitVals { - dependsOn setGitHash - dependsOn setGitBranch + project.ext.gitHash = hashStdOut.toString().trim() + project.ext.gitBranch = branchStdOut.toString().trim() + + outputs.upToDateWhen { false } } task createBuildProperties(type: WriteProperties) { dependsOn setGitVals inputs.dir("$jalviewDir/$sourceDir") + inputs.dir("$classes") inputs.dir("$jalviewDir/$resourceDir") outputFile "$classes/$buildPropertiesFile" // taking time specific comment out to allow better incremental builds @@ -452,7 +449,6 @@ task createBuildProperties(type: WriteProperties) { property "VERSION", JALVIEW_VERSION property "INSTALLATION", INSTALLATION+" git-commit:"+project.ext.gitHash+" ["+project.ext.gitBranch+"]" outputs.file(outputFile) - outputs.dir("$classes") } def buildingHTML = "$jalviewDir/$docDir/building.html" -- 1.7.10.2