...
1"""
2Helper rules for language proto.
3"""
4
5def _generate_tables_impl(ctx):
6 args = ctx.actions.args()
7 args.add("-input", ctx.file.src)
8 args.add("-output", ctx.outputs.out)
9 ctx.actions.run(
10 executable = ctx.executable.bin,
11 inputs = [ctx.file.src],
12 outputs = [ctx.outputs.out],
13 arguments = [args],
14 )
15
16generate_tables = rule(
17 implementation = _generate_tables_impl,
18 attrs = {
19 "src": attr.label(allow_single_file = True),
20 "out": attr.output(),
21 "bin": attr.label(
22 default = "//generatetables",
23 executable = True,
24 allow_single_file = True,
25 cfg = "exec",
26 ),
27 },
28)
View as plain text