Search in sources :

Example 1 with GradleProjectIdentity

use of org.gradle.tooling.internal.gradle.GradleProjectIdentity in project gradle by gradle.

the class DefaultBuildController method getTargetProject.

private ProjectInternal getTargetProject(Object target) {
    ProjectInternal project;
    if (target == null) {
        project = gradle.getDefaultProject();
    } else if (target instanceof GradleProjectIdentity) {
        GradleProjectIdentity projectIdentity = (GradleProjectIdentity) target;
        GradleInternal build = findBuild(projectIdentity);
        project = findProject(build, projectIdentity);
    } else if (target instanceof GradleBuildIdentity) {
        GradleBuildIdentity buildIdentity = (GradleBuildIdentity) target;
        project = findBuild(buildIdentity).getDefaultProject();
    } else {
        throw new IllegalArgumentException("Don't know how to build models for " + target);
    }
    return project;
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal) GradleBuildIdentity(org.gradle.tooling.internal.gradle.GradleBuildIdentity) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) GradleProjectIdentity(org.gradle.tooling.internal.gradle.GradleProjectIdentity)

Example 2 with GradleProjectIdentity

use of org.gradle.tooling.internal.gradle.GradleProjectIdentity in project gradle by gradle.

the class DefaultBuildController method getTarget.

private ToolingModelScope getTarget(@Nullable Object target, ModelIdentifier modelIdentifier, boolean parameter) {
    if (target == null) {
        return controller.locateBuilderForDefaultTarget(modelIdentifier.getName(), parameter);
    } else if (target instanceof GradleProjectIdentity) {
        GradleProjectIdentity projectIdentity = (GradleProjectIdentity) target;
        BuildState build = findBuild(projectIdentity);
        ProjectState project = findProject(build, projectIdentity);
        return controller.locateBuilderForTarget(project, modelIdentifier.getName(), parameter);
    } else if (target instanceof GradleBuildIdentity) {
        GradleBuildIdentity buildIdentity = (GradleBuildIdentity) target;
        BuildState build = findBuild(buildIdentity);
        return controller.locateBuilderForTarget(build, modelIdentifier.getName(), parameter);
    } else {
        throw new IllegalArgumentException("Don't know how to build models for " + target);
    }
}
Also used : GradleBuildIdentity(org.gradle.tooling.internal.gradle.GradleBuildIdentity) GradleProjectIdentity(org.gradle.tooling.internal.gradle.GradleProjectIdentity) ProjectState(org.gradle.api.internal.project.ProjectState) BuildState(org.gradle.internal.build.BuildState)

Aggregations

GradleBuildIdentity (org.gradle.tooling.internal.gradle.GradleBuildIdentity)2 GradleProjectIdentity (org.gradle.tooling.internal.gradle.GradleProjectIdentity)2 GradleInternal (org.gradle.api.internal.GradleInternal)1 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 ProjectState (org.gradle.api.internal.project.ProjectState)1 BuildState (org.gradle.internal.build.BuildState)1