use of org.gradle.initialization.DefaultBuildRequestContext in project gradle by gradle.
the class ProviderConnection method run.
private Object run(BuildAction action, BuildCancellationToken cancellationToken, ProgressListenerConfiguration progressListenerConfiguration, ProviderOperationParameters providerParameters, Parameters parameters) {
try {
BuildActionExecuter<ProviderOperationParameters> executer = createExecuter(providerParameters, parameters);
BuildRequestContext buildRequestContext = new DefaultBuildRequestContext(new DefaultBuildRequestMetaData(providerParameters.getStartTime()), cancellationToken, progressListenerConfiguration.buildEventConsumer);
BuildActionResult result = (BuildActionResult) executer.execute(action, buildRequestContext, providerParameters, sharedServices);
if (result.failure != null) {
throw (RuntimeException) payloadSerializer.deserialize(result.failure);
}
return payloadSerializer.deserialize(result.result);
} finally {
progressListenerConfiguration.failsafeWrapper.rethrowErrors();
}
}
use of org.gradle.initialization.DefaultBuildRequestContext in project gradle by gradle.
the class ExecuteBuild method doBuild.
@Override
protected void doBuild(final DaemonCommandExecution execution, Build build) {
LOGGER.debug(DaemonMessages.STARTED_BUILD);
LOGGER.debug("Executing build with daemon context: {}", execution.getDaemonContext());
runningStats.buildStarted();
DaemonConnectionBackedEventConsumer buildEventConsumer = new DaemonConnectionBackedEventConsumer(execution);
try {
BuildCancellationToken cancellationToken = execution.getDaemonStateControl().getCancellationToken();
BuildRequestContext buildRequestContext = new DefaultBuildRequestContext(build.getBuildRequestMetaData(), cancellationToken, buildEventConsumer);
if (!build.getAction().getStartParameter().isContinuous()) {
buildRequestContext.getCancellationToken().addCallback(new Runnable() {
@Override
public void run() {
LOGGER.info(DaemonMessages.CANCELED_BUILD);
}
});
}
BuildActionResult result = actionExecuter.execute(build.getAction(), build.getParameters(), buildRequestContext);
execution.setResult(result);
} finally {
buildEventConsumer.waitForFinish();
runningStats.buildFinished();
LOGGER.debug(DaemonMessages.FINISHED_BUILD);
}
// ExecuteBuild should be the last action, but in case we want to decorate the result in the future
execution.proceed();
}
use of org.gradle.initialization.DefaultBuildRequestContext in project gradle by gradle.
the class ProviderConnection method run.
private Object run(BuildAction action, BuildCancellationToken cancellationToken, ProgressListenerConfiguration progressListenerConfiguration, BuildEventConsumer buildEventConsumer, ProviderOperationParameters providerParameters, Parameters parameters) {
try {
BuildActionExecuter<ConnectionOperationParameters, BuildRequestContext> executer = createExecuter(providerParameters, parameters);
boolean interactive = providerParameters.getStandardInput() != null;
BuildRequestContext buildRequestContext = new DefaultBuildRequestContext(new DefaultBuildRequestMetaData(providerParameters.getStartTime(), interactive), cancellationToken, buildEventConsumer);
BuildActionResult result = executer.execute(action, new ConnectionOperationParameters(parameters.daemonParams, providerParameters), buildRequestContext);
throwFailure(result);
return payloadSerializer.deserialize(result.getResult());
} finally {
progressListenerConfiguration.failsafeWrapper.rethrowErrors();
}
}
Aggregations