scala-cli
scala-cli copied to clipboard
Run script or project with graalvm's automatic metadata collection via the tracing agent
There is already good support to build a native image using graalvm via scala-cli. However, many applications require a native-image configuration due to the dynamic features of Java. Creating those configuration files by hand can become a complex task.
Luckily, graalvm allows to automatically generate the native-image configuration by tracing the application.
It would be great if scala-cli run would grew a --native-image-trace [out-dir] option that results in out-dir becoming populated with the native-image configuration. If out-dir is unspecified, it probably should default to the current working directory.
Even though it is possible that the resulting configuration is incomplete, because the program did not exhibit a certain behavior during the trace, it would be still a good starting point.
It should be available on both run and test and use the merge variant of the graalvm commands underneath not to overwrite traces gathered in test vs run.