ray/ci/generate_compile_commands/BUILD.bazel
mwtian 26fd10c9e8
[CI] Add clang-tidy to lint (#18124)
* clang-tidy

* fix

* fix script

* test clang compiler

* fix clang-tidy rules

* Fix windows and other issues.

* Fix

* Improve information when running check-git-clang-tidy-output.sh on different OS
2021-09-09 00:41:53 -07:00

32 lines
1 KiB
Text

# Tool for listening on Bazel actions and generate compile commands database.
#
# Using Bazel aspect to generate compile commands would be faster. Also Bazel
# action listeners are deprecated. We can switch to that if a stable solution
# exists, e.g. https://github.com/grailbio/bazel-compilation-database
cc_binary(
name = "extract_compile_command",
srcs = ["extract_compile_command.cc"],
# Build fails on Windows, and not part of Ray either.
tags = ["manual"],
deps = [
"//:extra_actions_cc_proto_lib",
"@com_google_protobuf//:protobuf",
"@rapidjson",
],
)
action_listener(
name = "compile_command_listener",
extra_actions = [":compile_command_action"],
mnemonics = ["CppCompile"],
)
extra_action(
name = "compile_command_action",
cmd = "$(location :extract_compile_command) \
$(EXTRA_ACTION_FILE) \
$(output $(ACTION_ID).compile_command.json)",
out_templates = ["$(ACTION_ID).compile_command.json"],
tools = [":extract_compile_command"],
)