Documentation

rule_attributes

Information about attributes of a rule an aspect is applied to.

attr

struct rule_attributes.attr

A struct to access the values of the attributes. The values are provided by the user (if not, a default value is used).

executable

struct rule_attributes.executable

A struct containing executable files defined in label type attributes marked as executable=True. The struct fields correspond to the attribute names. Each value in the struct is either a file or None. If an optional attribute is not specified in the rule then the corresponding struct value is None. If a label type is not marked as executable=True, no corresponding struct field is generated.

file

struct rule_attributes.file

A struct containing files defined in label type attributes marked as single_file=True. The struct fields correspond to the attribute names. The struct value is always a file or None. If an optional attribute is not specified in the rule then the corresponding struct value is None. If a label type is not marked as single_file=True, no corresponding struct field is generated. It is a shortcut for:
list(ctx.attr.<ATTR>.files)[0]

files

struct rule_attributes.files

A struct containing files defined in label or label list type attributes. The struct fields correspond to the attribute names. The struct values are list of files. If an optional attribute is not specified in the rule, an empty list is generated. It is a shortcut for:
[f for t in ctx.attr.<ATTR> for f in t.files]

kind

string rule_attributes.kind

The kind of a rule, such as 'cc_library'