From 53b84983f6ca6208926c48c75a659013ac43dbad Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 30 Nov 2021 10:37:47 +0200 Subject: [PATCH] Fix native-image arguments generation for native-sources package type * Ensures the NativeImageSecurityProvidersBuildItem is taken into account to add -H:AdditionalSecurityProviders as needed * Set the GraalVM version to `CURRENT`, since we can't know which version will eventually be used to build the native image. This enables us to at least make sure that the generated arguments will work properly with the currently supported GraalVM. --- .../quarkus/deployment/pkg/steps/NativeImageBuildStep.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 8dcf24293d36f..bbc4630166cc7 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -90,7 +90,8 @@ ArtifactResultBuildItem nativeSourcesResult(NativeConfig nativeConfig, List nativeImageProperties, List excludeConfigs, NativeImageAllowIncompleteClasspathAggregateBuildItem incompleteClassPathAllowed, - List jpmsExportBuildItems) { + List jpmsExportBuildItems, + List nativeImageSecurityProviders) { Path outputDir; try { @@ -109,13 +110,15 @@ ArtifactResultBuildItem nativeSourcesResult(NativeConfig nativeConfig, .setNativeConfig(nativeConfig) .setOutputTargetBuildItem(outputTargetBuildItem) .setNativeImageProperties(nativeImageProperties) - .setBrokenClasspath(incompleteClassPathAllowed.isAllow()) .setExcludeConfigs(excludeConfigs) .setJPMSExportBuildItems(jpmsExportBuildItems) + .setBrokenClasspath(incompleteClassPathAllowed.isAllow()) + .setNativeImageSecurityProviders(nativeImageSecurityProviders) .setOutputDir(outputDir) .setRunnerJarName(runnerJar.getFileName().toString()) // the path to native-image is not known now, it is only known at the time the native-sources will be consumed .setNativeImageName(nativeImageName) + .setGraalVMVersion(GraalVM.Version.CURRENT) .build(); List command = nativeImageArgs.getArgs(); try (FileOutputStream commandFOS = new FileOutputStream(outputDir.resolve("native-image.args").toFile())) {