Skip to content

[GR-60421] Implement package-wildcards for LayerCreate package suboption. #10756

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

Merged
merged 1 commit into from
Mar 1, 2025

Conversation

graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented Feb 25, 2025

This PR adds the ability to specify LayerCreate package inclusion request also with wildcards.
E.g. -H:LayerCreate=custom.nil,module=java.base,package=io.netty.* will create a base layer that contains classes from all packages that start with io.netty.. I.e. if netty is on the class-path the following packages will be included:

io.netty.bootstrap
io.netty.buffer
io.netty.buffer.search
io.netty.channel
io.netty.channel.embedded
io.netty.channel.group
...

The LayerCreate now accepts a redirection file. This is handy for configurations with many suboptions. E.g instead of using -H:LayerCreate=base-layer.nil,module=java.base,package=io.micronaut.*,package=io.netty.*,package=jakarta.*,package=com.fasterxml.jackson.*,package=org.slf4j.*,package=reactor.*,package=org.reactivestreams.* one can now use -H:LayerCreate=@layer-create.args with a layer-create.args files that contains:

base-layer.nil
module=java.base
# micronaut and dependencies
package=io.micronaut.*
package=io.netty.*
package=jakarta.*
package=com.fasterxml.jackson.*
package=org.slf4j.*
# io.projectreactor:reactor-core and dependencies
package=reactor.*
package=org.reactivestreams.*

if the LayerCreate option is specified in a native-image.properties file.

Additionally the error reporting for LayerCreate suboptions package=<pn>,module=<mn>,path=<cp-entry> is much improved and actionable. E.g. requesting invalid packages with package=nothere',package=alsonotthere results in:

Error: Package requests (package=...) 'nothere', 'alsonotthere' specified with '-H:LayerCreate=@layer-create.args' from 'META-INF/native-image/micronaut-base-layer/native-image.properties' in 'file:///home/pwoegere/OLabs/issues/GR-60421/tests/native-image/layered-image/micronaut-base-layer-test/target/base-layer-test-1.0-SNAPSHOT.jar' could not find requested packages. Provide a class/module-path that contains the packages or remove entries from option.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 25, 2025
@graalvmbot graalvmbot force-pushed the paw/GR-60421 branch 2 times, most recently from 841cf88 to e31afe7 Compare February 27, 2025 16:29
Additionally provide a proper error message in case a package suboption
does not lead to inclusion of classes.
@graalvmbot graalvmbot closed this Mar 1, 2025
@graalvmbot graalvmbot merged commit ceb1f51 into master Mar 1, 2025
12 of 13 checks passed
@graalvmbot graalvmbot deleted the paw/GR-60421 branch March 1, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants