Closed tsr-boxbot closed 6 months ago
@tsr-boxbot I can't reproduce as I get some error from Bazel when trying to generate the compile_commands.json using this plugin:
❯ ../bazel-compdb/bazel-compilation-database-0.5.2/generate.py -q //... -- --config=clang_config
ERROR: Unable to find package for @@[unknown repo 'bazel_compdb' requested from @@]//:aspects.bzl: The repository '@@[unknown repo 'bazel_compdb' requested from @@]' could not be resolved: No repository visible as '@bazel_compdb' from main repository.
...
However, the reason for your error is that by default this plugin generates "directory"
entries in compile_commands.json
pointing to some temporary Bazel build directory.
It seems this plugin has an option -s
, which generates the paths pointing to the original source directory, try to regenerate your compile commands with this command:
bazel-compdb -s -q //... -- --config=clang_config
Also, glob
pattern only applies to translation units, so you shouldn't put any header files there:
compilation_database_dir: .
output_directory: docs/diagrams
diagrams:
example_class_diagram:
type: class
glob:
- add.cpp
- add.test.cpp
@bkryza sorry for the delay in responding to you, your find on the -s
flag fixed this issue for me and made your work here usable for me! Thank you and much appreciated
I'm having some trouble using this tool with bazel 6.3.2.
To show the issue I used a small test project found here: https://github.com/tsr-boxbot/bazel_code_coverage_problems
The following was done on hash
91932a84deaf74662657ebb89af0710789a5bc34
of that project.First I generated the compilation database by using https://github.com/grailbio/bazel-compilation-database using this command
which gives me compilation database:
When I use this
.clang-uml
file:I see this:
and there's clearly an
add.cpp
in the compile commands file. Note all the commands I ran were done in the base of the repository.I got clang-uml from the ppa, here's the version info:
I'd really like to use this tool, please lmk what I can do to make this work! <3