Search in sources :

Example 11 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class IncludedBuildArtifactBuilder method build.

public void build(BuildIdentifier requestingBuild, ComponentArtifactMetadata artifact) {
    if (artifact instanceof CompositeProjectComponentArtifactMetadata) {
        CompositeProjectComponentArtifactMetadata compositeBuildArtifact = (CompositeProjectComponentArtifactMetadata) artifact;
        BuildIdentifier buildId = getBuildIdentifier(compositeBuildArtifact);
        Collection<String> tasksToExecute = addTasksForBuild(buildId, compositeBuildArtifact);
        execute(requestingBuild, buildId, tasksToExecute);
    }
}
Also used : BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier)

Example 12 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class CompositeBuildClassPathInitializer method build.

public void build(BuildIdentifier requestingBuild, ComponentArtifactIdentifier artifact) {
    if (artifact instanceof CompositeProjectComponentArtifactMetadata) {
        CompositeProjectComponentArtifactMetadata compositeBuildArtifact = (CompositeProjectComponentArtifactMetadata) artifact;
        BuildIdentifier targetBuild = getBuildIdentifier(compositeBuildArtifact);
        assert !requestingBuild.equals(targetBuild);
        Set<String> tasks = compositeBuildArtifact.getTasks();
        for (String taskName : tasks) {
            includedBuildTaskGraph.addTask(requestingBuild, targetBuild, taskName);
        }
        for (String taskName : tasks) {
            includedBuildTaskGraph.awaitCompletion(targetBuild, taskName);
        }
    }
}
Also used : BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier)

Example 13 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class DefaultBuildableCompositeBuildContext method getRegisteredProject.

private RegisteredProject getRegisteredProject(ProjectComponentIdentifier project) {
    RegisteredProject registeredProject = projectMetadata.get(project);
    BuildIdentifier buildIdentifier = project.getBuild();
    if (registeredProject == null && !configuredBuilds.contains(buildIdentifier)) {
        // TODO: This shouldn't rely on the state of configuredBuilds to figure out whether or not we should configure this build again
        // This is to prevent a recursive loop through this when we're configuring the build
        configuredBuilds.add(buildIdentifier);
        IncludedBuildInternal includedBuild = includedBuildRegistry.getBuild(buildIdentifier);
        if (includedBuild != null) {
            projectMetadata.putAll(dependencyMetadataBuilder.build(includedBuild));
            registeredProject = projectMetadata.get(project);
            if (registeredProject == null) {
                throw new IllegalStateException(project + " was not found.");
            }
        }
    }
    return registeredProject;
}
Also used : BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier)

Example 14 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class DefaultIncludedBuildRegistry method registerProjects.

private void registerProjects(Iterable<IncludedBuildInternal> includedBuilds, boolean isImplicitBuild) {
    for (IncludedBuildInternal includedBuild : includedBuilds) {
        Path rootProjectPath = Path.ROOT.child(includedBuild.getName());
        BuildIdentifier buildIdentifier = new DefaultBuildIdentifier(includedBuild.getName());
        Set<DefaultProjectDescriptor> allProjects = includedBuild.getLoadedSettings().getProjectRegistry().getAllProjects();
        registerProjects(rootProjectPath, buildIdentifier, allProjects, isImplicitBuild);
    }
}
Also used : Path(org.gradle.util.Path) DefaultBuildIdentifier(org.gradle.api.internal.artifacts.DefaultBuildIdentifier) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) DefaultBuildIdentifier(org.gradle.api.internal.artifacts.DefaultBuildIdentifier) DefaultProjectDescriptor(org.gradle.initialization.DefaultProjectDescriptor)

Example 15 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class DefaultIncludedBuildTaskGraph method checkNoCycles.

private void checkNoCycles(BuildIdentifier sourceBuild, BuildIdentifier targetBuild, List<BuildIdentifier> candidateCycle) {
    candidateCycle.add(targetBuild);
    for (BuildIdentifier nextTarget : buildDependencies.get(targetBuild)) {
        if (sourceBuild.equals(nextTarget)) {
            candidateCycle.add(nextTarget);
            ProjectComponentSelector selector = DefaultProjectComponentSelector.newSelector(candidateCycle.get(0), Path.ROOT.getPath());
            throw new ModuleVersionResolveException(selector, "Included build dependency cycle: " + reportCycle(candidateCycle));
        }
        checkNoCycles(sourceBuild, nextTarget, candidateCycle);
    }
    candidateCycle.remove(targetBuild);
}
Also used : DefaultProjectComponentSelector(org.gradle.internal.component.local.model.DefaultProjectComponentSelector) ProjectComponentSelector(org.gradle.api.artifacts.component.ProjectComponentSelector) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) ModuleVersionResolveException(org.gradle.internal.resolve.ModuleVersionResolveException)

Aggregations

BuildIdentifier (org.gradle.api.artifacts.component.BuildIdentifier)15 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)3 DefaultBuildIdentifier (org.gradle.api.internal.artifacts.DefaultBuildIdentifier)3 ProjectComponentSelector (org.gradle.api.artifacts.component.ProjectComponentSelector)2 DefaultProjectDescriptor (org.gradle.initialization.DefaultProjectDescriptor)2 DefaultProjectComponentSelector (org.gradle.internal.component.local.model.DefaultProjectComponentSelector)2 ModuleVersionResolveException (org.gradle.internal.resolve.ModuleVersionResolveException)2 IdeaModuleMetadata (org.gradle.plugins.ide.idea.internal.IdeaModuleMetadata)2 IdeArtifactRegistry (org.gradle.plugins.ide.internal.IdeArtifactRegistry)2 Task (org.gradle.api.Task)1 LibraryBinaryIdentifier (org.gradle.api.artifacts.component.LibraryBinaryIdentifier)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 IncludedBuild (org.gradle.api.initialization.IncludedBuild)1 DefaultBuildIdentifier (org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier)1 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)1 TaskAction (org.gradle.api.tasks.TaskAction)1 TaskDependency (org.gradle.api.tasks.TaskDependency)1 TaskInstantiationException (org.gradle.api.tasks.TaskInstantiationException)1 IncludedBuildExecuter (org.gradle.initialization.IncludedBuildExecuter)1 IncludedBuilds (org.gradle.initialization.IncludedBuilds)1