use of org.gradle.workers.internal.DaemonForkOptionsBuilder in project gradle by gradle.
the class DaemonGroovyCompiler method toInvocationContext.
@Override
protected InvocationContext toInvocationContext(GroovyJavaJointCompileSpec spec) {
ForkOptions javaOptions = spec.getCompileOptions().getForkOptions();
GroovyForkOptions groovyOptions = spec.getGroovyCompileOptions().getForkOptions();
// Ant is optional dependency of groovy(-all) module but mandatory dependency of Groovy compiler;
// that's why we add it here. The following assumes that any Groovy compiler version supported by Gradle
// is compatible with Gradle's current Ant version.
Collection<File> antFiles = classPathRegistry.getClassPath("ANT").getAsFiles();
Iterable<File> groovyFiles = Iterables.concat(spec.getGroovyClasspath(), antFiles);
JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(fileResolver).transform(mergeForkOptions(javaOptions, groovyOptions));
File invocationWorkingDir = javaForkOptions.getWorkingDir();
javaForkOptions.setWorkingDir(daemonWorkingDir);
DaemonForkOptions daemonForkOptions = new DaemonForkOptionsBuilder(fileResolver).javaForkOptions(javaForkOptions).classpath(groovyFiles).sharedPackages(SHARED_PACKAGES).keepAliveMode(KeepAliveMode.SESSION).build();
return new InvocationContext(invocationWorkingDir, daemonForkOptions);
}
use of org.gradle.workers.internal.DaemonForkOptionsBuilder in project gradle by gradle.
the class DaemonPlayCompiler method toInvocationContext.
@Override
protected InvocationContext toInvocationContext(PlayCompileSpec spec) {
BaseForkOptions forkOptions = spec.getForkOptions();
JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(fileResolver).transform(forkOptions);
File invocationWorkingDir = javaForkOptions.getWorkingDir();
javaForkOptions.setWorkingDir(daemonWorkingDir);
DaemonForkOptions daemonForkOptions = new DaemonForkOptionsBuilder(fileResolver).javaForkOptions(javaForkOptions).classpath(compilerClasspath).sharedPackages(classLoaderPackages).keepAliveMode(KeepAliveMode.SESSION).build();
return new InvocationContext(invocationWorkingDir, daemonForkOptions);
}
use of org.gradle.workers.internal.DaemonForkOptionsBuilder in project gradle by gradle.
the class DaemonScalaCompiler method toInvocationContext.
@Override
protected InvocationContext toInvocationContext(T spec) {
ForkOptions javaOptions = spec.getCompileOptions().getForkOptions();
ScalaForkOptions scalaOptions = spec.getScalaCompileOptions().getForkOptions();
JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(fileResolver).transform(mergeForkOptions(javaOptions, scalaOptions));
File invocationWorkingDir = javaForkOptions.getWorkingDir();
javaForkOptions.setWorkingDir(daemonWorkingDir);
DaemonForkOptions daemonForkOptions = new DaemonForkOptionsBuilder(fileResolver).javaForkOptions(javaForkOptions).classpath(zincClasspath).sharedPackages(SHARED_PACKAGES).keepAliveMode(KeepAliveMode.SESSION).build();
return new InvocationContext(invocationWorkingDir, daemonForkOptions);
}
use of org.gradle.workers.internal.DaemonForkOptionsBuilder in project gradle by gradle.
the class DaemonGroovyCompiler method toDaemonForkOptions.
@Override
protected DaemonForkOptions toDaemonForkOptions(GroovyJavaJointCompileSpec spec) {
MinimalJavaCompilerDaemonForkOptions javaOptions = spec.getCompileOptions().getForkOptions();
MinimalGroovyCompilerDaemonForkOptions groovyOptions = spec.getGroovyCompileOptions().getForkOptions();
// Ant is optional dependency of groovy(-all) module but mandatory dependency of Groovy compiler;
// that's why we add it here. The following assumes that any Groovy compiler version supported by Gradle
// is compatible with Gradle's current Ant version.
Collection<File> antFiles = classPathRegistry.getClassPath("ANT").getAsFiles();
Iterable<File> classpath = Iterables.concat(spec.getGroovyClasspath(), antFiles);
VisitableURLClassLoader.Spec targetGroovyClasspath = new VisitableURLClassLoader.Spec("worker-loader", DefaultClassPath.of(classpath).getAsURLs());
Collection<File> languageGroovyFiles = classPathRegistry.getClassPath("GROOVY-COMPILER").getAsFiles();
VisitableURLClassLoader.Spec compilerClasspath = new VisitableURLClassLoader.Spec("compiler-loader", DefaultClassPath.of(languageGroovyFiles).getAsURLs());
FilteringClassLoader.Spec gradleAndUserFilter = getMinimalGradleFilter();
for (String sharedPackage : SHARED_PACKAGES) {
gradleAndUserFilter.allowPackage(sharedPackage);
}
HierarchicalClassLoaderStructure classLoaderStructure = new HierarchicalClassLoaderStructure(classLoaderRegistry.getGradleWorkerExtensionSpec()).withChild(getMinimalGradleFilter()).withChild(targetGroovyClasspath).withChild(gradleAndUserFilter).withChild(compilerClasspath);
JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(forkOptionsFactory).transform(mergeForkOptions(javaOptions, groovyOptions));
javaForkOptions.setWorkingDir(daemonWorkingDir);
javaForkOptions.setExecutable(javaOptions.getExecutable());
if (jvmVersionDetector.getJavaVersion(javaForkOptions.getExecutable()).isJava9Compatible()) {
javaForkOptions.jvmArgs(JpmsConfiguration.GROOVY_JPMS_ARGS);
}
return new DaemonForkOptionsBuilder(forkOptionsFactory).javaForkOptions(javaForkOptions).keepAliveMode(KeepAliveMode.SESSION).withClassLoaderStructure(classLoaderStructure).build();
}
use of org.gradle.workers.internal.DaemonForkOptionsBuilder in project gradle by gradle.
the class DaemonJavaCompiler method toDaemonForkOptions.
@Override
protected DaemonForkOptions toDaemonForkOptions(JavaCompileSpec spec) {
MinimalJavaCompilerDaemonForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(forkOptionsFactory).transform(forkOptions);
javaForkOptions.setWorkingDir(daemonWorkingDir);
javaForkOptions.setExecutable(findSuitableExecutable(spec));
ClassPath compilerClasspath = classPathRegistry.getClassPath("JAVA-COMPILER");
FlatClassLoaderStructure classLoaderStructure = new FlatClassLoaderStructure(new VisitableURLClassLoader.Spec("compiler", compilerClasspath.getAsURLs()));
return new DaemonForkOptionsBuilder(forkOptionsFactory).javaForkOptions(javaForkOptions).withClassLoaderStructure(classLoaderStructure).keepAliveMode(KeepAliveMode.SESSION).build();
}
Aggregations