Skip to content

Commit

Permalink
Merge pull request #559 from Peergos/fix/sqlite-graalvm-ni
Browse files Browse the repository at this point in the history
sqlite working  correctly in native image build (now h2 breaks)
  • Loading branch information
ianopolous authored Mar 26, 2024
2 parents 1d5c016 + eca9e7c commit d78095a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 45 deletions.
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
<echo file="META-INF/MANIFEST.MF">Main-Class: peergos.server.Main
Class-Path: .
Implementation-Version: web-ui/${repository.version}
Multi-Release: true
Javac-Version: ${javac.version}</echo>
<zip destfile="${server}/Peergos.jar" basedir="." includes="META-INF/MANIFEST.MF" update="true"></zip>
<!-- Canonicalise jar -->
Expand Down
12 changes: 6 additions & 6 deletions native-build/BuildNativeImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ public static void main(String[] a) throws Exception {
String extraDirs = OS.equals("darwin") ? "/Contents/Home" : "";

String ext = OS.equals("windows") ? ".exe" : "";
Optional<Path> nativeImage = Files.walk(Paths.get(""), 5)
.filter(p -> p.getFileName().startsWith("native-image") && p.toFile().isFile())
Optional<Path> nativeImage = Files.walk(Paths.get("."), 5)
.filter(p -> !p.toFile().isDirectory())
.filter(p -> p.getFileName().toString().endsWith("native-image" + binExt))
.findFirst();
if (nativeImage.isEmpty())
throw new IllegalStateException("Couldn't find native image executable");

// run native-image
runCommand(nativeImage.get().toString() +
" --allow-incomplete-classpath " +
runCommand(nativeImage.get().toString() + " " +
"-H:+UnlockExperimentalVMOptions " +
"-H:EnableURLProtocols=http " +
"-H:EnableURLProtocols=https " +
"-H:IncludeResources='./webroot/.*' " +
"-H:+ReportUnsupportedElementsAtRuntime " +
"-H:ConfigurationFileDirectories=META-INF/native-image " +
"--initialize-at-build-time=org.sqlite.util.ProcessRunner " +
"--no-fallback " +
"--initialize-at-build-time=org.sqlite.DB,org.sqlite.NativeDB,org.sqlite.Function,org.sqlite.Function\\$Aggregate,org.sqlite.DB\\$ProgressObserver " +
"-jar Peergos.jar peergos");
if (! new File("peergos"+ext).exists())
throw new IllegalStateException("Native build failed!");
Expand Down
38 changes: 0 additions & 38 deletions native-build/build-native-image.sh

This file was deleted.

2 changes: 1 addition & 1 deletion peergos

0 comments on commit d78095a

Please sign in to comment.