0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 08:30:56 +01:00
mongodb/BUILD.bazel
Daniel Moody 91dc1075f6 SERVER-80631 add compile_command.json support for bazel (#25604)
GitOrigin-RevId: 18d7d6a26bb6bbf3631fa1f6b4018afe0c12855b
2024-08-02 21:56:14 +00:00

50 lines
1.3 KiB
Python

load("@npm//:defs.bzl", "npm_link_all_packages")
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
package(default_visibility = ["//visibility:public"])
exports_files([
"pyproject.toml",
"poetry.lock",
])
npm_link_all_packages(name = "node_modules")
alias(
name = "format",
actual = "//bazel/format",
)
alias(
name = "codeowners",
actual = "//buildscripts:codeowners",
)
# This rule makes it possible to set the clang-tidy configuration setting:
genrule(
name = "clang_tidy_config",
srcs = [
".clang-tidy.in",
],
outs = [".clang-tidy"],
# Note: we use sed to substitute the known good value `build/compiledb/mongo`; testing
# has confirmed that this is the correct value.
cmd = """
cp $(location .clang-tidy.in) $@ && \
sed -i 's|@MONGO_BUILD_DIR@|$(RULEDIR)/src/mongo|g' $@
""",
visibility = ["//visibility:public"],
)
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
refresh_compile_commands(
name = "compiledb",
exclude_external_sources = True,
exclude_headers = "all", # not using "all" adds headers as sources to compile_commands.json which is never what we want
targets = {
"//src/...": "",
},
)