Search in sources :

Example 1 with DaemonClient

use of org.gradle.launcher.daemon.client.DaemonClient in project gradle by gradle.

the class BuildActionsFactory method runBuildInSingleUseDaemon.

private Runnable runBuildInSingleUseDaemon(StartParameter startParameter, DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    //(SF) this is a workaround until this story is completed. I'm hardcoding setting the idle timeout to be max X mins.
    //this way we avoid potential runaway daemons that steal resources on linux and break builds on windows.
    //We might leave that in if we decide it's a good idea for an extra safety net.
    int maxTimeout = 2 * 60 * 1000;
    if (daemonParameters.getIdleTimeout() > maxTimeout) {
        daemonParameters.setIdleTimeout(maxTimeout);
    }
    //end of workaround.
    // Create a client that will not match any existing daemons, so it will always startup a new one
    ServiceRegistry clientSharedServices = createGlobalClientServices();
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createSingleUseDaemonClientServices(loggingServices.get(OutputEventListener.class), daemonParameters, System.in);
    DaemonClient client = clientServices.get(DaemonClient.class);
    return runBuildAndCloseServices(startParameter, daemonParameters, client, clientSharedServices, clientServices);
}
Also used : DaemonClient(org.gradle.launcher.daemon.client.DaemonClient) DaemonClientFactory(org.gradle.launcher.daemon.client.DaemonClientFactory) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) OutputEventListener(org.gradle.internal.logging.events.OutputEventListener)

Example 2 with DaemonClient

use of org.gradle.launcher.daemon.client.DaemonClient in project gradle by gradle.

the class BuildActionsFactory method runBuildWithDaemon.

private Runnable runBuildWithDaemon(StartParameter startParameter, DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    // Create a client that will match based on the daemon startup parameters.
    ServiceRegistry clientSharedServices = createGlobalClientServices();
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createBuildClientServices(loggingServices.get(OutputEventListener.class), daemonParameters, System.in);
    DaemonClient client = clientServices.get(DaemonClient.class);
    return runBuildAndCloseServices(startParameter, daemonParameters, client, clientSharedServices, clientServices);
}
Also used : DaemonClient(org.gradle.launcher.daemon.client.DaemonClient) DaemonClientFactory(org.gradle.launcher.daemon.client.DaemonClientFactory) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) OutputEventListener(org.gradle.internal.logging.events.OutputEventListener)

Aggregations

OutputEventListener (org.gradle.internal.logging.events.OutputEventListener)2 ServiceRegistry (org.gradle.internal.service.ServiceRegistry)2 DaemonClient (org.gradle.launcher.daemon.client.DaemonClient)2 DaemonClientFactory (org.gradle.launcher.daemon.client.DaemonClientFactory)2