1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
def make_iso(**kwargs):
_make_iso(
image = "{name}.iso".format(**kwargs),
**kwargs
)
def _make_iso_impl(ctx):
inputs = []
outputs = []
args = ctx.actions.args()
args.add("-c", ctx.file.bootloader.path)
inputs.append(ctx.file.bootloader)
args.add("-k", ctx.file.kernel.path)
inputs.append(ctx.file.kernel)
args.add("-o", ctx.outputs.image.path)
outputs.append(ctx.outputs.image)
ctx.actions.run(
inputs = inputs,
outputs = outputs,
arguments = [args],
executable = ctx.executable._generator,
progress_message = "Generating ISO image %s" % ctx.label.name,
)
_make_iso = rule(
attrs = {
"bootloader": attr.label(allow_single_file = True),
"kernel": attr.label(allow_single_file = True),
"image": attr.output(),
"_generator": attr.label(
default = Label(":make_iso"),
executable = True,
allow_files = True,
cfg = "exec",
),
},
implementation = _make_iso_impl,
)
|