@@ -588,7 +588,6 @@ def __init__(self, data_dir: str,
588588 self .data_dir = data_dir
589589 self .errors = errors
590590 self .errors .set_ignore_prefix (ignore_prefix )
591- self .only_load_from_cache = options .use_fine_grained_cache
592591 self .lib_path = tuple (lib_path )
593592 self .source_set = source_set
594593 self .reports = reports
@@ -1675,10 +1674,10 @@ def __init__(self,
16751674 for id , line in zip (self .meta .dependencies , self .meta .dep_lines )}
16761675 self .child_modules = set (self .meta .child_modules )
16771676 else :
1678- # In fine-grained cache mode , pretend we only know about modules that
1679- # have cache information and defer handling new modules until the
1680- # fine-grained update.
1681- if manager .only_load_from_cache :
1677+ # When doing a fine-grained cache load , pretend we only
1678+ # know about modules that have cache information and defer
1679+ # handling new modules until the fine-grained update.
1680+ if manager .options . use_fine_grained_cache :
16821681 manager .log ("Deferring module to fine-grained update %s (%s)" % (path , id ))
16831682 raise ModuleNotFound
16841683
@@ -1799,7 +1798,7 @@ def fix_cross_refs(self) -> None:
17991798 # cache load because we need to gracefully handle missing modules.
18001799 fixup_module_pass_one (self .tree , self .manager .modules ,
18011800 self .manager .options .quick_and_dirty or
1802- self .manager .only_load_from_cache )
1801+ self .manager .options . use_fine_grained_cache )
18031802
18041803 def calculate_mros (self ) -> None :
18051804 assert self .tree is not None , "Internal error: method must be called on parsed file only"
@@ -2107,9 +2106,13 @@ def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph:
21072106 # This is a kind of unfortunate hack to work around some of fine-grained's
21082107 # fragility: if we have loaded less than 50% of the specified files from
21092108 # cache in fine-grained cache mode, load the graph again honestly.
2109+ # In this case, we just turn the cache off entirely, so we don't need
2110+ # to worry about some files being loaded and some from cache and so
2111+ # that fine-grained mode never *writes* to the cache.
21102112 if manager .options .use_fine_grained_cache and len (graph ) < 0.50 * len (sources ):
2111- manager .log ("Redoing load_graph because too much was missing" )
2112- manager .only_load_from_cache = False
2113+ manager .log ("Redoing load_graph without cache because too much was missing" )
2114+ manager .options .use_fine_grained_cache = False
2115+ manager .options .cache_dir = os .devnull
21132116 graph = load_graph (sources , manager )
21142117
21152118 t1 = time .time ()
@@ -2130,8 +2133,8 @@ def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph:
21302133 if manager .options .dump_graph :
21312134 dump_graph (graph )
21322135 return graph
2133- if manager .only_load_from_cache :
2134- halfass_process_graph (graph , manager )
2136+ if manager .options . use_fine_grained_cache :
2137+ process_fine_grained_cache_graph (graph , manager )
21352138 else :
21362139 process_graph (graph , manager )
21372140 updated = preserve_cache (graph )
@@ -2453,7 +2456,7 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
24532456 manager .log ("No fresh SCCs left in queue" )
24542457
24552458
2456- def halfass_process_graph (graph : Graph , manager : BuildManager ) -> None :
2459+ def process_fine_grained_cache_graph (graph : Graph , manager : BuildManager ) -> None :
24572460 """Finish loading everything for use in the fine-grained incremental cache"""
24582461
24592462 # If we are running in fine-grained incremental mode with caching,
0 commit comments