-task setGitVals {
-
- doFirst {
- def hashStdOut = new ByteArrayOutputStream()
- def resultHash = exec {
- commandLine "git", "rev-parse", "--short", "HEAD"
- standardOutput = hashStdOut
- ignoreExitValue true
- }
-
- def branchStdOut = new ByteArrayOutputStream()
- def resultBranch = exec {
- commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
- standardOutput = branchStdOut
- ignoreExitValue true
- }
-
- gitHash = resultHash.getExitValue() == 0 ? hashStdOut.toString().trim() : "NO_GIT_COMMITID_FOUND"
- gitBranch = resultBranch.getExitValue() == 0 ? branchStdOut.toString().trim() : "NO_GIT_BRANCH_FOUND"
- }
-
- outputs.upToDateWhen { false }
-}
-
-
-task createBuildProperties(type: WriteProperties) {
- group = "build"
- description = "Create the ${buildProperties} file"
-
- dependsOn setGitVals
- inputs.dir(sourceDir)
- inputs.dir(resourceDir)
- file(buildProperties).getParentFile().mkdirs()
- outputFile (buildProperties)
- // taking time specific comment out to allow better incremental builds
- comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
- //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
- property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy")
- property "VERSION", JALVIEW_VERSION
- property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]"
- outputs.file(outputFile)
-}
-
-
-clean {
- doFirst {
- delete buildProperties
- }
-}
-
-
-task cleanBuildingHTML(type: Delete) {
- doFirst {
- delete buildingHTML
- }
-}
-
-