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

Add javalib examples on using jlink, jpackage, and producing JPMS modules (500USD Bounty) #3638

Closed
lihaoyi opened this issue Oct 1, 2024 · 2 comments · Fixed by #4038
Closed
Labels
Milestone

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Oct 1, 2024


From the maintainer Li Haoyi: I'm putting a 500USD bounty on this issue, payable by bank transfer on a merged PR implementing this.


These are newer Java tools that we should have documented/tested golden paths to using. The examples should go in example/javalib/module with /** Usage */ tests and textual explanations of what the examples are doing and how they relate to the underlying tools and concepts (with links to the relevant upstream documentation pages)

@lihaoyi lihaoyi changed the title Add javalib examples on using jlink, jpackage, and producing JPMS modules (500USD Bounty) Add javalib examples on using jlink, jpackage, and producing JPMS modules (300USD Bounty) Oct 1, 2024
@lihaoyi lihaoyi changed the title Add javalib examples on using jlink, jpackage, and producing JPMS modules (300USD Bounty) Add javalib examples on using jlink, jpackage, and producing JPMS modules (500USD Bounty) Oct 1, 2024
@lefou
Copy link
Member

lefou commented Oct 1, 2024

@ayewo
Copy link
Contributor

ayewo commented Nov 27, 2024

Hi @lihaoyi
I've just opened a PR.

When you have a moment, would appreciate it if you could take a look.

lihaoyi added a commit that referenced this issue 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 <haoyi.sg@gmail.com>
@lefou lefou added this to the 0.12.4 milestone Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants