tests/inputs/build.bzl
raw| 1 | """This example creates a rule with a declared output.""" |
| 2 | |
| 3 | def _impl(ctx): |
| 4 | ctx.actions.write( |
| 5 | # Access the default outputs using ctx.outputs.<output name>. |
| 6 | output=ctx.outputs.my_output, |
| 7 | content="Hello World!" |
| 8 | ) |
| 9 | # The default outputs are added automatically to this target. |
| 10 | |
| 11 | rule_with_outputs = rule( |
| 12 | implementation=_impl, |
| 13 | outputs = { |
| 14 | # %{name} is substituted with the rule's name |
| 15 | "my_output": "%{name}.txt" |
| 16 | } |
| 17 | ) |
| 18 |