Search in sources :

Example 1 with BasicGradleProject

use of org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject in project gradle by gradle.

the class GradleBuildBuilder method addProjects.

private void addProjects(BuildState target, DefaultGradleBuild model) {
    Map<ProjectState, BasicGradleProject> convertedProjects = new LinkedHashMap<>();
    ProjectState rootProject = target.getProjects().getRootProject();
    BasicGradleProject convertedRootProject = convert(target, rootProject, convertedProjects);
    model.setRootProject(convertedRootProject);
    for (ProjectState project : target.getProjects().getAllProjects()) {
        model.addProject(convertedProjects.get(project));
    }
}
Also used : BasicGradleProject(org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject) ProjectState(org.gradle.api.internal.project.ProjectState) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with BasicGradleProject

use of org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject in project gradle by gradle.

the class GradleBuildBuilder method convert.

private BasicGradleProject convert(BuildState owner, ProjectState project, Map<ProjectState, BasicGradleProject> convertedProjects) {
    DefaultProjectIdentifier id = new DefaultProjectIdentifier(owner.getBuildRootDir(), project.getProjectPath().getPath());
    BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setProjectIdentifier(id);
    converted.setProjectDirectory(project.getProjectDir());
    if (project.getBuildParent() != null) {
        converted.setParent(convertedProjects.get(project.getBuildParent()));
    }
    convertedProjects.put(project, converted);
    for (ProjectState child : project.getChildProjects()) {
        converted.addChild(convert(owner, child, convertedProjects));
    }
    return converted;
}
Also used : BasicGradleProject(org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject) ProjectState(org.gradle.api.internal.project.ProjectState) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)

Aggregations

ProjectState (org.gradle.api.internal.project.ProjectState)2 BasicGradleProject (org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject)2 LinkedHashMap (java.util.LinkedHashMap)1 DefaultProjectIdentifier (org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)1