...
1"""
2Generate warehouse test layout inside bazel to be compared to the layout
3currently checked in.
4"""
5
6def _test_layout_impl(ctx):
7 out = ctx.actions.declare_directory(ctx.label.name)
8 args = ctx.actions.args()
9 args.add(ctx.executable.lift.path)
10 args.add(out.path)
11 args.add(ctx.attr.warehouse_path)
12 ctx.actions.run(
13 arguments = [args],
14 inputs = ctx.files.srcs,
15 outputs = [out],
16 tools = [ctx.executable.lift],
17 executable = ctx.executable.layout_tool,
18 )
19 return [DefaultInfo(files = depset([out]))]
20
21test_layout = rule(
22 implementation = _test_layout_impl,
23 attrs = {
24 "layout_tool": attr.label(
25 default = Label("//test/fixtures:generate_warehouse_layout"),
26 executable = True,
27 cfg = "exec",
28 allow_files = True,
29 doc = "points to sh_binary that generates the layout",
30 ),
31 "lift": attr.label(
32 default = Label("//cmd/f8n/warehouse/lift"),
33 executable = True,
34 cfg = "exec",
35 allow_files = True,
36 ),
37 "warehouse_path": attr.string(
38 mandatory = True,
39 ),
40 "srcs": attr.label_list(
41 allow_files = True,
42 allow_empty = False,
43 ),
44 },
45)
View as plain text