@@ -588,7 +588,6 @@ def __init__(self, data_dir: str,
588
588
self .data_dir = data_dir
589
589
self .errors = errors
590
590
self .errors .set_ignore_prefix (ignore_prefix )
591
- self .only_load_from_cache = options .use_fine_grained_cache
592
591
self .lib_path = tuple (lib_path )
593
592
self .source_set = source_set
594
593
self .reports = reports
@@ -1675,10 +1674,10 @@ def __init__(self,
1675
1674
for id , line in zip (self .meta .dependencies , self .meta .dep_lines )}
1676
1675
self .child_modules = set (self .meta .child_modules )
1677
1676
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 :
1682
1681
manager .log ("Deferring module to fine-grained update %s (%s)" % (path , id ))
1683
1682
raise ModuleNotFound
1684
1683
@@ -1799,7 +1798,7 @@ def fix_cross_refs(self) -> None:
1799
1798
# cache load because we need to gracefully handle missing modules.
1800
1799
fixup_module_pass_one (self .tree , self .manager .modules ,
1801
1800
self .manager .options .quick_and_dirty or
1802
- self .manager .only_load_from_cache )
1801
+ self .manager .options . use_fine_grained_cache )
1803
1802
1804
1803
def calculate_mros (self ) -> None :
1805
1804
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:
2107
2106
# This is a kind of unfortunate hack to work around some of fine-grained's
2108
2107
# fragility: if we have loaded less than 50% of the specified files from
2109
2108
# 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.
2110
2112
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
2113
2116
graph = load_graph (sources , manager )
2114
2117
2115
2118
t1 = time .time ()
@@ -2130,8 +2133,8 @@ def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph:
2130
2133
if manager .options .dump_graph :
2131
2134
dump_graph (graph )
2132
2135
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 )
2135
2138
else :
2136
2139
process_graph (graph , manager )
2137
2140
updated = preserve_cache (graph )
@@ -2453,7 +2456,7 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
2453
2456
manager .log ("No fresh SCCs left in queue" )
2454
2457
2455
2458
2456
- def halfass_process_graph (graph : Graph , manager : BuildManager ) -> None :
2459
+ def process_fine_grained_cache_graph (graph : Graph , manager : BuildManager ) -> None :
2457
2460
"""Finish loading everything for use in the fine-grained incremental cache"""
2458
2461
2459
2462
# If we are running in fine-grained incremental mode with caching,
0 commit comments