Search in sources :

Example 1 with PartialBasicGradleProject

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

the class GradleBuildConverter method toPartialGradleProject.

private PartialBasicGradleProject toPartialGradleProject(GradleProject childProject) {
    PartialBasicGradleProject basicGradleProject = new PartialBasicGradleProject();
    basicGradleProject.setName(childProject.getName());
    ProjectIdentifier id = childProject.getProjectIdentifier();
    basicGradleProject.setProjectIdentifier(new DefaultProjectIdentifier(id.getBuildIdentifier().getRootDir(), id.getProjectPath()));
    return basicGradleProject;
}
Also used : ProjectIdentifier(org.gradle.tooling.model.ProjectIdentifier) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier) PartialBasicGradleProject(org.gradle.tooling.internal.gradle.PartialBasicGradleProject) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)

Example 2 with PartialBasicGradleProject

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

the class GradleBuildConverter method convert.

public DefaultGradleBuild convert(GradleProject project) {
    DefaultGradleBuild gradleBuild = new DefaultGradleBuild();
    PartialBasicGradleProject rootProject = toPartialGradleProject(project);
    gradleBuild.setRootProject(rootProject);
    gradleBuild.addProject(rootProject);
    convertChildren(gradleBuild, rootProject, project);
    return gradleBuild;
}
Also used : DefaultGradleBuild(org.gradle.tooling.internal.gradle.DefaultGradleBuild) PartialBasicGradleProject(org.gradle.tooling.internal.gradle.PartialBasicGradleProject)

Example 3 with PartialBasicGradleProject

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

the class GradleBuildConverter method convertChildren.

private void convertChildren(DefaultGradleBuild gradleBuild, PartialBasicGradleProject rootProject, GradleProject project) {
    final List<? extends GradleProject> childProjects = new ArrayList<GradleProject>(project.getChildren());
    Collections.sort(childProjects, new Comparator<GradleProject>() {

        public int compare(GradleProject gp1, GradleProject gp2) {
            return gp1.getName().compareTo(gp2.getName());
        }
    });
    for (GradleProject childProject : childProjects) {
        PartialBasicGradleProject basicGradleProject = toPartialGradleProject(childProject);
        gradleBuild.addProject(basicGradleProject);
        basicGradleProject.setParent(rootProject);
        rootProject.addChild(basicGradleProject);
        convertChildren(gradleBuild, basicGradleProject, childProject);
    }
}
Also used : ArrayList(java.util.ArrayList) PartialBasicGradleProject(org.gradle.tooling.internal.gradle.PartialBasicGradleProject) GradleProject(org.gradle.tooling.model.GradleProject) PartialBasicGradleProject(org.gradle.tooling.internal.gradle.PartialBasicGradleProject)

Aggregations

PartialBasicGradleProject (org.gradle.tooling.internal.gradle.PartialBasicGradleProject)3 ArrayList (java.util.ArrayList)1 DefaultGradleBuild (org.gradle.tooling.internal.gradle.DefaultGradleBuild)1 DefaultProjectIdentifier (org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)1 GradleProject (org.gradle.tooling.model.GradleProject)1 ProjectIdentifier (org.gradle.tooling.model.ProjectIdentifier)1