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"
+task deleteBuildingHTML(type: Delete) {
+ delete buildingHTML
+}
+
+task convertBuildingMD(type: Exec) {
+ dependsOn deleteBuildingHTML
+ def buildingMD = "$jalviewDir/$docDir/building.md"
+ def css = "$jalviewDir/$docDir/github.css"
+
+ def pandoc = pandoc_exec
+ def hostname = "hostname".execute().text.trim()
+ if (! file(pandoc).exists() && hostname.equals("jv-bamboo")) {
+ pandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc"
+ }
+
+ if (file(pandoc).exists()) {
+ commandLine pandoc, '-s', '-o', buildingHTML, '--metadata', 'pagetitle="Building Jalview from Source"', '--toc', '-H', css, buildingMD
+ } else {
+ commandLine "true"
+ }
+
+ ignoreExitValue true
+
+ inputs.file(buildingMD)
+ inputs.file(css)
+ outputs.file(buildingHTML)
+}
+clean {
+ delete buildingHTML
}
task syncDocs(type: Sync) {
+ dependsOn convertBuildingMD
def syncDir = "$classes/$docDir"
from fileTree("$jalviewDir/$docDir")
into syncDir