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
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"