Skip to content

Commit 86f5474

Browse files
authored
Merge branch 'bazel-contrib:main' into adit/mdx-transform-tooling
2 parents bfd5869 + 1b1333b commit 86f5474

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

rules/lib/toplevel/attr.mdx

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and [using](https://bazel.build/extending/rules#implementation_function) attribu
1717
- [label](#label)
1818
- [label\_keyed\_string\_dict](#label_keyed_string_dict)
1919
- [label\_list](#label_list)
20+
- [label\_list\_dict](#label_list_dict)
2021
- [output](#output)
2122
- [output\_list](#output_list)
2223
- [string](#string)
@@ -367,6 +368,87 @@ If set, the attribute materializes dormant dependencies from the transitive clos
367368
The format of this argument is a list of lists of providers -- `*Info` objects returned by [`provider()`](../globals/bzl.html#provider) (or in the case of a legacy provider, its string name). The dependency must return ALL providers mentioned in at least ONE of the inner lists. As a convenience, this argument may also be a single-level list of providers, in which case it is wrapped in an outer list with one element (i.e. `[A, B]` means `[[A, B]]`). It is NOT required that the rule of the dependency advertises those providers in its `provides` parameter, however, it is considered best practice.
368369

369370

371+
`for_dependency_resolution`
372+
default is `unbound`
373+
374+
If this is set, the attribute is available for materializers. Only rules marked with the flag of the same name are allowed to be referenced through such attributes.
375+
`flags`[sequence](../core/list.html) of [string](../core/string.html) s;
376+
default is `[]`
377+
378+
Deprecated, will be removed.
379+
`mandatory`[bool](../core/bool.html);
380+
default is `False`
381+
382+
If true, the value must be specified explicitly (even if it has a `default`).
383+
`skip_validations`[bool](../core/bool.html);
384+
default is `False`
385+
386+
If true, validation actions of transitive dependencies from this attribute will not run. This is a temporary mitigation and WILL be removed in the future.
387+
`cfg`
388+
default is `None`
389+
390+
[Configuration](https://bazel.build/extending/rules#configurations) of the attribute. It can be either `"exec"`, which indicates that the dependency is built for the `execution platform`, or `"target"`, which indicates that the dependency is build for the `target platform`. A typical example of the difference is when building mobile apps, where the `target platform` is `Android` or `iOS` while the `execution platform` is `Linux`, `macOS`, or `Windows`.
391+
`aspects`[sequence](../core/list.html) of [Aspect](../builtins/Aspect.html) s;
392+
default is `[]`
393+
394+
Aspects that should be applied to the dependency or dependencies specified by this attribute.
395+
396+
397+
## label\_list\_dict
398+
399+
```
400+
Attribute attr.label_list_dict(allow_empty=True, *, configurable=unbound, default={}, doc=None, allow_files=None, allow_rules=None, providers=[], for_dependency_resolution=unbound, flags=[], mandatory=False, skip_validations=False, cfg=None, aspects=[])
401+
```
402+
403+
Creates a schema for an attribute holding a dictionary, where the keys are strings and the values are list of labels. This is a dependency attribute.
404+
405+
This attribute contains unique [`Label`](../builtins/Label.html) values. If a string is supplied in place of a `Label`, it will be converted using the [label constructor](../builtins/Label.html#Label). The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target's package.
406+
407+
At analysis time (within the rule's implementation function), when retrieving the attribute value from `ctx.attr`, labels are replaced by the corresponding [`Target`](../builtins/Target.html) s. This allows you to access the providers of the current target's dependencies.
408+
409+
410+
### Parameters
411+
412+
ParameterDescription`allow_empty`[bool](../core/bool.html);
413+
default is `True`
414+
415+
True if the attribute can be empty.
416+
`configurable`[bool](../core/bool.html); or unbound;
417+
default is `unbound`
418+
419+
This argument can only be specified for an attribute of a symbolic macro.
420+
421+
If `configurable` is explicitly set to `False`, the symbolic macro attribute is non-configurable - in other words, it cannot take a `select()` value. If the `configurable` is either unbound or explicitly set to `True`, the attribute is configurable and can take a `select()` value.
422+
423+
For an attribute of a rule or aspect, `configurable` must be left unbound. Most Starlark rule attributes are always configurable, with the exception of `attr.output()`, `attr.output_list()`, and `attr.license()` rule attributes, which are always non-configurable.
424+
425+
426+
`default`[dict](../core/dict.html);
427+
default is `{}`
428+
429+
A default value to use if no value for this attribute is given when instantiating the rule.Use strings or the [`Label`](../builtins/Label.html#Label) function to specify default values, for example,
430+
`attr.label_list_dict(default = {"key1": ["//a:b", "//a:c"], "key2":
431+
[Label("@my_repo//d:e")]})`.
432+
`doc`[string](../core/string.html); or `None`;
433+
default is `None`
434+
435+
A description of the attribute that can be extracted by documentation generating tools.
436+
`allow_files`[bool](../core/bool.html); or [sequence](../core/list.html) of [string](../core/string.html) s; or `None`;
437+
default is `None`
438+
439+
Whether `File` targets are allowed. Can be `True`, `False` (default), or a list of file extensions that are allowed (for example, `[".cc", ".cpp"]`).
440+
`allow_rules`[sequence](../core/list.html) of [string](../core/string.html) s; or `None`;
441+
default is `None`
442+
443+
Which rule targets (name of the classes) are allowed. This is deprecated (kept only for compatibility), use providers instead.
444+
`providers`[sequence](../core/list.html);
445+
default is `[]`
446+
447+
The providers that must be given by any dependency appearing in this attribute.
448+
449+
The format of this argument is a list of lists of providers -- `*Info` objects returned by [`provider()`](../globals/bzl.html#provider) (or in the case of a legacy provider, its string name). The dependency must return ALL providers mentioned in at least ONE of the inner lists. As a convenience, this argument may also be a single-level list of providers, in which case it is wrapped in an outer list with one element (i.e. `[A, B]` means `[[A, B]]`). It is NOT required that the rule of the dependency advertises those providers in its `provides` parameter, however, it is considered best practice.
450+
451+
370452
`for_dependency_resolution`
371453
default is `unbound`
372454

upstream

Submodule upstream updated 445 files

0 commit comments

Comments
 (0)