Search in sources :

Example 1 with RootBuildState

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

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

the class ChildBuildRegisteringSettingsLoader method findAndLoadSettings.

@Override
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
    SettingsInternal settings = delegate.findAndLoadSettings(gradle);
    // Add included builds defined in settings
    List<IncludedBuildSpec> includedBuilds = settings.getIncludedBuilds();
    if (!includedBuilds.isEmpty()) {
        Set<IncludedBuildInternal> children = new LinkedHashSet<>(includedBuilds.size());
        RootBuildState rootBuild = buildRegistry.getRootBuild();
        for (IncludedBuildSpec includedBuildSpec : includedBuilds) {
            if (!includedBuildSpec.rootDir.equals(rootBuild.getBuildRootDir())) {
                IncludedBuildState includedBuild = buildIncluder.includeBuild(includedBuildSpec);
                children.add(includedBuild.getModel());
            } else {
                buildRegistry.registerSubstitutionsForRootBuild();
                children.add(buildRegistry.getRootBuild().getModel());
            }
        }
        // Set the visible included builds
        gradle.setIncludedBuilds(children);
    } else {
        gradle.setIncludedBuilds(Collections.emptyList());
    }
    return settings;
}
Also used : SettingsInternal(org.gradle.api.internal.SettingsInternal) LinkedHashSet(java.util.LinkedHashSet) RootBuildState(org.gradle.internal.build.RootBuildState) IncludedBuildSpec(org.gradle.initialization.IncludedBuildSpec) IncludedBuildState(org.gradle.internal.build.IncludedBuildState)

Aggregations

IncludedBuildState (org.gradle.internal.build.IncludedBuildState)2 RootBuildState (org.gradle.internal.build.RootBuildState)2 LinkedHashSet (java.util.LinkedHashSet)1 SettingsInternal (org.gradle.api.internal.SettingsInternal)1 IncludedBuildSpec (org.gradle.initialization.IncludedBuildSpec)1 BuildState (org.gradle.internal.build.BuildState)1 IncludedBuildInternal (org.gradle.internal.composite.IncludedBuildInternal)1 DefaultGradleBuild (org.gradle.plugins.ide.internal.tooling.model.DefaultGradleBuild)1