Skip to content

Commit

Permalink
Fix documentation of Starlark defined aspects `required_aspect_provid…
Browse files Browse the repository at this point in the history
…ers` attribute

This CL updates the documentation of `required_aspect_providers` attribute to clarify that it accepts either list of providers or list of providers lists but not both at the same time.

PiperOrigin-RevId: 373865480
  • Loading branch information
mai93 authored and copybara-github committed May 14, 2021
1 parent 13b5029 commit d228b09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private static ImmutableList<ImmutableSet<StarlarkProviderIdentifier>> getProvid

for (Object o : starlarkList) {
if (!(o instanceof Sequence)) {
throw Starlark.errorf(errorMsg, PROVIDERS_ARG, "an element of type " + Starlark.type(o));
throw Starlark.errorf(errorMsg, argumentName, "an element of type " + Starlark.type(o));
}
for (Object value : (Sequence) o) {
if (!isProvider(value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,10 @@ StarlarkCallable rule(
defaultValue = "[]",
doc =
"This attribute allows this aspect to inspect other aspects. The value must be a "
+ "list containing individual providers or lists of providers. For example, "
+ "<code>[FooInfo, BarInfo, [BazInfo, QuxInfo]]</code> is a "
+ "valid value."
+ "list containing either individual providers or lists of providers but not "
+ "both. For example, <code>[[FooInfo], [BarInfo], [BazInfo, QuxInfo]]</code> "
+ "is a valid value while <code>[FooInfo, BarInfo, [BazInfo, QuxInfo]]</code> "
+ "is not valid."
+ ""
+ "<p>An unnested list of providers will automatically be converted to a list "
+ "containing one list of providers. That is, "
Expand All @@ -459,8 +460,8 @@ StarlarkCallable rule(
+ "<p>To make another aspect (e.g. <code>other_aspect</code>) visible to this "
+ "aspect, <code>other_aspect</code> must provide all providers from at least "
+ "one of the lists. In the example of "
+ "<code>[FooInfo, BarInfo, [BazInfo, QuxInfo]]</code>, this aspect can only "
+ "see <code>other_aspect</code> if and only if <code>other_aspect</code> "
+ "<code>[[FooInfo], [BarInfo], [BazInfo, QuxInfo]]</code>, this aspect can "
+ "only see <code>other_aspect</code> if and only if <code>other_aspect</code> "
+ "provides <code>FooInfo</code> *or* <code>BarInfo</code> *or* both "
+ "<code>BazInfo</code> *and* <code>QuxInfo</code>."),
@Param(name = "provides", named = true, defaultValue = "[]", doc = PROVIDES_DOC),
Expand Down

0 comments on commit d228b09

Please sign in to comment.