// Build configuration for GradleWorkerMain
List<URL> implementationClassPath = ClasspathUtil.getClasspath(getWorker().getClass().getClassLoader());
Object id = idGenerator.generateId();
String displayName = getBaseName() + " " + id;
WorkerFactory workerFactory;
if (isLoadApplicationInSystemClassLoader()) {
workerFactory = new ApplicationClassesInSystemClassLoaderWorkerFactory(id, displayName, this,
implementationClassPath, localAddress, classPathRegistry);
} else {
workerFactory = new ApplicationClassesInIsolatedClassLoaderWorkerFactory(id, displayName, this,
implementationClassPath, localAddress, classPathRegistry);
}
LOGGER.debug("Creating {}", displayName);
LOGGER.debug("Using application classpath {}", getApplicationClasspath());
LOGGER.debug("Using implementation classpath {}", implementationClassPath);
JavaExecHandleBuilder javaCommand = getJavaCommand();
attachStdInContent(workerFactory, javaCommand);
workerFactory.prepareJavaCommand(javaCommand);
javaCommand.setDisplayName(displayName);
javaCommand.args("'" + displayName + "'");
ExecHandle execHandle = javaCommand.build();
workerProcess.setExecHandle(execHandle);