Search in sources :

Example 6 with DefaultProjectIdentifier

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;
}
Also used : Project(org.gradle.api.Project) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)

Example 7 with DefaultProjectIdentifier

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());
}
Also used : InternalUnsupportedModelException(org.gradle.tooling.internal.protocol.InternalUnsupportedModelException) ModelIdentifier(org.gradle.tooling.internal.protocol.ModelIdentifier) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)

Aggregations

DefaultProjectIdentifier (org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)7 Project (org.gradle.api.Project)3 LaunchableGradleTask (org.gradle.plugins.ide.internal.tooling.model.LaunchableGradleTask)2 InternalUnsupportedModelException (org.gradle.tooling.internal.protocol.InternalUnsupportedModelException)2 ModelIdentifier (org.gradle.tooling.internal.protocol.ModelIdentifier)2 ArrayList (java.util.ArrayList)1 GradleException (org.gradle.api.GradleException)1 TaskContainerInternal (org.gradle.api.internal.tasks.TaskContainerInternal)1 DefaultBuildInvocations (org.gradle.plugins.ide.internal.tooling.model.DefaultBuildInvocations)1 LaunchableGradleTaskSelector (org.gradle.plugins.ide.internal.tooling.model.LaunchableGradleTaskSelector)1 BasicGradleProject (org.gradle.tooling.internal.gradle.BasicGradleProject)1 DefaultGradleProject (org.gradle.tooling.internal.gradle.DefaultGradleProject)1 PartialBasicGradleProject (org.gradle.tooling.internal.gradle.PartialBasicGradleProject)1 ProjectIdentifier (org.gradle.tooling.model.ProjectIdentifier)1