private void updateNonSelectedVersions(ConflictGroup group, Map<?, ?> conflictIds) { for (Position pos : group.positions) { DependencyNode parent = pos.parent; List<DependencyNode> children = parent.getChildren(); List<DependencyNode> toAdd = new ArrayList<DependencyNode>(); for (Iterator<DependencyNode> it = children.iterator(); it.hasNext();) { DependencyNode child = it.next(); Object key = conflictIds.get(child); if (group.key.equals(key)) { if (!group.pruned && group.position != null && group.version != null && group.position.depth == pos.depth && group.version.equals(child.getVersion())) { group.pruned = true; } else { it.remove(); // now lets add the common dependency if (group.versionDependency == null) { throw new IllegalStateException("Should have a versionDependency for group: " + group + " and version: " + group.version); } toAdd.add(group.versionDependency); } } } children.addAll(toAdd); } }
if (!group.isAcceptable(node.getVersion())) { return; if (group.version == null || isNearer(pos, node.getVersion(), group.position, group.version)) { group.version = node.getVersion(); group.versionDependency = node; group.position = pos; Version version = entry.getKey().getVersion(); pos = entry.getValue();
if ( group.winner != null && !constraint.containsVersion( group.winner.getNode().getVersion() ) ) if ( isAcceptable( group, node.getVersion() ) )
private boolean isNearer( ConflictItem item1, ConflictItem item2 ) { if ( item1.isSibling( item2 ) ) { return item1.getNode().getVersion().compareTo( item2.getNode().getVersion() ) > 0; } else { return item1.getDepth() < item2.getDepth(); } }
if ( group.winner != null && !constraint.containsVersion( group.winner.getNode().getVersion() ) ) if ( isAcceptable( group, node.getVersion() ) )
private boolean isNearer( ConflictItem item1, ConflictItem item2 ) { if ( item1.isSibling( item2 ) ) { return item1.getNode().getVersion().compareTo( item2.getNode().getVersion() ) > 0; } else { return item1.getDepth() < item2.getDepth(); } }
/** * Creates a mostly shallow clone of the specified node. The new node has its own copy of any custom data and * initially no children. * * @param node The node to copy, must not be {@code null}. */ public DefaultDependencyNode( DependencyNode node ) { dependency = node.getDependency(); artifact = node.getArtifact(); children = new ArrayList<DependencyNode>( 0 ); setAliases( node.getAliases() ); setRequestContext( node.getRequestContext() ); setManagedBits( node.getManagedBits() ); setRelocations( node.getRelocations() ); setRepositories( node.getRepositories() ); setVersion( node.getVersion() ); setVersionConstraint( node.getVersionConstraint() ); Map<?, ?> data = node.getData(); setData( data.isEmpty() ? null : new HashMap<Object, Object>( data ) ); }
private void backtrack( ConflictGroup group, ConflictContext context ) throws UnsolvableVersionConflictException { group.winner = null; for ( Iterator<ConflictItem> it = group.candidates.iterator(); it.hasNext(); ) { ConflictItem candidate = it.next(); if ( !isAcceptable( group, candidate.getNode().getVersion() ) ) { it.remove(); } else if ( group.winner == null || isNearer( candidate, group.winner ) ) { group.winner = candidate; } } if ( group.winner == null ) { throw newFailure( context ); } }
/** * Creates a mostly shallow clone of the specified node. The new node has its own copy of any custom data and * initially no children. * * @param node The node to copy, must not be {@code null}. */ public DefaultDependencyNode( DependencyNode node ) { dependency = node.getDependency(); artifact = node.getArtifact(); children = new ArrayList<DependencyNode>( 0 ); setAliases( node.getAliases() ); setRequestContext( node.getRequestContext() ); setManagedBits( node.getManagedBits() ); setRelocations( node.getRelocations() ); setRepositories( node.getRepositories() ); setVersion( node.getVersion() ); setVersionConstraint( node.getVersionConstraint() ); Map<?, ?> data = node.getData(); setData( data.isEmpty() ? null : new HashMap<Object, Object>( data ) ); }
private void backtrack( ConflictGroup group, ConflictContext context ) throws UnsolvableVersionConflictException { group.winner = null; for ( Iterator<ConflictItem> it = group.candidates.iterator(); it.hasNext(); ) { ConflictItem candidate = it.next(); if ( !isAcceptable( group, candidate.getNode().getVersion() ) ) { it.remove(); } else if ( group.winner == null || isNearer( candidate, group.winner ) ) { group.winner = candidate; } } if ( group.winner == null ) { throw newFailure( context ); } }