Search in sources :

Example 1 with ConsumerConnection

use of org.gradle.tooling.internal.consumer.connection.ConsumerConnection 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));
}
Also used : ConsumerOperationParameters(org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters) ConsumerConnection(org.gradle.tooling.internal.consumer.connection.ConsumerConnection)

Example 2 with ConsumerConnection

use of org.gradle.tooling.internal.consumer.connection.ConsumerConnection 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));
}
Also used : TestExecutionException(org.gradle.tooling.TestExecutionException) ConsumerOperationParameters(org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters) ConsumerConnection(org.gradle.tooling.internal.consumer.connection.ConsumerConnection)

Example 3 with ConsumerConnection

use of org.gradle.tooling.internal.consumer.connection.ConsumerConnection in project gradle by gradle.

the class CachingToolingImplementationLoader method create.

public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, InternalBuildProgressListener progressListener, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
    ClassPath classpath = distribution.getToolingImplementationClasspath(progressLoggerFactory, progressListener, connectionParameters.getGradleUserHomeDir(), cancellationToken);
    ConsumerConnection connection = connections.get(classpath);
    if (connection == null) {
        connection = loader.create(distribution, progressLoggerFactory, progressListener, connectionParameters, cancellationToken);
        connections.put(classpath, connection);
    }
    return connection;
}
Also used : ClassPath(org.gradle.internal.classpath.ClassPath) ConsumerConnection(org.gradle.tooling.internal.consumer.connection.ConsumerConnection)

Example 4 with ConsumerConnection

use of org.gradle.tooling.internal.consumer.connection.ConsumerConnection 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());
        }
    })));
}
Also used : ConsumerOperationParameters(org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters) ConsumerConnection(org.gradle.tooling.internal.consumer.connection.ConsumerConnection)

Example 5 with ConsumerConnection

use of org.gradle.tooling.internal.consumer.connection.ConsumerConnection in project gradle by gradle.

the class DefaultModelBuilder method get.

public void get(final 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 model = connection.run(modelType, operationParameters);
            return model;
        }
    }, new ResultHandlerAdapter<T>(handler));
}
Also used : ConsumerOperationParameters(org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters) ConsumerConnection(org.gradle.tooling.internal.consumer.connection.ConsumerConnection)

Aggregations

ConsumerConnection (org.gradle.tooling.internal.consumer.connection.ConsumerConnection)5 ConsumerOperationParameters (org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters)4 ClassPath (org.gradle.internal.classpath.ClassPath)1 TestExecutionException (org.gradle.tooling.TestExecutionException)1