JAL-3577 Moved application Categories for freedesktop menus into correct place in...
[jalview.git] / build.gradle
index 6129170..3080ed8 100644 (file)
@@ -260,21 +260,31 @@ 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 _-_
+  install4jUnixApplicationFolder = install4jApplicationName
                                     .replaceAll(" ","_")
                                     .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
                                     .replaceAll("_+", "_") // collapse __
                                     .replaceAll("_*-_*", "-") // collapse _-_
-  install4jUnixApplicationFolder = install4jInternalId
                                     .toLowerCase()
 
   getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
@@ -1434,6 +1444,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,
@@ -1446,15 +1457,15 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'GETDOWN_INSTALL_DIR': getdown_install_dir,
     'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
     'BUILD_DIR': install4jBuildDir,
-    'UNIX_DESKTOP_ADDITIONS': install4j_unix_desktop_additions,
+    'APPLICATION_CATEGORIES': install4j_application_categories,
     'APPLICATION_FOLDER': install4jApplicationFolder,
     'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
     'EXECUTABLE_NAME': install4jExecutableName,
     '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