ConfiguredAttr
Methods on configured target node's attributes.
ConfiguredAttr.strip_cfg
def ConfiguredAttr.strip_cfg() -> CoercedAttr
Returns this attribute with all configurations stripped.
This is useful when you want to display or compare attributes after configuration
without configuration-specific information in the output. For example, macros
like $(location) may include configuration strings when displayed that can be
removed with this method.
Sample usage:
def _impl_strip_cfg(ctx):
node = ctx.configured_targets("my_cell//:my_genrule")
attrs = node.attrs_eager()
# With configuration: $(exe <dep> (<cfg>))
ctx.output.print(attrs.bash)
# Without configuration: $(exe <dep>)
ctx.output.print(attrs.bash.strip_cfg())
ConfiguredAttr.type
ConfiguredAttr.type: str
Returns the type name of the attribute
Sample usage:
def _impl_type(ctx):
node = ctx.cquery().owner("bin/TARGETS")[0]
attrs = node.attrs_eager()
ctx.output.print(attrs.name.type)
ConfiguredAttr.value
def ConfiguredAttr.value()
Returns the value of this attribute. The value here is not fully resolved like in rules.
Sample usage:
def _impl_value(ctx):
node = ctx.cquery().owner("bin/TARGETS")[0]
attrs = node.attrs_eager()
ctx.output.print(attrs.name.value())