-
-
Notifications
You must be signed in to change notification settings - Fork 427
GraalVM: Honor the reachability metadata override flags by excluding configs inside dependency artifacts #6547
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
GraalVM: Honor the reachability metadata override flags by excluding configs inside dependency artifacts #6547
Conversation
|
Hi! I'm I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:
|
| @@ -0,0 +1,160 @@ | |||
| package build | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be referenced on the javalib/web.adoc page
|
a65f9da to
9e7e306
Compare
| deps0.map(_.dep), | ||
| sources = sources, | ||
| ctx = Some(ctx), | ||
| resolutionParams = resolutionParams, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bug fix. Could you mention it in the PR description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Motivation
Fixes #6534
Fixes micronaut native image generation (on basic examples) by honouring the override configurations and using a better alternative (
-H:ConfigurationFileDirectories=) to pass the reachability metadata configs.For a more detailed explanation see this issue
Solution
Reachability metadata may provide override flags. These suggest that something needs to take precedence over something else. I didn't find a direct recommendation in any of the docs, but, I pulled out the native-image command gradle uses and found 6
--exclude-configflags on 6 netty artifacts.After some trial and error, I replicated the result using this override logic. For more information on the reverse engineering part see my comment here
Micronaut
Micronaut, also has AOT. I focused on the GraalVM support in this PR, so I haven't added direct support to Micronaut's AOT yet. But I've provided an example, which shows how it can be added by the user.
A future PR may provide a similar module to SpringBootModule with all the utilities given out of the box.
I haven't added much in this example yet, just that it builds.
Manual test:
I have also added support for including application resources in the native image from the module itself (ref: https://www.graalvm.org/22.1/reference-manual/native-image/Resources/)
Other fixes
With the changes to fetch artifacts, the kotlin native fails due to ignoring the resolution parameters. A fix was added in the coursier module to pass resolutionParams on.