0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 08:30:56 +01:00
mongodb/bazel/coverity/coverity_toolchain.bzl
Daniel Moody 933cf012ef SERVER-89878 add support for bazel with coverity (#21587)
GitOrigin-RevId: 4224f8170307bb0288d349c308368127734c7537
2024-04-30 05:43:44 +00:00

33 lines
1.0 KiB
Python

def _coverity_toolchain(ctx):
result = ctx.execute([
"ls",
"/data/cov-sa/bin/cov-build",
])
if result.return_code == 0:
ctx.report_progress("extracting coverity rules...")
result = ctx.download_and_extract("file:///data/cov-sa/bazel/rules_coverity.tar.gz")
else:
ctx.template(
"coverity/BUILD.bazel",
ctx.attr.build_tpl,
)
ctx.template(
"coverity/repositories.bzl",
ctx.attr.repositories_tpl,
)
coverity_toolchain = repository_rule(
implementation = _coverity_toolchain,
attrs = {
"build_tpl": attr.label(
default = "//bazel/coverity:coverity_toolchain.BUILD",
doc = "Label denoting the BUILD file template that gets installed in the repo.",
),
"repositories_tpl": attr.label(
default = "//bazel/coverity:repositories.bzl",
doc = "Label denoting the repositories files the gets installed to the repo.",
),
},
)