| Tim Windelschmidt | 8e19fa4 | 2024-11-12 13:39:43 +0000 | [diff] [blame] | 1 | def _build_logo_impl(ctx): |
| 2 | arguments = ctx.actions.args() |
| 3 | |
| 4 | arguments.add_all(["--input"] + ctx.files.logo) |
| 5 | output = ctx.actions.declare_file("logo.asm") |
| 6 | arguments.add_all(["--output", output]) |
| 7 | |
| 8 | ctx.actions.run( |
| 9 | outputs = [output], |
| 10 | inputs = ctx.files.logo, |
| 11 | arguments = [arguments], |
| 12 | executable = ctx.executable._genlogo, |
| 13 | ) |
| 14 | |
| 15 | return DefaultInfo( |
| 16 | files = depset([output]), |
| 17 | ) |
| 18 | |
| Tim Windelschmidt | 8e19fa4 | 2024-11-12 13:39:43 +0000 | [diff] [blame] | 19 | gen_logo = rule( |
| 20 | implementation = _build_logo_impl, |
| 21 | attrs = { |
| 22 | "logo": attr.label( |
| 23 | allow_single_file = True, |
| 24 | ), |
| 25 | "_genlogo": attr.label( |
| 26 | default = Label(":genlogo"), |
| 27 | allow_single_file = True, |
| 28 | executable = True, |
| 29 | cfg = "exec", |
| 30 | ), |
| 31 | }, |
| 32 | ) |