Search in sources :

Example 1 with ProviderBuildResult

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

the class DefaultBuildController method getModel.

public BuildResult<?> getModel(Object target, ModelIdentifier modelIdentifier) throws BuildExceptionVersion1, InternalUnsupportedModelException {
    BuildCancellationToken cancellationToken = gradle.getServices().get(BuildCancellationToken.class);
    if (cancellationToken.isCancellationRequested()) {
        throw new BuildCancelledException(String.format("Could not build '%s' model. Build cancelled.", modelIdentifier.getName()));
    }
    ProjectInternal project = getTargetProject(target);
    ToolingModelBuilder builder = getToolingModelBuilder(project, modelIdentifier);
    Object model = builder.buildAll(modelIdentifier.getName(), project);
    return new ProviderBuildResult<Object>(model);
}
Also used : ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ProviderBuildResult(org.gradle.tooling.internal.provider.connection.ProviderBuildResult) BuildCancellationToken(org.gradle.initialization.BuildCancellationToken) ToolingModelBuilder(org.gradle.tooling.provider.model.ToolingModelBuilder) BuildCancelledException(org.gradle.api.BuildCancelledException)

Example 2 with ProviderBuildResult

use of org.gradle.tooling.internal.provider.connection.ProviderBuildResult 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 3 with ProviderBuildResult

use of org.gradle.tooling.internal.provider.connection.ProviderBuildResult 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 4 with ProviderBuildResult

use of org.gradle.tooling.internal.provider.connection.ProviderBuildResult 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 5 with ProviderBuildResult

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

the class DefaultConnection method getModel.

/**
     * This is used by consumers 2.1-rc-1 and later
     */
public BuildResult<?> getModel(ModelIdentifier modelIdentifier, InternalCancellationToken cancellationToken, BuildParameters operationParameters) throws BuildExceptionVersion1, InternalUnsupportedModelException, InternalUnsupportedBuildArgumentException, IllegalStateException {
    ProviderOperationParameters providerParameters = validateAndConvert(operationParameters);
    BuildCancellationToken buildCancellationToken = new InternalCancellationTokenAdapter(cancellationToken);
    Object result = connection.run(modelIdentifier.getName(), buildCancellationToken, providerParameters);
    return new ProviderBuildResult<Object>(result);
}
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)

Aggregations

ProviderBuildResult (org.gradle.tooling.internal.provider.connection.ProviderBuildResult)6 DefaultBuildCancellationToken (org.gradle.initialization.DefaultBuildCancellationToken)5 ProviderOperationParameters (org.gradle.tooling.internal.provider.connection.ProviderOperationParameters)5 BuildCancellationToken (org.gradle.initialization.BuildCancellationToken)4 BuildCancelledException (org.gradle.api.BuildCancelledException)1 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 ProviderInternalTestExecutionRequest (org.gradle.tooling.internal.provider.test.ProviderInternalTestExecutionRequest)1 ToolingModelBuilder (org.gradle.tooling.provider.model.ToolingModelBuilder)1