use of org.gradle.process.JavaForkOptions in project gradle by gradle.
the class BaseForkOptionsConverter method transform.
@Override
public JavaForkOptions transform(BaseForkOptions baseForkOptions) {
JavaForkOptions javaForkOptions = forkOptionsFactory.newJavaForkOptions();
javaForkOptions.setMinHeapSize(baseForkOptions.getMemoryInitialSize());
javaForkOptions.setMaxHeapSize(baseForkOptions.getMemoryMaximumSize());
javaForkOptions.setJvmArgs(baseForkOptions.getJvmArgs());
return javaForkOptions;
}
use of org.gradle.process.JavaForkOptions 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.process.JavaForkOptions 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();
}
use of org.gradle.process.JavaForkOptions in project gradle by gradle.
the class Test method createTestExecutionSpec.
/**
* {@inheritDoc}
*
* @since 4.4
*/
@Override
protected JvmTestExecutionSpec createTestExecutionSpec() {
validateToolchainConfiguration();
JavaForkOptions javaForkOptions = getForkOptionsFactory().newJavaForkOptions();
copyTo(javaForkOptions);
JavaModuleDetector javaModuleDetector = getJavaModuleDetector();
boolean testIsModule = javaModuleDetector.isModule(modularity.getInferModulePath().get(), getTestClassesDirs());
FileCollection classpath = javaModuleDetector.inferClasspath(testIsModule, stableClasspath);
FileCollection modulePath = javaModuleDetector.inferModulePath(testIsModule, stableClasspath);
return new JvmTestExecutionSpec(getTestFramework(), classpath, modulePath, getCandidateClassFiles(), isScanForTestClasses(), getTestClassesDirs(), getPath(), getIdentityPath(), getForkEvery(), javaForkOptions, getMaxParallelForks(), getPreviousFailedTestClasses());
}
use of org.gradle.process.JavaForkOptions 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);
}
Aggregations