JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
javaCommand.setMinHeapSize(forkOptions.getMinHeapSize());
javaCommand.setMaxHeapSize(forkOptions.getMaxHeapSize());
javaCommand.setJvmArgs(forkOptions.getJvmArgs());
javaCommand.setWorkingDir(workingDir);
WorkerProcess process = builder.worker(new CompilerDaemonServer()).setBaseName("Gradle Compiler Daemon").build();
process.start();
CompilerDaemonServerProtocol server = process.getConnection().addOutgoing(CompilerDaemonServerProtocol.class);
CompilerDaemonClient client = new CompilerDaemonClient(forkOptions, process, server);
process.getConnection().addIncoming(CompilerDaemonClientProtocol.class, client);