Skip to content

Commit

Permalink
Add missing config for GraalVM Native Image
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Sep 8, 2020
1 parent cc81ce7 commit e5dc8a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/bytedeco/javacpp/tools/Builder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,8 @@ public File[] build() throws IOException, InterruptedException, ParserException
try (PrintWriter out = encoding != null ? new PrintWriter(file, encoding) : new PrintWriter(file)) {
out.println("{");
out.println(" \"resources\": [");
out.print(" {\"pattern\": \"META-INF/.*\"}");
out.println(" {\"pattern\": \"META-INF/.*\"},");
out.print(" {\"pattern\": \"org/bytedeco/javacpp/properties/.*\"}");
String separator = "," + System.lineSeparator();
for (File f : files != null ? files : new File[0]) {
if (f != null && !f.toPath().startsWith(configDirectory.toPath())) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/bytedeco/javacpp/tools/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import org.bytedeco.javacpp.annotation.ValueGetter;
import org.bytedeco.javacpp.annotation.ValueSetter;
import org.bytedeco.javacpp.annotation.Virtual;
import sun.misc.Unsafe;

/**
* The Generator is where all the C++ source code that we need gets generated.
Expand Down Expand Up @@ -1748,12 +1749,14 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver
reflectClasses.add(Object.class);
reflectClasses.add(Buffer.class);
reflectClasses.add(String.class);
reflectClasses.add(Unsafe.class);

for (Class cls : new LinkedHashSet<Class>(allClasses)) {
while ((cls = cls.getEnclosingClass()) != null) {
allClasses.add(cls);
}
}
allClasses.add(Unsafe.class);

for (PrintWriter o : new PrintWriter[] {jniConfigOut, reflectConfigOut}) {
if (o == null) {
Expand Down

0 comments on commit e5dc8a6

Please sign in to comment.