Created
April 3, 2017 14:24
-
-
Save kchodorow/587a906989abcc9d0d07aa14aa1f241d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load('//:dark-underbelly.bzl', 'du') | |
du(name = "whatever") | |
load('//:very-dark-underbelly.bzl', 'vdu') | |
vdu( | |
name = "dark-whatever", | |
one_result = "foo" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_output(): | |
return {'txt' : '%{name}.txt'} | |
def _impl(ctx): | |
ctx.file_action( | |
output = ctx.outputs.txt, | |
content = "I'm bespoke.", | |
) | |
du = rule( | |
implementation = _impl, | |
outputs = my_output | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_output(one_result): | |
# One result is a label. | |
first_char = one_result.name[0:1] | |
return {'txt' : '%s.txt' % first_char} | |
def _impl(ctx): | |
ctx.file_action( | |
output = ctx.outputs.one_result, | |
content = "I'm bespoke.", | |
) | |
ctx.file_action( | |
output = ctx.outputs.txt, | |
content = "I'm also bespoke.", | |
) | |
vdu = rule( | |
implementation = _impl, | |
attrs = {'one_result' : attr.output()}, | |
outputs = my_output, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You do realize that I will immediately start using that now, right.