-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
0 / 20 of 2 issues completedOpen
0 / 20 of 2 issues completed
Copy link
Labels
Description
Description
Starting with GraalVM / Mandrel for JDK 23 (24.1) the proxy-config.json
file will be deprecated. Instead, proxy registrations should be moved to reachability-metadata.json
, see oracle/graal#9048
Not doing so results in a warning:
Warning: Option 'DynamicProxyConfigurationResources' is deprecated and might be removed in a future release. Please refer to the GraalVM release notes.
Implementation ideas
Ideally we should only generate proxy-config.json
when using GraalVM / Mandrel < 24.1 and reachability-metadata.json
when using >= 24.1, however the configuration files are created when building the jar file, i.e. before identifying the GraalVM / Mandrel version.
In such cases we use the following pattern:
Lines 146 to 163 in 20d3c9d
final GraalVM.Version graalVMVersion = nativeImageRunner.getBuildRunner().getGraalVMVersion(); | |
if (graalVMVersion.compareTo(GraalVM.Version.VERSION_23_0_0) >= 0) { | |
// See https://github.com/oracle/graal/issues/4921 | |
try (DirectoryStream<Path> sharedLibs = Files.newDirectoryStream(nativeImage.getPath().getParent(), | |
"*.{so,dll}")) { | |
sharedLibs.forEach(src -> { | |
try { | |
// In this use case, we can force all libs to be non-executable. | |
addZipEntry(zip, src, src.getFileName().toString(), 0644); | |
} catch (Exception e) { | |
throw new RuntimeException(e); | |
} | |
}); | |
} catch (IOException e) { | |
log.errorf("Could not list files in directory %s. Continuing. Error: %s", nativeImage.getPath().getParent(), | |
e); | |
} | |
} |
Which unfortunately is not ideal as:
- it requires invoking
native-image --version
each time we need the version - it might run on a different step than the actual native build (see https://quarkus.io/guides/building-native-image#separating-java-and-native-image-compilation)
Eng-Fouad