org.gradle.tooling.provider.model.ToolingModelBuilder Java Examples
The following examples show how to use
org.gradle.tooling.provider.model.ToolingModelBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultToolingModelBuilderRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public ToolingModelBuilder getBuilder(String modelName) throws UnsupportedOperationException { ToolingModelBuilder match = null; for (ToolingModelBuilder builder : builders) { if (builder.canBuild(modelName)) { if (match != null) { throw new UnsupportedOperationException(String.format("Multiple builders are available to build a model of type '%s'.", modelName)); } match = builder; } } if (match != null) { return match; } throw new UnknownModelException(String.format("No builders are available to build a model of type '%s'.", modelName)); }
Example #2
Source File: DefaultToolingModelBuilderRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public ToolingModelBuilder getBuilder(String modelName) throws UnsupportedOperationException { ToolingModelBuilder match = null; for (ToolingModelBuilder builder : builders) { if (builder.canBuild(modelName)) { if (match != null) { throw new UnsupportedOperationException(String.format("Multiple builders are available to build a model of type '%s'.", modelName)); } match = builder; } } if (match != null) { return match; } throw new UnknownModelException(String.format("No builders are available to build a model of type '%s'.", modelName)); }
Example #3
Source File: DefaultToolingModelBuilderRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public ToolingModelBuilder getBuilder(String modelName) throws UnsupportedOperationException { ToolingModelBuilder match = null; for (ToolingModelBuilder builder : builders) { if (builder.canBuild(modelName)) { if (match != null) { throw new UnsupportedOperationException(String.format("Multiple builders are available to build a model of type '%s'.", modelName)); } match = builder; } } if (match != null) { return match; } throw new UnknownModelException(String.format("No builders are available to build a model of type '%s'.", modelName)); }
Example #4
Source File: DefaultToolingModelBuilderRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public ToolingModelBuilder getBuilder(String modelName) throws UnsupportedOperationException { ToolingModelBuilder match = null; for (ToolingModelBuilder builder : builders) { if (builder.canBuild(modelName)) { if (match != null) { throw new UnsupportedOperationException(String.format("Multiple builders are available to build a model of type '%s'.", modelName)); } match = builder; } } if (match != null) { return match; } throw new UnknownModelException(String.format("No builders are available to build a model of type '%s'.", modelName)); }
Example #5
Source File: DefaultBuildController.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
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())); } ToolingModelBuilderRegistry modelBuilderRegistry; ProjectInternal project; boolean isImplicitProject; if (target == null) { project = gradle.getDefaultProject(); isImplicitProject = true; } else if (target instanceof GradleProjectIdentity) { GradleProjectIdentity gradleProject = (GradleProjectIdentity) target; project = gradle.getRootProject().project(gradleProject.getPath()); isImplicitProject = false; } else { throw new IllegalArgumentException("Don't know how to build models for " + target); } modelBuilderRegistry = project.getServices().get(ToolingModelBuilderRegistry.class); ToolingModelBuilder builder; try { builder = modelBuilderRegistry.getBuilder(modelIdentifier.getName()); } catch (UnknownModelException e) { throw (InternalUnsupportedModelException) (new InternalUnsupportedModelException()).initCause(e); } Object model; if (builder instanceof ProjectSensitiveToolingModelBuilder) { model = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelIdentifier.getName(), project, isImplicitProject); } else { model = builder.buildAll(modelIdentifier.getName(), project); } return new ProviderBuildResult<Object>(model); }
Example #6
Source File: BuildModelAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public BuildActionResult run(BuildController buildController) { GradleInternal gradle = buildController.getGradle(); if (runTasks) { buildController.run(); } else { buildController.configure(); // Currently need to force everything to be configured gradle.getServices().get(ProjectConfigurer.class).configureHierarchy(gradle.getRootProject()); } ToolingModelBuilderRegistry builderRegistry = getToolingModelBuilderRegistry(gradle); ToolingModelBuilder builder; try { builder = builderRegistry.getBuilder(modelName); } catch (UnknownModelException e) { throw (InternalUnsupportedModelException)new InternalUnsupportedModelException().initCause(e); } Object result; if (builder instanceof ProjectSensitiveToolingModelBuilder) { result = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelName, gradle.getDefaultProject(), true); } else { result = builder.buildAll(modelName, gradle.getDefaultProject()); } PayloadSerializer payloadSerializer = gradle.getServices().get(PayloadSerializer.class); return new BuildActionResult(payloadSerializer.serialize(result), null); }
Example #7
Source File: DefaultBuildController.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public BuildResult<?> getModel(Object target, ModelIdentifier modelIdentifier) throws BuildExceptionVersion1, InternalUnsupportedModelException { ToolingModelBuilderRegistry modelBuilderRegistry; ProjectInternal project; boolean isImplicitProject; if (target == null) { project = gradle.getDefaultProject(); isImplicitProject = true; } else if (target instanceof GradleProjectIdentity) { GradleProjectIdentity gradleProject = (GradleProjectIdentity) target; project = gradle.getRootProject().project(gradleProject.getPath()); isImplicitProject = false; } else { throw new IllegalArgumentException("Don't know how to build models for " + target); } modelBuilderRegistry = project.getServices().get(ToolingModelBuilderRegistry.class); ToolingModelBuilder builder; try { builder = modelBuilderRegistry.getBuilder(modelIdentifier.getName()); } catch (UnknownModelException e) { throw (InternalUnsupportedModelException) (new InternalUnsupportedModelException()).initCause(e); } Object model; if (builder instanceof ProjectSensitiveToolingModelBuilder) { model = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelIdentifier.getName(), project, isImplicitProject); } else { model = builder.buildAll(modelIdentifier.getName(), project); } return new ProviderBuildResult<Object>(model); }
Example #8
Source File: DefaultBuildController.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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())); } ToolingModelBuilderRegistry modelBuilderRegistry; ProjectInternal project; boolean isImplicitProject; if (target == null) { project = gradle.getDefaultProject(); isImplicitProject = true; } else if (target instanceof GradleProjectIdentity) { GradleProjectIdentity gradleProject = (GradleProjectIdentity) target; project = gradle.getRootProject().project(gradleProject.getPath()); isImplicitProject = false; } else { throw new IllegalArgumentException("Don't know how to build models for " + target); } modelBuilderRegistry = project.getServices().get(ToolingModelBuilderRegistry.class); ToolingModelBuilder builder; try { builder = modelBuilderRegistry.getBuilder(modelIdentifier.getName()); } catch (UnknownModelException e) { throw (InternalUnsupportedModelException) (new InternalUnsupportedModelException()).initCause(e); } Object model; if (builder instanceof ProjectSensitiveToolingModelBuilder) { model = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelIdentifier.getName(), project, isImplicitProject); } else { model = builder.buildAll(modelIdentifier.getName(), project); } return new ProviderBuildResult<Object>(model); }
Example #9
Source File: BuildModelAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public BuildActionResult run(BuildController buildController) { GradleInternal gradle = buildController.getGradle(); if (runTasks) { buildController.run(); } else { buildController.configure(); // Currently need to force everything to be configured gradle.getServices().get(ProjectConfigurer.class).configureHierarchy(gradle.getRootProject()); } ToolingModelBuilderRegistry builderRegistry = getToolingModelBuilderRegistry(gradle); ToolingModelBuilder builder; try { builder = builderRegistry.getBuilder(modelName); } catch (UnknownModelException e) { throw (InternalUnsupportedModelException)new InternalUnsupportedModelException().initCause(e); } Object result; if (builder instanceof ProjectSensitiveToolingModelBuilder) { result = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelName, gradle.getDefaultProject(), true); } else { result = builder.buildAll(modelName, gradle.getDefaultProject()); } PayloadSerializer payloadSerializer = gradle.getServices().get(PayloadSerializer.class); return new BuildActionResult(payloadSerializer.serialize(result), null); }
Example #10
Source File: DefaultBuildController.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public BuildResult<?> getModel(Object target, ModelIdentifier modelIdentifier) throws BuildExceptionVersion1, InternalUnsupportedModelException { ToolingModelBuilderRegistry modelBuilderRegistry; ProjectInternal project; boolean isImplicitProject; if (target == null) { project = gradle.getDefaultProject(); isImplicitProject = true; } else if (target instanceof GradleProjectIdentity) { GradleProjectIdentity gradleProject = (GradleProjectIdentity) target; project = gradle.getRootProject().project(gradleProject.getPath()); isImplicitProject = false; } else { throw new IllegalArgumentException("Don't know how to build models for " + target); } modelBuilderRegistry = project.getServices().get(ToolingModelBuilderRegistry.class); ToolingModelBuilder builder; try { builder = modelBuilderRegistry.getBuilder(modelIdentifier.getName()); } catch (UnknownModelException e) { throw (InternalUnsupportedModelException) (new InternalUnsupportedModelException()).initCause(e); } Object model; if (builder instanceof ProjectSensitiveToolingModelBuilder) { model = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelIdentifier.getName(), project, isImplicitProject); } else { model = builder.buildAll(modelIdentifier.getName(), project); } return new ProviderBuildResult<Object>(model); }
Example #11
Source File: DefaultToolingModelBuilderRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void register(ToolingModelBuilder builder) { builders.add(builder); }
Example #12
Source File: DefaultToolingModelBuilderRegistry.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void register(ToolingModelBuilder builder) { builders.add(builder); }
Example #13
Source File: DefaultToolingModelBuilderRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void register(ToolingModelBuilder builder) { builders.add(builder); }
Example #14
Source File: DefaultToolingModelBuilderRegistry.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void register(ToolingModelBuilder builder) { builders.add(builder); }