aboutsummaryrefslogtreecommitdiffhomepage
path: root/site
diff options
context:
space:
mode:
authorGravatar laurentlb <laurentlb@google.com>2017-12-20 09:44:18 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-20 10:40:46 -0800
commita982168020216055b1cc7a2825d459f76208a733 (patch)
tree5f2d529d9c90b1c0a73459d3145018737f4d1d87 /site
parent241d6cad572f4ba67eb9cdcfddd3ac109c557f0f (diff)
Add link to provider example in the doc
RELNOTES: None. PiperOrigin-RevId: 179697088
Diffstat (limited to 'site')
-rw-r--r--site/docs/skylark/rules.md14
1 files changed, 9 insertions, 5 deletions
diff --git a/site/docs/skylark/rules.md b/site/docs/skylark/rules.md
index 0af307f525..938381d754 100644
--- a/site/docs/skylark/rules.md
+++ b/site/docs/skylark/rules.md
@@ -111,8 +111,8 @@ metal_compile = rule(
Every rule requires an `implementation` function. It contains the actual logic
of the rule and is executed strictly in the
[analysis phase](concepts.md#evaluation-model). The function has exactly one
-input parameter, `ctx`, and it may return the [runfiles](#runfiles)
-and [providers](#providers) of the rule. The input parameter `ctx` can be used
+input parameter, `ctx`, and it may return a list of
+[providers](#providers) of the rule. The input parameter `ctx` can be used
to access attribute values, outputs and dependent targets, and files. It also
has some helper functions. See [the library](lib/ctx.html) for more context.
Example:
@@ -213,8 +213,9 @@ Every rule has a set of default outputs. This is used:
This is the case, for example, if you use a rule in the `srcs` attribute of a
`genrule`.
-In the `DefaultInfo` provider, the `files` field specifies the default outputs
-of a rule. If left unspecified, it will contain all the declared outputs.
+In the [`DefaultInfo`](lib/globals.html#DefaultInfo) provider, the `files` field
+specifies the default outputs of a rule. If left unspecified, it will contain
+all the declared outputs.
```python
def _impl(ctx):
@@ -406,6 +407,8 @@ Providers are only available during the analysis phase. Examples of usage:
* [mandatory providers](https://github.com/bazelbuild/examples/blob/master/rules/mandatory_provider/sum.bzl)
* [optional providers](https://github.com/bazelbuild/examples/blob/master/rules/optional_provider/sum.bzl)
+* [providers with depsets](https://github.com/bazelbuild/examples/blob/master/rules/depsets/foo.bzl)
+ This examples shows how a library and a binary rule can pass information.
> *Note:*
> Historically, Bazel also supported provider instances that are identified by strings and
@@ -653,7 +656,8 @@ you may need to [specify the runfiles](#runfiles).
### How to choose which files are shown in the output of `bazel build`?
-Use the `DefaultInfo` provider to [set the default outputs](#default-outputs).
+Use the [`DefaultInfo`](lib/globals.html#DefaultInfo) provider to
+[set the default outputs](#default-outputs).
### How to run a program in the analysis phase?