Skip to content

Commit b07a76b

Browse files
authored
Wrap sh_binary in macro (#8)
* Wrap sh_binary in macro * Add kwargs parameter * Run buildifier
1 parent ccce4e5 commit b07a76b

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

BUILD.bazel

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
sh_binary(
2-
name = "qac_compile_commands",
3-
srcs = ["qac_compile_commands.sh"],
4-
args = ["$(location //:refresh_compile_commands)"],
5-
data = ["//:refresh_compile_commands"],
6-
)
1+
exports_files(["qac_compile_commands.sh"])

qac_compile_commands.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def qac_compile_commands(name, tool, **kwargs):
2+
"""Replaces -isystem with -I in a compile_commands.json file.
3+
4+
This is necessary to get Helix QAC to work correctly.
5+
6+
Args:
7+
name: A unique label for this rule.
8+
tool: A label refrencing a @hedron_compile_commands:refresh_compile_commands target.
9+
10+
"""
11+
arg = "$(location {})".format(tool)
12+
native.sh_binary(
13+
name = name,
14+
# FIXME: Assumes //bazel is a valid label in the consuming workspace.
15+
srcs = ["//bazel:qac_compile_commands.sh"],
16+
args = [arg],
17+
data = [tool],
18+
**kwargs
19+
)

0 commit comments

Comments
 (0)