Extend the gradle daemon?

Hi all. Is it possible to extend the gradle daemon? I know I can create workers, but they seem to be short-lived, as a means of doing things concurrently, while I want something that has the same lifetime as the daemon.

My specific use case - I have a build step which is calling into a non-gradle (and non-JVM) build script. Gradle doesn’t know anything about inputs or outputs and there are too many to hard code in the script. So the only thing I can realistically do is always call this build script, on each build.

But this is expensive.

However, this build script can also be run in a daemon mode - it runs long lived and responds to requests to builds. Since it knows what’s in the scripts, it can handle the up-to-date check instantaneously. I can start the process, but there are two things I don’t know:

  1. How to cache the inter-process communication details across builds
  2. How to notify the external process that the daemon is shutting down

Anyone have any ideas?

Thanks!

Regards
Matt