@@ -33,11 +33,16 @@ public class ArcDevModeApiProcessor {
3333
3434 private static final Logger LOG = Logger .getLogger (ArcDevModeApiProcessor .class );
3535
36+ /**
37+ * Do not generate dependency graphs for apps with more than N beans
38+ */
39+ private static final int DEPENCENY_GRAPH_BEANS_LIMIT = 1000 ;
40+
3641 /**
3742 * If a dependency graph exceeds the limit then we apply the {@link DevBeanInfos#MAX_DEPENDENCY_LEVEL} and if still exceeds
3843 * the limit it's skipped completely, i.e. dependency graph is not available
3944 */
40- private static final int DEPENCENY_GRAPH_LIMIT = 30 ;
45+ private static final int DEPENCENY_GRAPH_NODES_LIMIT = 30 ;
4146
4247 @ BuildStep (onlyIf = IsDevelopment .class )
4348 public void collectBeanInfo (ArcConfig config , ValidationPhaseBuildItem validationPhaseBuildItem ,
@@ -75,7 +80,7 @@ public void collectBeanInfo(ArcConfig config, ValidationPhaseBuildItem validatio
7580
7681 // Build dependency graphs
7782 Map <String , List <String >> beanDependenciesMap = new HashMap <>();
78- if (config . devMode (). generateDependencyGraphs ()) {
83+ if (generateDependencyGraphs (config , beanInfos )) {
7984 BeanResolver resolver = validationPhaseBuildItem .getBeanResolver ();
8085 Collection <BeanInfo > beans = validationContext .get (BuildExtension .Key .BEANS );
8186 Map <BeanInfo , List <InjectionPointInfo >> directDependents = new HashMap <>();
@@ -99,9 +104,9 @@ public void collectBeanInfo(ArcConfig config, ValidationPhaseBuildItem validatio
99104 // Skip the graph if no links exist
100105 continue ;
101106 }
102- if (dependencyGraph .nodes .size () > DEPENCENY_GRAPH_LIMIT ) {
107+ if (dependencyGraph .nodes .size () > DEPENCENY_GRAPH_NODES_LIMIT ) {
103108 DependencyGraph visibleGraph = dependencyGraph .forLevel (DevBeanInfos .DEFAULT_MAX_DEPENDENCY_LEVEL );
104- if (visibleGraph .nodes .size () > DEPENCENY_GRAPH_LIMIT ) {
109+ if (visibleGraph .nodes .size () > DEPENCENY_GRAPH_NODES_LIMIT ) {
105110 LOG .debugf ("Skip dependency graph for %s - too many visible nodes: %s" , bean ,
106111 visibleGraph .nodes .size ());
107112 continue ;
@@ -210,4 +215,13 @@ private void addNodesDependents(int level, BeanInfo root, Set<DevBeanInfo> nodes
210215 }
211216 }
212217
218+ private boolean generateDependencyGraphs (ArcConfig config , DevBeanInfos beanInfos ) {
219+ return switch (config .devMode ().generateDependencyGraphs ()) {
220+ case TRUE -> true ;
221+ case FALSE -> false ;
222+ case AUTO -> beanInfos .getBeans ().size () < DEPENCENY_GRAPH_BEANS_LIMIT ;
223+ default -> throw new IllegalArgumentException ("Unexpected value: " + config .devMode ().generateDependencyGraphs ());
224+ };
225+ }
226+
213227}
0 commit comments