My goal is to use NuProcessBuilder instead of ProcessBuilder to start processes on Windows, so that long-running or background-style child processes, like starting a node server, are automatically terminated when the Gradle daemon is terminated. Currently they are not.
When and how would I apply such a plugin?
package com.example
import net.rubygrapefruit.platform.ProcessLauncher
...
class ProcessPlugin implements Plugin<Project> {
@Override
void apply(Project target) {
NativeServices.getInstance().register(serviceRegistration -> {
serviceRegistration.add(ProcessLauncher.class, new NuProcessLauncher())
});
}
}
This doesn’t work, because NativeServices is no longer mutable - the file system is requested too early on. When is the earliest I can add such a service?
I would upstream this fix.