Skip to content

Commit

Permalink
[GR-60382] Handle Enable-Native-Access manifest attribute if present
Browse files Browse the repository at this point in the history
PullRequest: graal/19561
  • Loading branch information
zapster committed Dec 12, 2024
2 parents 7801055 + 29067f5 commit d9578a8
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ static boolean processJarManifestMainAttributes(Path jarFilePath, BiConsumer<Pat
void handleManifestFileAttributes(Path jarFilePath, Attributes mainAttributes) {
handleMainClassAttribute(jarFilePath, mainAttributes);
handleModuleAttributes(mainAttributes);
handleEnableNativeAccessAttribute(mainAttributes);
}

void handleMainClassAttribute(Path jarFilePath, Attributes mainAttributes) {
Expand All @@ -1091,6 +1092,16 @@ void handleModuleAttributes(Attributes mainAttributes) {
}
}

void handleEnableNativeAccessAttribute(Attributes mainAttributes) {
String nativeAccessAttrName = mainAttributes.getValue("Enable-Native-Access");
if (nativeAccessAttrName != null) {
if (!ALL_UNNAMED.equals(nativeAccessAttrName)) {
throw NativeImage.showError("illegal value \"" + nativeAccessAttrName + "\" for " + nativeAccessAttrName + " manifest attribute. Only " + ALL_UNNAMED + " is allowed");
}
addImageBuilderJavaArgs("--enable-native-access=" + ALL_UNNAMED);
}
}

void handleClassPathAttribute(LinkedHashSet<Path> destination, Path jarFilePath, Attributes mainAttributes) {
String classPathValue = mainAttributes.getValue("Class-Path");
/* Missing Class-Path Attribute is tolerable */
Expand Down

0 comments on commit d9578a8

Please sign in to comment.