use of org.gradle.workers.ProcessWorkerSpec in project gradle by gradle.
the class DefaultWorkerConfiguration method adaptTo.
void adaptTo(WorkerSpec workerSpec) {
if (workerSpec instanceof ClassLoaderWorkerSpec) {
ClassLoaderWorkerSpec classLoaderWorkerSpec = (ClassLoaderWorkerSpec) workerSpec;
classLoaderWorkerSpec.getClasspath().from(getClasspath());
}
if (workerSpec instanceof ProcessWorkerSpec) {
ProcessWorkerSpec processWorkerSpec = (ProcessWorkerSpec) workerSpec;
processWorkerSpec.getClasspath().from(getClasspath());
getForkOptions().copyTo(processWorkerSpec.getForkOptions());
}
}
use of org.gradle.workers.ProcessWorkerSpec in project gradle by gradle.
the class DefaultWorkerExecutor method getWorkerRequirement.
WorkerRequirement getWorkerRequirement(Class<?> executionClass, WorkerSpec configuration, WorkParameters parameters) {
if (configuration instanceof ProcessWorkerSpec) {
DaemonForkOptionsBuilder builder = new DaemonForkOptionsBuilder(forkOptionsFactory).keepAliveMode(KeepAliveMode.DAEMON);
ProcessWorkerSpec processConfiguration = (ProcessWorkerSpec) configuration;
JavaForkOptions forkOptions = forkOptionsFactory.newJavaForkOptions();
processConfiguration.getForkOptions().copyTo(forkOptions);
forkOptions.setWorkingDir(workerDirectoryProvider.getWorkingDirectory());
builder.javaForkOptions(forkOptions).withClassLoaderStructure(classLoaderStructureProvider.getWorkerProcessClassLoaderStructure(processConfiguration.getClasspath(), getParamClasses(executionClass, parameters)));
return new ForkedWorkerRequirement(baseDir, builder.build());
} else if (configuration instanceof ClassLoaderWorkerSpec) {
ClassLoaderWorkerSpec classLoaderConfiguration = (ClassLoaderWorkerSpec) configuration;
return new IsolatedClassLoaderWorkerRequirement(baseDir, classLoaderStructureProvider.getInProcessClassLoaderStructure(classLoaderConfiguration.getClasspath(), getParamClasses(executionClass, parameters)));
} else {
return new FixedClassLoaderWorkerRequirement(baseDir, Thread.currentThread().getContextClassLoader());
}
}
Aggregations