use of org.gradle.tooling.provider.model.ToolingModelBuilder 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);
}
use of org.gradle.tooling.provider.model.ToolingModelBuilder in project gradle by gradle.
the class DefaultBuildController method getToolingModelBuilder.
private ToolingModelBuilder getToolingModelBuilder(ProjectInternal project, ModelIdentifier modelIdentifier) {
ToolingModelBuilderRegistry modelBuilderRegistry = project.getServices().get(ToolingModelBuilderRegistry.class);
ToolingModelBuilder builder;
try {
builder = modelBuilderRegistry.getBuilder(modelIdentifier.getName());
} catch (UnknownModelException e) {
throw (InternalUnsupportedModelException) (new InternalUnsupportedModelException()).initCause(e);
}
return builder;
}
Aggregations