From f3c6c72783e6384c0438b647b4d2ba507d5161db Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Wed, 24 Jul 2024 13:16:57 +0300 Subject: [PATCH] Disable external configuration sources parsing in native-mode `SmallryeConfigBuilder` tries to access properties files from various sources, despite them not being available at run-time nor supported in native-mode, see https://github.com/quarkusio/quarkus/issues/41994 This patch also avoids getting a `MissingRegistrationError` when using `-H:+ThrowMissingRegistrationErrors` or `--exact-reachability-metadata`. Related to https://github.com/quarkusio/quarkus/issues/41994 and https://github.com/quarkusio/quarkus/issues/41995 --- .../io/quarkus/deployment/steps/ConfigBuildSteps.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java index 478b4b9d13ff4..975071dad0eb1 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java @@ -15,6 +15,7 @@ import io.quarkus.deployment.builditem.StaticInitConfigBuilderBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; +import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; import io.quarkus.deployment.util.ServiceUtil; import io.quarkus.runtime.configuration.SystemOnlySourcesConfigBuilder; import io.quarkus.runtime.graal.InetRunTime; @@ -62,6 +63,16 @@ void systemOnlySources(BuildProducer staticIni runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(SystemOnlySourcesConfigBuilder.class.getName())); } + /** + * Disable external configuration sources parsing for native executables since they are not supported see + * https://github.com/quarkusio/quarkus/issues/41994 + */ + @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) + void nativeNoSources(BuildProducer staticInitConfigBuilder, + BuildProducer runTimeConfigBuilder) { + runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(SystemOnlySourcesConfigBuilder.class.getName())); + } + private static class SystemOnlySources implements BooleanSupplier { ConfigBuildTimeConfig configBuildTimeConfig;