Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
aloubyansky committed Feb 1, 2024
1 parent d6282be commit 206bfa1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.quarkus.bootstrap.resolver.maven;

import static io.quarkus.bootstrap.util.DependencyUtils.getKey;
import static io.quarkus.bootstrap.util.DependencyUtils.hasWinner;
import static io.quarkus.bootstrap.util.DependencyUtils.newDependencyBuilder;
import static io.quarkus.bootstrap.util.DependencyUtils.toArtifact;

Expand Down Expand Up @@ -417,7 +418,7 @@ void init(List<CompletableFuture<?>> futures, ConcurrentLinkedDeque<Throwable> e

void initChildren(List<CompletableFuture<?>> futures, ConcurrentLinkedDeque<Throwable> errors) {
for (var childNode : node.getChildren()) {
if (!childNode.getData().containsKey(ConflictResolver.NODE_DATA_WINNER)) {
if (!hasWinner(childNode)) {
var child = new AppDep(this, childNode);
children.add(child);
child.init(futures, errors);
Expand Down Expand Up @@ -655,7 +656,9 @@ private void injectDeploymentDependencies(ExtensionDependency extDep)

private void clearReloadable(DependencyNode node) {
for (DependencyNode child : node.getChildren()) {
clearReloadable(child);
if (!hasWinner(child)) {
clearReloadable(child);
}
}
final ResolvedDependencyBuilder dep = appBuilder.getDependency(getKey(node.getArtifact()));
if (dep != null) {
Expand All @@ -668,11 +671,9 @@ private boolean replaceDirectDepBranch(ExtensionDependency extDep, List<Dependen
int i = 0;
DependencyNode inserted = null;
while (i < deploymentDeps.size()) {
final Artifact a = deploymentDeps.get(i).getArtifact();
if (a == null) {
continue;
}
if (isSameKey(extDep.info.runtimeArtifact, a)) {
var node = deploymentDeps.get(i);
final Artifact a = node.getArtifact();
if (a != null && !hasWinner(node) && isSameKey(extDep.info.runtimeArtifact, a)) {
// we are not comparing the version in the above condition because the runtime version
// may appear to be different then the deployment one and that's ok
// e.g. the version of the runtime artifact could be managed by a BOM
Expand All @@ -692,7 +693,7 @@ private boolean replaceDirectDepBranch(ExtensionDependency extDep, List<Dependen
if (extDep.runtimeExtensionDeps != null) {
for (ExtensionDependency dep : extDep.runtimeExtensionDeps) {
for (DependencyNode deploymentDep : deploymentDeps) {
if (deploymentDep == inserted) {
if (deploymentDep == inserted || hasWinner(deploymentDep)) {
continue;
}
if (replaceRuntimeBranch(dep, deploymentDep.getChildren())) {
Expand All @@ -711,7 +712,7 @@ private boolean replaceRuntimeBranch(ExtensionDependency extNode, List<Dependenc
return true;
}
for (DependencyNode deploymentNode : deploymentNodes) {
if (replaceRuntimeBranch(extNode, deploymentNode.getChildren())) {
if (!hasWinner(deploymentNode) && replaceRuntimeBranch(extNode, deploymentNode.getChildren())) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.util.graph.transformer.ConflictResolver;

import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
Expand Down Expand Up @@ -152,4 +153,8 @@ public static ResolvedDependencyBuilder toAppArtifact(Artifact artifact, Workspa
.setVersion(artifact.getVersion())
.setResolvedPaths(artifact.getFile() == null ? PathList.empty() : PathList.of(artifact.getFile().toPath()));
}

public static boolean hasWinner(DependencyNode node) {
return node.getData().containsKey(ConflictResolver.NODE_DATA_WINNER);
}
}

0 comments on commit 206bfa1

Please sign in to comment.