Note
Use the workspace branch for older versions of bazel that use the
WORKSPACE file
Add the following lines to the MODULE.bazel file of the project:
bazel_dep(name = "compile_commands_generator", dev_dependency = True)
git_override(
module_name = "compile_commands_generator",
branch = "main",
remote = "https://github.com/xulongwu4/bazel-compilation-database.git",
)Then run the following command to generate the compilation database:
bazel run @compile_commands_generator//:generate_compilation_database