diff --git a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyOverrideMetadata.java b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyOverrideMetadata.java new file mode 100644 index 0000000000000..f052a335696cc --- /dev/null +++ b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyOverrideMetadata.java @@ -0,0 +1,21 @@ +package io.quarkus.netty.deployment; + +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.nativeimage.ExcludeConfigBuildItem; + +public class NettyOverrideMetadata { + + static final String NETTY_CODEC_JAR_MATCH_REGEX = "io\\.netty\\.netty-codec"; + static final String NETTY_CODEC_REFLECT_CONFIG_MATCH_REGEX = "/META-INF/native-image/io\\.netty/netty-codec/generated/handlers/reflect-config\\.json"; + static final String NETTY_HANDLER_JAR_MATCH_REGEX = "io\\.netty\\.netty-handler"; + static final String NETTY_HANDLER_REFLECT_CONFIG_MATCH_REGEX = "/META-INF/native-image/io\\.netty/netty-handler/generated/handlers/reflect-config\\.json"; + + @BuildStep + void excludeNettyDirectives(BuildProducer nativeImageExclusions) { + nativeImageExclusions + .produce(new ExcludeConfigBuildItem(NETTY_CODEC_JAR_MATCH_REGEX, NETTY_CODEC_REFLECT_CONFIG_MATCH_REGEX)); + nativeImageExclusions + .produce(new ExcludeConfigBuildItem(NETTY_HANDLER_JAR_MATCH_REGEX, NETTY_HANDLER_REFLECT_CONFIG_MATCH_REGEX)); + } +}