Search in sources :

Example 1 with ProviderOperationParameters

use of org.gradle.tooling.internal.provider.connection.ProviderOperationParameters in project gradle by gradle.

the class DefaultConnection method getModel.

/**
     * This is used by consumers 1.6-rc-1 to 2.0
     */
public BuildResult<?> getModel(ModelIdentifier modelIdentifier, BuildParameters operationParameters) throws UnsupportedOperationException, IllegalStateException {
    ProviderOperationParameters providerParameters = validateAndConvert(operationParameters);
    Object result = connection.run(modelIdentifier.getName(), new DefaultBuildCancellationToken(), providerParameters);
    return new ProviderBuildResult<Object>(result);
}
Also used : DefaultBuildCancellationToken(org.gradle.initialization.DefaultBuildCancellationToken) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) ProviderBuildResult(org.gradle.tooling.internal.provider.connection.ProviderBuildResult)

Example 2 with ProviderOperationParameters

use of org.gradle.tooling.internal.provider.connection.ProviderOperationParameters in project gradle by gradle.

the class DefaultConnection method run.

/**
     * This is used by consumers 2.1-rc-1 and later.
     */
public <T> BuildResult<T> run(InternalBuildAction<T> action, InternalCancellationToken cancellationToken, BuildParameters operationParameters) throws BuildExceptionVersion1, InternalUnsupportedBuildArgumentException, IllegalStateException {
    ProviderOperationParameters providerParameters = validateAndConvert(operationParameters);
    BuildCancellationToken buildCancellationToken = new InternalCancellationTokenAdapter(cancellationToken);
    Object results = connection.run(action, buildCancellationToken, providerParameters);
    return new ProviderBuildResult<T>((T) results);
}
Also used : ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) ProviderBuildResult(org.gradle.tooling.internal.provider.connection.ProviderBuildResult) DefaultBuildCancellationToken(org.gradle.initialization.DefaultBuildCancellationToken) BuildCancellationToken(org.gradle.initialization.BuildCancellationToken)

Example 3 with ProviderOperationParameters

use of org.gradle.tooling.internal.provider.connection.ProviderOperationParameters in project gradle by gradle.

the class DefaultConnection method runTests.

/**
     * This is used by consumers 2.6-rc-1 and later
     */
public BuildResult<?> runTests(InternalTestExecutionRequest testExecutionRequest, InternalCancellationToken cancellationToken, BuildParameters operationParameters) throws BuildExceptionVersion1, InternalUnsupportedBuildArgumentException, IllegalStateException {
    ProviderOperationParameters providerParameters = validateAndConvert(operationParameters);
    ProviderInternalTestExecutionRequest testExecutionRequestVersion2 = adapter.adapt(ProviderInternalTestExecutionRequest.class, testExecutionRequest);
    BuildCancellationToken buildCancellationToken = new InternalCancellationTokenAdapter(cancellationToken);
    Object results = connection.runTests(testExecutionRequestVersion2, buildCancellationToken, providerParameters);
    return new ProviderBuildResult<Object>(results);
}
Also used : ProviderInternalTestExecutionRequest(org.gradle.tooling.internal.provider.test.ProviderInternalTestExecutionRequest) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) ProviderBuildResult(org.gradle.tooling.internal.provider.connection.ProviderBuildResult) DefaultBuildCancellationToken(org.gradle.initialization.DefaultBuildCancellationToken) BuildCancellationToken(org.gradle.initialization.BuildCancellationToken)

Example 4 with ProviderOperationParameters

use of org.gradle.tooling.internal.provider.connection.ProviderOperationParameters 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();
    }
}
Also used : DefaultBuildRequestContext(org.gradle.initialization.DefaultBuildRequestContext) DefaultBuildRequestMetaData(org.gradle.initialization.DefaultBuildRequestMetaData) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DefaultBuildRequestContext(org.gradle.initialization.DefaultBuildRequestContext) BuildRequestContext(org.gradle.initialization.BuildRequestContext)

Example 5 with ProviderOperationParameters

use of org.gradle.tooling.internal.provider.connection.ProviderOperationParameters in project gradle by gradle.

the class ProviderConnection method run.

public Object run(InternalBuildAction<?> clientAction, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    List<String> tasks = providerParameters.getTasks();
    SerializedPayload serializedAction = payloadSerializer.serialize(clientAction);
    Parameters params = initParams(providerParameters);
    StartParameter startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
    BuildAction action = new ClientProvidedBuildAction(startParameter, serializedAction, tasks != null, listenerConfig.clientSubscriptions);
    return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
Also used : SerializedPayload(org.gradle.tooling.internal.provider.serialization.SerializedPayload) StartParameter(org.gradle.StartParameter) ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) InternalBuildAction(org.gradle.tooling.internal.protocol.InternalBuildAction) BuildAction(org.gradle.internal.invocation.BuildAction)

Aggregations

ProviderOperationParameters (org.gradle.tooling.internal.provider.connection.ProviderOperationParameters)10 DefaultBuildCancellationToken (org.gradle.initialization.DefaultBuildCancellationToken)5 ProviderBuildResult (org.gradle.tooling.internal.provider.connection.ProviderBuildResult)5 BuildLayoutParameters (org.gradle.initialization.BuildLayoutParameters)4 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)4 BuildActionParameters (org.gradle.launcher.exec.BuildActionParameters)4 ProviderConnectionParameters (org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters)4 StartParameter (org.gradle.StartParameter)3 BuildCancellationToken (org.gradle.initialization.BuildCancellationToken)3 BuildAction (org.gradle.internal.invocation.BuildAction)2 InternalBuildAction (org.gradle.tooling.internal.protocol.InternalBuildAction)2 File (java.io.File)1 HashMap (java.util.HashMap)1 BuildRequestContext (org.gradle.initialization.BuildRequestContext)1 DefaultBuildRequestContext (org.gradle.initialization.DefaultBuildRequestContext)1 DefaultBuildRequestMetaData (org.gradle.initialization.DefaultBuildRequestMetaData)1 LayoutToPropertiesConverter (org.gradle.launcher.cli.converter.LayoutToPropertiesConverter)1 PropertiesToDaemonParametersConverter (org.gradle.launcher.cli.converter.PropertiesToDaemonParametersConverter)1 DefaultBuildEnvironment (org.gradle.tooling.internal.build.DefaultBuildEnvironment)1 ModelMapping (org.gradle.tooling.internal.consumer.versioning.ModelMapping)1