From 86af0c98fbe553e196a2e6d7515799c8576d003f 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. * Don't `setContainerBuild` since we don't really know whether it will eventually be built with a builder-image or locally. --- .../deployment/pkg/steps/NativeImageBuildStep.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 0fc2a9ff9a6ee..cd7b6cc6d7833 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 @@ -85,7 +85,8 @@ ArtifactResultBuildItem nativeSourcesResult(NativeConfig nativeConfig, PackageConfig packageConfig, List nativeImageProperties, List excludeConfigs, - NativeImageAllowIncompleteClasspathAggregateBuildItem incompleteClassPathAllowed) { + NativeImageAllowIncompleteClasspathAggregateBuildItem incompleteClassPathAllowed, + List nativeImageSecurityProviders) { Path outputDir; try { @@ -104,13 +105,14 @@ ArtifactResultBuildItem nativeSourcesResult(NativeConfig nativeConfig, .setNativeConfig(nativeConfig) .setOutputTargetBuildItem(outputTargetBuildItem) .setNativeImageProperties(nativeImageProperties) - .setBrokenClasspath(incompleteClassPathAllowed.isAllow()) .setExcludeConfigs(excludeConfigs) + .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) - .setContainerBuild(nativeConfig.containerRuntime.isPresent() || nativeConfig.containerBuild) + .setGraalVMVersion(GraalVM.Version.CURRENT) .build(); List command = nativeImageArgs.getArgs(); try (FileOutputStream commandFOS = new FileOutputStream(outputDir.resolve("native-image.args").toFile())) {