should I use the ``packageGraalvmNativeDistributio...
# nucleus
a
should I use the ``packageGraalvmNativeDistributionForCurrentOS`` instead of ``packageDistributionForCurrentOS`` when having graal?
u
yes but it is strongly advised to check before the application works well with graalvm via runGraalVmNative
a
btw is it possible to make
./gradlew :<module>:compileKotlinJvm
or
./gradlew :<module>:compileKotlin
running already automatically uses graal for fast iteration compile checking
u
No, because it wouldn't achieve anything; the application will still compile, and GraalVM's reflection errors will be noticeable at runtime. GraalVM is starting to experiment with layered compilation precisely to avoid having to recompile everything, but currently I haven't been able to get it working with Compose.
a
i see many thanks
u
The best approach is to use
runWithNativeAgent
when adding new dependencies. The agent will generate metadata which, depending on reflection, will determine whether or not the application can be used with native images. Generally, older libraries written in an era when reflection was considered a good thing will be very problematic with GraalVM. I'm thinking of JNA, for example; it could also be GStreamer Java, D-Bus Java, etc.
There's also Bouncy Castle