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

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

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
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