Search in sources :

Example 1 with DaemonForkOptions

use of org.gradle.workers.internal.DaemonForkOptions 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);
}
Also used : DaemonForkOptionsBuilder(org.gradle.workers.internal.DaemonForkOptionsBuilder) BaseForkOptionsConverter(org.gradle.api.internal.tasks.compile.BaseForkOptionsConverter) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) ForkOptions(org.gradle.api.tasks.compile.ForkOptions) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) GroovyForkOptions(org.gradle.api.tasks.compile.GroovyForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) GroovyForkOptions(org.gradle.api.tasks.compile.GroovyForkOptions) File(java.io.File)

Example 2 with DaemonForkOptions

use of org.gradle.workers.internal.DaemonForkOptions 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);
}
Also used : DaemonForkOptionsBuilder(org.gradle.workers.internal.DaemonForkOptionsBuilder) BaseForkOptionsConverter(org.gradle.api.internal.tasks.compile.BaseForkOptionsConverter) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) File(java.io.File) BaseForkOptions(org.gradle.api.tasks.compile.BaseForkOptions)

Example 3 with DaemonForkOptions

use of org.gradle.workers.internal.DaemonForkOptions 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);
}
Also used : DaemonForkOptionsBuilder(org.gradle.workers.internal.DaemonForkOptionsBuilder) BaseForkOptionsConverter(org.gradle.api.internal.tasks.compile.BaseForkOptionsConverter) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) ScalaForkOptions(org.gradle.api.tasks.scala.ScalaForkOptions) ForkOptions(org.gradle.api.tasks.compile.ForkOptions) DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) ScalaForkOptions(org.gradle.api.tasks.scala.ScalaForkOptions) JavaForkOptions(org.gradle.process.JavaForkOptions) File(java.io.File)

Example 4 with DaemonForkOptions

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

the class DaemonGroovyCompiler method createGroovyForkOptions.

private DaemonForkOptions createGroovyForkOptions(GroovyJavaJointCompileSpec spec) {
    GroovyForkOptions options = 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);
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs(), groovyFiles, SHARED_PACKAGES);
}
Also used : DaemonForkOptions(org.gradle.workers.internal.DaemonForkOptions) GroovyForkOptions(org.gradle.api.tasks.compile.GroovyForkOptions) File(java.io.File)

Example 5 with DaemonForkOptions

use of org.gradle.workers.internal.DaemonForkOptions 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)

Aggregations

File (java.io.File)5 DaemonForkOptions (org.gradle.workers.internal.DaemonForkOptions)5 JavaForkOptions (org.gradle.process.JavaForkOptions)4 DaemonForkOptionsBuilder (org.gradle.workers.internal.DaemonForkOptionsBuilder)4 BaseForkOptionsConverter (org.gradle.api.internal.tasks.compile.BaseForkOptionsConverter)3 ForkOptions (org.gradle.api.tasks.compile.ForkOptions)3 GroovyForkOptions (org.gradle.api.tasks.compile.GroovyForkOptions)2 BaseForkOptions (org.gradle.api.tasks.compile.BaseForkOptions)1 ScalaForkOptions (org.gradle.api.tasks.scala.ScalaForkOptions)1