JAL-3394 JAL-3420 Temporary measure limits unix file extension to be the shortest...
[jalview.git] / build.gradle
index f02d8ad..8d84b25 100644 (file)
@@ -1057,15 +1057,16 @@ clean {
 install4j {
   def install4jHomeDir = "/opt/install4j"
   def hostname = "hostname".execute().text.trim()
+  def install4jName = (install4jVersion >= 8) ? "install4j"+install4jVersion:"install4j"
   if (hostname.equals("jv-bamboo")) {
-    install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
+    install4jHomeDir = System.getProperty("user.home")+"/buildtools/"+install4jName
   } else if (OperatingSystem.current().isMacOsX()) {
-    install4jHomeDir = '/Applications/install4j.app/Contents/Resources/app'
+    install4jHomeDir = '/Applications/'+install4jName+'.app/Contents/Resources/app'
     if (! file(install4jHomeDir).exists()) {
       install4jHomeDir = System.getProperty("user.home")+install4jHomeDir
     }
   } else if (OperatingSystem.current().isLinux()) {
-    install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
+    install4jHomeDir = System.getProperty("user.home")+"/buildtools/"+install4jName
   }
   installDir = file(install4jHomeDir)
   mediaTypes = Arrays.asList(install4jMediaTypes.split(","))
@@ -1088,9 +1089,10 @@ task copyInstall4jTemplate(type: Copy) {
   macosJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/macos-jre"+JAVA_VERSION+".tar.gz"
   windowsJavaVMDir = System.env.HOME+"/buildtools/jre/openjdk-java_vm/getdown/windows-jre"+JAVA_VERSION+"/jre"
   windowsJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/windows-jre"+JAVA_VERSION+".tar.gz"
+  def i4jTemplate = (install4jVersion >= 8)?install4j8Template:install4jTemplate
   from (install4jDir) {
-    include install4jTemplate
-    rename (install4jTemplate, install4jConfFile)
+    include i4jTemplate
+    rename (i4jTemplate, install4jConfFile)
     filter(ReplaceTokens, beginToken: '', endToken: '', tokens: ['9999999999': JAVA_VERSION])
     filter(ReplaceTokens, beginToken: '$$', endToken: '$$',
     tokens: [
@@ -1116,11 +1118,20 @@ task copyInstall4jTemplate(type: Copy) {
     }
   }
   into install4jDir
+
+  inputs.files(i4jTemplate)
+  if (install4jVersion >= 8) {
+    inputs.files(install4jDir+"/"+install4j8InstallerFileAssociations)
+  } else {
+    inputs.files(install4jDir+"/"+install4jInstallerFileAssociations)
+    inputs.files(install4jDir+"/"+install4jInfoPlistFileAssociations)
+  }
   outputs.files(install4jConf)
 
   doLast {
     // include file associations in installer
-    def installerFileAssociationsXml = file("$install4jDir/$install4jInstallerFileAssociations").text
+    def i4jIFA = (install4jVersion >= 8)?install4j8InstallerFileAssociations:install4jInstallerFileAssociations
+    def installerFileAssociationsXml = file("$install4jDir/$i4jIFA").text
     ant.replaceregexp(
       byline: false,
       flags: "s",