diff options
Diffstat (limited to 'ci/build_test_suites.py')
-rw-r--r-- | ci/build_test_suites.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py index 933e43e387..b8c4a385e0 100644 --- a/ci/build_test_suites.py +++ b/ci/build_test_suites.py @@ -22,6 +22,7 @@ import os import pathlib import subprocess import sys +from typing import Callable from build_context import BuildContext import optimized_targets @@ -68,7 +69,7 @@ class BuildPlanner: return BuildPlan(set(self.args.extra_targets), set()) build_targets = set() - packaging_commands = [] + packaging_commands_getters = [] for target in self.args.extra_targets: if self._unused_target_exclusion_enabled( target @@ -84,9 +85,11 @@ class BuildPlanner: target, self.build_context, self.args ) build_targets.update(target_optimizer.get_build_targets()) - packaging_commands.extend(target_optimizer.get_package_outputs_commands()) + packaging_commands_getters.append( + target_optimizer.get_package_outputs_commands + ) - return BuildPlan(build_targets, packaging_commands) + return BuildPlan(build_targets, packaging_commands_getters) def _unused_target_exclusion_enabled(self, target: str) -> bool: return ( @@ -98,7 +101,7 @@ class BuildPlanner: @dataclass(frozen=True) class BuildPlan: build_targets: set[str] - packaging_commands: list[list[str]] + packaging_commands_getters: list[Callable[[], list[list[str]]]] def build_test_suites(argv: list[str]) -> int: @@ -180,9 +183,10 @@ def execute_build_plan(build_plan: BuildPlan): except subprocess.CalledProcessError as e: raise BuildFailureError(e.returncode) from e - for packaging_command in build_plan.packaging_commands: + for packaging_commands_getter in build_plan.packaging_commands_getters: try: - run_command(packaging_command) + for packaging_command in packaging_commands_getter(): + run_command(packaging_command) except subprocess.CalledProcessError as e: raise BuildFailureError(e.returncode) from e |