use of org.gradle.workers.WorkQueue in project gradle by gradle.
the class PrefixHeaderFileGenerateTask method generatePrefixHeaderFile.
@TaskAction
void generatePrefixHeaderFile() {
WorkQueue workQueue = workerExecutor.noIsolation();
workQueue.submit(GeneratePrefixHeaderFile.class, new Action<PrefixHeaderFileParameters>() {
@Override
public void execute(@Nonnull PrefixHeaderFileParameters parameters) {
parameters.getHeader().set(header);
parameters.getPrefixHeaderFile().set(prefixHeaderFile);
}
});
}
use of org.gradle.workers.WorkQueue in project gradle by gradle.
the class ScalaDoc method generate.
@TaskAction
protected void generate() {
ScalaDocOptions options = getScalaDocOptions();
if (!GUtil.isTrue(options.getDocTitle())) {
options.setDocTitle(getTitle());
}
WorkQueue queue = getWorkerExecutor().processIsolation(worker -> {
worker.getClasspath().from(getScalaClasspath());
JavaForkOptions forkOptions = worker.getForkOptions();
if (getMaxMemory().isPresent()) {
forkOptions.setMaxHeapSize(getMaxMemory().get());
}
if (javaLauncher.isPresent()) {
forkOptions.setExecutable(javaLauncher.get().getExecutablePath().getAsFile().getAbsolutePath());
}
});
queue.submit(GenerateScaladoc.class, parameters -> {
@Nullable File optionsFile = createOptionsFile();
parameters.getOptionsFile().set(optionsFile);
parameters.getClasspath().from(getClasspath());
parameters.getOutputDirectory().set(getDestinationDir());
boolean isScala3 = ScalaRuntimeHelper.findScalaJar(getScalaClasspath(), "library_3") != null;
parameters.getIsScala3().set(isScala3);
if (isScala3) {
parameters.getSources().from(getFilteredCompilationOutputs());
} else {
parameters.getSources().from(getSource());
if (options.isDeprecation()) {
parameters.getOptions().add("-deprecation");
}
if (options.isUnchecked()) {
parameters.getOptions().add("-unchecked");
}
}
String footer = options.getFooter();
if (footer != null) {
parameters.getOptions().add("-doc-footer");
parameters.getOptions().add(footer);
}
String docTitle = options.getDocTitle();
if (docTitle != null) {
parameters.getOptions().add("-doc-title");
parameters.getOptions().add(docTitle);
}
// None of these options work for Scala >=2.8
// options.getBottom();;
// options.getTop();
// options.getHeader();
// options.getWindowTitle();
List<String> additionalParameters = options.getAdditionalParameters();
if (additionalParameters != null) {
parameters.getOptions().addAll(additionalParameters);
}
});
}
use of org.gradle.workers.WorkQueue in project gradle by gradle.
the class DefaultWorkerExecutor method submit.
@Override
@SuppressWarnings("deprecation")
public void submit(Class<? extends Runnable> actionClass, Action<? super org.gradle.workers.WorkerConfiguration> configAction) {
DeprecationLogger.deprecateMethod(WorkerExecutor.class, "submit()").replaceWith("noIsolation(), classLoaderIsolation() or processIsolation()").willBeRemovedInGradle8().withUserManual("upgrading_version_5", "method_workerexecutor_submit_is_deprecated").nagUser();
DefaultWorkerConfiguration configuration = new DefaultWorkerConfiguration(forkOptionsFactory);
configAction.execute(configuration);
Action<AdapterWorkParameters> parametersAction = parameters -> {
parameters.setImplementationClassName(actionClass.getName());
parameters.setParams(configuration.getParams());
parameters.setDisplayName(configuration.getDisplayName());
};
WorkQueue workQueue;
switch(configuration.getIsolationMode()) {
case NONE:
case AUTO:
workQueue = noIsolation(getWorkerSpecAdapterAction(configuration));
break;
case CLASSLOADER:
workQueue = classLoaderIsolation(getWorkerSpecAdapterAction(configuration));
break;
case PROCESS:
workQueue = processIsolation(getWorkerSpecAdapterAction(configuration));
break;
default:
throw new IllegalArgumentException("Unknown isolation mode: " + configuration.getIsolationMode());
}
workQueue.submit(AdapterWorkAction.class, parametersAction);
}
Aggregations