MCPcopy Create free account
hub / github.com/FastLED/FastLED / _write_zccache_input_sidecar

Function _write_zccache_input_sidecar

ci/meson/meson_setup_execute.py:423–456  ·  view source on GitHub ↗

Persist FastLED's source/test/example hashes to a sidecar file the zccache configure-cache wrapper can hash via ``--input-file``. The sidecar lives in ``build_dir.parent`` (typically ``.build/``) so it survives ``bash test --clean`` (which wipes the inner build dir but leaves ``.bui

(
    *,
    build_dir: Path,
    build_mode: str,
    source_hashes: "SourceHashes",
)

Source from the content-addressed store, hash-verified

421
422
423def _write_zccache_input_sidecar(
424 *,
425 build_dir: Path,
426 build_mode: str,
427 source_hashes: "SourceHashes",
428) -> Optional[Path]:
429 """Persist FastLED's source/test/example hashes to a sidecar file the
430 zccache configure-cache wrapper can hash via ``--input-file``.
431
432 The sidecar lives in ``build_dir.parent`` (typically ``.build/``) so
433 it survives ``bash test --clean`` (which wipes the inner build dir
434 but leaves ``.build/`` intact). The per-build-mode suffix prevents
435 cross-mode cache pollution. Returns the sidecar path on success or
436 ``None`` if the parent isn't writable (in which case the caller
437 falls back to the non-input-file wrapper invocation).
438 """
439 sidecar_dir = build_dir.parent
440 try:
441 sidecar_dir.mkdir(parents=True, exist_ok=True)
442 except OSError:
443 return None
444 sidecar = sidecar_dir / f".zccache-meson-inputs-{build_mode}.hash"
445 payload = "\n".join(
446 [
447 f"src={source_hashes.src_hash}",
448 f"test={source_hashes.test_hash}",
449 f"source={source_hashes.source_hash}",
450 ]
451 )
452 try:
453 sidecar.write_text(payload, encoding="utf-8")
454 except OSError:
455 return None
456 return sidecar
457
458
459def build_meson_setup_cmd(

Callers 1

build_meson_setup_cmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected