Search in sources :

Example 11 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 1.8-rc-1 to 2.0
 */
public <T> BuildResult<T> run(InternalBuildAction<T> action, BuildParameters operationParameters) throws BuildExceptionVersion1, InternalUnsupportedBuildArgumentException, IllegalStateException {
    ProviderOperationParameters providerParameters = validateAndConvert(operationParameters);
    Object results = connection.run(action, new DefaultBuildCancellationToken(), providerParameters);
    return new ProviderBuildResult<T>((T) results);
}
Also used : DefaultBuildCancellationToken(org.gradle.initialization.DefaultBuildCancellationToken) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) ProviderBuildResult(org.gradle.tooling.internal.provider.connection.ProviderBuildResult)

Example 12 with ProviderOperationParameters

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

the class ProviderConnection method run.

public Object run(String modelName, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    List<String> tasks = providerParameters.getTasks();
    if (modelName.equals(ModelIdentifier.NULL_MODEL) && tasks == null) {
        throw new IllegalArgumentException("No model type or tasks specified.");
    }
    Parameters params = initParams(providerParameters);
    Class<?> type = new ModelMapping().getProtocolTypeFromModelName(modelName);
    if (type == InternalBuildEnvironment.class) {
        // we don't really need to launch the daemon to acquire information needed for BuildEnvironment
        if (tasks != null) {
            throw new IllegalArgumentException("Cannot run tasks and fetch the build environment model.");
        }
        return new DefaultBuildEnvironment(new DefaultBuildIdentifier(providerParameters.getProjectDir()), params.gradleUserhome, GradleVersion.current().getVersion(), params.daemonParams.getEffectiveJvm().getJavaHome(), params.daemonParams.getEffectiveJvmArgs());
    }
    StartParameterInternal startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
    BuildAction action = new BuildModelAction(startParameter, modelName, tasks != null, listenerConfig.clientSubscriptions);
    return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
Also used : DefaultBuildEnvironment(org.gradle.tooling.internal.build.DefaultBuildEnvironment) ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) ModelMapping(org.gradle.tooling.internal.consumer.versioning.ModelMapping) DefaultBuildIdentifier(org.gradle.tooling.internal.gradle.DefaultBuildIdentifier) StartParameterInternal(org.gradle.api.internal.StartParameterInternal) InternalBuildAction(org.gradle.tooling.internal.protocol.InternalBuildAction) BuildAction(org.gradle.internal.invocation.BuildAction)

Example 13 with ProviderOperationParameters

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

the class ProviderConnection method runTests.

public Object runTests(ProviderInternalTestExecutionRequest testExecutionRequest, BuildCancellationToken cancellationToken, ProviderOperationParameters providerParameters) {
    Parameters params = initParams(providerParameters);
    StartParameterInternal startParameter = new ProviderStartParameterConverter().toStartParameter(providerParameters, params.properties);
    ProgressListenerConfiguration listenerConfig = ProgressListenerConfiguration.from(providerParameters);
    TestExecutionRequestAction action = TestExecutionRequestAction.create(listenerConfig.clientSubscriptions, startParameter, testExecutionRequest);
    return run(action, cancellationToken, listenerConfig, providerParameters, params);
}
Also used : ProviderConnectionParameters(org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) ProviderOperationParameters(org.gradle.tooling.internal.provider.connection.ProviderOperationParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) BuildActionParameters(org.gradle.launcher.exec.BuildActionParameters) StartParameterInternal(org.gradle.api.internal.StartParameterInternal)

Aggregations

ProviderOperationParameters (org.gradle.tooling.internal.provider.connection.ProviderOperationParameters)13 DefaultBuildCancellationToken (org.gradle.initialization.DefaultBuildCancellationToken)6 ProviderBuildResult (org.gradle.tooling.internal.provider.connection.ProviderBuildResult)6 BuildLayoutParameters (org.gradle.initialization.BuildLayoutParameters)5 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)5 BuildActionParameters (org.gradle.launcher.exec.BuildActionParameters)5 ProviderConnectionParameters (org.gradle.tooling.internal.provider.connection.ProviderConnectionParameters)5 BuildCancellationToken (org.gradle.initialization.BuildCancellationToken)4 StartParameterInternal (org.gradle.api.internal.StartParameterInternal)3 BuildAction (org.gradle.internal.invocation.BuildAction)3 InternalBuildAction (org.gradle.tooling.internal.protocol.InternalBuildAction)3 SerializedPayload (org.gradle.tooling.internal.provider.serialization.SerializedPayload)2 File (java.io.File)1 HashMap (java.util.HashMap)1 StartParameter (org.gradle.StartParameter)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