JAL-3553 copy sha256sums to a versioned filename too when created
authorBen Soares <b.soares@dundee.ac.uk>
Tue, 16 Nov 2021 18:02:11 +0000 (18:02 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Tue, 16 Nov 2021 18:02:11 +0000 (18:02 +0000)
build.gradle

index c09a61e..c60c88a 100644 (file)
@@ -211,6 +211,8 @@ ext {
   install4jWindowsIconsFile = string("${install4j_images_dir}/${install4j_windows_icons_file}")
   install4jPngIconFile = string("${install4j_images_dir}/${install4j_png_icon_file}")
   install4jBackground = string("${install4j_images_dir}/${install4j_background}")
+  install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
+  install4jCheckSums = true
   switch (CHANNEL) {
 
     case "BUILD":
@@ -317,6 +319,7 @@ ext {
     getdownAppBase = file(getdownWebsiteDir).toURI().toString()
     getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
     install4jExtraScheme = "jalviewl"
+    install4jCheckSums = false
     break
 
     default: // something wrong specified
@@ -1810,11 +1813,7 @@ task copyInstall4jTemplate {
 
     // turn off checksum creation for LOCAL channel
     def e = install4jConfigXml.application[0]
-    if (CHANNEL == "LOCAL") {
-      e.'@createChecksums' = "false"
-    } else {
-      e.'@createChecksums' = "true"
-    }
+    e.'@createChecksums' = string(install4jCheckSums)
 
     // put file association actions where placeholder action is
     def install4jFileAssociationsText = install4jFileAssociationsFile.text
@@ -1886,8 +1885,6 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) {
     filesMd5 = filesMd5.substring(0,8)
   }
   def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
-  // make install4jBuildDir relative to jalviewDir
-  def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
 
   variables = [
     'JALVIEW_NAME': jalview_name,
@@ -1980,24 +1977,32 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) {
   outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
 }
 
-task copyInstallersOutputTxt {
+task addVersionToInstallersDataFiles {
   dependsOn installerFiles
 
-  def install4jBuildDir = "${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}"
-  def installersOutputTxt = "${install4jBuildDir}/output.txt"
-  def installersOutputVersionTxt = "${install4jBuildDir}/output-${JALVIEW_VERSION}.txt"
+  def installersOutputTxt = "${jalviewDir}/${install4jBuildDir}/output.txt"
+  def installersOutputVersionTxt = "${jalviewDir}/${install4jBuildDir}/output-${JALVIEW_VERSION}.txt"
+  def installersSha256 = "${jalviewDir}/${install4jBuildDir}/sha256sums"
+  def installersSha256Version = "${jalviewDir}/${install4jBuildDir}/sha256sums-${JALVIEW_VERSION}"
 
   inputs.file(installersOutputTxt)
-  outputs.file("${install4jBuildDir}/${installersOutputVersionTxt}")
+  outputs.file(installersOutputVersionTxt)
+  if (install4jCheckSums) {
+    inputs.file(installersSha256)
+    outputs.file(installersSha256Version)
+  }
 
   doFirst {
     file(installersOutputVersionTxt).write(file(installersOutputTxt).text)
+    if (install4jCheckSums) {
+      file(installersSha256Version).write(file(installersSha256).text)
+    }
   }
 }
 
 task installers {
   dependsOn installerFiles
-  dependsOn copyInstallersOutputTxt
+  dependsOn addVersionToInstallersDataFiles
 }