Java Code Examples for org.gradle.process.internal.JavaExecHandleBuilder#setMinHeapSize()

The following examples show how to use org.gradle.process.internal.JavaExecHandleBuilder#setMinHeapSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompilerDaemonStarter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompilerDaemonClient startDaemon(File workingDir, DaemonForkOptions forkOptions) {
    LOG.debug("Starting Gradle compiler daemon with fork options {}.", forkOptions);
    Clock clock = new Clock();
    WorkerProcessBuilder builder = workerFactory.create();
    builder.setLogLevel(startParameter.getLogLevel()); // NOTE: might make sense to respect per-compile-task log level
    builder.applicationClasspath(forkOptions.getClasspath());
    builder.sharedPackages(forkOptions.getSharedPackages());
    JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
    javaCommand.setMinHeapSize(forkOptions.getMinHeapSize());
    javaCommand.setMaxHeapSize(forkOptions.getMaxHeapSize());
    javaCommand.setJvmArgs(forkOptions.getJvmArgs());
    javaCommand.setWorkingDir(workingDir);
    WorkerProcess process = builder.worker(new CompilerDaemonServer()).setBaseName("Gradle Compiler Daemon").build();
    process.start();

    CompilerDaemonServerProtocol server = process.getConnection().addOutgoing(CompilerDaemonServerProtocol.class);
    CompilerDaemonClient client = new CompilerDaemonClient(forkOptions, process, server);
    process.getConnection().addIncoming(CompilerDaemonClientProtocol.class, client);
    process.getConnection().connect();

    LOG.info("Started Gradle compiler daemon ({}) with fork options {}.", clock.getTime(), forkOptions);

    return client;
}
 
Example 2
Source File: CompilerDaemonStarter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public CompilerDaemonClient startDaemon(File workingDir, DaemonForkOptions forkOptions) {
    LOG.debug("Starting Gradle compiler daemon with fork options {}.", forkOptions);
    Clock clock = new Clock();
    WorkerProcessBuilder builder = workerFactory.create();
    builder.setLogLevel(startParameter.getLogLevel()); // NOTE: might make sense to respect per-compile-task log level
    builder.applicationClasspath(forkOptions.getClasspath());
    builder.sharedPackages(forkOptions.getSharedPackages());
    JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
    javaCommand.setMinHeapSize(forkOptions.getMinHeapSize());
    javaCommand.setMaxHeapSize(forkOptions.getMaxHeapSize());
    javaCommand.setJvmArgs(forkOptions.getJvmArgs());
    javaCommand.setWorkingDir(workingDir);
    WorkerProcess process = builder.worker(new CompilerDaemonServer()).setBaseName("Gradle Compiler Daemon").build();
    process.start();

    CompilerDaemonServerProtocol server = process.getConnection().addOutgoing(CompilerDaemonServerProtocol.class);
    CompilerDaemonClient client = new CompilerDaemonClient(forkOptions, process, server);
    process.getConnection().addIncoming(CompilerDaemonClientProtocol.class, client);
    process.getConnection().connect();

    LOG.info("Started Gradle compiler daemon ({}) with fork options {}.", clock.getTime(), forkOptions);

    return client;
}
 
Example 3
Source File: CompilerDaemonStarter.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public CompilerDaemonClient startDaemon(File workingDir, DaemonForkOptions forkOptions) {
    LOG.debug("Starting Gradle compiler daemon with fork options {}.", forkOptions);
    Clock clock = new Clock();
    WorkerProcessBuilder builder = workerFactory.create();
    builder.setLogLevel(startParameter.getLogLevel()); // NOTE: might make sense to respect per-compile-task log level
    builder.applicationClasspath(forkOptions.getClasspath());
    builder.sharedPackages(forkOptions.getSharedPackages());
    File toolsJar = Jvm.current().getToolsJar();
    if (toolsJar != null) {
        builder.getApplicationClasspath().add(toolsJar); // for SunJavaCompiler
    }
    JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
    javaCommand.setMinHeapSize(forkOptions.getMinHeapSize());
    javaCommand.setMaxHeapSize(forkOptions.getMaxHeapSize());
    javaCommand.setJvmArgs(forkOptions.getJvmArgs());
    javaCommand.setWorkingDir(workingDir);
    WorkerProcess process = builder.worker(new CompilerDaemonServer()).setBaseName("Gradle Compiler Daemon").build();
    process.start();

    CompilerDaemonServerProtocol server = process.getConnection().addOutgoing(CompilerDaemonServerProtocol.class);
    CompilerDaemonClient client = new CompilerDaemonClient(forkOptions, process, server);
    process.getConnection().addIncoming(CompilerDaemonClientProtocol.class, client);
    process.getConnection().connect();

    LOG.info("Started Gradle compiler daemon ({}) with fork options {}.", clock.getTime(), forkOptions);

    return client;
}
 
Example 4
Source File: PlayApplicationRunner.java    From playframework with Apache License 2.0 5 votes vote down vote up
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.playframework.tools.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();
}
 
Example 5
Source File: CompilerDaemonStarter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public CompilerDaemonClient startDaemon(File workingDir, DaemonForkOptions forkOptions) {
    LOG.debug("Starting Gradle compiler daemon with fork options {}.", forkOptions);
    Clock clock = new Clock();
    WorkerProcessBuilder builder = workerFactory.create();
    builder.setLogLevel(startParameter.getLogLevel()); // NOTE: might make sense to respect per-compile-task log level
    builder.applicationClasspath(forkOptions.getClasspath());
    builder.sharedPackages(forkOptions.getSharedPackages());
    File toolsJar = Jvm.current().getToolsJar();
    if (toolsJar != null) {
        builder.getApplicationClasspath().add(toolsJar); // for SunJavaCompiler
    }
    JavaExecHandleBuilder javaCommand = builder.getJavaCommand();
    javaCommand.setMinHeapSize(forkOptions.getMinHeapSize());
    javaCommand.setMaxHeapSize(forkOptions.getMaxHeapSize());
    javaCommand.setJvmArgs(forkOptions.getJvmArgs());
    javaCommand.setWorkingDir(workingDir);
    WorkerProcess process = builder.worker(new CompilerDaemonServer()).setBaseName("Gradle Compiler Daemon").build();
    process.start();

    CompilerDaemonServerProtocol server = process.getConnection().addOutgoing(CompilerDaemonServerProtocol.class);
    CompilerDaemonClient client = new CompilerDaemonClient(forkOptions, process, server);
    process.getConnection().addIncoming(CompilerDaemonClientProtocol.class, client);
    process.getConnection().connect();

    LOG.info("Started Gradle compiler daemon ({}) with fork options {}.", clock.getTime(), forkOptions);

    return client;
}