Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ lazy val graalOptions = Seq(
).flatten ++ Seq(
"--features=eu.neverblink.jelly.cli.graal.ProtobufFeature",
"-H:ReflectionConfigurationFiles=" + file("graal.json").getAbsolutePath,
"-H:+AddAllCharsets", // TODO: only add necessary charsets github.com/Jelly-RDF/cli/issues/154
// Needed to skip initializing all charsets.
// See: https://github.com/Jelly-RDF/cli/issues/154
"--initialize-at-build-time=org.glassfish.json.UnicodeDetectingInputStream",
"-H:+TrackPrimitiveValues", // SkipFlow optimization -- will be default in GraalVM 25
"-H:+UsePredicates", // SkipFlow optimization -- will be default in GraalVM 25
)
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/eu/neverblink/jelly/cli/graal/GraalSubstitutes.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import com.apicatalog.jsonld.JsonLdError;
import com.apicatalog.jsonld.http.HttpClient;
import com.apicatalog.jsonld.http.HttpResponse;
import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import java.net.URI;
import java.nio.charset.Charset;
import java.security.Provider;
import java.util.List;

Expand Down Expand Up @@ -61,3 +63,14 @@ public List<Provider> providers() {
return List.of();
}
}

/**
* Disable UTF-32LE support in JSON parsers, which we don't need.
* This allows us to avoid including all charsets in the native image, which saves quite a bit of space.
* See: https://github.com/Jelly-RDF/cli/issues/154
*/
@TargetClass(className = "org.glassfish.json.UnicodeDetectingInputStream")
final class UnicodeDetectingInputStreamSubstitute {
@Delete
private static Charset UTF_32LE;
}