0

I want to build a GraalVM native image (CLI app) that uses/calls the Gradle Tooling API.

In order to do that, a Gradle daemon must exist. So far it seems as though a native image cannot start a Gradle daemon. I suspect it is due to reflection and/or a lot of classes (like, a lot!) that I'm not providing to the config of native image.

Does anybody know if it's even remotely possible to do this? If so, how? Note, that it is important to me that the native image is able to create the daemon directly, if possible.

So far, I've resorted to "delegate" the Gradle Tooling API (and daemon creation) parts of the CLI app to a sub-process that is started by the native image, and the sub-process handles the API calls and feeds the IO back to the native image using inheritIO(). So I've resorted to create a native image and a (shadow)Jar, where the native image calls the Jar using the JDK of my choosing.

SwirlingJoe
  • 51
  • 1
  • 1
  • I guess you could start by figuring out how to start Gradle daemon from a Java program (regular one, a jar that has Gradle as dependency, run under JVM). Once you have this sorted out, run it with the native-image agent enabled to capture reflection etc, then finally try to invoke native-image with the configuration files created by the agent – peterz Sep 14 '22 at 09:12

0 Answers0