JAL-3577 Changed shortName to INTERNAL_ID
[jalview.git] / build.gradle
index b47e420..e9c9da4 100644 (file)
@@ -141,7 +141,7 @@ ext {
   install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
   install4jDSStore = "DS_Store-NON-RELEASE"
   install4jDMGBackgroundImage = "jalview_dmg_background-NON-RELEASE.png"
-  install4jInstallerName = "${jalview_name} Installer"
+  install4jInstallerName = "${jalview_name} Non-Release Installer"
   install4jExecutableName = jalview_name.replaceAll("[^\\w]+", "_").toLowerCase()
   install4jExtraScheme = "jalviewx"
   switch (CHANNEL) {
@@ -156,6 +156,7 @@ ext {
     if ("".equals(testngExcludedGroups)) { 
       testngExcludedGroups = "Not-bamboo"
     }
+    install4jExtraScheme = "jalviewb"
     break
 
     case "RELEASE":
@@ -164,6 +165,7 @@ ext {
     install4jSuffix = ""
     install4jDSStore = "DS_Store"
     install4jDMGBackgroundImage = "jalview_dmg_background.png"
+    install4jInstallerName = "${jalview_name} Installer"
     break
 
     case "ARCHIVE":
@@ -178,6 +180,7 @@ ext {
       buildDist = false
     }
     reportRsyncCommand = true
+    install4jExtraScheme = "jalviewa"
     break
 
     case "ARCHIVELOCAL":
@@ -194,17 +197,22 @@ ext {
     reportRsyncCommand = true
     getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
     install4jSuffix = "Archive"
+    install4jExtraScheme = "jalviewa"
     break
 
     case "DEVELOP":
     reportRsyncCommand = true
+    install4jExtraScheme = "jalviewd"
     break
 
     case "TEST-RELEASE":
     reportRsyncCommand = true
-    install4jSuffix = "Test"
     JALVIEW_VERSION = "TEST"
+    install4jSuffix = "Test"
+    install4jDSStore = "DS_Store-TEST-RELEASE"
+    install4jDMGBackgroundImage = "jalview_dmg_background.png"
     install4jExtraScheme = "jalviewt"
+    install4jInstallerName = "${jalview_name} Test Installer"
     break
 
     case ~/^SCRATCH(|-[-\w]*)$/:
@@ -222,14 +230,18 @@ ext {
       getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
       getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
     }
-    install4jSuffix = "Test-Local"
     JALVIEW_VERSION = "TEST"
+    install4jSuffix = "Test-Local"
+    install4jDSStore = "DS_Store-TEST-RELEASE"
+    install4jDMGBackgroundImage = "jalview_dmg_background.png"
     install4jExtraScheme = "jalviewt"
+    install4jInstallerName = "${jalview_name} Test Installer"
     break
 
     case "LOCAL":
     getdownAppBase = file(getdownWebsiteDir).toURI().toString()
     getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
+    install4jExtraScheme = "jalviewl"
     break
 
     default: // something wrong specified
@@ -247,19 +259,23 @@ ext {
   // install4j application and folder names
   if (install4jSuffix == "") {
     install4jApplicationName = "${jalview_name}"
+    install4jBundleId = "${install4j_bundle_id}"
   } else {
     install4jApplicationName = "${jalview_name} ${install4jSuffix}"
-    install4jInstallerName = "${jalview_name} Non-Release Installer"
+    install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
   }
-  // sanitise folder names
+  // sanitise folder and id names
+  // install4jApplicationFolder = e.g. "Jalview Build"
   install4jApplicationFolder = install4jApplicationName
-                                    .replaceAll("[\"'~:\\\\]+", "_") // replace all awkward filename chars
-  install4jUnixApplicationFolder = install4jApplicationFolder
-                                    .toLowerCase()
+                                    .replaceAll("[\"'~:/\\\\]", "_") // replace all awkward filename chars " ' ~ : / \
+                                    .replaceAll("_+", "_") // collapse __
+  install4jInternalId = install4jApplicationFolder
                                     .replaceAll(" ","_")
-                                    .replaceAll("[^\\w\\-\\.]+", "_") // replace other non [alphanumeric,_,-,.]
-                                    .replaceAll("_+", "_")
-                                    .replaceAll("_*-_*", "-")
+                                    .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
+                                    .replaceAll("_+", "_") // collapse __
+                                    .replaceAll("_*-_*", "-") // collapse _-_
+  install4jUnixApplicationFolder = install4jInternalId
+                                    .toLowerCase()
 
   getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
   //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}"
@@ -1396,7 +1412,8 @@ task installers(type: com.install4j.gradle.Install4jTask) {
   def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
 
   variables = [
-    'JALVIEW_NAME': install4jApplicationName,
+    'JALVIEW_NAME': jalview_name,
+    'JALVIEW_APPLICATION_NAME': install4jApplicationName,
     'JALVIEW_DIR': "../..",
     'OSX_KEYSTORE': OSX_KEYSTORE,
     'JSIGN_SH': JSIGN_SH,
@@ -1415,7 +1432,8 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
     'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz,
     'COPYRIGHT_MESSAGE': install4j_copyright_message,
-    'MACOS_BUNDLE_ID': install4j_macOS_bundle_id,
+    'BUNDLE_ID': install4jBundleId,
+    'INTERNAL_ID': install4jInternalId,
     'MACOS_DS_STORE': install4jDSStore,
     'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
     'INSTALLER_NAME': install4jInstallerName,
@@ -1435,6 +1453,9 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'EXTRA_SCHEME': install4jExtraScheme,
   ]
 
+  //println("INSTALL4J VARIABLES:")
+  //variables.each{k,v->println("${k}=${v}")}
+
   destination = "${jalviewDir}/${install4jBuildDir}"
   buildSelected = true