Search in sources :

Example 1 with IncludedBuild

use of org.gradle.api.initialization.IncludedBuild in project gradle by gradle.

the class GradleBuildBuilder method convert.

private DefaultGradleBuild convert(Gradle gradle) {
    DefaultGradleBuild model = new DefaultGradleBuild();
    Map<Project, BasicGradleProject> convertedProjects = new LinkedHashMap<Project, BasicGradleProject>();
    Project rootProject = gradle.getRootProject();
    BasicGradleProject convertedRootProject = convert(rootProject, convertedProjects);
    model.setRootProject(convertedRootProject);
    for (Project project : rootProject.getAllprojects()) {
        model.addProject(convertedProjects.get(project));
    }
    for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
        Gradle includedGradle = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
        DefaultGradleBuild convertedIncludedBuild = convert(includedGradle);
        model.addIncludedBuild(convertedIncludedBuild);
    }
    return model;
}
Also used : Project(org.gradle.api.Project) BasicGradleProject(org.gradle.tooling.internal.gradle.BasicGradleProject) IncludedBuildInternal(org.gradle.composite.internal.IncludedBuildInternal) DefaultGradleBuild(org.gradle.tooling.internal.gradle.DefaultGradleBuild) BasicGradleProject(org.gradle.tooling.internal.gradle.BasicGradleProject) Gradle(org.gradle.api.invocation.Gradle) LinkedHashMap(java.util.LinkedHashMap) IncludedBuild(org.gradle.api.initialization.IncludedBuild)

Example 2 with IncludedBuild

use of org.gradle.api.initialization.IncludedBuild in project gradle by gradle.

the class DefaultCompositeContextBuilder method addToCompositeContext.

@Override
public void addToCompositeContext(Iterable<IncludedBuild> includedBuilds) {
    IncludedBuildDependencySubstitutionsBuilder contextBuilder = new IncludedBuildDependencySubstitutionsBuilder(context);
    for (IncludedBuild includedBuild : includedBuilds) {
        allIncludedBuilds.registerBuild(includedBuild);
        doAddToCompositeContext((IncludedBuildInternal) includedBuild, contextBuilder);
    }
}
Also used : IncludedBuild(org.gradle.api.initialization.IncludedBuild)

Example 3 with IncludedBuild

use of org.gradle.api.initialization.IncludedBuild in project gradle by gradle.

the class CompositeBuildSettingsLoader method findAndLoadSettings.

@Override
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
    SettingsInternal settings = delegate.findAndLoadSettings(gradle);
    Collection<IncludedBuild> includedBuilds = getIncludedBuilds(gradle.getStartParameter(), settings);
    if (!includedBuilds.isEmpty()) {
        gradle.setIncludedBuilds(includedBuilds);
        if (gradle.getStartParameter().isContinuous()) {
            LOGGER.warn("[composite-build] Warning: continuous build doesn't detect changes in included builds.");
        }
        CompositeContextBuilder compositeContextBuilder = buildServices.get(CompositeContextBuilder.class);
        compositeContextBuilder.addToCompositeContext(includedBuilds);
    }
    return settings;
}
Also used : SettingsInternal(org.gradle.api.internal.SettingsInternal) IncludedBuild(org.gradle.api.initialization.IncludedBuild)

Example 4 with IncludedBuild

use of org.gradle.api.initialization.IncludedBuild in project gradle by gradle.

the class CompositeBuildTaskDelegate method executeTasksInOtherBuild.

@TaskAction
public void executeTasksInOtherBuild() {
    IncludedBuilds includedBuilds = getServices().get(IncludedBuilds.class);
    IncludedBuildExecuter builder = getServices().get(IncludedBuildExecuter.class);
    IncludedBuild includedBuild = includedBuilds.getBuild(build);
    BuildIdentifier buildId = new DefaultBuildIdentifier(includedBuild.getName());
    // sourceBuild is currently always root build in a composite
    builder.execute(new DefaultBuildIdentifier(":", true), buildId, tasks);
}
Also used : DefaultBuildIdentifier(org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) DefaultBuildIdentifier(org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier) IncludedBuildExecuter(org.gradle.initialization.IncludedBuildExecuter) IncludedBuilds(org.gradle.initialization.IncludedBuilds) IncludedBuild(org.gradle.api.initialization.IncludedBuild) TaskAction(org.gradle.api.tasks.TaskAction)

Example 5 with IncludedBuild

use of org.gradle.api.initialization.IncludedBuild in project gradle by gradle.

the class ClientProvidedBuildActionRunner method forceFullConfiguration.

private void forceFullConfiguration(GradleInternal gradle) {
    try {
        gradle.getServices().get(ProjectConfigurer.class).configureHierarchyFully(gradle.getRootProject());
        for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
            GradleInternal build = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
            forceFullConfiguration(build);
        }
    } catch (BuildCancelledException e) {
        throw new InternalBuildCancelledException(e);
    } catch (RuntimeException e) {
        throw new BuildExceptionVersion1(e);
    }
}
Also used : IncludedBuildInternal(org.gradle.composite.internal.IncludedBuildInternal) GradleInternal(org.gradle.api.internal.GradleInternal) BuildExceptionVersion1(org.gradle.tooling.internal.protocol.BuildExceptionVersion1) ProjectConfigurer(org.gradle.execution.ProjectConfigurer) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException) BuildCancelledException(org.gradle.api.BuildCancelledException) IncludedBuild(org.gradle.api.initialization.IncludedBuild) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException)

Aggregations

IncludedBuild (org.gradle.api.initialization.IncludedBuild)6 IncludedBuildInternal (org.gradle.composite.internal.IncludedBuildInternal)2 File (java.io.File)1 LinkedHashMap (java.util.LinkedHashMap)1 BuildCancelledException (org.gradle.api.BuildCancelledException)1 Project (org.gradle.api.Project)1 BuildIdentifier (org.gradle.api.artifacts.component.BuildIdentifier)1 GradleInternal (org.gradle.api.internal.GradleInternal)1 SettingsInternal (org.gradle.api.internal.SettingsInternal)1 DefaultBuildIdentifier (org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier)1 Gradle (org.gradle.api.invocation.Gradle)1 TaskAction (org.gradle.api.tasks.TaskAction)1 ProjectConfigurer (org.gradle.execution.ProjectConfigurer)1 IncludedBuildExecuter (org.gradle.initialization.IncludedBuildExecuter)1 IncludedBuildFactory (org.gradle.initialization.IncludedBuildFactory)1 IncludedBuilds (org.gradle.initialization.IncludedBuilds)1 BasicGradleProject (org.gradle.tooling.internal.gradle.BasicGradleProject)1 DefaultGradleBuild (org.gradle.tooling.internal.gradle.DefaultGradleBuild)1 BuildExceptionVersion1 (org.gradle.tooling.internal.protocol.BuildExceptionVersion1)1 InternalBuildCancelledException (org.gradle.tooling.internal.protocol.InternalBuildCancelledException)1