Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Java 17 and other improvements #134

Merged
merged 24 commits into from
Oct 6, 2023
Merged

Update to Java 17 and other improvements #134

merged 24 commits into from
Oct 6, 2023

Conversation

hannesbraun
Copy link
Member

@hannesbraun hannesbraun commented Sep 23, 2023

A summary of the relevant changes of this pull request:

  • JOGL got updated to version 2.4.0. This allows running RoboViz on the latest version of macOS (Ventura 13.6) and therefore fixes Unable to launch Roboviz with macOS Ventura #132.
  • The minimum required Java version is now 17 (possible thanks to the new version of JOGL). Over are the days of fiddling around with an old Java 8 version to get RoboViz to work. (At least, that is what I'm hoping for.)
    • Some of the new features, such as records and pattern matching with instanceof, are already in use.
  • Other dependencies have been updated as well.
  • The Gradle build script was extended with a binDir task that creates the bin directory with all the necessary files. The old build.sh script is only kept for backwards compatibility. Instead, you can just use gradle binDir now.
  • A macOS app bundle can now be created using the macOSApp task. For example, this allows RoboViz to be placed in the dock. It mostly appears in the same way as other GUI applications on macOS.
  • The roboviz.sh script got simplified.
  • Running RoboViz without a config file being present should now work as well. This was a requirement for the macOS app bundle to work properly. If the config is not present and you try to edit it using the built-in editor, a new config can automatically be initialized in your home directory (at your wish).

A few more notes:

  • Meanwhile, JOGL 2.5.0 is available. I haven't upgraded to that version yet, as that currently breaks RoboViz. We can't change into the log mode anymore. And the rendered content looks horrible, as everything is either too small or too big. I'll try to do that upgrade in the future. But that requires some work again that exceeds the scope of this pull request. For now, I'm happy that RoboViz runs again on macOS.
  • I've experienced a few occasional crashes when running RoboViz on macOS with a Java version newer than 17. (I was using the Eclipse Temurin builds.) It mostly works. Sometimes, however, RoboViz would just crash on startup or when opening the configuration window. In most cases, I tried again, and it worked the next few times. Let me know if you experience similar issues. If this is just happening on macOS with Java versions newer than 17, I'd say that this is not a problem for now. It's certainly better than not being able to run RoboViz at all. Also, this is something that might already be fixed with JOGL 2.5.0. (I didn't really investigate into that.)
  • clang-format cannot handle the enhanced switch statements/expressions yet. If you'll insert such a switch, clang-format is going to stop formatting the rest of the source file. For that reason, I refrained from using those already.

Testing and any kind of feedback are very appreciated. Thanks.

This is required in order for JOGL to work.
It's ugly, I know. But right now, there doesn't seem to exist a better
solution. Let's hope it doesn't break anytime soon...
We need to set Multi-Release to true so that log4j can determine the
correct class names. Otherwise, the app wouldn't work when running as a
jar (and not inside an IDE).
With this approach, we don't have to maintain two separate build scripts
and keep both up-to-date. Also, you can invoke Gradle now directly
instead of calling the old build scripts. Those are only kept for
compatibility reasons.
There may be some issues left to make the app fully work. However, this
should pretty much cover the additional building steps required.
Instead of parsing the arguments and replacing the paths to the log files
with absolute paths, we'll just keep the current working directory. We then
refer to the Jar file through the already existing DIR variable.

This also supports setting the Dock icon on macOS if the application is
running inside of a bundled application.

And on top of that, the script should now be compatible with other
POSIX-compatible shells (not just bash).
Otherwise, we'd try to copy the jar file before it was created.
Until now, RoboViz would not start without a config file being present.
Now, we'll just use the default hardcoded configuration values in that
case. When attempting to save the configuration using the built-in
configuration editor, RoboViz will ask if a new configuration file
should be initialized (if none is present so far).
@hannesbraun hannesbraun merged commit 57e3f74 into master Oct 6, 2023
2 checks passed
@hannesbraun hannesbraun deleted the java-17 branch October 6, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to launch Roboviz with macOS Ventura
1 participant