diff options
author | 2017-12-14 12:28:56 -0500 | |
---|---|---|
committer | 2017-12-14 12:38:47 -0500 | |
commit | 81a4948b88986359293c78d789dcbdd714caeab1 (patch) | |
tree | 4f00a4bf79fa353f56cc84a0a5e1c6abbc63a0d6 /site | |
parent | ab97d786e9400b70c4513d5b5635fa676487cacf (diff) |
Clarify types of `ctx.attr.<attr_name>` objects.
PiperOrigin-RevId: 179053724
Diffstat (limited to 'site')
-rw-r--r-- | site/docs/skylark/rules.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/site/docs/skylark/rules.md b/site/docs/skylark/rules.md index 7b87852733..ced17c6b06 100644 --- a/site/docs/skylark/rules.md +++ b/site/docs/skylark/rules.md @@ -74,8 +74,11 @@ following attributes: `args`, `flaky`, `local`, `shard_count`, `size`, Labels listed in `attr` will be inputs to the rule. -To access an attribute in a rule's implementation, use -`ctx.attr.<attribute_name>`. The name and the package of a rule are available +To access an attribute in a rule's implementation, use `ctx.attr.<attribute_name>`. +This field will have the type given in the rule's `attrs` dictionary corresponding to +`<attribute_name>`. + +The name and the package of a rule are available with `ctx.label.name` and `ctx.label.package`. See [an example](cookbook.md#attr) of using `attr` in a rule. |