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

Function get_compile_commands

ci/util/fbuild_adapter.py:33–63  ·  view source on GitHub ↗

Return the path to ``compile_commands.json`` for ``board``. Thin wrapper around :func:`ci.util.fbuild_compiledb.ensure_compile_commands` that serves as the public, stable entry point for static-analysis tools (``ci/ci-iwyu.py``, ``ci/ci-cppcheck.py``, future ``clang-tidy`` / ``clang

(board: str, build_root: Path)

Source from the content-addressed store, hash-verified

31
32
33def get_compile_commands(board: str, build_root: Path) -> Path | None:
34 """Return the path to ``compile_commands.json`` for ``board``.
35
36 Thin wrapper around :func:`ci.util.fbuild_compiledb.ensure_compile_commands`
37 that serves as the public, stable entry point for static-analysis tools
38 (``ci/ci-iwyu.py``, ``ci/ci-cppcheck.py``, future ``clang-tidy`` /
39 ``clang-format-check`` front-ends) to obtain an fbuild-produced compile
40 database without reaching into the implementation module directly.
41
42 If fbuild has already emitted the database for this board, its existing
43 path is returned. Otherwise fbuild is invoked with
44 ``fbuild <project> build -e <board> --target compiledb`` to materialize it.
45
46 Args:
47 board: Canonical board / fbuild environment name (e.g. ``"esp32c2"``).
48 build_root: The ``.build/`` directory — where fbuild writes its
49 artifacts under ``.fbuild/build/<env>/``. Callers know their build
50 root; no default is applied (per repo style: parameters don&#x27;t have
51 defaults).
52
53 Returns:
54 Path to ``compile_commands.json`` on success, ``None`` if fbuild
55 couldn&#x27;t produce one (binary missing, build failure, etc.).
56 """
57 # Local import: keep this module importable even when fbuild isn't
58 # installed, so callers that only need the identity-probe helpers
59 # (``is_fbuild_available``) stay lightweight.
60 from ci.util.fbuild_compiledb import ensure_compile_commands
61
62 project_root = Path(__file__).resolve().parent.parent.parent
63 return ensure_compile_commands(project_root, build_root, board)
64
65
66def is_fbuild_available() -> bool:

Callers 1

mainFunction · 0.90

Calls 2

ensure_compile_commandsFunction · 0.90
resolveMethod · 0.45

Tested by

no test coverage detected