AnalysisContext
The type used for defining rules, usually bound as ctx
. Usually the sole argument to the impl
argument of the rule
function.
def _impl_my_rule(ctx: AnalysisContext) -> ["provider"]:
return [DefaultInfo()]
my_rule = rule(impl = _impl_my_rule, attrs = {})
AnalysisContext.actions
AnalysisContext.actions: actions
Returns an actions
value containing functions to define actual actions that are run. See the actions
type for the operations that are available.
AnalysisContext.attrs
AnalysisContext.attrs: struct(..)
Returns the attributes of the target as a Starlark struct with a field for each attribute, which varies per rule. As an example, given a rule with the attrs
argument of {"foo": attrs.string()}
, this field will be a struct
containing a field foo
of type string.
AnalysisContext.label
AnalysisContext.label: None | label
Returns a label
representing the target, or None
if being invoked from a dynamic_output
in Bxl.
AnalysisContext.plugins
AnalysisContext.plugins: AnalysisPlugins
An opaque value that can be indexed with a plugin kind to get a list of the available plugin deps of that kind. The rule must set an appropriate value on uses_plugins
in its declaration.