return dateOnly ? map["date"] : [map, content]
}
+def setReleaseAndWhatsNew(File whatsnewMdFile, File releaseMdFile) {
+ if (CHANNEL != "") {
+ // we may have a version string that has additional bits vs the actual release version
+ if (CHANNEL != "RELEASE")
+ {
+ var nearestVersion = "${JALVIEW_VERSION_UNDERSCORES}"
+ print "Stripping rc/test/etc for ${nearestVersion}"
+ nearestVersion = nearestVersion.replaceAll(~/\-?(d|rc|test|develop|dev).+/,"")
+ var nearestMd = file("${jalviewDir}/${whatsnew_dir}/whatsnew-${nearestVersion}.md")
+ print "Looking in ${nearestMd}"
+ if (nearestMd.exists()) {
+ whatsnewMdFile = nearestMd
+ releaseMdFile = file("${jalviewDir}/${releases_dir}/release-${nearestVersion}.md")
+ }
+ }
+ }
+ return [whatsnewMdFile,releaseMdFile]
+}
+
task hugoTemplates {
group "website"
description "Create partially populated md pages for hugo website build"
def givenDate = null
def givenChannel = null
def givenVersion = null
- if (CHANNEL == "RELEASE") {
+
+ if (CHANNEL!="") {
+ (whatsnewMdFile, releaseMdFile) = setReleaseAndWhatsNew(whatsnewMdFile, releaseMdFile)
+
def (map, content) = mdFileComponents(releaseMdFile)
givenDate = map.date
givenChannel = map.channel
givenVersion = map.version
changes = content
- if (givenVersion != null && givenVersion != JALVIEW_VERSION) {
+ if (CHANNEL=="RELEASE" && givenVersion != null && givenVersion != JALVIEW_VERSION) {
throw new GradleException("'version' header (${givenVersion}) found in ${releaseMdFile} does not match JALVIEW_VERSION (${JALVIEW_VERSION})")
}
-
if (whatsnewMdFile.exists())
whatsnew = whatsnewMdFile.text
}
def releaseMdFile = file("${releasesMdDir}/release-${JALVIEW_VERSION_UNDERSCORES}.md")
def whatsnewMdFile = file("${whatsnewMdDir}/whatsnew-${JALVIEW_VERSION_UNDERSCORES}.md")
+ (whatsnewMdFile,releaseMdFile) = setReleaseAndWhatsNew(whatsnewMdFile, releaseMdFile)
+
if (CHANNEL == "RELEASE") {
if (!releaseMdFile.exists()) {
throw new GradleException("File ${releaseMdFile} must be created for RELEASE")