use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier in project gradle by gradle.
the class ToolingModelBuilderSupport method buildFromTask.
public static <T extends LaunchableGradleTask> T buildFromTask(T target, Task task) {
Project project = task.getProject();
target.setPath(task.getPath()).setName(task.getName()).setGroup(task.getGroup()).setDisplayName(task.toString()).setDescription(task.getDescription()).setPublic(PublicTaskSpecification.INSTANCE.isSatisfiedBy(task)).setProjectIdentifier(new DefaultProjectIdentifier(project.getRootDir(), project.getPath()));
return target;
}
use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier in project gradle by gradle.
the class BuildControllerAdapter method getModel.
@Override
public <T, P> T getModel(Model target, Class<T> modelType, Class<P> parameterType, Action<? super P> parameterInitializer) throws UnsupportedVersionException {
ModelIdentifier modelIdentifier = modelMapping.getModelIdentifierFromModelType(modelType);
Object originalTarget = target == null ? null : adapter.unpack(target);
P parameter = initializeParameter(parameterType, parameterInitializer);
BuildResult<?> result;
try {
result = buildController.getModel(originalTarget, modelIdentifier, parameter);
} catch (InternalUnsupportedModelException e) {
throw Exceptions.unknownModel(modelType, e);
}
ViewBuilder<T> viewBuilder = resultAdapter.builder(modelType);
applyCompatibilityMapping(viewBuilder, new DefaultProjectIdentifier(rootDir, getProjectPath(target)));
return viewBuilder.build(result.getModel());
}
Aggregations