The easiest way to generate compile_commands.json with Bazel.
- Copy
third_partyto your repository directory. AppendWORKSPACEto yours. - Optionally replace
'kind(cc_.*, //...)'inthird_party/generate_compile_commands/gen.sh. - Run
third_party/generate_compile_commands/gen.sh. - Very likely you need
$ ln -s $(bazel info execution_root)/external ..
Tested with bazel 2.2.0 and protobuf 3.11.4. For old versions of bazel and protobuf, try old commits.