Skip to content

Commit d9578a8

Browse files
committed
[GR-60382] Handle Enable-Native-Access manifest attribute if present
PullRequest: graal/19561
2 parents 7801055 + 29067f5 commit d9578a8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ static boolean processJarManifestMainAttributes(Path jarFilePath, BiConsumer<Pat
10681068
void handleManifestFileAttributes(Path jarFilePath, Attributes mainAttributes) {
10691069
handleMainClassAttribute(jarFilePath, mainAttributes);
10701070
handleModuleAttributes(mainAttributes);
1071+
handleEnableNativeAccessAttribute(mainAttributes);
10711072
}
10721073

10731074
void handleMainClassAttribute(Path jarFilePath, Attributes mainAttributes) {
@@ -1091,6 +1092,16 @@ void handleModuleAttributes(Attributes mainAttributes) {
10911092
}
10921093
}
10931094

1095+
void handleEnableNativeAccessAttribute(Attributes mainAttributes) {
1096+
String nativeAccessAttrName = mainAttributes.getValue("Enable-Native-Access");
1097+
if (nativeAccessAttrName != null) {
1098+
if (!ALL_UNNAMED.equals(nativeAccessAttrName)) {
1099+
throw NativeImage.showError("illegal value \"" + nativeAccessAttrName + "\" for " + nativeAccessAttrName + " manifest attribute. Only " + ALL_UNNAMED + " is allowed");
1100+
}
1101+
addImageBuilderJavaArgs("--enable-native-access=" + ALL_UNNAMED);
1102+
}
1103+
}
1104+
10941105
void handleClassPathAttribute(LinkedHashSet<Path> destination, Path jarFilePath, Attributes mainAttributes) {
10951106
String classPathValue = mainAttributes.getValue("Class-Path");
10961107
/* Missing Class-Path Attribute is tolerable */

0 commit comments

Comments
 (0)