TemplatePlaceholderInfo
A provider that is used for expansions in string attribute templates
String attribute templates allow two types of user-defined placeholders, "unkeyed placeholders"
like $(CXX)
or $(aapt)
and "keyed placeholders" that include a target key like
$(cxxppflags //some:target)
. The expansion of each of these types is based on the
TemplatePlaceholderInfo
providers.
"keyed placeholders" are used for the form $(<key> <target>)
or $(<key> <target> <arg>)
. In both cases
the lookup will expect a TemplatePlaceholderInfo
in the providers of <target>
. It will then lookup
<key>
in the keyed_variables (call this the value
). There are then four valid possibilities:
- no-arg placeholder, an arg-like
value
: resolve tovalue
- no-arg placeholder, a dictionary
value
: resolve tovalue["DEFAULT"]
- arg placeholder, a non-dictionary
value
: this is an error - arg placeholder, a dictionary
value
: resolve tovalue[<arg>]
"unkeyed placeholders" are resolved by matching to any of the deps of the target. $(CXX)
will resolve
to the "CXX" value in any dep's TemplateProviderInfo.unkeyed_variables
Fields:
- unkeyed_variables: A mapping of names to arg-like values. These are used for "unkeyed placeholder" expansion.
- keyed_variables: A mapping of names to arg-like values or dictionary of string to arg-like values. These are used for "keyed placeholder" expansion.
TemplatePlaceholderInfo.keyed_variables
TemplatePlaceholderInfo.keyed_variables: dict[str, typing.Any]
TemplatePlaceholderInfo.unkeyed_variables
TemplatePlaceholderInfo.unkeyed_variables: dict[str, typing.Any]