use of org.gradle.tooling.internal.protocol.InternalBuildCancelledException in project gradle by gradle.
the class ClientProvidedBuildActionRunner method buildResult.
@SuppressWarnings("deprecation")
private BuildActionResult buildResult(Object clientAction, GradleInternal gradle) {
forceFullConfiguration(gradle);
DefaultBuildController internalBuildController = new DefaultBuildController(gradle);
Object model = null;
Throwable failure = null;
try {
if (clientAction instanceof InternalBuildActionVersion2<?>) {
model = ((InternalBuildActionVersion2) clientAction).execute(internalBuildController);
} else {
model = ((org.gradle.tooling.internal.protocol.InternalBuildAction) clientAction).execute(internalBuildController);
}
} catch (BuildCancelledException e) {
failure = new InternalBuildCancelledException(e);
} catch (RuntimeException e) {
failure = new InternalBuildActionFailureException(e);
}
PayloadSerializer payloadSerializer = getPayloadSerializer(gradle);
if (failure != null) {
return new BuildActionResult(null, payloadSerializer.serialize(failure));
} else {
return new BuildActionResult(payloadSerializer.serialize(model), null);
}
}
use of org.gradle.tooling.internal.protocol.InternalBuildCancelledException in project gradle by gradle.
the class ClientProvidedBuildActionRunner method buildResult.
private BuildActionResult buildResult(InternalBuildAction<?> clientAction, GradleInternal gradle, boolean isRunTasks) {
if (!isRunTasks) {
forceFullConfiguration(gradle);
}
InternalBuildController internalBuildController = new DefaultBuildController(gradle);
Object model = null;
Throwable failure = null;
try {
model = clientAction.execute(internalBuildController);
} catch (BuildCancelledException e) {
failure = new InternalBuildCancelledException(e);
} catch (RuntimeException e) {
failure = new InternalBuildActionFailureException(e);
}
PayloadSerializer payloadSerializer = getPayloadSerializer(gradle);
if (failure != null) {
return new BuildActionResult(null, payloadSerializer.serialize(failure));
} else {
return new BuildActionResult(payloadSerializer.serialize(model), null);
}
}
use of org.gradle.tooling.internal.protocol.InternalBuildCancelledException in project gradle by gradle.
the class ClientProvidedBuildActionRunner method forceFullConfiguration.
private void forceFullConfiguration(GradleInternal gradle) {
try {
gradle.getServices().get(ProjectConfigurer.class).configureHierarchyFully(gradle.getRootProject());
for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
GradleInternal build = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
forceFullConfiguration(build);
}
} catch (BuildCancelledException e) {
throw new InternalBuildCancelledException(e);
} catch (RuntimeException e) {
throw new BuildExceptionVersion1(e);
}
}
use of org.gradle.tooling.internal.protocol.InternalBuildCancelledException in project gradle by gradle.
the class DaemonBuildActionExecuter method execute.
public Object execute(BuildAction action, BuildRequestContext buildRequestContext, ProviderOperationParameters parameters, ServiceRegistry contextServices) {
boolean continuous = action.getStartParameter() != null && action.getStartParameter().isContinuous() && isNotBuildingModel(action);
if (continuous && !doesConsumerSupportCancellation(buildRequestContext)) {
throw new UnsupportedVersionException("Continuous build requires Tooling API client version 2.1 or later.");
}
ClassPath classPath = DefaultClassPath.of(parameters.getInjectedPluginClasspath(Collections.<File>emptyList()));
BuildActionParameters actionParameters = new DefaultBuildActionParameters(daemonParameters.getEffectiveSystemProperties(), daemonParameters.getEnvironmentVariables(), SystemProperties.getInstance().getCurrentDir(), parameters.getBuildLogLevel(), daemonParameters.isEnabled(), continuous, false, classPath);
try {
return executer.execute(action, buildRequestContext, actionParameters, contextServices);
} catch (ReportedException e) {
Throwable t = e.getCause();
// Unpack tunnelled test request failure
if (t instanceof InternalTestExecutionException) {
throw (InternalTestExecutionException) t;
}
while (t != null) {
if (t instanceof BuildCancelledException) {
throw new InternalBuildCancelledException(e.getCause());
}
t = t.getCause();
}
throw new BuildExceptionVersion1(e.getCause());
}
}
Aggregations