Combine buck codegen steps into one run of cxxbridge

This commit is contained in:
David Tolnay 2020-09-27 17:41:42 -04:00
parent d1ca05aa1c
commit 0489527aec
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -3,17 +3,21 @@ load("//tools/buck:genrule.bzl", "genrule")
def rust_cxx_bridge(name, src, deps = []):
genrule(
name = "%s/header" % name,
srcs = [src],
out = src + ".h",
cmd = "$(exe //:codegen) ${SRCS} -o ${OUT}",
type = "cxxbridge",
cmd = "cp $(location :%s/generated)/generated.h ${OUT}" % name,
)
genrule(
name = "%s/source" % name,
srcs = [src],
out = src + ".cc",
cmd = "$(exe //:codegen) ${SRCS} -o ${OUT}",
cmd = "cp $(location :%s/generated)/generated.cc ${OUT}" % name,
)
genrule(
name = "%s/generated" % name,
srcs = [src],
out = ".",
cmd = "$(exe //:codegen) ${SRCS} -o ${OUT}/generated.h -o ${OUT}/generated.cc",
type = "cxxbridge",
)