Search in sources :

Example 1 with LocalConfigurationMetadata

use of org.gradle.internal.component.local.model.LocalConfigurationMetadata in project gradle by gradle.

the class DefaultResolvedArtifactsBuilder method visitArtifacts.

@Override
public void visitArtifacts(DependencyGraphNode from, DependencyGraphNode to, ArtifactSet artifacts) {
    if (sortOrder != ResolutionStrategy.SortOrder.DEFAULT) {
        sortedNodeIds.get(to.getNodeId()).add(artifacts);
    } else {
        artifactSets.put(artifacts.getId(), artifacts);
    }
    // Don't collect build dependencies if not required
    if (!buildProjectDependencies) {
        return;
    }
    if (buildableArtifactSets.contains(artifacts.getId())) {
        return;
    }
    // Collect the build dependencies in 2 steps: collect the artifact sets while traversing and at the end of traversal unpack the build dependencies for each
    // We need to discard the artifact sets to avoid keeping strong references
    ConfigurationMetadata configurationMetadata = to.getMetadata();
    if (!(configurationMetadata instanceof LocalConfigurationMetadata)) {
        return;
    }
    if (from.getOwner().getComponentId() instanceof ProjectComponentIdentifier) {
        // This is here to attempt to leave out build dependencies that would cause a cycle in the task graph for the current build, so that the cross-build cycle detection kicks in. It's not fully correct
        ProjectComponentIdentifier incomingId = (ProjectComponentIdentifier) from.getOwner().getComponentId();
        if (!incomingId.getBuild().isCurrentBuild()) {
            return;
        }
    }
    buildableArtifactSets.add(artifacts.getId());
}
Also used : LocalConfigurationMetadata(org.gradle.internal.component.local.model.LocalConfigurationMetadata) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) ConfigurationMetadata(org.gradle.internal.component.model.ConfigurationMetadata) LocalConfigurationMetadata(org.gradle.internal.component.local.model.LocalConfigurationMetadata)

Example 2 with LocalConfigurationMetadata

use of org.gradle.internal.component.local.model.LocalConfigurationMetadata in project gradle by gradle.

the class FileDependencyCollectingGraphVisitor method start.

@Override
public void start(DependencyGraphNode root) {
    Set<LocalFileDependencyMetadata> fileDependencies = ((LocalConfigurationMetadata) root.getMetadata()).getFiles();
    rootFiles = Maps.newLinkedHashMap();
    for (LocalFileDependencyMetadata fileDependency : fileDependencies) {
        FileDependencyArtifactSet artifactSet = new FileDependencyArtifactSet(idGenerator.generateId(), fileDependency, immutableAttributesFactory);
        rootFiles.put(fileDependency.getSource(), artifactSet);
        filesByNodeId.put(root.getNodeId(), artifactSet);
    }
}
Also used : LocalConfigurationMetadata(org.gradle.internal.component.local.model.LocalConfigurationMetadata) FileDependencyArtifactSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.FileDependencyArtifactSet) LocalFileDependencyMetadata(org.gradle.internal.component.local.model.LocalFileDependencyMetadata)

Example 3 with LocalConfigurationMetadata

use of org.gradle.internal.component.local.model.LocalConfigurationMetadata in project gradle by gradle.

the class DefaultResolvedArtifactsBuilder method visitArtifacts.

@Override
public void visitArtifacts(DependencyGraphNode from, DependencyGraphNode to, int artifactSetId, ArtifactSet artifacts) {
    // Don't collect build dependencies if not required
    if (!buildProjectDependencies) {
        artifacts = new NoBuildDependenciesArtifactSet(artifacts);
    } else {
        ConfigurationMetadata configurationMetadata = to.getMetadata();
        if (configurationMetadata instanceof LocalConfigurationMetadata) {
            // For a dependency from _another_ build to _this_ build, don't make the artifact buildable
            // Making these artifacts buildable leads to poor error reporting due to direct task dependency cycle (losing the intervening build dependencies)
            ComponentIdentifier incomingId = from.getOwner().getComponentId();
            ComponentIdentifier outgoingId = to.getOwner().getComponentId();
            if (incomingId instanceof ProjectComponentIdentifier && outgoingId instanceof ProjectComponentIdentifier) {
                if (!isCurrentBuild(incomingId) && isCurrentBuild(outgoingId)) {
                    artifacts = new NoBuildDependenciesArtifactSet(artifacts);
                }
            }
        }
    }
    collectArtifacts(artifactSetId, artifacts);
}
Also used : ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) LocalConfigurationMetadata(org.gradle.internal.component.local.model.LocalConfigurationMetadata) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) LocalConfigurationMetadata(org.gradle.internal.component.local.model.LocalConfigurationMetadata) ConfigurationMetadata(org.gradle.internal.component.model.ConfigurationMetadata)

Aggregations

LocalConfigurationMetadata (org.gradle.internal.component.local.model.LocalConfigurationMetadata)3 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)2 ConfigurationMetadata (org.gradle.internal.component.model.ConfigurationMetadata)2 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 FileDependencyArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.FileDependencyArtifactSet)1 LocalFileDependencyMetadata (org.gradle.internal.component.local.model.LocalFileDependencyMetadata)1