godot-kotlin-jvm icon indicating copy to clipboard operation
godot-kotlin-jvm copied to clipboard

Add Support for Reflection in GraalVM Native Image Task

Open aqua-pro opened this issue 11 months ago • 0 comments

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
         }
     }
 }

aqua-pro avatar Dec 09 '24 17:12 aqua-pro