Skip to content

Commit 5a3ddf1

Browse files
committed
Switch from genrule to run_binary for Bazel
1 parent e53ec04 commit 5a3ddf1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tools/bazel/rust_cxx_bridge.bzl

Lines changed: 7 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,20 @@ 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 = ["$(location %s)" % src, "-o", "$(location %s.h)" % src, "--header"],
15+
tool = "//:codegen",
1516
)
1617

17-
native.genrule(
18+
run_binary(
1819
name = "%s/source" % name,
1920
srcs = [src],
2021
outs = [src + ".cc"],
21-
cmd = "$(location //:codegen) $< > $@",
22-
tools = ["//:codegen"],
22+
args = ["$(location %s)" % src, "-o", "$(location %s.cc)" % src],
23+
tool = "//:codegen",
2324
)
2425

2526
cc_library(

0 commit comments

Comments
 (0)