Search in sources :

Example 6 with BuildState

use of org.gradle.internal.build.BuildState 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 7 with BuildState

use of org.gradle.internal.build.BuildState 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)

Example 8 with BuildState

use of org.gradle.internal.build.BuildState in project gradle by gradle.

the class DefaultIncludedBuildRegistry method addBuild.

private void addBuild(BuildState build) {
    BuildState before = buildsByIdentifier.put(build.getBuildIdentifier(), build);
    if (before != null) {
        throw new IllegalArgumentException("Build is already registered: " + build.getBuildIdentifier());
    }
    buildAddedBroadcaster.buildAdded(build);
    maybeAddBuildSrcBuild(build);
}
Also used : BuildState(org.gradle.internal.build.BuildState) RootBuildState(org.gradle.internal.build.RootBuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Example 9 with BuildState

use of org.gradle.internal.build.BuildState in project gradle by gradle.

the class DefaultIncludedBuildRegistry method visitBuilds.

@Override
public void visitBuilds(Consumer<? super BuildState> visitor) {
    List<BuildState> ordered = new ArrayList<>(buildsByIdentifier.values());
    ordered.sort(Comparator.comparing(BuildState::getIdentityPath));
    for (BuildState buildState : ordered) {
        visitor.accept(buildState);
    }
}
Also used : ArrayList(java.util.ArrayList) BuildState(org.gradle.internal.build.BuildState) RootBuildState(org.gradle.internal.build.RootBuildState) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Example 10 with BuildState

use of org.gradle.internal.build.BuildState 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)11 IncludedBuildState (org.gradle.internal.build.IncludedBuildState)8 IncludedBuildInternal (org.gradle.internal.composite.IncludedBuildInternal)5 GradleInternal (org.gradle.api.internal.GradleInternal)4 RootBuildState (org.gradle.internal.build.RootBuildState)4 ArrayList (java.util.ArrayList)2 Project (org.gradle.api.Project)2 DefaultGradleProject (org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject)2 Task (org.gradle.api.Task)1 TaskInternal (org.gradle.api.internal.TaskInternal)1 ProjectState (org.gradle.api.internal.project.ProjectState)1 ExportedTaskNode (org.gradle.internal.build.ExportedTaskNode)1 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 GradleBuildIdentity (org.gradle.tooling.internal.gradle.GradleBuildIdentity)1 GradleProjectIdentity (org.gradle.tooling.internal.gradle.GradleProjectIdentity)1 EclipseWorkspaceProject (org.gradle.tooling.model.eclipse.EclipseWorkspaceProject)1 Path (org.gradle.util.Path)1