Search in sources :

Example 1 with InProcessWorkerFactory

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

the class GroovyCompilerFactory method newCompiler.

@Override
public Compiler<GroovyJavaJointCompileSpec> newCompiler(GroovyJavaJointCompileSpec spec) {
    GroovyCompileOptions groovyOptions = spec.getGroovyCompileOptions();
    Compiler<JavaCompileSpec> javaCompiler = javaCompilerFactory.createForJointCompilation(spec.getClass());
    Compiler<GroovyJavaJointCompileSpec> groovyCompiler = new ApiGroovyCompiler(javaCompiler);
    WorkerFactory workerFactory;
    if (groovyOptions.isFork()) {
        workerFactory = workerDaemonFactory;
    } else {
        workerFactory = inProcessWorkerFactory;
    }
    groovyCompiler = new DaemonGroovyCompiler(project.getRootProject().getProjectDir(), groovyCompiler, project.getServices().get(ClassPathRegistry.class), workerFactory);
    return new NormalizingGroovyCompiler(groovyCompiler);
}
Also used : DaemonGroovyCompiler(org.gradle.api.internal.tasks.compile.daemon.DaemonGroovyCompiler) GroovyCompileOptions(org.gradle.api.tasks.compile.GroovyCompileOptions) InProcessWorkerFactory(org.gradle.workers.internal.InProcessWorkerFactory) WorkerFactory(org.gradle.workers.internal.WorkerFactory)

Example 2 with InProcessWorkerFactory

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

the class GroovyCompile method getCompiler.

private Compiler<GroovyJavaJointCompileSpec> getCompiler(GroovyJavaJointCompileSpec spec) {
    if (compiler == null) {
        ProjectInternal projectInternal = (ProjectInternal) getProject();
        WorkerDaemonFactory workerDaemonFactory = getServices().get(WorkerDaemonFactory.class);
        InProcessWorkerFactory inProcessWorkerFactory = getServices().get(InProcessWorkerFactory.class);
        JavaCompilerFactory javaCompilerFactory = getServices().get(JavaCompilerFactory.class);
        GroovyCompilerFactory groovyCompilerFactory = new GroovyCompilerFactory(projectInternal, javaCompilerFactory, workerDaemonFactory, inProcessWorkerFactory);
        Compiler<GroovyJavaJointCompileSpec> delegatingCompiler = groovyCompilerFactory.newCompiler(spec);
        compiler = new CleaningGroovyCompiler(delegatingCompiler, getOutputs());
    }
    return compiler;
}
Also used : InProcessWorkerFactory(org.gradle.workers.internal.InProcessWorkerFactory) GroovyCompilerFactory(org.gradle.api.internal.tasks.compile.GroovyCompilerFactory) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) GroovyJavaJointCompileSpec(org.gradle.api.internal.tasks.compile.GroovyJavaJointCompileSpec) DefaultGroovyJavaJointCompileSpec(org.gradle.api.internal.tasks.compile.DefaultGroovyJavaJointCompileSpec) CleaningGroovyCompiler(org.gradle.api.internal.tasks.compile.CleaningGroovyCompiler) JavaCompilerFactory(org.gradle.api.internal.tasks.compile.JavaCompilerFactory) WorkerDaemonFactory(org.gradle.workers.internal.WorkerDaemonFactory)

Aggregations

InProcessWorkerFactory (org.gradle.workers.internal.InProcessWorkerFactory)2 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 CleaningGroovyCompiler (org.gradle.api.internal.tasks.compile.CleaningGroovyCompiler)1 DefaultGroovyJavaJointCompileSpec (org.gradle.api.internal.tasks.compile.DefaultGroovyJavaJointCompileSpec)1 GroovyCompilerFactory (org.gradle.api.internal.tasks.compile.GroovyCompilerFactory)1 GroovyJavaJointCompileSpec (org.gradle.api.internal.tasks.compile.GroovyJavaJointCompileSpec)1 JavaCompilerFactory (org.gradle.api.internal.tasks.compile.JavaCompilerFactory)1 DaemonGroovyCompiler (org.gradle.api.internal.tasks.compile.daemon.DaemonGroovyCompiler)1 GroovyCompileOptions (org.gradle.api.tasks.compile.GroovyCompileOptions)1 WorkerDaemonFactory (org.gradle.workers.internal.WorkerDaemonFactory)1 WorkerFactory (org.gradle.workers.internal.WorkerFactory)1