Read the .c/.h paths recorded for this group on the previous run. All modules in a group share the same src_hashes map, so the first readable IR cache is sufficient. Returns paths paired with empty content so callers can distinguish "reuse on disk" from "newly generated".
(
group_sources: list[BuildSource], result: BuildResult
)
| 379 | |
| 380 | |
| 381 | def _load_cached_group_files( |
| 382 | group_sources: list[BuildSource], result: BuildResult |
| 383 | ) -> list[tuple[str, str]]: |
| 384 | """Read the .c/.h paths recorded for this group on the previous run. |
| 385 | |
| 386 | All modules in a group share the same src_hashes map, so the first |
| 387 | readable IR cache is sufficient. Returns paths paired with empty |
| 388 | content so callers can distinguish "reuse on disk" from "newly |
| 389 | generated". |
| 390 | """ |
| 391 | for source in group_sources: |
| 392 | state = result.graph.get(source.module) |
| 393 | if state is None: |
| 394 | continue |
| 395 | try: |
| 396 | ir_json = result.manager.metastore.read(get_state_ir_cache_name(state)) |
| 397 | except (FileNotFoundError, OSError): |
| 398 | continue |
| 399 | try: |
| 400 | ir_data = json.loads(ir_json) |
| 401 | except json.JSONDecodeError: |
| 402 | continue |
| 403 | return [(path, "") for path in ir_data.get("src_hashes", {})] |
| 404 | return [] |
| 405 | |
| 406 | |
| 407 | def get_ir_cache_name(id: str, path: str, options: Options) -> str: |
no test coverage detected
searching dependent graphs…