Search in sources :

Example 6 with DaemonForkOptionsBuilder

use of org.gradle.workers.internal.DaemonForkOptionsBuilder in project gradle by gradle.

the class DaemonJavaCompiler method toInvocationContext.

@Override
protected InvocationContext toInvocationContext(JavaCompileSpec spec) {
    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    JavaForkOptions javaForkOptions = new BaseForkOptionsConverter(fileResolver).transform(forkOptions);
    File invocationWorkingDir = javaForkOptions.getWorkingDir();
    javaForkOptions.setWorkingDir(daemonWorkingDir);
    DaemonForkOptions daemonForkOptions = new DaemonForkOptionsBuilder(fileResolver).javaForkOptions(javaForkOptions).sharedPackages(SHARED_PACKAGES).keepAliveMode(KeepAliveMode.SESSION).build();
    return new InvocationContext(invocationWorkingDir, daemonForkOptions);
}
Also used : DaemonForkOptionsBuilder(org.gradle.workers.internal.DaemonForkOptionsBuilder) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) ForkOptions(org.gradle.api.tasks.compile.ForkOptions) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) File(java.io.File)

Example 7 with DaemonForkOptionsBuilder

use of org.gradle.workers.internal.DaemonForkOptionsBuilder 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();
}
Also used : DaemonForkOptionsBuilder(org.gradle.workers.internal.DaemonForkOptionsBuilder) DefaultClassPath(org.gradle.internal.classpath.DefaultClassPath) ClassPath(org.gradle.internal.classpath.ClassPath) BaseForkOptionsConverter(org.gradle.api.internal.tasks.compile.BaseForkOptionsConverter) VisitableURLClassLoader(org.gradle.internal.classloader.VisitableURLClassLoader) HierarchicalClassLoaderStructure(org.gradle.workers.internal.HierarchicalClassLoaderStructure) JavaForkOptions(org.gradle.process.JavaForkOptions) MinimalJavaCompilerDaemonForkOptions(org.gradle.api.internal.tasks.compile.MinimalJavaCompilerDaemonForkOptions)

Aggregations

JavaForkOptions (org.gradle.process.JavaForkOptions)7 DaemonForkOptionsBuilder (org.gradle.workers.internal.DaemonForkOptionsBuilder)7 File (java.io.File)5 BaseForkOptionsConverter (org.gradle.api.internal.tasks.compile.BaseForkOptionsConverter)5 DaemonForkOptions (org.gradle.workers.internal.DaemonForkOptions)4 ForkOptions (org.gradle.api.tasks.compile.ForkOptions)3 VisitableURLClassLoader (org.gradle.internal.classloader.VisitableURLClassLoader)3 MinimalJavaCompilerDaemonForkOptions (org.gradle.api.internal.tasks.compile.MinimalJavaCompilerDaemonForkOptions)2 ClassPath (org.gradle.internal.classpath.ClassPath)2 HierarchicalClassLoaderStructure (org.gradle.workers.internal.HierarchicalClassLoaderStructure)2 GroovyJavaJointCompileSpec (org.gradle.api.internal.tasks.compile.GroovyJavaJointCompileSpec)1 MinimalGroovyCompilerDaemonForkOptions (org.gradle.api.internal.tasks.compile.MinimalGroovyCompilerDaemonForkOptions)1 BaseForkOptions (org.gradle.api.tasks.compile.BaseForkOptions)1 GroovyForkOptions (org.gradle.api.tasks.compile.GroovyForkOptions)1 ScalaForkOptions (org.gradle.api.tasks.scala.ScalaForkOptions)1 FilteringClassLoader (org.gradle.internal.classloader.FilteringClassLoader)1 DefaultClassPath (org.gradle.internal.classpath.DefaultClassPath)1 FlatClassLoaderStructure (org.gradle.workers.internal.FlatClassLoaderStructure)1