diff --git a/CHANGES.md b/CHANGES.md index 4b16a1a..4bca075 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ # 1.0.0-SNAPSHOT-${buildNumber} - * Under development ... + * Switch to OpenJ9 for lower memory usage and faster startup time. + + * Updated Dorkbox SystemTray to latest. + + * Added splash screen. # 1.0.0-SNAPSHOT-148 diff --git a/buildNumber.properties b/buildNumber.properties index 962968b..795e440 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:30 GMT 2021 -buildNumber=148 +#Thu Apr 15 18:29:54 BST 2021 +buildNumber=1 diff --git a/pom.xml b/pom.xml index 6600c35..f2f5151 100644 --- a/pom.xml +++ b/pom.xml @@ -74,34 +74,14 @@ org.codehaus.mojo buildnumber-maven-plugin 1.4 + + true + - - org.codehaus.mojo - buildnumber-maven-plugin - - - buildnumber - prepare-package - - create - - - - - true - {0,number} - - buildNumber - - false - false - unknownbuild - - maven-resources-plugin 3.2.0 diff --git a/snake-app-linux/buildNumber.properties b/snake-app-linux/buildNumber.properties index cf554d3..5fc75ab 100644 --- a/snake-app-linux/buildNumber.properties +++ b/snake-app-linux/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:36 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:30:00 BST 2021 +buildNumber=1 diff --git a/snake-backend-openrazer/buildNumber.properties b/snake-backend-openrazer/buildNumber.properties index 9193d82..16d8d1a 100644 --- a/snake-backend-openrazer/buildNumber.properties +++ b/snake-backend-openrazer/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:34 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:58 BST 2021 +buildNumber=1 diff --git a/snake-backend-openrazer/pom.xml b/snake-backend-openrazer/pom.xml index f00ea6b..ea7edd1 100644 --- a/snake-backend-openrazer/pom.xml +++ b/snake-backend-openrazer/pom.xml @@ -12,7 +12,7 @@ com.github.hypfvieh dbus-java - 3.3.0-SNAPSHOT + 3.3.0 ${project.groupId} diff --git a/snake-dist/buildNumber.properties b/snake-dist/buildNumber.properties index f63cc39..82be09c 100644 --- a/snake-dist/buildNumber.properties +++ b/snake-dist/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:38 GMT 2021 -buildNumber=133 +#Thu Apr 15 18:45:04 BST 2021 +buildNumber=151 diff --git a/snake-dist/pom.xml b/snake-dist/pom.xml index 096017b..ead0bd4 100644 --- a/snake-dist/pom.xml +++ b/snake-dist/pom.xml @@ -71,6 +71,7 @@ ${snakeRemote} uk.co.bithatch.snake.app.linux/uk.co.bithatch.snake.app.linux.App false + ${basedir}/src/main/images/splash.png true -Xmx64m @@ -82,6 +83,7 @@ jvmarg -Djava.system.class.loader=uk.co.bithatch.snake.ui.DynamicClassLoader restart-on 90 single-instance-per-user + run-on-install install-location ${installer.home}/snake-razer jvmarg --add-modules jvmarg themes.awhitelight,themes.agreenfuture,themes.aredsky,themes.abluelife,themes.ayellowdwarf,themes.anorangetwist,themes.apinkburst,themes.apurplehaze @@ -114,12 +116,19 @@ snake-updater - - asm - + asm java-utils svgSalamander + kotlin-stdlib + kotlin-stdlib-common + jffi + jnr-a64asm + jnr-x86asm + annotations + kotlinx-coroutines-core-jvm + kotlin-logging-jvm + javassist java.prefs @@ -129,20 +138,16 @@ jdk.zipfs java.instrument - java.management - jdk.attach - jdk.management.agent jdk.xml.dom jdk.jsobject java.net.http java.scripting + jdk.management.agent + java.management java.desktop - - java.management - java.sql @@ -164,6 +169,7 @@ uk.co.bithatch.snake.app.linux/uk.co.bithatch.snake.app.linux.App false ${project.build.directory}/image-noruntime + ${basedir}/src/main/images/splash.png true false @@ -175,6 +181,7 @@ jvmarg -Dforker.betaChannel=${snakeRemoteNoRuntimeSnapshot} jvmarg -Djava.system.class.loader=uk.co.bithatch.snake.ui.DynamicClassLoader restart-on 90 + run-on-install single-instance-per-user install-location ${installer.home}/snake-razer jvmarg --add-modules @@ -208,12 +215,19 @@ snake-updater - - asm - + asm java-utils svgSalamander + kotlin-stdlib + kotlin-stdlib-common + jffi + jnr-a64asm + jnr-x86asm + annotations + kotlinx-coroutines-core-jvm + kotlin-logging-jvm + javassist java.prefs @@ -223,19 +237,15 @@ java.instrument java.management - jdk.attach - jdk.management.agent jdk.xml.dom jdk.jsobject java.net.http java.scripting + jdk.management.agent java.desktop - - java.management - java.sql @@ -787,6 +797,30 @@ snake + + org.codehaus.mojo + buildnumber-maven-plugin + + + buildnumber + prepare-package + + create + + + + + false + true + {0,number} + + buildNumber + + false + false + unknownbuild + + org.apache.maven.plugins maven-deploy-plugin diff --git a/snake-dist/src/main/images/splash.png b/snake-dist/src/main/images/splash.png new file mode 100644 index 0000000..c095e5e Binary files /dev/null and b/snake-dist/src/main/images/splash.png differ diff --git a/snake-lib/buildNumber.properties b/snake-lib/buildNumber.properties index 2cd7e87..eb88741 100644 --- a/snake-lib/buildNumber.properties +++ b/snake-lib/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:32 GMT 2021 -buildNumber=147 +#Thu Apr 15 18:29:56 BST 2021 +buildNumber=1 diff --git a/snake-themes/buildNumber.properties b/snake-themes/buildNumber.properties index 33842bc..16d8d1a 100644 --- a/snake-themes/buildNumber.properties +++ b/snake-themes/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:58 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-abluelife/buildNumber.properties b/snake-themes/snake-theme-abluelife/buildNumber.properties index 33842bc..3d30090 100644 --- a/snake-themes/snake-theme-abluelife/buildNumber.properties +++ b/snake-themes/snake-theme-abluelife/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:59 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-agreenfuture/buildNumber.properties b/snake-themes/snake-theme-agreenfuture/buildNumber.properties index 33842bc..16d8d1a 100644 --- a/snake-themes/snake-theme-agreenfuture/buildNumber.properties +++ b/snake-themes/snake-theme-agreenfuture/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:58 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-anorangetwist/buildNumber.properties b/snake-themes/snake-theme-anorangetwist/buildNumber.properties index 33842bc..3d30090 100644 --- a/snake-themes/snake-theme-anorangetwist/buildNumber.properties +++ b/snake-themes/snake-theme-anorangetwist/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:59 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-apinkburst/buildNumber.properties b/snake-themes/snake-theme-apinkburst/buildNumber.properties index cf554d3..3d30090 100644 --- a/snake-themes/snake-theme-apinkburst/buildNumber.properties +++ b/snake-themes/snake-theme-apinkburst/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:36 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:59 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-apurplehaze/buildNumber.properties b/snake-themes/snake-theme-apurplehaze/buildNumber.properties index cf554d3..3d30090 100644 --- a/snake-themes/snake-theme-apurplehaze/buildNumber.properties +++ b/snake-themes/snake-theme-apurplehaze/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:36 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:59 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-aredsky/buildNumber.properties b/snake-themes/snake-theme-aredsky/buildNumber.properties index 33842bc..3d30090 100644 --- a/snake-themes/snake-theme-aredsky/buildNumber.properties +++ b/snake-themes/snake-theme-aredsky/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:59 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-awhitelight/buildNumber.properties b/snake-themes/snake-theme-awhitelight/buildNumber.properties index 33842bc..16d8d1a 100644 --- a/snake-themes/snake-theme-awhitelight/buildNumber.properties +++ b/snake-themes/snake-theme-awhitelight/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:58 BST 2021 +buildNumber=1 diff --git a/snake-themes/snake-theme-ayellowdwarf/buildNumber.properties b/snake-themes/snake-theme-ayellowdwarf/buildNumber.properties index cf554d3..3d30090 100644 --- a/snake-themes/snake-theme-ayellowdwarf/buildNumber.properties +++ b/snake-themes/snake-theme-ayellowdwarf/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:36 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:59 BST 2021 +buildNumber=1 diff --git a/snake-ui-linux/buildNumber.properties b/snake-ui-linux/buildNumber.properties index 33842bc..16d8d1a 100644 --- a/snake-ui-linux/buildNumber.properties +++ b/snake-ui-linux/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:35 GMT 2021 -buildNumber=134 +#Thu Apr 15 18:29:58 BST 2021 +buildNumber=1 diff --git a/snake-ui/buildNumber.properties b/snake-ui/buildNumber.properties index d0b301a..16d8d1a 100644 --- a/snake-ui/buildNumber.properties +++ b/snake-ui/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:34 GMT 2021 -buildNumber=135 +#Thu Apr 15 18:29:58 BST 2021 +buildNumber=1 diff --git a/snake-ui/pom.xml b/snake-ui/pom.xml index 756dd4d..3e8f49a 100644 --- a/snake-ui/pom.xml +++ b/snake-ui/pom.xml @@ -51,17 +51,47 @@ uk.co.bithatch FX-BorderlessScene + + com.dorkbox + Updates + 1.0 + com.dorkbox SystemTray - 3.17 + 4.1 - org.slf4j - slf4j-api + ch.qos.logback + logback-classic + + + com.hierynomus + sshj + + + org.tukaani + xz + + com.sshtools forker-wrapped @@ -97,26 +127,26 @@ jdraw 1.0 - + com.sshtools - jfreedesktop-javafx - 3.0.0 + jfreedesktop-javafx + 3.0.1 + + + org.kordamp.ikonli + ikonli-javafx + 12.0.0 + + + org.kordamp.ikonli + ikonli-swing + 12.0.0 + + + org.kordamp.ikonli + ikonli-fontawesome-pack + 12.0.0 - - org.kordamp.ikonli - ikonli-javafx - 12.0.0 - - - org.kordamp.ikonli - ikonli-swing - 12.0.0 - - - org.kordamp.ikonli - ikonli-fontawesome-pack - 12.0.0 - diff --git a/snake-ui/src/main/java/module-info.java b/snake-ui/src/main/java/module-info.java index e1c9ea4..018d9dc 100644 --- a/snake-ui/src/main/java/module-info.java +++ b/snake-ui/src/main/java/module-info.java @@ -1,4 +1,7 @@ module uk.co.bithatch.snake.ui { + requires org.objectweb.asm.commons; + requires org.objectweb.asm.tree; + requires org.objectweb.asm.util; requires java.desktop; requires transitive javafx.controls; requires transitive javafx.graphics; @@ -8,7 +11,9 @@ requires transitive uk.co.bithatch.snake.lib; requires transitive javafx.web; requires com.goxr3plus.fxborderlessscene; + requires kotlin.stdlib; requires SystemTray; + requires Updates; requires transitive uk.co.bithatch.snake.widgets; exports uk.co.bithatch.snake.ui; exports uk.co.bithatch.snake.ui.addons; diff --git a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/App.java b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/App.java index 99d8be1..bfc83e7 100644 --- a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/App.java +++ b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/App.java @@ -214,6 +214,8 @@ public void close(boolean shutdown) { audioManager.close(); } catch (Exception e) { } + if(Wrapped.isWrapped()) + Wrapped.get().close(); Platform.exit(); } else { if (LOG.isLoggable(Level.DEBUG)) @@ -467,6 +469,9 @@ else if (evt.getKey().equals(Configuration.PREF_TRANSPARENCY)) { PlatformService.get().setStartOnLogin(true); PREFS.putBoolean("installed", true); } + + if(Wrapped.isWrapped()) + Wrapped.get().ready(); } private void clearControllers() { diff --git a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Configuration.java b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Configuration.java index 73ea6de..14115cf 100644 --- a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Configuration.java +++ b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Configuration.java @@ -27,6 +27,7 @@ public class Configuration implements PreferenceChangeListener { public static final String PREF_TRAY_ICON = "trayIcon"; public static final String PREF_WHEN_LOW = "whenLow"; public static final String PREF_SHOW_BATTERY = "showBattery"; + public static final String PREF_TELEMETRY = "telemetry"; public enum TrayIcon { OFF, AUTO, DARK, LIGHT, COLOR @@ -45,11 +46,13 @@ public enum TrayIcon { private boolean showBattery; private boolean whenLow; private TrayIcon trayIcon; + private boolean telemetry; Configuration(Preferences node, App context) { this.node = node; showBattery = node.getBoolean(PREF_SHOW_BATTERY, true); + telemetry = node.getBoolean(PREF_TELEMETRY, true); whenLow = node.getBoolean(PREF_WHEN_LOW, true); trayIcon = TrayIcon.valueOf(node.get(PREF_TRAY_ICON, TrayIcon.AUTO.name())); decorated = node.getBoolean(PREF_DECORATED, false); @@ -206,6 +209,15 @@ public void setShowBattery(boolean showBattery) { node.putBoolean(PREF_SHOW_BATTERY, showBattery); } + public boolean isTelemetry() { + return telemetry; + } + + public void setTelemetry(boolean telemetry) { + this.telemetry = telemetry; + node.putBoolean(PREF_TELEMETRY, telemetry); + } + public boolean isWhenLow() { return whenLow; } diff --git a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Options.java b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Options.java index e3876f3..feaaaa6 100644 --- a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Options.java +++ b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/Options.java @@ -81,6 +81,8 @@ public class Options extends AbstractDeviceController implements Listener, Prefe @FXML private CheckBox updateAutomatically; @FXML + private CheckBox telemetry; + @FXML private CheckBox checkForUpdates; @FXML private VBox updates; @@ -117,6 +119,9 @@ protected void onConfigure() throws Exception { PlatformService ps = PlatformService.get(); startOnLogin.selectedProperty().set(ps.isStartOnLogin()); updatesContainer.visibleProperty().set(ps.isUpdateableApp()); + telemetry.selectedProperty().set(cfg.isTelemetry()); + telemetry.selectedProperty() + .addListener((e) -> cfg.setTelemetry(telemetry.selectedProperty().get())); updateAutomatically.selectedProperty().set(ps.isUpdateAutomatically()); updateAutomatically.selectedProperty() .addListener((e) -> ps.setUpdateAutomatically(updateAutomatically.selectedProperty().get())); diff --git a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/SchedulerManager.java b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/SchedulerManager.java index c3e37e5..8142e63 100644 --- a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/SchedulerManager.java +++ b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/SchedulerManager.java @@ -41,7 +41,7 @@ public void clear(Queue queue) { public void close() throws IOException { synchronized (schedulers) { for (Map.Entry s : schedulers.entrySet()) { - s.getValue().shutdown(); + s.getValue().shutdownNow(); } schedulers.clear(); } diff --git a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/audio/AudioManager.java b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/audio/AudioManager.java index be180fb..ca79f9b 100644 --- a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/audio/AudioManager.java +++ b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/audio/AudioManager.java @@ -286,7 +286,10 @@ public void preferenceChange(PreferenceChangeEvent evt) { protected AudioBackend createBackend() { try { - return new JImpulseAudioBackend(this); + if(Boolean.getBoolean("snake.noJimpulse")) + throw new Exception("Disable by user."); + else + return new JImpulseAudioBackend(this); } catch (UnsatisfiedLinkError | Exception e) { error = e; if (LOG.isLoggable(Level.DEBUG)) diff --git a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/tray/Tray.java b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/tray/Tray.java index 83fa21d..003ec7d 100644 --- a/snake-ui/src/main/java/uk/co/bithatch/snake/ui/tray/Tray.java +++ b/snake-ui/src/main/java/uk/co/bithatch/snake/ui/tray/Tray.java @@ -42,6 +42,7 @@ import dorkbox.systemTray.Separator; import dorkbox.systemTray.SystemTray; import dorkbox.systemTray.util.SystemTrayFixes; +import dorkbox.updates.Updates; import javafx.application.Platform; import uk.co.bithatch.macrolib.MacroSystem.RecordingListener; import uk.co.bithatch.macrolib.RecordingSession; @@ -96,8 +97,10 @@ public Tray(App context) throws Exception { for (Device dev : context.getBackend().getDevices()) { dev.addListener(this); } - SwingUtilities.invokeLater(() -> adjustTray()); - + SwingUtilities.invokeLater(() -> { + Updates.INSTANCE.setENABLE(cfg.isTelemetry()); + adjustTray(); + }); } @Override @@ -574,6 +577,9 @@ public void preferenceChange(PreferenceChangeEvent evt) { || evt.getKey().equals(Configuration.PREF_WHEN_LOW)) { SwingUtilities.invokeLater(() -> adjustTray()); } + else if (evt.getKey().equals(Configuration.PREF_THEME)) { + SwingUtilities.invokeLater(() -> Updates.INSTANCE.setENABLE(cfg.isTelemetry())); + } } @Override diff --git a/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.fxml b/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.fxml index 78e5ac6..105525b 100644 --- a/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.fxml +++ b/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.fxml @@ -18,7 +18,7 @@ - +
@@ -143,6 +143,7 @@ +
diff --git a/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.properties b/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.properties index 86e3e4d..3551dfc 100644 --- a/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.properties +++ b/snake-ui/src/main/resources/uk/co/bithatch/snake/ui/Options.properties @@ -25,4 +25,5 @@ theme=Theme: addOns=Add-Ons addOnsText=Add-ons further extend the features and capabilities of Snake. There \ are different types of Add-ons, including Themes, Scripts and Plugins. -openAddOns=Show my add-ons \ No newline at end of file +openAddOns=Show my add-ons +telemetry=Send anonymous usage statistics (DorkBox system tray) \ No newline at end of file diff --git a/snake-updater/buildNumber.properties b/snake-updater/buildNumber.properties index f63cc39..7e8dbfa 100644 --- a/snake-updater/buildNumber.properties +++ b/snake-updater/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Mon Feb 08 08:59:38 GMT 2021 -buildNumber=133 +#Thu Apr 15 18:30:03 BST 2021 +buildNumber=1 diff --git a/snake-updater/src/main/java/module-info.java b/snake-updater/src/main/java/module-info.java index 30607ba..1366c7f 100644 --- a/snake-updater/src/main/java/module-info.java +++ b/snake-updater/src/main/java/module-info.java @@ -1,6 +1,7 @@ module uk.co.bithatch.snake.updater { requires java.desktop; requires java.prefs; + requires java.logging; requires transitive javafx.controls; requires transitive javafx.graphics; requires transitive javafx.fxml; diff --git a/snake-updater/src/main/java/uk/co/bithatch/snake/updater/Install.java b/snake-updater/src/main/java/uk/co/bithatch/snake/updater/Install.java index 46b584d..8ecd051 100644 --- a/snake-updater/src/main/java/uk/co/bithatch/snake/updater/Install.java +++ b/snake-updater/src/main/java/uk/co/bithatch/snake/updater/Install.java @@ -10,12 +10,16 @@ import java.util.concurrent.Callable; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import java.util.logging.Logger; import java.util.prefs.Preferences; +import com.sshtools.forker.common.OS; import com.sshtools.forker.updater.AppManifest; import com.sshtools.forker.updater.DesktopShortcut; import com.sshtools.forker.updater.InstallHandler; import com.sshtools.forker.updater.InstallSession; +import com.sshtools.forker.updater.Updater; +import com.sshtools.forker.wrapper.Configuration; import javafx.application.Platform; import javafx.event.ActionEvent; @@ -39,6 +43,10 @@ import javafx.stage.Stage; public class Install implements Controller, InstallHandler { + + /** The logger. */ + protected Logger logger = Logger.getGlobal(); + final static ResourceBundle bundle = ResourceBundle.getBundle(Install.class.getName()); final static Preferences PREFS = Preferences.userRoot().node("uk").node("co").node("bithatch").node("snake") @@ -93,6 +101,18 @@ public void installDone() { public void complete() { bootstrap.setInstalled(); + if(OS.getJavaPath().startsWith(System.getProperty("java.io.tmpdir"))) { + logger.info("Running from temporary runtime"); + Path installedRuntime = Paths.get(installLocation.getText(), "bin", com.sun.jna.Platform.isWindows() ? "java.exe" : "java"); + if(Files.exists(installedRuntime)) { + Configuration cfg = session.updater().getConfiguration(); + cfg.setProperty("java", installedRuntime.toString()); + session.updater().setLaunchDirectory(new File(installLocation.getText())); + cfg.setProperty("cwd", installLocation.toString()); + logger.info(String.format("Found alternative runtime at %s", installedRuntime)); + } + } + try { if (installShortcut.selectedProperty().get()) { session.installShortcut(new DesktopShortcut(SNAKE_RAZER_DESKTOP) @@ -150,12 +170,15 @@ public void init(InstallSession session) { options.managedProperty().bind(options.visibleProperty()); progressContainer.visibleProperty().set(false); + launch.setSelected(this.session.updater().getConfiguration().getSwitch("run-on-install", false)); installLocation.textProperty().set(PREFS.get("installLocation", session.base().toString())); installLocation.textProperty().addListener((e) -> checkInstallable()); status.textProperty().set(bundle.getString("preparing")); progress.setProgress(-1); bootstrap.getStage().show(); + Updater updater = this.session.updater(); + updater.closeSplash(); } @Override @@ -235,6 +258,9 @@ void evtClose(ActionEvent evt) { @FXML void evtInstall(ActionEvent evt) { PREFS.put("installLocation", installLocation.textProperty().get()); + boolean doLaunch = launch.selectedProperty().get(); + this.session.updater().getConfiguration().setProperty("run-on-install", doLaunch); + this.session.updater().getConfiguration().setProperty("daemon", doLaunch); new Thread() { public void run() { try { diff --git a/snake-updater/src/main/resources/uk/co/bithatch/snake/updater/Install.fxml b/snake-updater/src/main/resources/uk/co/bithatch/snake/updater/Install.fxml index 51c5f87..2cdaa36 100644 --- a/snake-updater/src/main/resources/uk/co/bithatch/snake/updater/Install.fxml +++ b/snake-updater/src/main/resources/uk/co/bithatch/snake/updater/Install.fxml @@ -13,7 +13,7 @@ - + @@ -63,7 +63,12 @@