Categorization of files changed during the session.
| 55 | |
| 56 | @dataclass |
| 57 | class ChangeBuckets: |
| 58 | """Categorization of files changed during the session.""" |
| 59 | |
| 60 | src: bool = False |
| 61 | tests: bool = False |
| 62 | examples: bool = False |
| 63 | build: bool = False # CMakeLists.txt, meson.build, meson_options.txt |
| 64 | meson: bool = False # meson.build / meson_options.txt only |
| 65 | other: bool = False # ci/, agents/, docs/, .github/, anything else |
| 66 | files: list[str] = field(default_factory=lambda: list[str]()) |
| 67 | |
| 68 | @property |
| 69 | def needs_cpp_test(self) -> bool: |
| 70 | """C++ tests must run when source/test/example/build files changed.""" |
| 71 | return self.src or self.tests or self.examples or self.build |
| 72 | |
| 73 | @property |
| 74 | def needs_meson_lint(self) -> bool: |
| 75 | """Meson lint stage only needs to run when meson files changed.""" |
| 76 | return self.meson |
| 77 | |
| 78 | @property |
| 79 | def has_any(self) -> bool: |
| 80 | return bool(self.files) |
| 81 | |
| 82 | |
| 83 | def run_cmd(cmd: list[str]) -> subprocess.CompletedProcess[str]: |