use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class DefaultWorkerProcessBuilder method build.
@Override
public WorkerProcess build() {
final WorkerJvmMemoryStatus memoryStatus = shouldPublishJvmMemoryInfo ? new WorkerJvmMemoryStatus() : null;
final DefaultWorkerProcess workerProcess = new DefaultWorkerProcess(connectTimeoutSeconds, TimeUnit.SECONDS, memoryStatus);
ConnectionAcceptor acceptor = server.accept(new Action<ObjectConnection>() {
public void execute(final ObjectConnection connection) {
workerProcess.onConnect(connection, new Runnable() {
@Override
public void run() {
DefaultWorkerLoggingProtocol defaultWorkerLoggingProtocol = new DefaultWorkerLoggingProtocol(outputEventListener);
connection.useParameterSerializers(WorkerLoggingSerializer.create());
connection.addIncoming(WorkerLoggingProtocol.class, defaultWorkerLoggingProtocol);
if (shouldPublishJvmMemoryInfo) {
connection.useParameterSerializers(WorkerJvmMemoryInfoSerializer.create());
connection.addIncoming(WorkerJvmMemoryInfoProtocol.class, memoryStatus);
}
}
});
}
});
workerProcess.startAccepting(acceptor);
Address localAddress = acceptor.getAddress();
// Build configuration for GradleWorkerMain
Object id = idGenerator.generateId();
String displayName = getBaseName() + " " + id;
LOGGER.debug("Creating {}", displayName);
LOGGER.debug("Using application classpath {}", applicationClasspath);
LOGGER.debug("Using implementation classpath {}", implementationClassPath);
JavaExecHandleBuilder javaCommand = getJavaCommand();
javaCommand.setDisplayName(displayName);
workerImplementationFactory.prepareJavaCommand(id, displayName, this, implementationClassPath, localAddress, javaCommand, shouldPublishJvmMemoryInfo);
javaCommand.args("'" + displayName + "'");
ExecHandle execHandle = javaCommand.build();
workerProcess.setExecHandle(execHandle);
return new MemoryRequestingWorkerProcess(workerProcess, memoryManager, MemoryAmount.parseNotation(javaCommand.getMinHeapSize()));
}
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 = new JavaExecHandleBuilder(TestFiles.resolver());
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 FindBugsWorkerManager method createWorkerProcess.
private FindBugsWorker createWorkerProcess(File workingDir, WorkerProcessFactory workerFactory, FileCollection findBugsClasspath, FindBugsSpec spec) {
SingleRequestWorkerProcessBuilder<FindBugsWorker> builder = workerFactory.singleRequestWorker(FindBugsWorker.class, FindBugsExecuter.class);
builder.setBaseName("Gradle FindBugs Worker");
builder.applicationClasspath(findBugsClasspath);
builder.sharedPackages(Arrays.asList("edu.umd.cs.findbugs"));
JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
javaCommand.setWorkingDir(workingDir);
javaCommand.setMaxHeapSize(spec.getMaxHeapSize());
return builder.build();
}
use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class DefaultRhinoWorkerHandleFactory method create.
@Override
public <T> T create(Iterable<File> rhinoClasspath, Class<T> protocolType, Class<? extends T> workerImplementationType, LogLevel logLevel, File workingDir) {
SingleRequestWorkerProcessBuilder<T> builder = workerProcessBuilderFactory.singleRequestWorker(protocolType, workerImplementationType);
builder.setBaseName("Gradle Rhino Worker");
builder.setLogLevel(logLevel);
builder.applicationClasspath(rhinoClasspath);
builder.sharedPackages("org.mozilla.javascript");
JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
javaCommand.setWorkingDir(workingDir);
return builder.build();
}
use of org.gradle.process.internal.JavaExecHandleBuilder in project gradle by gradle.
the class PlayApplicationRunner method createWorkerProcess.
private static WorkerProcess createWorkerProcess(File workingDir, WorkerProcessFactory workerFactory, PlayRunSpec spec, VersionedPlayRunAdapter adapter) {
WorkerProcessBuilder builder = workerFactory.create(new PlayWorkerServer(spec, adapter));
builder.setBaseName("Gradle Play Worker");
builder.sharedPackages("org.gradle.play.internal.run");
JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
javaCommand.setWorkingDir(workingDir);
javaCommand.setMinHeapSize(spec.getForkOptions().getMemoryInitialSize());
javaCommand.setMaxHeapSize(spec.getForkOptions().getMemoryMaximumSize());
javaCommand.setJvmArgs(spec.getForkOptions().getJvmArgs());
return builder.build();
}
Aggregations