Bazel support
Since we are currently switching from CMake to Bazel I was wondering whether you'd accept a patch that was building in support for Bazel.
Is it possible to generate compile_commands.json from Bazel without running a full compile? This was the reason why I never added support for https://github.com/rizsotto/Bear and other build systems, it required full compile before creating the compile_commands.json file needed for libclang.
@damienmg may correct me if I am wrong but here goes:
It would be possible to create Aspects, which collect all inputs of Bazel Rules (mostly from cc_binary, cc_library and such). Then since this is the input only you would have to make an educated guess which arguments are passed to the tools in which form. With this approach you could get most cases roughly covered (IIDMA).
The cleaner approach of course would be a dry-run mode in Bazel, which lets you collect the commandline arguments. I currently would imagine this to be a bit difficult because of script indirection happening AFAIK.
Tried to google it, or find any information on their github and web page. All without success so far however. Only meaningful information I could find was here: https://groups.google.com/forum/#!topic/bazel-discuss/oz4xa1jyIqY
+1
http://www.bazel.io/blog/2016/06/10/ide-support.html is the IDE specific explanation, and the documentation of aspects are in http://www.bazel.io/docs/skylark/aspects.html
Currently working on that (when not fixing Bazel stuff). Want to have https://github.com/bazelbuild/bazel/issues/1486 first, though.
Thank you for the links. Looking forward to finally have support for a second build management system.
@eidheim would it be easier to add a new build system that produces compile_commands.json without full build? If yes, then can I recommend adding support for meson - https://github.com/mesonbuild/meson ?
FYI: Opened https://github.com/abergmeier/bazel_rules_llvm for all things aspect and compile_commands.json.
Thank you guys, I'll have a look after the weekend.
@agauniyal I finally got around to having a look at Meson. It seems to support everything we need, and I'll implement support for meson builds soon.
I'm sorry, but Meson is not Bazel.
For an example of generating compile commands from Bazel, see:
https://gist.github.com/bsilver8192/0115ee5d040bb601e3b7/
@kayasoze I know that meson isn't bazel and I assume @eidheim knows this too. I commented just out of curiosity to see if support for Meson was possible which is totally another build system.
Support for Meson is added in PR #298. Will probably be merged in a week or so depending on how the testing goes. Have to say, adding support for Meson was really easy, since we could find the executables from the compile_commands.json alone. Developers from other build systems should have a look at the compile_commands.json file generated by Meson.