Create a BuildOptimizer with an appropriate cache file path for the given build directory. The cache file name is derived from the build directory name (e.g., "meson-quick") so different build modes (quick/debug/release) maintain separate fingerprint caches. Args: build_di
(
build_dir: Path, cache_root: Optional[Path] = None
)
| 170 | |
| 171 | |
| 172 | def make_build_optimizer( |
| 173 | build_dir: Path, cache_root: Optional[Path] = None |
| 174 | ) -> BuildOptimizer: |
| 175 | """ |
| 176 | Create a BuildOptimizer with an appropriate cache file path for the given build directory. |
| 177 | |
| 178 | The cache file name is derived from the build directory name (e.g., "meson-quick") |
| 179 | so different build modes (quick/debug/release) maintain separate fingerprint caches. |
| 180 | |
| 181 | Args: |
| 182 | build_dir: The meson build directory (e.g., .build/meson-quick) |
| 183 | cache_root: Directory for cache files (defaults to .cache/ relative to CWD) |
| 184 | |
| 185 | Returns: |
| 186 | BuildOptimizer instance with loaded saved fingerprints |
| 187 | """ |
| 188 | if cache_root is None: |
| 189 | cache_root = Path(".cache") |
| 190 | mode_name = build_dir.name # e.g., "meson-quick" |
| 191 | cache_file = cache_root / f"build_optimizer_{mode_name}.json" |
| 192 | return BuildOptimizer(cache_file=cache_file) |
no test coverage detected