@@ -281,9 +281,10 @@ def update_single(self, module: str, path: str) -> Tuple[List[str],
281
281
print ('triggered:' , sorted (filtered ))
282
282
self .triggered .extend (triggered | self .previous_targets_with_errors )
283
283
collect_dependencies ({module : tree }, self .deps , graph )
284
- propagate_changes_using_dependencies (manager , graph , self .deps , triggered ,
285
- {module },
286
- self .previous_targets_with_errors )
284
+ remaining += propagate_changes_using_dependencies (
285
+ manager , graph , self .deps , triggered ,
286
+ {module },
287
+ self .previous_targets_with_errors )
287
288
288
289
# Preserve state needed for the next update.
289
290
self .previous_targets_with_errors = manager .errors .targets ()
@@ -318,6 +319,9 @@ def mark_all_meta_as_memory_only(graph: Dict[str, State],
318
319
def get_all_dependencies (manager : BuildManager , graph : Dict [str , State ],
319
320
options : Options ) -> Dict [str , Set [str ]]:
320
321
"""Return the fine-grained dependency map for an entire build."""
322
+ if not options .use_fine_grained_cache :
323
+ for state in graph .values ():
324
+ state .compute_fine_grained_deps ()
321
325
deps = {} # type: Dict[str, Set[str]]
322
326
collect_dependencies (manager .modules , deps , graph )
323
327
return deps
@@ -441,6 +445,7 @@ def update_single_isolated(module: str,
441
445
# Perform type checking.
442
446
state .type_check_first_pass ()
443
447
state .type_check_second_pass ()
448
+ state .compute_fine_grained_deps ()
444
449
state .finish_passes ()
445
450
# TODO: state.write_cache()?
446
451
# TODO: state.mark_as_rechecked()?
@@ -650,7 +655,6 @@ def collect_dependencies(new_modules: Mapping[str, Optional[MypyFile]],
650
655
for id , node in new_modules .items ():
651
656
if node is None :
652
657
continue
653
- graph [id ].compute_fine_grained_deps ()
654
658
for trigger , targets in graph [id ].fine_grained_deps .items ():
655
659
deps .setdefault (trigger , set ()).update (targets )
656
660
@@ -707,9 +711,10 @@ def propagate_changes_using_dependencies(
707
711
deps : Dict [str , Set [str ]],
708
712
triggered : Set [str ],
709
713
up_to_date_modules : Set [str ],
710
- targets_with_errors : Set [str ]) -> None :
714
+ targets_with_errors : Set [str ]) -> List [ Tuple [ str , str ]] :
711
715
# TODO: Multiple type checking passes
712
716
num_iter = 0
717
+ remaining_modules = []
713
718
714
719
# Propagate changes until nothing visible has changed during the last
715
720
# iteration.
@@ -733,7 +738,13 @@ def propagate_changes_using_dependencies(
733
738
# TODO: Preserve order (set is not optimal)
734
739
for id , nodes in sorted (todo .items (), key = lambda x : x [0 ]):
735
740
assert id not in up_to_date_modules
736
- triggered |= reprocess_nodes (manager , graph , id , nodes , deps )
741
+ # TODO: Is there a better way to detect that the file isn't loaded?
742
+ if not manager .modules [id ].defs :
743
+ # We haven't actually loaded this file! Add it to the
744
+ # queue of files that need to be processed fully.
745
+ remaining_modules .append ((id , manager .modules [id ].path ))
746
+ else :
747
+ triggered |= reprocess_nodes (manager , graph , id , nodes , deps )
737
748
# Changes elsewhere may require us to reprocess modules that were
738
749
# previously considered up to date. For example, there may be a
739
750
# dependency loop that loops back to an originally processed module.
@@ -742,6 +753,8 @@ def propagate_changes_using_dependencies(
742
753
if DEBUG :
743
754
print ('triggered:' , list (triggered ))
744
755
756
+ return remaining_modules
757
+
745
758
746
759
def find_targets_recursive (
747
760
triggers : Set [str ],
@@ -989,4 +1002,6 @@ def lookup_target(modules: Dict[str, MypyFile], target: str) -> List[DeferredNod
989
1002
990
1003
991
1004
def extract_type_maps (graph : Graph ) -> Dict [str , Dict [Expression , Type ]]:
992
- return {id : state .type_map () for id , state in graph .items ()}
1005
+ # This is used to export information used only by the testmerge harness.
1006
+ return {id : state .type_map () for id , state in graph .items ()
1007
+ if state .tree }
0 commit comments