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.palantir.git-version' version '0.13.0' apply false
-// id 'org.gradle.crypto.checksum' version '1.4.0'
-
}
repositories {
// the following values might be overridden by the CHANNEL switch
getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
- getdownArchiveAppBase = null
+ getdownArchiveAppBase = getdown_archive_base
getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
getdownAppDistDir = getdown_app_dir_alt
getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}")
reportRsyncCommand = true
install4jSuffix = ""
install4jInstallerName = "${jalview_name} Installer"
- getdownArchiveAppBase = getdown_archive_base
break
case "ARCHIVE":
}
JALVIEW_VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
+ hugoDataJsonFile = file("${jalviewDir}/${hugo_build_dir}/data/installers/installers-${JALVIEW_VERSION_UNDERSCORES}.json")
// override getdownAppBase if requested
if (findProperty("getdown_appbase_override") != null) {
// revert to LOCAL if empty string
def archiveImagesDir = "${jalviewDir}/${channel_properties_dir}/old/images"
doFirst {
- if (getdownArchiveAppBase == null) {
- throw new StopExecutionException("Cannot create getdownArchive for CHANNEL=${CHANNEL}")
- }
-
// cleanup old "old" dir
delete getdownArchiveDir
HashCode hash = Files.asByteSource(myFile).hash(Hashing.sha256())
return myFile.exists()
? [
- "filename" : myFile.getName(),
+ "file" : myFile.getName(),
"filesize" : myFile.length(),
"sha256" : hash.toString()
]
: null
}
-def writeDataJsonFile(File installersOutputTxt, File installersSha256, File hugoDataJsonFile) {
- if (!installersOutputTxt.exists()) {
- throw new GradleException("Required input file '${installersOutputTxt.getPath()}' doesn't exist.")
- return null;
- }
- if (install4jCheckSums && (!installersSha256)) {
- throw new GradleException("Required input file '${installersSha256.getPath()}' doesn't exist.")
- return null;
- }
+def writeDataJsonFile(File installersOutputTxt, File installersSha256, File dataJsonFile) {
def hash = [
"channel" : getdownChannelName,
"date" : getDate("yyyy-MM-dd HH:mm:ss"),
"git-commit" : "${gitHash} [${gitBranch}]",
"version" : JALVIEW_VERSION
]
- def idHash = [:]
- installersOutputTxt.readLines().each { def line ->
- if (line.startsWith("#")) {
- return;
- }
- line.replaceAll("\n","")
- def vals = line.split("\t")
- def filename = vals[3]
- def filesize = file(filename).length()
- filename = filename.replaceAll(/^.*\//, "")
- hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize ]
- idHash."${filename}" = vals[0]
- }
- if (install4jCheckSums) {
- installersSha256.readLines().each { def line ->
+ // install4j installer files
+ if (installersOutputTxt.exists()) {
+ def idHash = [:]
+ installersOutputTxt.readLines().each { def line ->
if (line.startsWith("#")) {
return;
}
line.replaceAll("\n","")
- def vals = line.split(/\s+\*?/)
- def filename = vals[1]
- def innerHash = (hash.(idHash."${filename}"))."sha256" = vals[0]
+ def vals = line.split("\t")
+ def filename = vals[3]
+ def filesize = file(filename).length()
+ filename = filename.replaceAll(/^.*\//, "")
+ hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize ]
+ idHash."${filename}" = vals[0]
+ }
+ if (install4jCheckSums && installersSha256.exists()) {
+ installersSha256.readLines().each { def line ->
+ if (line.startsWith("#")) {
+ return;
+ }
+ line.replaceAll("\n","")
+ def vals = line.split(/\s+\*?/)
+ def filename = vals[1]
+ def innerHash = (hash.(idHash."${filename}"))."sha256" = vals[0]
+ }
}
}
- // executable JAR
- def jarHash = getDataHash(file(shadowJar.archiveFile))
- if (jarHash != null) {
- hash."JAR" = jarHash;
- }
-
- // version JVL
- def jvlHash =getDataHash(file(getdownVersionLaunchJvl))
- if (jvlHash != null) {
- hash."JVL" = jvlHash;
- }
-
- // source TGZ
- def tarHash = getDataHash(file(sourceDist.archiveFile))
- if (tarHash != null) {
- hash."SOURCE" = tarHash;
+ [
+ "JAR": shadowJar.archiveFile, // executable JAR
+ "JVL": getdownVersionLaunchJvl, // version JVL
+ "SOURCE": sourceDist.archiveFile // source TGZ
+ ].each { key, value ->
+ def file = file(value)
+ if (file.exists()) {
+ def fileHash = getDataHash(file)
+ if (fileHash != null) {
+ hash."${key}" = fileHash;
+ }
+ }
}
-
- return hugoDataJsonFile.write(new JsonBuilder(hash).toPrettyString())
+ return dataJsonFile.write(new JsonBuilder(hash).toPrettyString())
}
task staticMakeInstallersJsonFile {
}
task makeDataJsonFile {
- dependsOn installerFiles
- dependsOn sourceDist
- dependsOn getdownArchive
- dependsOn shadowJar
+ group "website"
+ description "Create the installers-VERSION.json data file for installer files created"
def installersOutputTxt = file("${jalviewDir}/${install4jBuildDir}/output.txt")
def installersSha256 = file("${jalviewDir}/${install4jBuildDir}/sha256sums")
- def hugoDataJsonFile = file("${jalviewDir}/${hugo_build_dir}/data/installers-${JALVIEW_VERSION_UNDERSCORES}.json")
- inputs.file(installersOutputTxt)
- if (install4jCheckSums) {
+ if (installersOutputTxt.exists()) {
+ inputs.file(installersOutputTxt)
+ }
+ if (install4jCheckSums && installersSha256.exists()) {
inputs.file(installersSha256)
}
+ [
+ shadowJar.archiveFile, // executable JAR
+ getdownVersionLaunchJvl, // version JVL
+ sourceDist.archiveFile // source TGZ
+ ].each { fileName ->
+ if (file(fileName).exists()) {
+ inputs.file(fileName)
+ }
+ }
+
outputs.file(hugoDataJsonFile)
doFirst {
}
}
+makeDataJsonFile.mustRunAfter installers
+makeDataJsonFile.mustRunAfter shadowJar
+makeDataJsonFile.mustRunAfter sourceDist
+makeDataJsonFile.mustRunAfter getdownArchive
+
+
task helppages {
dependsOn copyHelp
dependsOn pubhtmlhelp