Skip to content

Commit f0bd14d

Browse files
authored
Merge pull request #326 from dtolnay/run_binary
Switch Bazel rules from genrule to run_binary
2 parents e53ec04 + 73d129d commit f0bd14d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tools/bazel/rust_cxx_bridge.bzl

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
12
load("@rules_cc//cc:defs.bzl", "cc_library")
23

34
def rust_cxx_bridge(
@@ -6,20 +7,29 @@ def rust_cxx_bridge(
67
include_prefix = None,
78
strip_include_prefix = None,
89
deps = []):
9-
native.genrule(
10+
run_binary(
1011
name = "%s/header" % name,
1112
srcs = [src],
1213
outs = [src + ".h"],
13-
cmd = "$(location //:codegen) --header $< > $@",
14-
tools = ["//:codegen"],
14+
args = [
15+
"$(location %s)" % src,
16+
"-o",
17+
"$(location %s.h)" % src,
18+
"--header",
19+
],
20+
tool = "//:codegen",
1521
)
1622

17-
native.genrule(
23+
run_binary(
1824
name = "%s/source" % name,
1925
srcs = [src],
2026
outs = [src + ".cc"],
21-
cmd = "$(location //:codegen) $< > $@",
22-
tools = ["//:codegen"],
27+
args = [
28+
"$(location %s)" % src,
29+
"-o",
30+
"$(location %s.cc)" % src,
31+
],
32+
tool = "//:codegen",
2333
)
2434

2535
cc_library(

0 commit comments

Comments
 (0)