X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=851c5f6c98c2511a9c2b5e5b64c916d6dce5b144;hb=refs%2Fheads%2Fmerge%2FJAL-1988_JAL-3772%2BJAL-3416%2BJAL-4054%2BJAL-4064;hp=105612405ae00414e7003db2f8ca812f62381803;hpb=639bc5f3126d65cc1de8992b9a0fa0cfb993a9ff;p=jalview.git diff --git a/build.gradle b/build.gradle index 1056124..851c5f6 100644 --- a/build.gradle +++ b/build.gradle @@ -47,8 +47,8 @@ plugins { id 'eclipse' 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.install4j.gradle' version '10.0.3' + 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") @@ -482,16 +483,10 @@ ext { // for install4j JAVA_MIN_VERSION = JAVA_VERSION JAVA_MAX_VERSION = JAVA_VERSION - def jreInstallsDir = string(jre_installs_dir) + jreInstallsDir = string(jre_installs_dir) if (jreInstallsDir.startsWith("~/")) { jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1) } - macosJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-mac-x64/jre") - windowsJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-windows-x64/jre") - linuxJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-linux-x64/jre") - macosJavaVMTgz = string("${jreInstallsDir}/tgz/jre_${JAVA_INTEGER_VERSION}_mac_x64.tar.gz") - windowsJavaVMTgz = string("${jreInstallsDir}/tgz/jre_${JAVA_INTEGER_VERSION}_windows_x64.tar.gz") - linuxJavaVMTgz = string("${jreInstallsDir}/tgz/jre_${JAVA_INTEGER_VERSION}_linux_x64.tar.gz") install4jDir = string("${jalviewDir}/${install4j_utils_dir}") install4jConfFileName = string("jalview-install4j-conf.install4j") install4jConfFile = file("${install4jDir}/${install4jConfFileName}") @@ -1406,14 +1401,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 +1508,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 +1548,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 +1574,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" @@ -1632,6 +1634,7 @@ task createBuildProperties(type: WriteProperties) { property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy") property "VERSION", JALVIEW_VERSION property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]" + property "JAVA_COMPILE_VERSION", JAVA_INTEGER_VERSION if (getdownSetAppBaseProperty) { property "GETDOWNAPPBASE", getdownAppBase property "GETDOWNAPPDISTDIR", getdownAppDistDir @@ -1669,6 +1672,7 @@ task prepare { dependsOn buildResources dependsOn copyDocs dependsOn copyHelp + dependsOn releasesTemplates dependsOn convertMdFiles dependsOn buildIndices } @@ -1741,7 +1745,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 @@ -2401,12 +2405,6 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) { 'JAVA_VERSION': JAVA_VERSION, 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION, 'VERSION': JALVIEW_VERSION, - 'MACOS_JAVA_VM_DIR': macosJavaVMDir, - 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir, - 'LINUX_JAVA_VM_DIR': linuxJavaVMDir, - 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz, - 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz, - 'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz, 'COPYRIGHT_MESSAGE': install4j_copyright_message, 'BUNDLE_ID': install4jBundleId, 'INTERNAL_ID': install4jInternalId, @@ -2436,8 +2434,29 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) { 'WINDOWS_ICONS_FILE': install4jWindowsIconsFile, 'PNG_ICON_FILE': install4jPngIconFile, 'BACKGROUND': install4jBackground, + ] + def varNameMap = [ + 'mac': 'MACOS', + 'windows': 'WINDOWS', + 'linux': 'LINUX' ] + + // these are the bundled OS/architecture VMs needed by install4j + def osArch = [ + [ "mac", "x64" ], + [ "mac", "aarch64" ], + [ "windows", "x64" ], + [ "linux", "x64" ], + [ "linux", "aarch64" ] + ] + osArch.forEach { os, arch -> + variables[ sprintf("%s_%s_JAVA_VM_DIR", varNameMap[os], arch.toUpperCase(Locale.ROOT)) ] = sprintf("%s/jre-%s-%s-%s/jre", jreInstallsDir, JAVA_INTEGER_VERSION, os, arch) + // N.B. For some reason install4j requires the below filename to have underscores and not hyphens + // otherwise running `gradle installers` generates a non-useful error: + // `install4j: compilation failed. Reason: java.lang.NumberFormatException: For input string: "windows"` + variables[ sprintf("%s_%s_JAVA_VM_TGZ", varNameMap[os], arch.toUpperCase(Locale.ROOT)) ] = sprintf("%s/tgz/jre_%s_%s_%s.tar.gz", jreInstallsDir, JAVA_INTEGER_VERSION, os, arch) + } //println("INSTALL4J VARIABLES:") //variables.each{k,v->println("${k}=${v}")} @@ -2471,8 +2490,6 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) { inputs.dir(getdownAppBaseDir) inputs.file(install4jConfFile) inputs.file("${install4jDir}/${install4j_info_plist_file_associations}") - inputs.dir(macosJavaVMDir) - inputs.dir(windowsJavaVMDir) outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}") }