Description
The grpc-netty-shaded
JAR provides several config files under the resources/META-INF
dir:
I.e. native-image.properties
and reflection-config.json
in the screenshot.
Inside these config files, the library writers reference Netty package classes, and it would be very useful if these classes could also have their packages renamed during the shading process.
For example META-INF/native-image/io.netty/codec-http/native-image.properties
is currently this:
Args = --initialize-at-build-time=io.netty \
--initialize-at-run-time=io.netty.handler.codec.http.HttpObjectEncoder,io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,io.netty.handler.codec.http.websocketx.extensions.compression.DeflateDecoder
But it should be updated to this:
Args = --initialize-at-build-time=io.grpc.netty.shaded.io.netty \
--initialize-at-run-time=io.grpc.netty.shaded.io.netty.handler.codec.http.HttpObjectEncoder,io.grpc.netty.shaded.io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,io.grpc.netty.shaded.io.netty.handler.codec.http.websocketx.extensions.compression.DeflateDecoder
These files and settings are used by Oracle's GraalVM compiler to assist in the ahead-of-time compilation process. The original library writers added it in so that it would work with native image building.
Is your feature request related to a problem?
Yes, this will greatly contribute to the internal effort of getting Google Cloud Java client libraries compatible with GraalVM native image compilation.
There is significant user interest from Native image app developers for this feature (Quarkus, Micronaut, Spring + GraalVM).
Describe the solution you'd like
Is it possible to extend the shading process to apply package name updates to config files under META-INF/native-image/
?
Describe alternatives you've considered
Users can duplicate configuration on their own manually, but this runs the risk of going out of sync with the Netty repo when changes are made.
cc/ @meltsufin