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

feat: JLink plugin #688

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open

feat: JLink plugin #688

wants to merge 50 commits into from

Conversation

vpa1977
Copy link
Contributor

@vpa1977 vpa1977 commented Aug 29, 2024

  • Have you signed the CLA?

This PR adds jlink plugin that allows to generate Java runtime tailored for the Java application.
When ran without supplying jar file property it will search the staging area for any jars and generate an image for them.
If no jar files are found, then java.base image will be generated.

This PR includes unit and integration tests.
The plugin documentation is split into separate PR: #689

Sample ROCK using plugin: https://github.com/canonical/openjdk-rocks/tree/prototype/demos/java-runtime

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 29, 2024
@vpa1977 vpa1977 requested a review from lengau September 2, 2024 03:53
@vpa1977 vpa1977 mentioned this pull request Sep 2, 2024
1 task
@lengau
Copy link
Contributor

lengau commented Sep 6, 2024

This is probably worth having a plugin-jlink spread test like the plugin-python ones.

@vpa1977
Copy link
Contributor Author

vpa1977 commented Sep 9, 2024

Added PR for the linkcheck linter failure: #700

@vpa1977
Copy link
Contributor Author

vpa1977 commented Sep 9, 2024

This is probably worth having a plugin-jlink spread test like the plugin-python ones.

Thanks!!! I have added one.

@vpa1977 vpa1977 requested a review from lengau September 9, 2024 06:24
@lengau
Copy link
Contributor

lengau commented Sep 21, 2024

I discussed this with my team this week, and the conclusion was that the way we should do this is as an option for the base Java plugin.

So the default behaviour would be the current behaviour (which I think is to not stage a JRE?), but the jlink options here would be changed to <plugin>-jlink-<option>, and if any of them are set, it would use jlink to stage the JRE. Do you think that's reasonable/feasible?

- maven
plugin: nil
build-environment:
- JAVA_HOME: "/usr/lib/jvm/java-21-openjdk-${CRAFT_TARGET_ARCH}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under the suggested change about putting this into the java plugins, this would be something we could add in get_build_environment (which is still override-able by users if need be)

@vpa1977
Copy link
Contributor Author

vpa1977 commented Sep 22, 2024

I discussed this with my team this week, and the conclusion was that the way we should do this is as an option for the base Java plugin.

So the default behaviour would be the current behaviour (which I think is to not stage a JRE?), but the jlink options here would be changed to <plugin>-jlink-<option>, and if any of them are set, it would use jlink to stage the JRE. Do you think that's reasonable/feasible?

Hmm, so we will have to enumerate plugin properties in java plugin and retrieve ones with jlink key in it?

Also we need ability to decouple build and stage Java.
Example is test libraries requiring higher version then the release jar.
In this case we will have to stage Java runtime in a separate part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants