JAL-3577 Added existing and new Application IDs for Windows. Fixed Desktop shortcut...
[jalview.git] / build.gradle
index e9c9da4..227e59a 100644 (file)
@@ -260,20 +260,26 @@ ext {
   if (install4jSuffix == "") {
     install4jApplicationName = "${jalview_name}"
     install4jBundleId = "${install4j_bundle_id}"
+    install4jWinApplicationId = install4j_release_win_application_id
   } else {
     install4jApplicationName = "${jalview_name} ${install4jSuffix}"
     install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
+    // add int hash of install4jSuffix to the last part of the application_id
+    def id = install4j_release_win_application_id
+    def idsplitreverse = id.split("-").reverse()
+    idsplitreverse[0] = idsplitreverse[0].toInteger() + install4jSuffix.hashCode()
+    install4jWinApplicationId = idsplitreverse.reverse().join("-")
   }
   // sanitise folder and id names
   // install4jApplicationFolder = e.g. "Jalview Build"
   install4jApplicationFolder = install4jApplicationName
-                                    .replaceAll("[\"'~:/\\\\]", "_") // replace all awkward filename chars " ' ~ : / \
+                                    .replaceAll("[\"'~:/\\\\\\s]", "_") // replace all awkward filename chars " ' ~ : / \
                                     .replaceAll("_+", "_") // collapse __
-  install4jInternalId = install4jApplicationFolder
+  install4jInternalId = install4jApplicationName
                                     .replaceAll(" ","_")
                                     .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
-                                    .replaceAll("_+", "_") // collapse __
-                                    .replaceAll("_*-_*", "-") // collapse _-_
+                                    .replaceAll("_+", "") // collapse __
+                                    //.replaceAll("_*-_*", "-") // collapse _-_
   install4jUnixApplicationFolder = install4jInternalId
                                     .toLowerCase()
 
@@ -1434,6 +1440,7 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'COPYRIGHT_MESSAGE': install4j_copyright_message,
     'BUNDLE_ID': install4jBundleId,
     'INTERNAL_ID': install4jInternalId,
+    'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
     'MACOS_DS_STORE': install4jDSStore,
     'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
     'INSTALLER_NAME': install4jInstallerName,
@@ -1453,8 +1460,8 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'EXTRA_SCHEME': install4jExtraScheme,
   ]
 
-  //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