use of org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters in project gradle by gradle.
the class DefaultBuildLauncher method run.
public void run(final ResultHandler<? super Void> handler) {
final ConsumerOperationParameters operationParameters = getConsumerOperationParameters();
connection.run(new ConsumerAction<Void>() {
public ConsumerOperationParameters getParameters() {
return operationParameters;
}
public Void run(ConsumerConnection connection) {
Void sink = connection.run(Void.class, operationParameters);
return sink;
}
}, new ResultHandlerAdapter(handler));
}
use of org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters in project gradle by gradle.
the class DefaultTestLauncher method run.
public void run(final ResultHandler<? super Void> handler) {
if (operationDescriptors.isEmpty() && internalJvmTestRequests.isEmpty()) {
throw new TestExecutionException("No test declared for execution.");
}
final ConsumerOperationParameters operationParameters = getConsumerOperationParameters();
final TestExecutionRequest testExecutionRequest = new TestExecutionRequest(operationDescriptors, ImmutableList.copyOf(testClassNames), ImmutableSet.copyOf(internalJvmTestRequests));
connection.run(new ConsumerAction<Void>() {
public ConsumerOperationParameters getParameters() {
return operationParameters;
}
public Void run(ConsumerConnection connection) {
connection.runTests(testExecutionRequest, getParameters());
return null;
}
}, new ResultHandlerAdapter(handler));
}
use of org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters in project gradle by gradle.
the class LazyConsumerActionExecutor method run.
public <T> T run(ConsumerAction<T> action) throws UnsupportedOperationException, IllegalStateException {
try {
ConsumerOperationParameters parameters = action.getParameters();
BuildCancellationToken cancellationToken = parameters.getCancellationToken();
InternalBuildProgressListener buildProgressListener = parameters.getBuildProgressListener();
ConsumerConnection connection = onStartAction(cancellationToken, buildProgressListener);
return action.run(connection);
} finally {
onEndAction();
}
}
use of org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters in project gradle by gradle.
the class ProgressLoggingConsumerActionExecutor method run.
public <T> T run(ConsumerAction<T> action) throws UnsupportedOperationException, IllegalStateException {
ConsumerOperationParameters parameters = action.getParameters();
ProgressListenerAdapter listener = new ProgressListenerAdapter(parameters.getProgressListener());
ListenerManager listenerManager = loggingProvider.getListenerManager();
listenerManager.addListener(listener);
try {
ProgressLogger progressLogger = loggingProvider.getProgressLoggerFactory().newOperation(ProgressLoggingConsumerActionExecutor.class);
progressLogger.setDescription("Build");
progressLogger.started();
try {
return actionExecutor.run(action);
} finally {
progressLogger.completed();
}
} finally {
listenerManager.removeListener(listener);
}
}
use of org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters in project gradle by gradle.
the class DefaultBuildActionExecuter method run.
public void run(ResultHandler<? super T> handler) throws IllegalStateException {
final ConsumerOperationParameters operationParameters = getConsumerOperationParameters();
connection.run(new ConsumerAction<T>() {
public ConsumerOperationParameters getParameters() {
return operationParameters;
}
public T run(ConsumerConnection connection) {
T result = connection.run(buildAction, operationParameters);
return result;
}
}, new ResultHandlerAdapter<T>(handler, new ExceptionTransformer(new Transformer<String, Throwable>() {
@Override
public String transform(Throwable throwable) {
return String.format("Could not run build action using %s.", connection.getDisplayName());
}
})));
}
Aggregations