public void visitOutgoingDependencies(Collection<DependencyEdge> target) { // If this configuration's version is in conflict, don't do anything // If not traversed before, add all selected outgoing edges // If traversed before, and the selected modules have changed, remove previous outgoing edges // and add outgoing edges again with // the new selections. // If traversed before, and the selected modules have not changed, ignore // If none of the incoming edges are transitive, then the node has no outgoing edges if (moduleRevision.state != ModuleState.Selected) { LOGGER.debug("version for {} is not selected. ignoring.", this); return; } List<DependencyEdge> transitiveIncoming = new ArrayList<DependencyEdge>(); for (DependencyEdge edge : incomingEdges) { if (edge.isTransitive()) { transitiveIncoming.add(edge); } } if (transitiveIncoming.isEmpty() && this != resolveState.root) { if (previousTraversal != null) { removeOutgoingEdges(); } if (incomingEdges.isEmpty()) { LOGGER.debug("{} has no incoming edges. ignoring.", this); } else { LOGGER.debug("{} has no transitive incoming edges. ignoring outgoing edges.", this); } return; } ModuleResolutionFilter resolutionFilter = getSelector(transitiveIncoming); if (previousTraversal != null) { if (previousTraversal.acceptsSameModulesAs(resolutionFilter)) { LOGGER.debug( "Changed edges for {} selects same versions as previous traversal. ignoring", this); // Don't need to traverse again, but hang on to the new filter as the set of artifact may // have changed previousTraversal = resolutionFilter; return; } removeOutgoingEdges(); } for (DependencyMetaData dependency : metaData.getDependencies()) { ModuleIdentifier targetModuleId = DefaultModuleIdentifier.newId( dependency.getRequested().getGroup(), dependency.getRequested().getName()); if (isExcluded(resolutionFilter, targetModuleId)) { continue; } DependencyEdge dependencyEdge = new DependencyEdge(this, dependency, resolutionFilter, resolveState); outgoingEdges.add(dependencyEdge); target.add(dependencyEdge); } previousTraversal = resolutionFilter; }
/** * Called when a change is made to a configuration node, such that its dependency graph * <em>may</em> now be larger than it previously was, and the node should be visited. */ public void onMoreSelected(ConfigurationNode configuration) { // Add to the end of the queue, so that we traverse the graph in breadth-wise order to pick up // as many conflicts as // possible before attempting to resolve them if (queued.add(configuration)) { queue.addLast(configuration); } }
public void addIncomingEdge(DependencyEdge dependencyEdge) { incomingEdges.add(dependencyEdge); resolveState.onMoreSelected(this); }
public void addConfiguration(ConfigurationNode configurationNode) { configurations.add(configurationNode); }
public void addSelector(ModuleVersionSelectorResolveState selector) { selectors.add(selector); }
public void addUnattachedDependency(DependencyEdge edge) { unattachedDependencies.add(edge); }
/** * Called when a change is made to a configuration node, such that its dependency graph * <em>may</em> now be smaller than it previously was, and the node should be visited. */ public void onFewerSelected(ConfigurationNode configuration) { // Add to the front of the queue, to flush out configurations that are no longer required. if (queued.add(configuration)) { queue.addFirst(configuration); } }