diff --git a/BUILD.bazel b/BUILD.bazel index 85bd5b43..f3982a2b 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1 @@ -sh_binary( - name = "qac_compile_commands", - srcs = ["qac_compile_commands.sh"], - args = ["$(location //:refresh_compile_commands)"], - data = ["//:refresh_compile_commands"], -) +exports_files(["qac_compile_commands.sh"]) diff --git a/qac_compile_commands.bzl b/qac_compile_commands.bzl new file mode 100644 index 00000000..3c2b8977 --- /dev/null +++ b/qac_compile_commands.bzl @@ -0,0 +1,19 @@ +def qac_compile_commands(name, tool, **kwargs): + """Replaces -isystem with -I in a compile_commands.json file. + + This is necessary to get Helix QAC to work correctly. + + Args: + name: A unique label for this rule. + tool: A label refrencing a @hedron_compile_commands:refresh_compile_commands target. + + """ + arg = "$(location {})".format(tool) + native.sh_binary( + name = name, + # FIXME: Assumes //bazel is a valid label in the consuming workspace. + srcs = ["//bazel:qac_compile_commands.sh"], + args = [arg], + data = [tool], + **kwargs + )