Search in sources :

Example 1 with IncludedBuildInternal

use of org.gradle.internal.composite.IncludedBuildInternal in project gradle by gradle.

the class GradleBuildBuilder method addIncludedBuilds.

private void addIncludedBuilds(GradleInternal gradle, DefaultGradleBuild model, Map<BuildState, DefaultGradleBuild> all) {
    for (IncludedBuildInternal reference : gradle.includedBuilds()) {
        BuildState target = reference.getTarget();
        if (target instanceof IncludedBuildState) {
            IncludedBuildState includedBuildState = (IncludedBuildState) target;
            DefaultGradleBuild convertedIncludedBuild = convert(includedBuildState, all);
            model.addIncludedBuild(convertedIncludedBuild);
        } else if (target instanceof RootBuildState) {
            DefaultGradleBuild rootBuild = convert(target, all);
            model.addIncludedBuild(rootBuild);
        } else {
            throw new IllegalStateException("Unknown build type: " + reference.getClass().getName());
        }
    }
}
Also used : IncludedBuildInternal(org.gradle.internal.composite.IncludedBuildInternal) RootBuildState(org.gradle.internal.build.RootBuildState) DefaultGradleBuild(org.gradle.plugins.ide.internal.tooling.model.DefaultGradleBuild) IncludedBuildState(org.gradle.internal.build.IncludedBuildState) BuildState(org.gradle.internal.build.BuildState) RootBuildState(org.gradle.internal.build.RootBuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Example 2 with IncludedBuildInternal

use of org.gradle.internal.composite.IncludedBuildInternal in project gradle by gradle.

the class IdeaModelBuilder method applyIdeaPlugin.

private void applyIdeaPlugin(ProjectInternal root, List<GradleInternal> alreadyProcessed) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPluginManager().apply(IdeaPlugin.class);
    }
    for (IncludedBuildInternal reference : root.getGradle().includedBuilds()) {
        BuildState target = reference.getTarget();
        if (target instanceof IncludedBuildState) {
            target.ensureProjectsConfigured();
            GradleInternal build = target.getMutableModel();
            if (!alreadyProcessed.contains(build)) {
                alreadyProcessed.add(build);
                applyIdeaPlugin(build.getRootProject(), alreadyProcessed);
            }
        }
    }
}
Also used : IdeaProject(org.gradle.plugins.ide.idea.model.IdeaProject) Project(org.gradle.api.Project) DefaultIdeaProject(org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaProject) DefaultGradleProject(org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject) IncludedBuildInternal(org.gradle.internal.composite.IncludedBuildInternal) GradleInternal(org.gradle.api.internal.GradleInternal) IncludedBuildState(org.gradle.internal.build.IncludedBuildState) BuildState(org.gradle.internal.build.BuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Example 3 with IncludedBuildInternal

use of org.gradle.internal.composite.IncludedBuildInternal in project gradle by gradle.

the class EclipseModelBuilder method collectAllProjects.

private List<Project> collectAllProjects(List<Project> all, GradleInternal gradle, Set<Gradle> allBuilds) {
    all.addAll(gradle.getRootProject().getAllprojects());
    for (IncludedBuildInternal reference : gradle.includedBuilds()) {
        BuildState target = reference.getTarget();
        if (target instanceof IncludedBuildState) {
            target.ensureProjectsConfigured();
            GradleInternal build = target.getMutableModel();
            if (!allBuilds.contains(build)) {
                allBuilds.add(build);
                collectAllProjects(all, build, allBuilds);
            }
        }
    }
    return all;
}
Also used : IncludedBuildInternal(org.gradle.internal.composite.IncludedBuildInternal) GradleInternal(org.gradle.api.internal.GradleInternal) IncludedBuildState(org.gradle.internal.build.IncludedBuildState) BuildState(org.gradle.internal.build.BuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Example 4 with IncludedBuildInternal

use of org.gradle.internal.composite.IncludedBuildInternal in project gradle by gradle.

the class EclipseModelBuilder method applyEclipsePlugin.

private void applyEclipsePlugin(ProjectInternal root, List<GradleInternal> alreadyProcessed) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPluginManager().apply(EclipsePlugin.class);
    }
    for (IncludedBuildInternal reference : root.getGradle().includedBuilds()) {
        BuildState target = reference.getTarget();
        if (target instanceof IncludedBuildState) {
            target.ensureProjectsConfigured();
            GradleInternal build = target.getMutableModel();
            if (!alreadyProcessed.contains(build)) {
                alreadyProcessed.add(build);
                applyEclipsePlugin(build.getRootProject(), alreadyProcessed);
            }
        }
    }
}
Also used : Project(org.gradle.api.Project) EclipseWorkspaceProject(org.gradle.tooling.model.eclipse.EclipseWorkspaceProject) DefaultGradleProject(org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject) DefaultEclipseProject(org.gradle.plugins.ide.internal.tooling.eclipse.DefaultEclipseProject) IncludedBuildInternal(org.gradle.internal.composite.IncludedBuildInternal) GradleInternal(org.gradle.api.internal.GradleInternal) IncludedBuildState(org.gradle.internal.build.IncludedBuildState) BuildState(org.gradle.internal.build.BuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Example 5 with IncludedBuildInternal

use of org.gradle.internal.composite.IncludedBuildInternal in project gradle by gradle.

the class DefaultIncludedBuildRegistry method ensureConfigured.

@Override
public void ensureConfigured(IncludedBuildState buildToConfigure) {
    if (currentlyConfiguring.contains(buildToConfigure)) {
        return;
    }
    currentlyConfiguring.add(buildToConfigure);
    buildToConfigure.ensureProjectsConfigured();
    GradleInternal gradle = buildToConfigure.getMutableModel();
    for (IncludedBuildInternal reference : gradle.includedBuilds()) {
        BuildState target = reference.getTarget();
        if (target instanceof IncludedBuildState) {
            dependencySubstitutionsBuilder.build((IncludedBuildState) target);
        }
    }
    currentlyConfiguring.remove(buildToConfigure);
}
Also used : IncludedBuildInternal(org.gradle.internal.composite.IncludedBuildInternal) GradleInternal(org.gradle.api.internal.GradleInternal) IncludedBuildState(org.gradle.internal.build.IncludedBuildState) BuildState(org.gradle.internal.build.BuildState) RootBuildState(org.gradle.internal.build.RootBuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Aggregations

BuildState (org.gradle.internal.build.BuildState)5 IncludedBuildState (org.gradle.internal.build.IncludedBuildState)5 IncludedBuildInternal (org.gradle.internal.composite.IncludedBuildInternal)5 GradleInternal (org.gradle.api.internal.GradleInternal)4 Project (org.gradle.api.Project)2 RootBuildState (org.gradle.internal.build.RootBuildState)2 DefaultGradleProject (org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject)2 IdeaProject (org.gradle.plugins.ide.idea.model.IdeaProject)1 DefaultEclipseProject (org.gradle.plugins.ide.internal.tooling.eclipse.DefaultEclipseProject)1 DefaultIdeaProject (org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaProject)1 DefaultGradleBuild (org.gradle.plugins.ide.internal.tooling.model.DefaultGradleBuild)1 EclipseWorkspaceProject (org.gradle.tooling.model.eclipse.EclipseWorkspaceProject)1