From cb7bbdd108d89e748ef2df3a72cbf77274970427 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Tue, 30 Jan 2024 21:56:28 +0100 Subject: [PATCH] more --- .../ApplicationDependencyModelResolver.java | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyModelResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyModelResolver.java index f734db46ec321..c7a70b1fcc2ae 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyModelResolver.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/ApplicationDependencyModelResolver.java @@ -141,7 +141,7 @@ public void resolve(CollectRequest collectRtDepsRequest) throws AppModelResolver this.managedDeps = managedDeps.isEmpty() ? new ArrayList<>() : managedDeps; var current = System.currentTimeMillis(); - processDependencies(root); + processRuntimeDeps(root); if (doLog) System.out.println("Process rt deps " + (System.currentTimeMillis() - current) + ", conditional deps " + conditionalDepsToProcess.size()); @@ -185,18 +185,18 @@ public void resolve(CollectRequest collectRtDepsRequest) throws AppModelResolver if (doLog) System.out.println("Added deployment " + (System.currentTimeMillis() - current)); - if (!CONVERGED_TREE_ONLY && collectReloadableModules) { - for (ResolvedDependencyBuilder db : appBuilder.getDependencies()) { - if (db.isFlagSet(DependencyFlags.RELOADABLE | DependencyFlags.VISITED)) { - continue; - } - clearReloadableFlag(db); + for (var d : appBuilder.getDependencies()) { + if (!d.isFlagSet(DependencyFlags.VISITED) && !d.isFlagSet(DependencyFlags.RELOADABLE)) { + clearReloadableFlag(d); } } - for (ResolvedDependencyBuilder db : appBuilder.getDependencies()) { - db.clearFlag(DependencyFlags.VISITED); - appBuilder.addDependency(db); + for (var d : appBuilder.getDependencies()) { + d.clearFlag(DependencyFlags.VISITED); + if (d.isFlagSet(DependencyFlags.RELOADABLE)) { + appBuilder.addReloadableWorkspaceModule(d.getKey()); + } + appBuilder.addDependency(d); } collectPlatformProperties(); @@ -314,15 +314,14 @@ private void collectPlatformProperties() throws AppModelResolverException { appBuilder.setPlatformImports(platformReleases); } - private void clearReloadableFlag(ResolvedDependencyBuilder db) { - for (ArtifactKey key : db.getDependencies()) { - final ResolvedDependencyBuilder dep = appBuilder.getDependency(key); - if (dep == null || dep.isFlagSet(DependencyFlags.VISITED)) { - continue; + private void clearReloadableFlag(ResolvedDependencyBuilder dep) { + dep.setFlags(DependencyFlags.VISITED); + dep.clearFlag(DependencyFlags.RELOADABLE); + for (ArtifactKey key : dep.getDependencies()) { + final ResolvedDependencyBuilder child = appBuilder.getDependency(key); + if (child != null && !child.isFlagSet(DependencyFlags.VISITED)) { + clearReloadableFlag(child); } - dep.setFlags(DependencyFlags.VISITED); - dep.clearFlag(DependencyFlags.RELOADABLE); - clearReloadableFlag(dep); } } @@ -364,7 +363,7 @@ private boolean isRuntimeArtifact(ArtifactKey key) { return dep != null && dep.isFlagSet(DependencyFlags.RUNTIME_CP); } - private void processDependencies(DependencyNode root) { + private void processRuntimeDeps(DependencyNode root) { final AppDep app = new AppDep(root); app.walkingFlags = COLLECT_TOP_EXTENSION_RUNTIME_NODES | COLLECT_DIRECT_DEPS; @@ -538,9 +537,9 @@ void setFlags(byte walkingFlags) { topExtensionDeps.add(ext); } if (isWalkingFlagOn(COLLECT_RELOADABLE_MODULES)) { - if (resolvedDep.getWorkspaceModule() != null) { + if (resolvedDep.getWorkspaceModule() != null + && !resolvedDep.isFlagSet(DependencyFlags.RUNTIME_EXTENSION_ARTIFACT)) { resolvedDep.setReloadable(); - appBuilder.addReloadableWorkspaceModule(resolvedDep.getKey()); } else { clearWalkingFlag(COLLECT_RELOADABLE_MODULES); } @@ -635,10 +634,6 @@ private void injectDeploymentDependencies(ExtensionDependency extDep) + extDep.info.runtimeArtifact + " is expected"); } - if (resolver.getProjectModuleResolver() != null && collectReloadableModules) { - clearReloadable(deploymentNode); - } - final List deploymentDeps = deploymentNode.getChildren(); if (!replaceDirectDepBranch(extDep, deploymentDeps)) { throw new BootstrapDependencyProcessingException(