File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -513,6 +513,20 @@ def _run(self):
513513 f"Adding { len (always_target_tasks ) - len (always_target_tasks & target_tasks )} tasks with `always_target` attribute" # type: ignore
514514 )
515515 requested_tasks = target_tasks | always_target_tasks # type: ignore
516+
517+ # Ensure if a task has any `if-dependencies`, it isn't responsible for
518+ # pulling any of them into the target graph when computing the
519+ # transitive closure.
520+ for label in requested_tasks :
521+ task = all_tasks [label ]
522+ if_dep_labels = {task .dependencies [e ] for e in task .if_dependencies }
523+
524+ # Find any if-dependencies that aren't in `requested_tasks` and
525+ # delete them.
526+ for missing in if_dep_labels - requested_tasks :
527+ task .if_dependencies .remove (m )
528+ del task .dependencies [m ]
529+
516530 target_graph = full_task_graph .graph .transitive_closure (requested_tasks )
517531 target_task_graph = TaskGraph (
518532 {l : all_tasks [l ] for l in target_graph .nodes },
You can’t perform that action at this time.
0 commit comments