From 1a1ef26885c32c5e79012f638c5b0f96f59b8c96 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 1 Nov 2022 11:17:16 +0000 Subject: [PATCH] JAL-4064 Cleaned up file sets in install4j template. New media installers for AARCH64 JVMs for macOS and Linux in install4j template. New variables passed to install4j by gradle. --- build.gradle | 52 ++++++--- utils/install4j/install4j9_template.install4j | 152 +++++++++---------------- 2 files changed, 89 insertions(+), 115 deletions(-) diff --git a/build.gradle b/build.gradle index bde50b5..8c3f168 100644 --- a/build.gradle +++ b/build.gradle @@ -483,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}") @@ -2411,12 +2405,7 @@ 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, @@ -2446,11 +2435,40 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) { 'WINDOWS_ICONS_FILE': install4jWindowsIconsFile, 'PNG_ICON_FILE': install4jPngIconFile, 'BACKGROUND': install4jBackground, - ] + + + //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") + + 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}")} + println("INSTALL4J VARIABLES:") + variables.each{k,v->println("${k}=${v}")} destination = "${jalviewDir}/${install4jBuildDir}" buildSelected = true @@ -2481,8 +2499,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}") } diff --git a/utils/install4j/install4j9_template.install4j b/utils/install4j/install4j9_template.install4j index 23ff9c9..9e07abd 100644 --- a/utils/install4j/install4j9_template.install4j +++ b/utils/install4j/install4j9_template.install4j @@ -1,5 +1,5 @@ - + @@ -23,18 +23,22 @@ - - - - - - + + + + + + + + + + - - + + @@ -86,25 +90,14 @@ - - - - - - - - - - - @@ -112,9 +105,6 @@ - - - @@ -122,26 +112,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -1421,89 +1391,77 @@ ${compiler:JALVIEW_APPLICATION_NAME} will now launch. - - - - - - + + + - - - - - + - - - - - - + - - - - + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + - - - - - + - - - - - - + + + - - - - - + - - - - - - + + + - - - - - + -- 1.7.10.2