-1.8.3-1.4.0_FJVL
+1.8.3-1.4.1_FJVL
-1.8.3-1.4.0_JVL
+1.8.3-1.4.1_JVL
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.4.0_FJVL</version>
+ <version>1.8.3-1.4.1_FJVL</version>
</parent>
<artifactId>getdown-ant</artifactId>
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.4.0_FJVL</version>
+ <version>1.8.3-1.4.1_FJVL</version>
</parent>
<artifactId>getdown-core</artifactId>
if (System.getProperty("installer.extrainfo") != null) {
args.add("-Dinstaller.extrainfo=" + System.getProperty("installer.extrainfo"));
}
+
+ // backward compatibility (old getdown-launcher.jar)
+ args.add("-Dgetdownappdir=" + getAppDir());
+ args.add("-Dgetdowninstanceappbase=" + getAppbase().toString());
+ args.add("-Dinstaller_template_version=" + System.getProperty("installer.template_version"));
+ args.add("-Dlauncher_version=" + Build.version());
// set HiDPI property if wanted
String scalePropertyArg = HiDPISetting.getScalePropertyArg();
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.*;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
import com.threerings.getdown.util.Config;
import com.threerings.getdown.util.LaunchUtil;
File appdirGetdown = new File(appDir, getdown);
if (appdirGetdown.exists()) {
File installerGetdown = new File(installerAppdir, getdown);
- try {
- Resource appdirGetdownResource = new Resource(appdirGetdown.getAbsolutePath(), null, appdirGetdown, Resource.NORMAL);
- Resource installerGetdownResource = new Resource(installerGetdown.getAbsolutePath(), null, installerGetdown, Resource.NORMAL);
- MessageDigest md = Digest.getMessageDigest(1);
- String appdirGetdownDigest = appdirGetdownResource.computeDigest(1, md, null);
- String installerGetdownDigest = installerGetdownResource.computeDigest(1, md, null);
- if (!appdirGetdownDigest.equals(installerGetdownDigest)) { // not the same file content
- // change classpath and restart. A null startClass looks it up from system property "sun.java.command"
- String javaBin = LaunchUtils.findJavaBin(false);
- List<String> removeClasspath = new ArrayList<>();
- removeClasspath.add(installerGetdown.getAbsolutePath());
- List<String> prependClasspath = new ArrayList<>();
- prependClasspath.add(appdirGetdown.getAbsolutePath());
- // ensure the appdir and appid are also added as command line arguments for backwards compatibility (earlier versions of getdown-launcher.jar)
- List<String> removeArgs = new ArrayList<>();
- removeArgs.add(argvAppDir);
- removeArgs.add(argvAppId);
- List<String> addArgs = new ArrayList<>();
- addArgs.add(appDir);
- addArgs.add(appId);
- String startClassName = startClass == null ? null : startClass.getName();
- int exitValue = LaunchUtils.startNewJvm(javaBin, null, null, prependClasspath, null, removeClasspath, startClassName, removeArgs, addArgs, Arrays.asList(argv), true, true, false, true, false);
-
- if (exitValue == 0) {
- notes.add(Note.info("Relaunching getdown succeeded. Original getdown exiting now."));
- setRelaunched(true);
- return null;
- } else {
- notes.add(Note.warn("Relaunching getdown did not seem to succeed with exit value " + exitValue + ". Continuing with this getdown process."));
- }
+ int launcherVersionComparison = LaunchUtils.compareGetdownLauncherJarVersions(installerGetdown, appdirGetdown);
+ notes.add(Note.info("Comparing launchers: installation launcher '" + installerGetdown.getAbsolutePath()
+ + "', user launcher '" + appdirGetdown.getAbsoluteFile() + "', comparison=" + launcherVersionComparison));
+ if (launcherVersionComparison > 0) {
+ notes.add(Note.info("Using user appdir launcher at '" + appdirGetdown.getAbsolutePath() + "'"));
+ // change classpath and restart. A null startClass looks it up from system property "sun.java.command"
+ String javaBin = LaunchUtils.findJavaBin(false);
+ List<String> removeClasspath = new ArrayList<>();
+ removeClasspath.add(installerGetdown.getAbsolutePath());
+ List<String> prependClasspath = new ArrayList<>();
+ prependClasspath.add(appdirGetdown.getAbsolutePath());
+ // ensure the appdir and appid are also added as command line arguments for backwards compatibility (earlier versions of getdown-launcher.jar)
+ List<String> removeArgs = new ArrayList<>();
+ removeArgs.add(argvAppDir);
+ removeArgs.add(argvAppId);
+ List<String> addArgs = new ArrayList<>();
+ addArgs.add(appDir);
+ addArgs.add(appId);
+ String startClassName = startClass == null ? null : startClass.getName();
+ int exitValue = LaunchUtils.startNewJvm(javaBin, null, null, prependClasspath, null, removeClasspath, startClassName, removeArgs, addArgs, Arrays.asList(argv), true, true, false, true, false);
+
+ if (exitValue == 0) {
+ notes.add(Note.info("Relaunching getdown succeeded. Original getdown exiting now."));
+ setRelaunched(true);
+ return null;
+ } else {
+ notes.add(Note.warn("Relaunching getdown did not seem to succeed with exit value " + exitValue + ". Continuing with this getdown process."));
}
- } catch (IOException e) {
- notes.add(Note.warn("IOException opening '" + appdirGetdown.getAbsolutePath() + "' and '" + installerGetdown.getAbsolutePath() + "' as Resources. Continuing without restart. " + e.getMessage()));
+ } else {
+ notes.add(Note.info("Using user installion launcher at '" + appdirGetdown.getAbsolutePath() + "'"));
}
}
}
static {
// paths from user.home with application folder added to end. '/' replaced with file.separator
osAppDataPathMap = new HashMap<>();
- osAppDataPathMap.put("macos", "Library/Application Support/Jaview-Desktop");
+ osAppDataPathMap.put("macos", "Library/Application Support/Jalview-Desktop");
osAppDataPathMap.put("linux", ".local/share/jalview-desktop");
osAppDataPathMap.put("windows", "AppData/Local/Jalview-Desktop");
osAppDataPathMap.put("other", ".jalview-desktop");
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
public class LaunchUtils
{
}
*/
+ /**
+ * Look for Implementation-Version in two jar manifests and compare according
+ * to the getdown-launcher version spec (1.8.3-1.4.0_JVL or _FJVL) returns -1
+ * if f0 is newer (or more "valid"), +1 if f1 is newer (or more "valid"), 0 if
+ * the same or both equally "invalid"
+ *
+ * @param f0
+ * @param f1
+ * @return int
+ */
+ public static int compareGetdownLauncherJarVersions(File f0, File f1)
+ {
+ if (!f0.exists() && !f1.exists())
+ {
+ return 0;
+ }
+ if (!f0.exists())
+ {
+ return 1;
+ }
+ if (!f1.exists())
+ {
+ return -1;
+ }
+ String v0 = getJarImplementationVersion(f0);
+ String v1 = getJarImplementationVersion(f1);
+ syserr(true, false,
+ "Got launcher versions '" + v0 + "' and '" + v1 + "'");
+ if (v0 == null && v1 == null)
+ {
+ return 0;
+ }
+ if (v0 == null)
+ {
+ return 1;
+ }
+ if (v1 == null)
+ {
+ return -1;
+ }
+ // now for the fun
+ if (v0.endsWith("JVL"))
+ {
+ v0 = v0.substring(0, v0.lastIndexOf('_'));
+ }
+ if (v1.endsWith("JVL"))
+ {
+ v1 = v1.substring(0, v1.lastIndexOf('_'));
+ }
+
+ String[] v0parts = v0.split("-");
+ String[] v1parts = v1.split("-");
+
+ int compare = 0;
+ for (int j = 0; j < Math.min(v0parts.length, v1parts.length); j++)
+ {
+ compare = 0;
+ try
+ {
+ compare = compareVersions(v0parts[j], v1parts[j]);
+ } catch (NumberFormatException e)
+ {
+ syserr(true, false,
+ "Problem parsing one of the getdown launcher version numbers: '"
+ + v0 + "', '" + v1 + "'");
+ }
+
+ if (compare != 0
+ || (v0parts.length == j + 1 && v1parts.length == j + 1))
+ {
+ return compare;
+ }
+ }
+
+ return v1parts.length - v0parts.length;
+ }
+
+ // just comparing 1.2.3.4...n
+ public static int compareVersions(String v0, String v1)
+ throws NumberFormatException
+ {
+ if (v0 == null && v1 == null)
+ {
+ return 0;
+ }
+ if (v0 == null)
+ {
+ return 1;
+ }
+ if (v1 == null)
+ {
+ return -1;
+ }
+ String[] v0dots = v0.split("\\.");
+ String[] v1dots = v1.split("\\.");
+ for (int i = 0; i < Math.min(v0dots.length, v1dots.length); i++)
+ {
+ if (!v0dots[i].equals(v1dots[i]))
+ {
+ return Integer.parseInt(v1dots[i]) - Integer.parseInt(v0dots[i]);
+ }
+ }
+ // all numbers match up to min length. If one has more dots, assume it's
+ // bigger.
+ return v1dots.length - v0dots.length;
+ }
+
+ public static String getJarImplementationVersion(File jarFile)
+ {
+ String implementationVersion = null;
+ try
+ {
+ JarInputStream j0 = new JarInputStream(new FileInputStream(jarFile));
+ Manifest m0 = j0.getManifest();
+ if (m0 == null)
+ {
+ System.err.println("No manifest in " + jarFile.getAbsolutePath());
+ }
+ else
+ {
+ implementationVersion = m0.getMainAttributes()
+ .getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+ }
+ } catch (IOException e)
+ {
+ System.err.println("Exception opening " + jarFile.getAbsolutePath()
+ + " to check version: " + e.getMessage());
+ }
+ return implementationVersion;
+ }
+
public static void syserr(boolean debug, boolean quiet, String message)
{
if (debug && !quiet)
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.4.0_FJVL</version>
+ <version>1.8.3-1.4.1_FJVL</version>
</parent>
<artifactId>getdown-launcher</artifactId>
if [ x$JVLVERSION != x ]; then
export VERSION=$JVLVERSION
else
- export VERSION=1.8.3-1.4.0_JVL
+ export VERSION=1.8.3-1.4.1_JVL
fi
if [ x${VERSION%_JVL} = x$VERSION ]; then
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
<packaging>pom</packaging>
- <version>1.8.3-1.4.0_FJVL</version>
+ <version>1.8.3-1.4.1_FJVL</version>
<name>getdown</name>
<description>An application installer and updater.</description>
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
public class LaunchUtils
{
}
*/
+ /**
+ * Look for Implementation-Version in two jar manifests and compare according
+ * to the getdown-launcher version spec (1.8.3-1.4.0_JVL or _FJVL) returns -1
+ * if f0 is newer (or more "valid"), +1 if f1 is newer (or more "valid"), 0 if
+ * the same or both equally "invalid"
+ *
+ * @param f0
+ * @param f1
+ * @return int
+ */
+ public static int compareGetdownLauncherJarVersions(File f0, File f1)
+ {
+ if (!f0.exists() && !f1.exists())
+ {
+ return 0;
+ }
+ if (!f0.exists())
+ {
+ return 1;
+ }
+ if (!f1.exists())
+ {
+ return -1;
+ }
+ String v0 = getJarImplementationVersion(f0);
+ String v1 = getJarImplementationVersion(f1);
+ syserr(true, false,
+ "Got launcher versions '" + v0 + "' and '" + v1 + "'");
+ if (v0 == null && v1 == null)
+ {
+ return 0;
+ }
+ if (v0 == null)
+ {
+ return 1;
+ }
+ if (v1 == null)
+ {
+ return -1;
+ }
+ // now for the fun
+ if (v0.endsWith("JVL"))
+ {
+ v0 = v0.substring(0, v0.lastIndexOf('_'));
+ }
+ if (v1.endsWith("JVL"))
+ {
+ v1 = v1.substring(0, v1.lastIndexOf('_'));
+ }
+
+ String[] v0parts = v0.split("-");
+ String[] v1parts = v1.split("-");
+
+ int compare = 0;
+ for (int j = 0; j < Math.min(v0parts.length, v1parts.length); j++)
+ {
+ compare = 0;
+ try
+ {
+ compare = compareVersions(v0parts[j], v1parts[j]);
+ } catch (NumberFormatException e)
+ {
+ syserr(true, false,
+ "Problem parsing one of the getdown launcher version numbers: '"
+ + v0 + "', '" + v1 + "'");
+ }
+
+ if (compare != 0
+ || (v0parts.length == j + 1 && v1parts.length == j + 1))
+ {
+ return compare;
+ }
+ }
+
+ return v1parts.length - v0parts.length;
+ }
+
+ // just comparing 1.2.3.4...n
+ public static int compareVersions(String v0, String v1)
+ throws NumberFormatException
+ {
+ if (v0 == null && v1 == null)
+ {
+ return 0;
+ }
+ if (v0 == null)
+ {
+ return 1;
+ }
+ if (v1 == null)
+ {
+ return -1;
+ }
+ String[] v0dots = v0.split("\\.");
+ String[] v1dots = v1.split("\\.");
+ for (int i = 0; i < Math.min(v0dots.length, v1dots.length); i++)
+ {
+ if (!v0dots[i].equals(v1dots[i]))
+ {
+ return Integer.parseInt(v1dots[i]) - Integer.parseInt(v0dots[i]);
+ }
+ }
+ // all numbers match up to min length. If one has more dots, assume it's
+ // bigger.
+ return v1dots.length - v0dots.length;
+ }
+
+ public static String getJarImplementationVersion(File jarFile)
+ {
+ String implementationVersion = null;
+ try
+ {
+ JarInputStream j0 = new JarInputStream(new FileInputStream(jarFile));
+ Manifest m0 = j0.getManifest();
+ if (m0 == null)
+ {
+ System.err.println("No manifest in " + jarFile.getAbsolutePath());
+ }
+ else
+ {
+ implementationVersion = m0.getMainAttributes()
+ .getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+ }
+ } catch (IOException e)
+ {
+ System.err.println("Exception opening " + jarFile.getAbsolutePath()
+ + " to check version: " + e.getMessage());
+ }
+ return implementationVersion;
+ }
+
public static void syserr(boolean debug, boolean quiet, String message)
{
if (debug && !quiet)