hedronvision / bazel-compile-commands-extractor

Goal: Enable awesome tooling for Bazel users of the C language family.
Other
697 stars 115 forks source link

Fix for header-only compile actions by Bazel #219

Open mikael-s-persson opened 2 months ago

mikael-s-persson commented 2 months ago

Fix for header-only compile actions by Bazel

This PR fixes, as far as I can tell, the issues related to #199 where Bazel adds header-only / syntax-only compilation actions that produce dummy output files (.processed). I believe this is part of Bazel open-sourcing more of its capabilities for preprocessing headers and handling pre-compiled modules.

The fix is based on #209 and makes the following changes:

This fix was tested in this repo: https://github.com/mikael-s-persson/evdevpp And also tested and used for a while in other private repos. This seems to produce clean, non-racy outputs. AFAICT, the resulting compile_commands.json file contains everything it should, including the headers.

Fixes #199

davidzchen commented 1 month ago

Is ready to be committed? Can someone please review this?

mtanida commented 3 weeks ago

Is this ready to be merged? We are running into the same issue...

LaicepS commented 1 week ago

This worked fine to produce a compilation database on a Abseil library. But I had to patch the refresh.template.py file in the bazel cache by hand. Is there another way (other than waiting for this to be merged)?