use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class InProcessGradleExecuter method getJavaExecBuilder.
private Factory<JavaExecHandleBuilder> getJavaExecBuilder() {
return new Factory<JavaExecHandleBuilder>() {
public JavaExecHandleBuilder create() {
GradleInvocation invocation = buildInvocation();
JavaExecHandleBuilder builder = TestFiles.execFactory().newJavaExec();
builder.workingDir(getWorkingDir());
builder.setExecutable(new File(getJavaHome(), "bin/java"));
Collection<File> classpath = cleanup(GLOBAL_SERVICES.get(ModuleRegistry.class).getAdditionalClassPath().getAsFiles());
builder.classpath(classpath);
builder.jvmArgs(invocation.launcherJvmArgs);
builder.setMain(Main.class.getName());
builder.args(invocation.args);
builder.setStandardInput(connectStdIn());
return builder;
}
};
}
use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class RunApplication method startApplication.
@TaskAction
public void startApplication() {
DeploymentRegistry registry = getDeploymentRegistry();
JavaApplicationHandle handle = registry.get(getPath(), JavaApplicationHandle.class);
if (handle == null) {
JavaExecHandleBuilder builder = getExecActionFactory().newJavaExec();
builder.setClasspath(classpath);
builder.setMain(mainClassName);
builder.setArgs(arguments);
registry.start(getPath(), changeBehavior, JavaApplicationHandle.class, builder);
}
}
use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class AntlrWorkerManager method createWorkerProcess.
private AntlrWorker createWorkerProcess(File workingDir, WorkerProcessFactory workerFactory, FileCollection antlrClasspath, AntlrSpec spec) {
SingleRequestWorkerProcessBuilder<AntlrWorker> builder = workerFactory.singleRequestWorker(AntlrWorker.class, AntlrExecuter.class);
builder.setBaseName("Gradle ANTLR Worker");
if (antlrClasspath != null) {
builder.applicationClasspath(antlrClasspath);
}
builder.sharedPackages(new String[] { "antlr", "org.antlr" });
JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
javaCommand.setWorkingDir(workingDir);
javaCommand.setMaxHeapSize(spec.getMaxHeapSize());
javaCommand.systemProperty("ANTLR_DO_NOT_EXIT", "true");
javaCommand.redirectErrorStream();
return builder.build();
}
use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class WorkerDaemonStarter method startDaemon.
public <T extends WorkSpec> WorkerDaemonClient startDaemon(Class<? extends WorkerProtocol<ActionExecutionSpec>> workerProtocolImplementationClass, DaemonForkOptions forkOptions) {
LOG.debug("Starting Gradle worker daemon with fork options {}.", forkOptions);
Timer clock = Time.startTimer();
MultiRequestWorkerProcessBuilder<WorkerDaemonProcess> builder = workerDaemonProcessFactory.multiRequestWorker(WorkerDaemonProcess.class, WorkerProtocol.class, workerProtocolImplementationClass);
builder.setBaseName("Gradle Worker Daemon");
// NOTE: might make sense to respect per-compile-task log level
builder.setLogLevel(loggingManager.getLevel());
builder.applicationClasspath(forkOptions.getClasspath());
builder.sharedPackages(forkOptions.getSharedPackages());
JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
forkOptions.getJavaForkOptions().copyTo(javaCommand);
WorkerDaemonProcess workerDaemonProcess = builder.build();
WorkerProcess workerProcess = workerDaemonProcess.start();
WorkerDaemonClient client = new WorkerDaemonClient(forkOptions, workerDaemonProcess, workerProcess, loggingManager.getLevel());
LOG.info("Started Gradle worker daemon ({}) with fork options {}.", clock.getElapsed(), forkOptions);
return client;
}
Aggregations