Add @main entry point and AppBundler support for standalone distributions
#640
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR demonstrates the feasibility of bundling KomaMRI as a standalone installer using AppBundler. This required addressing relocation issues in multiple dependencies (Blink, Interact, InteractBase, Knockout, PlotlyJS, WebIO) that hardcode paths using
@__DIR__. The solution usesBase.pkgdir(@__MODULE__)to make resource paths relocatable.However, this approach has a limitation: when resource paths are set with global variables during module initialisation,
Base.pkgdir(@__MODULE__)is not yet defined at__init__time. This appears to be a Julia bug that would need to be addressed upstream.So I added a
@mainentry point following https://docs.julialang.org/en/v1/manual/command-line-interface/#The-Main.main-entry-point. I did not find a proper way to wait for the Blink-based application, and there could be better ways to do that.The build can be run with
Build Release Assetsunder GitHub actions or locally with:I tested the GitHub-generated builds for MacOS, Linux and Windows and can report that installation works and the installed applications are running on all platforms.
I temporarily added
Manifest.tomlandmeta/Manifest.tomlto this draft proposal to ensure the patches do not go out of sync until one upstreams them. This PR is not meant to be merged in the current form!