Make compact snapshot of options for a module. Separately store only the options we may compare individually, and take a hash of everything else. If --debug-cache is specified, fall back to full snapshot.
(id: str, manager: BuildManager)
| 1972 | |
| 1973 | |
| 1974 | def options_snapshot(id: str, manager: BuildManager) -> dict[str, object]: |
| 1975 | """Make compact snapshot of options for a module. |
| 1976 | |
| 1977 | Separately store only the options we may compare individually, and take a hash |
| 1978 | of everything else. If --debug-cache is specified, fall back to full snapshot. |
| 1979 | """ |
| 1980 | platform_opt, values = manager.options.clone_for_module(id).select_options_affecting_cache() |
| 1981 | if manager.options.debug_cache: |
| 1982 | # Build full options snapshot for debugging purposes. |
| 1983 | result: dict[str, object] = {"platform": platform_opt} |
| 1984 | for key, val in zip(OPTIONS_AFFECTING_CACHE_NO_PLATFORM, values): |
| 1985 | result[key] = val |
| 1986 | return result |
| 1987 | # Process most options quickly, since this is performance critical. |
| 1988 | buf = WriteBuffer() |
| 1989 | write_json_value(buf, cast(JsonValue, values)) |
| 1990 | return {"platform": platform_opt, "other_options": hash_digest(buf.getvalue())} |
| 1991 | |
| 1992 | |
| 1993 | def find_cache_meta( |
no test coverage detected
searching dependent graphs…