@@ -1795,13 +1795,15 @@ def load_tree(self) -> None:
17951795
17961796 def fix_cross_refs (self ) -> None :
17971797 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.
17981800 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 )
18001803
18011804 def calculate_mros (self ) -> None :
18021805 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 )
18051807
18061808 def patch_dependency_parents (self ) -> None :
18071809 """
@@ -2128,7 +2130,10 @@ def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph:
21282130 if manager .options .dump_graph :
21292131 dump_graph (graph )
21302132 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 )
21322137 updated = preserve_cache (graph )
21332138 set_updated = set (updated )
21342139 manager .saved_cache .clear ()
@@ -2437,14 +2442,6 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
24372442 manager .log ("Processing SCC of size %d (%s) as %s" % (size , scc_str , fresh_msg ))
24382443 process_stale_scc (graph , scc , manager )
24392444
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-
24482445 sccs_left = len (fresh_scc_queue )
24492446 nodes_left = sum (len (scc ) for scc in fresh_scc_queue )
24502447 manager .add_stats (sccs_left = sccs_left , nodes_left = nodes_left )
@@ -2456,6 +2453,25 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
24562453 manager .log ("No fresh SCCs left in queue" )
24572454
24582455
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+
24592475def order_ascc (graph : Graph , ascc : AbstractSet [str ], pri_max : int = PRI_ALL ) -> List [str ]:
24602476 """Come up with the ideal processing order within an SCC.
24612477
0 commit comments