Skip to content

Instantly share code, notes, and snippets.

@kchodorow
Created June 17, 2016 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kchodorow/22de1dcb8a3e929728d52f3aa8241ceb to your computer and use it in GitHub Desktop.
Save kchodorow/22de1dcb8a3e929728d52f3aa8241ceb to your computer and use it in GitHub Desktop.
load("//:tester.bzl", "greet")
greet(
name = "a-greeting",
my_name = "kristina",
)
$ bazel build :a-greeting
INFO: Found 1 target...
Target //:a-greeting up-to-date:
bazel-bin/hi-there-kristina
INFO: Elapsed time: 0.324s, Critical Path: 0.00s
def _impl(ctx):
output = ctx.outputs.greeting
ctx.file_action(
output = output,
content = "")
greet = rule(
attrs = {"my_name": attr.string()},
outputs = {"greeting": "hi-there-%{my_name}"},
implementation = _impl,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment