-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
[WIP] Experiment with jpackage to create executable binaries #3201
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Based on https://dotnet.social/@fornever/112560707798240443, which points to https://fornever.me/en/posts/2024-06-05.scala-jpackage-publishing.html, I tried to implement a generic |
lihaoyi
added a commit
that referenced
this pull request
Dec 2, 2024
This intended to close #3638. The `JlinkModule` creates a runtime image in two steps: 1. it creates a `jlink.jmod` file for the module containing the `mainClass` using the [`jmod`](https://docs.oracle.com/en/java/javase/23/docs/specs/man/jmod.html) tool; 2. it then uses the [jlink](https://docs.oracle.com/en/java/javase/23/docs/specs/man/jlink.html) tool, to link the previously created `jlink.jmod` with a runtime image. The generated runtime image can be executed with: ```sh ./out/foo/jlinkAppImage.dest/jlink-runtime/bin/jlink ``` As for the `JpackageModule` implementation, I decided to reuse most of the `JpackageModule` code @lefou [linked](#3201) to the original issue. Of course his code completely avoids the `jmod` dance by using [`jpackage`](https://docs.oracle.com/en/java/javase/23/docs/specs/man/jpackage.html) to create a native package/installer directly. `jpackage` supports up to 3 different package/installer outputs on macOS: ```sh jpackageType = "dmg" ./out/foo/jpackageAppImage.dest/image/foo-1.0.dmg jpackageType = "pkg" ./out/foo/jpackageAppImage.dest/image/foo-1.0.pkg jpackageType = "app-image" ./out/foo/jpackageAppImage.dest/image/foo.app ``` Would be interested to hear your thoughts on the slight difference between how the 2 traits are implemented. --------- Co-authored-by: Li Haoyi <[email protected]>
Merged as part of #4038 |
jodersky
pushed a commit
to jodersky/mill
that referenced
this pull request
Jan 14, 2025
This intended to close com-lihaoyi#3638. The `JlinkModule` creates a runtime image in two steps: 1. it creates a `jlink.jmod` file for the module containing the `mainClass` using the [`jmod`](https://docs.oracle.com/en/java/javase/23/docs/specs/man/jmod.html) tool; 2. it then uses the [jlink](https://docs.oracle.com/en/java/javase/23/docs/specs/man/jlink.html) tool, to link the previously created `jlink.jmod` with a runtime image. The generated runtime image can be executed with: ```sh ./out/foo/jlinkAppImage.dest/jlink-runtime/bin/jlink ``` As for the `JpackageModule` implementation, I decided to reuse most of the `JpackageModule` code @lefou [linked](com-lihaoyi#3201) to the original issue. Of course his code completely avoids the `jmod` dance by using [`jpackage`](https://docs.oracle.com/en/java/javase/23/docs/specs/man/jpackage.html) to create a native package/installer directly. `jpackage` supports up to 3 different package/installer outputs on macOS: ```sh jpackageType = "dmg" ./out/foo/jpackageAppImage.dest/image/foo-1.0.dmg jpackageType = "pkg" ./out/foo/jpackageAppImage.dest/image/foo-1.0.pkg jpackageType = "app-image" ./out/foo/jpackageAppImage.dest/image/foo.app ``` Would be interested to hear your thoughts on the slight difference between how the 2 traits are implemented. --------- Co-authored-by: Li Haoyi <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Still in experimenting phase
Created a new module
JpackageModule
, which wraps around thejpackage
tool, that's part of newer JDK releases and is used to produced native executables and distributable packages.Although, there are some configuration points, in most cases, it should be as easy usable as
assembly
.