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());
}
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);
}
}
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);
}
Aggregations