@@ -1795,13 +1795,15 @@ def load_tree(self) -> None:
1795
1795
1796
1796
def fix_cross_refs (self ) -> None :
1797
1797
assert self .tree is not None , "Internal error: method must be called on parsed file only"
1798
+ # We need to set quick_and_dirty when doing a fine grained
1799
+ # cache load because we need to gracefully handle missing modules.
1798
1800
fixup_module_pass_one (self .tree , self .manager .modules ,
1799
- self .manager .options .quick_and_dirty )
1801
+ self .manager .options .quick_and_dirty or
1802
+ self .manager .only_load_from_cache )
1800
1803
1801
1804
def calculate_mros (self ) -> None :
1802
1805
assert self .tree is not None , "Internal error: method must be called on parsed file only"
1803
- fixup_module_pass_two (self .tree , self .manager .modules ,
1804
- self .manager .options .quick_and_dirty )
1806
+ fixup_module_pass_two (self .tree , self .manager .modules )
1805
1807
1806
1808
def patch_dependency_parents (self ) -> None :
1807
1809
"""
@@ -2128,7 +2130,10 @@ def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph:
2128
2130
if manager .options .dump_graph :
2129
2131
dump_graph (graph )
2130
2132
return graph
2131
- process_graph (graph , manager )
2133
+ if manager .only_load_from_cache :
2134
+ halfass_process_graph (graph , manager )
2135
+ else :
2136
+ process_graph (graph , manager )
2132
2137
updated = preserve_cache (graph )
2133
2138
set_updated = set (updated )
2134
2139
manager .saved_cache .clear ()
@@ -2437,14 +2442,6 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
2437
2442
manager .log ("Processing SCC of size %d (%s) as %s" % (size , scc_str , fresh_msg ))
2438
2443
process_stale_scc (graph , scc , manager )
2439
2444
2440
- # If we are running in fine-grained incremental mode with caching,
2441
- # we always process fresh SCCs so that we have all of the symbol
2442
- # tables and fine-grained dependencies available.
2443
- if manager .options .use_fine_grained_cache :
2444
- for prev_scc in fresh_scc_queue :
2445
- process_fresh_scc (graph , prev_scc , manager )
2446
- fresh_scc_queue = []
2447
-
2448
2445
sccs_left = len (fresh_scc_queue )
2449
2446
nodes_left = sum (len (scc ) for scc in fresh_scc_queue )
2450
2447
manager .add_stats (sccs_left = sccs_left , nodes_left = nodes_left )
@@ -2456,6 +2453,25 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
2456
2453
manager .log ("No fresh SCCs left in queue" )
2457
2454
2458
2455
2456
+ def halfass_process_graph (graph : Graph , manager : BuildManager ) -> None :
2457
+ """Finish loading everything for use in the fine-grained incremental cache"""
2458
+
2459
+ # If we are running in fine-grained incremental mode with caching,
2460
+ # we process all SCCs as fresh SCCs so that we have all of the symbol
2461
+ # tables and fine-grained dependencies available.
2462
+ # We fail the loading of any SCC that we can't load a meta for, so we
2463
+ # don't have anything *but* fresh SCCs.
2464
+ sccs = sorted_components (graph )
2465
+ manager .log ("Found %d SCCs; largest has %d nodes" %
2466
+ (len (sccs ), max (len (scc ) for scc in sccs )))
2467
+
2468
+ for ascc in sccs :
2469
+ # Order the SCC's nodes using a heuristic.
2470
+ # Note that ascc is a set, and scc is a list.
2471
+ scc = order_ascc (graph , ascc )
2472
+ process_fresh_scc (graph , scc , manager )
2473
+
2474
+
2459
2475
def order_ascc (graph : Graph , ascc : AbstractSet [str ], pri_max : int = PRI_ALL ) -> List [str ]:
2460
2476
"""Come up with the ideal processing order within an SCC.
2461
2477
0 commit comments