JAL-3830 unix and macos wrappers. Symbolic link to jalviewc-macos in Contents/MacOS...
authorBen Soares <b.soares@dundee.ac.uk>
Fri, 12 Mar 2021 01:09:56 +0000 (01:09 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Fri, 12 Mar 2021 01:09:56 +0000 (01:09 +0000)
build.gradle
gradle.properties
utils/getdown/jalviewc [new file with mode: 0755]
utils/getdown/jalviewc-macos [new file with mode: 0755]
utils/install4j/install4j8_template.install4j
utils/install4j/macos_jalview [deleted file]

index 5588c51..4930f94 100644 (file)
@@ -1572,6 +1572,18 @@ task getdownWebsite() {
         into getdownResourceDir
       }
     }
+    
+    def getdownWrapperScripts = [ getdown_mac_wrapper_script, getdown_unix_wrapper_script ]
+    getdownWrapperScripts.each{ script ->
+      def s = file( "${jalviewDir}/utils/getdown/${script}" )
+      if (s.exists()) {
+        copy {
+          from s
+          into getdownWebsiteDir
+        }
+        getdownTextString += "resource = ${script}\n"
+      }
+    }
 
     def codeFiles = []
     fileTree(file(package_dir)).each{ f ->
@@ -1900,7 +1912,8 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
     'MACOS_DMG_DS_STORE': install4jDMGDSStore,
     'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
-    'MACOS_DMG_WRAPPER_SCRIPT': install4j_dmg_wrapper_script,
+    'MACOS_DMG_WRAPPER_LINK': install4j_dmg_wrapper_link,
+    'MACOS_WRAPPER_SCRIPT': getdown_mac_wrapper_script,
     'INSTALLER_NAME': install4jInstallerName,
     'INSTALL4J_UTILS_DIR': install4j_utils_dir,
     'GETDOWN_WEBSITE_DIR': getdown_website_dir,
index 1d7b10c..8157012 100644 (file)
@@ -133,7 +133,9 @@ install4j_png_icon_file = jalview_logo.png
 install4j_background = jalview_logo_background_fade-640x480.png
 install4j_dmg_background = jalview_dmg_background-NON-RELEASE.png
 install4j_dmg_ds_store = jalview_dmg_DS_Store
-install4j_dmg_wrapper_script = utils/install4j/macos_jalview
+install4j_dmg_wrapper_link = jalviewc
+getdown_mac_wrapper_script = jalviewc-macos
+getdown_unix_wrapper_script = jalviewc
 
 OSX_KEYSTORE =
 OSX_KEYPASS =
diff --git a/utils/getdown/jalviewc b/utils/getdown/jalviewc
new file mode 100755 (executable)
index 0000000..a3fa66b
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+ARG1=$1
+WDIR="$( pwd )"
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+
+# check to see if $1 is set and is not start of other cli set args
+OPEN=""
+if [ -n "$ARG1" -a "$ARG1" = "${ARG1#-}" -a \! "$ARG1" = "open" ]; then
+ # first argument exists and does not start with a "-" and is not "open"
+ OPEN="-open"
+fi
+
+APPDIR="${DIR}"
+JAVA="${APPDIR}/jre/bin/java"
+GETDOWNTXT="${APPDIR}/getdown.txt"
+if [ -e "$GETDOWNTXT" ]; then
+  CLASSPATH=""
+  for x in $(grep -e 'code = ' "${GETDOWNTXT}" | sed -e 's/^code\s*=\s*//;'); do
+    [ -n "$CLASSPATH" ] && CLASSPATH="${CLASSPATH}:"
+    CLASSPATH="${CLASSPATH}${APPDIR}/${x}"
+  done
+else
+  echo "Cannot find getdown.txt" >&2
+  exit 1
+fi
+
+"$JAVA" -cp "$CLASSPATH" jalview.bin.Launcher $OPEN "$@"
diff --git a/utils/getdown/jalviewc-macos b/utils/getdown/jalviewc-macos
new file mode 100755 (executable)
index 0000000..32748cb
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+ARG1=$1
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+APP=${DIR%/Contents/*}
+
+if [ "${APP}" = "${APP%.app}" ]; then
+  echo "Could not find .app dir" >&2
+  exit 1
+fi
+
+# check to see if $1 is set and is not start of other cli set args
+OPEN=""
+if [ -n "$ARG1" -a "$ARG1" = "${ARG1#-}" -a \! "$ARG1" = "open" ]; then
+ # first argument exists and does not start with a "-" and is not "open"
+ OPEN="-open"
+fi
+
+APPDIR="${APP}/Contents/Resources/app"
+JAVA="${APPDIR}/jre/Contents/Home/bin/java"
+GETDOWNTXT="${APPDIR}/getdown.txt"
+# always check grep and sed regexes on macOS -- they're not the same
+if [ -e "$GETDOWNTXT" ]; then
+  CLASSPATH=""
+  for x in $(grep -e 'code = ' "${GETDOWNTXT}" | sed -e 's/^code\s*=\s*//;'); do
+    [ -n "$CLASSPATH" ] && CLASSPATH="${CLASSPATH}:"
+    CLASSPATH="${CLASSPATH}${APPDIR}/${x}"
+  done
+else
+  echo "Cannot find getdown.txt" >&2
+  exit 1
+fi
+
+"$JAVA" -cp "$CLASSPATH" jalview.bin.Launcher $OPEN "$@"
index 038ee90..112cbbc 100644 (file)
@@ -35,7 +35,8 @@
       <variable name="WINDOWS_APPLICATION_ID" value="6595-2347-1923-0725" />
       <variable name="MACOS_DMG_DS_STORE" value="jalview_dmg_DS_Store" />
       <variable name="MACOS_DMG_BG_IMAGE" />
-      <variable name="MACOS_DMG_WRAPPER_SCRIPT" />
+      <variable name="MACOS_DMG_WRAPPER_LINK" />
+      <variable name="MACOS_WRAPPER_SCRIPT" />
       <variable name="INSTALLER_NAME" value="Jalview Installer" />
       <variable name="INSTALL4J_UTILS_DIR" value="utils/install4j" />
       <variable name="GETDOWN_WEBSITE_DIR" value="getdown/website" />
@@ -1178,7 +1179,7 @@ return console.askYesNo(message, true);
         <file name=".DS_Store" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_DMG_DS_STORE}" />
         <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/Jalview-File.icns" file="${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/Jalview-File.icns" />
         <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/Resources/Jalview-Launch.icns" file="${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/Jalview-Launch.icns" />
-        <file name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/MacOS/jalview" file="${compiler:JALVIEW_DIR}/${compiler:MACOS_DMG_WRAPPER_SCRIPT}" />
+        <symlink name="${compiler:JALVIEW_APPLICATION_NAME}.app/Contents/MacOS/${compiler:MACOS_DMG_WRAPPER_LINK}" target="../Resources/app/${compiler:MACOS_WRAPPER_SCRIPT}" />
       </topLevelFiles>
     </macosArchive>
     <unixInstaller name="Linux x64 Shell Installer" id="1595" mediaFileName="${compiler:UNIX_APPLICATION_FOLDER}-${compiler:JALVIEW_VERSION}-linux_x64-java_${compiler:JAVA_INTEGER_VERSION}" installDir="${compiler:UNIX_APPLICATION_FOLDER}" customInstallBaseDir="~/opt/">
diff --git a/utils/install4j/macos_jalview b/utils/install4j/macos_jalview
deleted file mode 100755 (executable)
index aabdba8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-
-ARG1=$1
-WDIR="$( pwd )"
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
-APP=${DIR%/Contents/MacOS}
-
-if [ "${APP}" = "${APP%.app}" ]; then
-  echo "Could not find .app dir" >&2
-  exit 1
-fi
-
-# check to see if $1 is set and is not start of other cli set args
-OPEN=""
-if [ -n "$ARG1" -a "$ARG1" = "${ARG1#-}" ]; then
- # first argument exists and does not start with a "-"
- OPEN="-open"
-fi
-
-# This would open the Jalview application as if double clicking, with the supplied args
-# open -a ${APP} --args $OPEN "$@"
-### but we don't want to run getdown in case of autoupdates or changing the working dir, so ...
-
-APPDIR="${APP}/Contents/Resources/app"
-JAVA="${APPDIR}/jre/Contents/Home/bin/java"
-CLASSPATH=""; for x in $(grep -e 'code = ' "${APP}/Contents/Resources/app/getdown.txt" | sed -e 's/^code\s*=\s*//;'); do [ -n "$CLASSPATH" ] && CLASSPATH="${CLASSPATH}:"; CLASSPATH="${CLASSPATH}${APPDIR}/${x}"; done
-
-"$JAVA" -cp "$CLASSPATH" jalview.bin.Launcher $OPEN "$@"