attrs dictionary argument of rule() and aspect().
See the Rules page for more on defining and using attributes.
Members
- bool
- int
- int_list
- label
- label_keyed_string_dict
- label_list
- output
- output_list
- string
- string_dict
- string_keyed_label_dict
- string_list
- string_list_dict
bool
ctx.attr attribute will be of type bool.
Parameters
int
ctx.attr attribute will be of type int.
Parameters
int_list
Parameters
label
Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target’s package.
At analysis time (within the rule’s implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target’s dependencies.
In addition to ordinary source files, this kind of attribute is often used to refer to a tool — for example, a compiler. Such tools are considered to be dependencies, just like source files. To avoid requiring users to specify the tool’s label every time they use the rule in their BUILD files, you can hard-code the label of a canonical tool as the default value of this attribute. If you also want to prevent users from overriding this default, you can make the attribute private by giving it a name that starts with an underscore. See the Rules page for more information.
Parameters
label_keyed_string_dict
Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target’s package.
At analysis time (within the rule’s implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target’s dependencies.
Parameters
label_list
ctx.attr attribute will be of type list of Targets.
This attribute contains unique Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target’s package.
At analysis time (within the rule’s implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target’s dependencies.
Parameters
output
Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target’s package.
At analysis time, the corresponding File can be retrieved using ctx.outputs.
Parameters
output_list
Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target’s package.
At analysis time, the corresponding File can be retrieved using ctx.outputs.
Parameters
string
Parameters
string_dict
Parameters
string_keyed_label_dict
Label values. If a string is supplied in place of a Label, it will be converted using the label constructor. The relative parts of the label path, including the (possibly renamed) repository, are resolved with respect to the instantiated target’s package.
At analysis time (within the rule’s implementation function), when retrieving the attribute value from ctx.attr, labels are replaced by the corresponding Targets. This allows you to access the providers of the current target’s dependencies.