Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
aloubyansky committed Jan 20, 2024
1 parent dc834bf commit 0bfe954
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

import org.eclipse.aether.util.artifact.JavaScopes;

import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
import io.quarkus.deployment.runnerjar.BootstrapFromOriginalJarTestBase;
import io.quarkus.maven.dependency.ArtifactCoords;
import io.quarkus.maven.dependency.ArtifactDependency;
import io.quarkus.maven.dependency.Dependency;
import io.quarkus.maven.dependency.DependencyFlags;
import io.quarkus.maven.dependency.GACTV;

public class ConditionalDependencyWithSingleConditionTest extends BootstrapFromOriginalJarTestBase {

@Override
protected TsArtifact composeApplication() {

//System.setProperty("parallel", "true");

final TsQuarkusExt extA = new TsQuarkusExt("ext-a");

final TsQuarkusExt extB = new TsQuarkusExt("ext-b");
Expand All @@ -44,19 +43,19 @@ protected TsArtifact composeApplication() {

@Override
protected void assertAppModel(ApplicationModel appModel) throws Exception {
final Set<Dependency> deploymentDeps = appModel.getDependencies().stream()
.filter(d -> d.isDeploymentCp() && !d.isRuntimeCp()).map(d -> new ArtifactDependency(d))
.collect(Collectors.toSet());
final Set<Dependency> expected = new HashSet<>();
expected.add(new ArtifactDependency(
new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), JavaScopes.COMPILE,
DependencyFlags.DEPLOYMENT_CP));
expected.add(new ArtifactDependency(
new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), JavaScopes.COMPILE,
DependencyFlags.DEPLOYMENT_CP));
expected.add(new ArtifactDependency(
new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), JavaScopes.COMPILE,
DependencyFlags.DEPLOYMENT_CP));
assertEquals(expected, deploymentDeps);
var expected = Set.of(
new ArtifactDependency(
ArtifactCoords.jar(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION),
JavaScopes.COMPILE,
DependencyFlags.DEPLOYMENT_CP),
new ArtifactDependency(
ArtifactCoords.jar(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION),
JavaScopes.COMPILE,
DependencyFlags.DEPLOYMENT_CP),
new ArtifactDependency(
ArtifactCoords.jar(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION),
JavaScopes.COMPILE,
DependencyFlags.DEPLOYMENT_CP));
assertEquals(expected, getDeploymentOnlyDeps(appModel));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class DeploymentDependencyConvergenceTest extends BootstrapFromOriginalJa
@Override
protected TsArtifact composeApplication() {

System.setProperty("parallel", "true");

var libE10 = install(TsArtifact.jar("lib-e", "1.0"));
var libE20 = install(TsArtifact.jar("lib-e", "2.0"));
var libE30 = install(TsArtifact.jar("lib-e", "3.0"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
Expand Down Expand Up @@ -419,7 +431,6 @@ private void processDependencies(DependencyNode root) {
final AppDep app = new AppDep(root);
app.walkingFlags = walkingFlags;
var futures = new ArrayList<CompletableFuture<?>>();

app.initChildren(futures);
CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])).join();

Expand Down Expand Up @@ -548,14 +559,16 @@ void init() {
}

void setFlags(byte walkingFlags) {
appBuilder.addDependency(resolvedDep);
if (appBuilder.getDependency(resolvedDep.getKey()) == null) {
appBuilder.addDependency(resolvedDep);
}
this.walkingFlags = walkingFlags;

resolvedDep.setDirect(isWalkingFlagOn(COLLECT_DIRECT_DEPS));
if (ext != null) {
if (isWalkingFlagOn(COLLECT_TOP_EXTENSION_RUNTIME_NODES)) {
resolvedDep.setFlags(DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);
}
if (ext != null && isWalkingFlagOn(COLLECT_TOP_EXTENSION_RUNTIME_NODES)) {
resolvedDep.setFlags(DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);
clearWalkingFlag(COLLECT_TOP_EXTENSION_RUNTIME_NODES);
topExtensionDeps.add(ext);
}
if (isWalkingFlagOn(COLLECT_RELOADABLE_MODULES)) {
if (resolvedDep.getWorkspaceModule() != null) {
Expand All @@ -568,13 +581,6 @@ void setFlags(byte walkingFlags) {

clearWalkingFlag(COLLECT_DIRECT_DEPS);

if (ext != null) {
if (isWalkingFlagOn(COLLECT_TOP_EXTENSION_RUNTIME_NODES)) {
clearWalkingFlag(COLLECT_TOP_EXTENSION_RUNTIME_NODES);
topExtensionDeps.add(ext);
}
}

passFlags();
}

Expand Down Expand Up @@ -1093,6 +1099,7 @@ void activate() {
currentChildren.addAll(originalNode.getChildren());
}
visitRuntimeDependency(rtNode);
//processDependencies(rtNode);
dependent.runtimeNode.getChildren().add(rtNode);
}

Expand Down

0 comments on commit 0bfe954

Please sign in to comment.