Search in sources :

Example 1 with DaemonStateControl

use of org.gradle.launcher.daemon.server.api.DaemonStateControl in project gradle by gradle.

the class StartBuildOrRespondWithBusy method doBuild.

protected void doBuild(final DaemonCommandExecution execution, final Build build) {
    DaemonStateControl stateCoordinator = execution.getDaemonStateControl();
    try {
        Runnable command = new Runnable() {

            public void run() {
                LOGGER.info("Daemon is about to start building {}. Dispatching build started information...", build);
                execution.getConnection().buildStarted(new BuildStarted(diagnostics));
                execution.proceed();
            }
        };
        stateCoordinator.runCommand(command, execution.toString());
    } catch (DaemonUnavailableException e) {
        LOGGER.info("Daemon will not handle the command {} because is unavailable: {}", build, e.getMessage());
        execution.getConnection().daemonUnavailable(new DaemonUnavailable(e.getMessage()));
    } catch (DaemonStoppedException e) {
        execution.getConnection().completed(new Failure(e));
    }
}
Also used : DaemonStoppedException(org.gradle.launcher.daemon.server.api.DaemonStoppedException) DaemonStateControl(org.gradle.launcher.daemon.server.api.DaemonStateControl) DaemonUnavailable(org.gradle.launcher.daemon.protocol.DaemonUnavailable) BuildStarted(org.gradle.launcher.daemon.protocol.BuildStarted) DaemonUnavailableException(org.gradle.launcher.daemon.server.api.DaemonUnavailableException) Failure(org.gradle.launcher.daemon.protocol.Failure)

Aggregations

BuildStarted (org.gradle.launcher.daemon.protocol.BuildStarted)1 DaemonUnavailable (org.gradle.launcher.daemon.protocol.DaemonUnavailable)1 Failure (org.gradle.launcher.daemon.protocol.Failure)1 DaemonStateControl (org.gradle.launcher.daemon.server.api.DaemonStateControl)1 DaemonStoppedException (org.gradle.launcher.daemon.server.api.DaemonStoppedException)1 DaemonUnavailableException (org.gradle.launcher.daemon.server.api.DaemonUnavailableException)1