Open bhack opened 4 years ago
/cc @gunan This could be interesting to have in Tensorflow itself but I don't want to duplicate the ticket there. I don't know if you have an internal route on the Bazel team.
I am not sure what compile_commands.json file is. Is this file generated by bazel? Could you provide more details?
@gunan compile_commands.json Is https://clang.llvm.org/docs/JSONCompilationDatabase.html and It is used by many IDEs for integrating with c++ project. If you see I've mentioned two Bazel issues (one for Basel itself and the other one for the Bazel team official plugin for Vscode) cause currently you need to use some external tools/workarounds) to generate/distribuire compile_commands.json with Bazel projects.
This is also useful for clangd and Clang Tooling based refactorings.
@mihaimaruseac are you using the tool or not? :wink: See https://github.com/tensorflow/addons/pull/1808#issuecomment-636217541
clang-tidy
is used, but on the imported code.
What I meant above is other tooling (clang_query
and related) and directly on the open source code
From what I can tell, then we would need to update this file every time a new file is added, or a BUILD file is modified?
@gunan I've already mentioined two bazel bugs: bazelbuild/bazel#258 bazelbuild/vscode-bazel#179
I think I might be able to do it, if I really need this for a security analysis I'm running. No promises yet.
As Bazel team seems is not interested to put resources on this at upstream level many projects are using https://github.com/grailbio/bazel-compilation-database
Yes, but I think I have a solution which uses Bazel and a minimal number of additions to the projects .bazelrc
Ok but check to not reinvet the wheel of alternative approaches: https://github.com/grailbio/bazel-compilation-database#alternatives
Yes, I'm only trying to get the solution that is most stable and requires fewer changes
@mihaimaruseac Do you think that we could track this issue in the SIG build repo?
Yes, let's do that there. Can you open an issue for me please?
I got preempted from working on this, apologies for the delay
Sorry I have no superpowers to migrate this issue.
Oh, I meant creating a new one and then we can either close this or just mention this in the other
@gunan So fast. Too fast :wink:
Umm, now this should be opened again?
Yup!
Just to add a new resource on this thread:
https://github.com/hedronvision/bazel-compile-commands-extractor
Do you think that this could be scheduled in any roadmap?
so how to generate the compile_commands.json?
I generated compile_commands.json sucessfully by use Bazel_and_CompileCommands with tensorflow version v2.17.0-rc1 And I comipled it with clang, and using tensorflow devel docker.
It could be nice if we could generate/distribute
compile_commands.json
to better interact with some IDE and our c++ code.I.e. In Bazel and also in Vscode the the official Bazel team vscode plugin we don't have in tree support to generate
compile_commands
: https://github.com/bazelbuild/bazel/issues/258 https://github.com/bazelbuild/vscode-bazel/issues/179I've tried some quite popular community workaround like: https://github.com/grailbio/bazel-compilation-database
But the problem is that we are using
--action_env
forbuild
when we generate our.bazelrc
withpython configure.py
and so these arguments not supported in other command like e.g.bazel query
https://github.com/bazelbuild/bazel/issues/10226. This is going to invalidate the official bazel vscode plugin that need to executequery command
but also thebazel-compilation-database
workaround cause we have problem to retrieve our env variable.