X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=build.gradle;h=a62e85a0f2d68c25f5c9e887e295eaed701e4087;hp=105612405ae00414e7003db2f8ca812f62381803;hb=a92455a4db78cdc97d94f7bddb1929096abab1f2;hpb=639bc5f3126d65cc1de8992b9a0fa0cfb993a9ff diff --git a/build.gradle b/build.gradle index 1056124..a62e85a 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ plugins { id "com.diffplug.gradle.spotless" version "3.28.0" id 'com.github.johnrengelman.shadow' version '4.0.3' id 'com.install4j.gradle' version '9.0.6' - id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree + id 'com.dorongold.task-tree' version '2.1.0' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree id 'com.palantir.git-version' version '0.13.0' apply false } @@ -138,6 +138,7 @@ ext { if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) { JALVIEW_VERSION = releaseProps.get("jalview.version") } + println("JALVIEW_VERSION is set to '${JALVIEW_VERSION}'") // this property set when running Eclipse headlessly j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild") @@ -1406,14 +1407,52 @@ def getMdSections(String content) { return sections } + +task copyHelp(type: Copy) { + def inputDir = helpSourceDir + def outputDir = "${helpBuildDir}/${help_dir}" + from(inputDir) { + include('**/*.txt') + include('**/*.md') + include('**/*.html') + include('**/*.hs') + include('**/*.xml') + include('**/*.jhm') + filter(ReplaceTokens, + beginToken: '$$', + endToken: '$$', + tokens: [ + 'Version-Rel': JALVIEW_VERSION, + 'Year-Rel': getDate("yyyy") + ] + ) + } + from(inputDir) { + exclude('**/*.txt') + exclude('**/*.md') + exclude('**/*.html') + exclude('**/*.hs') + exclude('**/*.xml') + exclude('**/*.jhm') + } + into outputDir + + inputs.dir(inputDir) + outputs.files(helpFile) + outputs.dir(outputDir) +} + + task releasesTemplates { group "help" description "Recreate whatsNew.html and releases.html from markdown files and templates in help" + dependsOn copyHelp + def releasesTemplateFile = file("${jalviewDir}/${releases_template}") def whatsnewTemplateFile = file("${jalviewDir}/${whatsnew_template}") - def releasesHtmlFile = file("${helpSourceDir}/${releases_html}") - def whatsnewHtmlFile = file("${helpSourceDir}/${whatsnew_html}") + def releasesHtmlFile = file("${helpBuildDir}/${help_dir}/${releases_html}") + def whatsnewHtmlFile = file("${helpBuildDir}/${help_dir}/${whatsnew_html}") def releasesMdDir = "${jalviewDir}/${releases_dir}" def whatsnewMdDir = "${jalviewDir}/${whatsnew_dir}" @@ -1475,18 +1514,18 @@ task releasesTemplates { } firstPart = false } - def displayDate = releaseFilesDates[rFile].format("d MMMMM yyyy") - - def lm = null - def rContentProcessed = "" - rContent.eachLine { line -> - if (lm = line =~ /^(\s*-)(\s*)(.*)$/) { - line = "${lm[0][1]}${lm[0][3]}${lm[0][2]}" - } else if (lm = line =~ /^###([^#]+.*)$/) { - line = "_${lm[0][1].trim()}_" - } - rContentProcessed += line + "\n" + def displayDate = releaseFilesDates[rFile].format("dd/MM/yyyy") + + def lm = null + def rContentProcessed = "" + rContent.eachLine { line -> + if (lm = line =~ /^(\s*-)(\s*)(.*)$/) { + line = "${lm[0][1]}${lm[0][3]}${lm[0][2]}" + } else if (lm = line =~ /^###([^#]+.*)$/) { + line = "_${lm[0][1].trim()}_" } + rContentProcessed += line + "\n" + } def rContentSections = getMdSections(rContentProcessed) def rVersion = versionTemplate @@ -1515,13 +1554,19 @@ task releasesTemplates { releasesHtmlFile.text = releasesTemplate if (whatsnewMdFile.exists()) { + def wnDisplayDate = releaseFilesDates[releaseMdFile] != null ? releaseFilesDates[releaseMdFile].format("dd MMMM yyyy") : "" def whatsnewMd = hugoTemplateSubstitutions(whatsnewMdFile.text) Node whatsnewNode = parser.parse(whatsnewMd) String whatsnewHtml = renderer.render(whatsnewNode) whatsnewHtml = whatsnewTemplateFile.text.replaceAll("__WHATS_NEW__", whatsnewHtml) whatsnewHtmlFile.text = hugoTemplateSubstitutions(whatsnewHtml, - [:] + [ + VERSION: JALVIEW_VERSION, + DISPLAY_DATE: wnDisplayDate + ] ) + } else if (gradle.taskGraph.hasTask(":linkCheck")) { + whatsnewHtmlFile.text = "Development build " + getDate("yyyy-MM-dd HH:mm:ss") } } @@ -1535,43 +1580,6 @@ task releasesTemplates { } -task copyHelp(type: Copy) { - dependsOn releasesTemplates - - def inputDir = helpSourceDir - def outputDir = "${helpBuildDir}/${help_dir}" - from(inputDir) { - include('**/*.txt') - include('**/*.md') - include('**/*.html') - include('**/*.hs') - include('**/*.xml') - include('**/*.jhm') - filter(ReplaceTokens, - beginToken: '$$', - endToken: '$$', - tokens: [ - 'Version-Rel': JALVIEW_VERSION, - 'Year-Rel': getDate("yyyy") - ] - ) - } - from(inputDir) { - exclude('**/*.txt') - exclude('**/*.md') - exclude('**/*.html') - exclude('**/*.hs') - exclude('**/*.xml') - exclude('**/*.jhm') - } - into outputDir - - inputs.dir(inputDir) - outputs.files(helpFile) - outputs.dir(outputDir) -} - - task copyResources(type: Copy) { group = "build" description = "Copy (and make text substitutions in) the resources dir to the build area" @@ -1669,6 +1677,7 @@ task prepare { dependsOn buildResources dependsOn copyDocs dependsOn copyHelp + dependsOn releasesTemplates dependsOn convertMdFiles dependsOn buildIndices } @@ -1741,7 +1750,7 @@ task linkCheck(type: JavaExec) { def helpLinksCheckerOutFile = file("${jalviewDir}/${utils_dir}/HelpLinksChecker.out") classpath = files("${jalviewDir}/${utils_dir}") main = "HelpLinksChecker" - workingDir = jalviewDir + workingDir = "${helpBuildDir}" args = [ "${helpBuildDir}/${help_dir}", "-nointernet" ] def outFOS = new FileOutputStream(helpLinksCheckerOutFile, false) // false == don't append