godot-kotlin-jvm
godot-kotlin-jvm copied to clipboard
Add Support for Reflection in GraalVM Native Image Task
https://www.graalvm.org/latest/reference-manual/native-image/overview/BuildOutput/
The --strict-image-heap argument for GraalVM's native-image tool ensures that Reflection and similar features operate correctly within the constraints of the native image heap.
When using Reflection, adding this option to the GraalVM native image generation process increases total build size and time, but stops the build from failing, and the program works as expected.
Suggestion Add a boolean config to enable or disable this feature (disabled by default so you don't get increased build size and time)
Current workaround
tasks.withType<Exec>().configureEach {
if (name == "createGraalNativeImage") {
doFirst {
val arguments = commandLine as MutableList<String>
arguments.add("--strict-image-heap")
commandLine = arguments
}
}
}