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, )