forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexey Loubyansky
committed
Dec 11, 2024
1 parent
177a3fa
commit d378086
Showing
6 changed files
with
264 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...s/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DepNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.quarkus.bootstrap.resolver.maven; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.eclipse.aether.graph.DependencyNode; | ||
|
||
import io.quarkus.maven.dependency.ArtifactCoords; | ||
|
||
class DepNode { | ||
|
||
static DepNode of(DependencyNode node) { | ||
return new DepNode(node); | ||
} | ||
|
||
final DepNode parent; | ||
final ArtifactCoords coords; | ||
final List<DepNode> deps; | ||
|
||
DepNode(DependencyNode node) { | ||
this(null, node); | ||
} | ||
|
||
DepNode(DepNode parent, DependencyNode node) { | ||
this.parent = parent; | ||
var a = node.getArtifact(); | ||
this.coords = ArtifactCoords.of(a.getGroupId(), a.getArtifactId(), a.getClassifier(), a.getExtension(), a.getVersion()); | ||
if (node.getChildren().isEmpty()) { | ||
deps = List.of(); | ||
} else { | ||
deps = new ArrayList<>(node.getChildren().size()); | ||
for (var d : node.getChildren()) { | ||
deps.add(new DepNode(this, d)); | ||
} | ||
} | ||
} | ||
|
||
void assertEquals(DepNode other) { | ||
if (!other.coords.equals(coords)) { | ||
throw new RuntimeException(); | ||
} | ||
int i = 0; | ||
while (i < deps.size() && i < other.deps.size()) { | ||
deps.get(i).assertEquals(other.deps.get(i)); | ||
++i; | ||
} | ||
if (i < deps.size()) { | ||
throw new RuntimeException(); | ||
} | ||
if (i < other.deps.size()) { | ||
throw new RuntimeException(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (o instanceof DepNode other) { | ||
if (!other.coords.equals(coords)) { | ||
return false; | ||
} | ||
return deps.equals(other.deps); | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters