Skip to content

Commit

Permalink
Fix native-image arguments generation for native-sources package type
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
zakkak committed Dec 9, 2021
1 parent 07e923a commit 53b8498
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ ArtifactResultBuildItem nativeSourcesResult(NativeConfig nativeConfig,
List<NativeImageSystemPropertyBuildItem> nativeImageProperties,
List<ExcludeConfigBuildItem> excludeConfigs,
NativeImageAllowIncompleteClasspathAggregateBuildItem incompleteClassPathAllowed,
List<JPMSExportBuildItem> jpmsExportBuildItems) {
List<JPMSExportBuildItem> jpmsExportBuildItems,
List<NativeImageSecurityProviderBuildItem> nativeImageSecurityProviders) {

Path outputDir;
try {
Expand All @@ -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<String> command = nativeImageArgs.getArgs();
try (FileOutputStream commandFOS = new FileOutputStream(outputDir.resolve("native-image.args").toFile())) {
Expand Down

0 comments on commit 53b8498

Please sign in to comment.