X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=0ae4e5c32bc9dfae61cd42e05d87026d316aaa9f;hb=eb9f07f8197ef5135da5aa8df0dc537dc28f7154;hp=e143b8085ce1ae02269a3a5ff04ca01d69db400b;hpb=19cb2eab37ddf738c73a8e5c6eed4e1091e610bf;p=jalview.git diff --git a/build.gradle b/build.gradle index e143b80..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,10 +449,42 @@ 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" +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