Skip to content

Commit

Permalink
[MNG-7974] Upgrade to Resolver 2.0.0-alpha-5 Addendum (#1348)
Browse files Browse the repository at this point in the history
There was a TODO in code that I missed.

---

https://issues.apache.org/jira/browse/MNG-7974
  • Loading branch information
cstamas authored Dec 18, 2023
1 parent a1fdd89 commit 8001c30
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
import org.apache.maven.project.MavenProject;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.graph.DependencyVisitor;
import org.eclipse.aether.util.graph.visitor.FilteringDependencyVisitor;
import org.eclipse.aether.util.graph.visitor.PreorderDependencyNodeConsumerVisitor;

import static org.apache.maven.internal.impl.Utils.cast;
import static org.apache.maven.internal.impl.Utils.map;
Expand All @@ -63,16 +60,10 @@ public class DefaultDependencyResolver implements DependencyResolver {
@Override
public List<Node> flatten(Session s, Node node, ResolutionScope scope) throws DependencyResolverException {
InternalSession session = InternalSession.from(s);

// TODO: v4: refactor with RepositorySystem#flattenDependencyNodes with resolver alpha-3
DependencyNode root = cast(AbstractNode.class, node, "node").getDependencyNode();
List<DependencyNode> dependencies = new ArrayList<>();
DependencyVisitor builder = new PreorderDependencyNodeConsumerVisitor(dependencies::add);
DependencyFilter filter = getScopeDependencyFilter(scope);
DependencyVisitor visitor = new FilteringDependencyVisitor(builder, filter);
root.accept(visitor);
List<DependencyNode> dependencies = session.getRepositorySystem()
.flattenDependencyNodes(session.getSession(), root, getScopeDependencyFilter(scope));
dependencies.remove(root);

return map(dependencies, session::getNode);
}

Expand Down

0 comments on commit 8001c30

Please sign in to comment.