Skip to content

Commit 61dbb45

Browse files
authored
Merge pull request #327 from dtolnay/bazel
Combine bazel codegen steps into one run of cxxbridge
2 parents f0bd14d + 8b7878c commit 61dbb45

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

tools/bazel/rust_cxx_bridge.bzl

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,42 @@ def rust_cxx_bridge(
77
include_prefix = None,
88
strip_include_prefix = None,
99
deps = []):
10-
run_binary(
10+
native.alias(
1111
name = "%s/header" % name,
12-
srcs = [src],
13-
outs = [src + ".h"],
14-
args = [
15-
"$(location %s)" % src,
16-
"-o",
17-
"$(location %s.h)" % src,
18-
"--header",
19-
],
20-
tool = "//:codegen",
12+
actual = src + ".h",
2113
)
2214

23-
run_binary(
15+
native.alias(
2416
name = "%s/source" % name,
17+
actual = src + ".cc",
18+
)
19+
20+
run_binary(
21+
name = "%s/generated" % name,
2522
srcs = [src],
26-
outs = [src + ".cc"],
23+
outs = [
24+
src + ".h",
25+
src + ".cc",
26+
],
2727
args = [
2828
"$(location %s)" % src,
2929
"-o",
30+
"$(location %s.h)" % src,
31+
"-o",
3032
"$(location %s.cc)" % src,
3133
],
3234
tool = "//:codegen",
3335
)
3436

3537
cc_library(
3638
name = name,
37-
srcs = [":%s/source" % name],
39+
srcs = [src + ".cc"],
3840
deps = deps + [":%s/include" % name],
3941
)
4042

4143
cc_library(
4244
name = "%s/include" % name,
43-
hdrs = [":%s/header" % name],
45+
hdrs = [src + ".h"],
4446
include_prefix = include_prefix,
4547
strip_include_prefix = strip_include_prefix,
4648
)

0 commit comments

Comments
 (0)