|
10 | 10 | import java.util.Set; |
11 | 11 | import java.util.stream.Collectors; |
12 | 12 |
|
| 13 | +import org.jboss.logging.Logger; |
| 14 | + |
13 | 15 | import io.quarkus.arc.deployment.ArcConfig; |
14 | 16 | import io.quarkus.arc.deployment.CompletedApplicationClassPredicateBuildItem; |
15 | 17 | import io.quarkus.arc.deployment.ValidationPhaseBuildItem; |
|
29 | 31 |
|
30 | 32 | public class ArcDevModeApiProcessor { |
31 | 33 |
|
| 34 | + private static final Logger LOG = Logger.getLogger(ArcDevModeApiProcessor.class); |
| 35 | + |
| 36 | + /** |
| 37 | + * If a dependency graph exceeds the limit then we apply the {@link DevBeanInfos#MAX_DEPENDENCY_LEVEL} and if still exceeds |
| 38 | + * the limit it's skipped completely, i.e. dependency graph is not available |
| 39 | + */ |
| 40 | + private static final int DEPENCENY_GRAPH_LIMIT = 30; |
| 41 | + |
32 | 42 | @BuildStep(onlyIf = IsDevelopment.class) |
33 | 43 | public void collectBeanInfo(ArcConfig config, ValidationPhaseBuildItem validationPhaseBuildItem, |
34 | 44 | CompletedApplicationClassPredicateBuildItem predicate, |
@@ -85,6 +95,22 @@ public void collectBeanInfo(ArcConfig config, ValidationPhaseBuildItem validatio |
85 | 95 | DependencyGraph dependencyGraph = buildDependencyGraph(bean, validationContext, resolver, beanInfos, |
86 | 96 | allInjectionPoints, declaringToProducers, |
87 | 97 | directDependents); |
| 98 | + if (dependencyGraph.links.isEmpty()) { |
| 99 | + // Skip the graph if no links exist |
| 100 | + continue; |
| 101 | + } |
| 102 | + if (dependencyGraph.nodes.size() > DEPENCENY_GRAPH_LIMIT) { |
| 103 | + DependencyGraph visibleGraph = dependencyGraph.forLevel(DevBeanInfos.DEFAULT_MAX_DEPENDENCY_LEVEL); |
| 104 | + if (visibleGraph.nodes.size() > DEPENCENY_GRAPH_LIMIT) { |
| 105 | + LOG.debugf("Skip dependency graph for %s - too many visible nodes: %s", bean, |
| 106 | + visibleGraph.nodes.size()); |
| 107 | + continue; |
| 108 | + } else { |
| 109 | + LOG.debugf("Dependency graph for %s was reduced to visible nodes: %s", bean, |
| 110 | + dependencyGraph.nodes.size()); |
| 111 | + dependencyGraph = visibleGraph; |
| 112 | + } |
| 113 | + } |
88 | 114 | beanInfos.addDependencyGraph(bean.getIdentifier(), dependencyGraph); |
89 | 115 | // id -> [dep1Id, dep2Id] |
90 | 116 | beanDependenciesMap.put(bean.getIdentifier(), |
|
0 commit comments