use of org.gradle.process.JavaForkOptions in project gradle by gradle.
the class DaemonScalaCompiler method toDaemonForkOptions.
@Override
protected DaemonForkOptions toDaemonForkOptions(T spec) {
MinimalJavaCompilerDaemonForkOptions javaOptions = spec.getCompileOptions().getForkOptions();
MinimalScalaCompilerDaemonForkOptions scalaOptions = spec.getScalaCompileOptions().getForkOptions();
JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(forkOptionsFactory).transform(mergeForkOptions(javaOptions, scalaOptions));
javaForkOptions.setWorkingDir(daemonWorkingDir);
String javaExecutable = javaOptions.getExecutable();
if (javaExecutable != null) {
javaForkOptions.setExecutable(javaExecutable);
}
ClassPath compilerClasspath = classPathRegistry.getClassPath("SCALA-COMPILER").plus(DefaultClassPath.of(zincClasspath));
HierarchicalClassLoaderStructure classLoaderStructure = new HierarchicalClassLoaderStructure(classLoaderRegistry.getGradleWorkerExtensionSpec()).withChild(getScalaFilterSpec()).withChild(new VisitableURLClassLoader.Spec("compiler", compilerClasspath.getAsURLs()));
return new DaemonForkOptionsBuilder(forkOptionsFactory).javaForkOptions(javaForkOptions).withClassLoaderStructure(classLoaderStructure).keepAliveMode(KeepAliveMode.SESSION).build();
}
use of org.gradle.process.JavaForkOptions 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());
}
}
use of org.gradle.process.JavaForkOptions in project gradle by gradle.
the class DefaultTestTaskPropertiesService method collectForkOptions.
private TestTaskForkOptions collectForkOptions(Test task) {
boolean testIsModule = javaModuleDetector.isModule(task.getModularity().getInferModulePath().get(), task.getTestClassesDirs());
JavaForkOptions forkOptions = forkOptionsFactory.newJavaForkOptions();
task.copyTo(forkOptions);
String executable = forkOptions.getExecutable();
return new DefaultTestTaskForkOptions(forkOptions.getWorkingDir(), executable, detectJavaVersion(executable), javaModuleDetector.inferClasspath(testIsModule, task.getClasspath()), javaModuleDetector.inferModulePath(testIsModule, task.getClasspath()), forkOptions.getAllJvmArgs(), DefaultProcessForkOptions.getActualEnvironment(forkOptions));
}
Aggregations