Skip to content

Conversation

@mmorel-35
Copy link

Replace the unmaintained bazel_compdb with the Hedron bazel-compile-commands-extractor and adapt the workspace tooling.

  • Add http_archive for Hedron in bazel/repositories.bzl (pinned sha256).
  • Add a convenience refresh_compile_commands target to the workspace BUILD.
  • Update tools/gen_compilation_database.py:
    • Prefer calling the external extractor (@hedron_compile_commands//:refresh_all) by default.
    • Support positional Bazel targets by creating a temporary Bazel package with a tmp_refresh_compile_commands target (avoids forwarding targets directly to the extractor which can break bazel aquery).
    • Forward boolean flags (--include_external, --include_genfiles, --include_headers, --include_all, --system-clang) to the extractor.
    • Remove automatic fallback to a workspace-root :refresh_compile_commands and emit a clear error if the external extractor fails.
    • Best-effort cleanup of temporary files created for per-target runs.
  • Update DEVELOPMENT.md with concise English instructions, examples and useful links for generating compile_commands.json.
  • Run basic validation: built and ran the extractor and verified compile_commands.json is produced for both workspace-wide and per-target invocations.

… and docs

Replace the unmaintained `bazel_compdb` with the Hedron
`bazel-compile-commands-extractor` and adapt the workspace tooling.

- Add `http_archive` for Hedron in `bazel/repositories.bzl` (pinned sha256).
- Add a convenience `refresh_compile_commands` target to the workspace `BUILD`.
- Update `tools/gen_compilation_database.py`:
  - Prefer calling the external extractor (`@hedron_compile_commands//:refresh_all`) by default.
  - Forward boolean flags (`--include_external`, `--include_genfiles`,
    `--include_headers`, `--include_all`, `--system-clang`) to the extractor.
  - Remove automatic fallback to a workspace-root `:refresh_compile_commands` and
    emit a clear error if the external extractor fails.
  - Best-effort cleanup of temporary files created for per-target runs.
- Update `DEVELOPMENT.md` with concise English instructions, examples and useful links
  for generating `compile_commands.json`.
- Run basic validation: built and ran the extractor and verified `compile_commands.json`
  is produced for both workspace-wide and per-target invocations.

Signed-off-by: Matthieu MOREL <[email protected]>
@mmorel-35 mmorel-35 force-pushed the bazel-compile-commands-extractor branch from d50460d to 135d081 Compare November 28, 2025 10:41
@mmorel-35 mmorel-35 marked this pull request as draft November 28, 2025 11:08
@mmorel-35 mmorel-35 closed this Nov 29, 2025
@mmorel-35 mmorel-35 deleted the bazel-compile-commands-extractor branch November 29, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant