docs/versions/6.2.0/rules/lib/Target.mdx
The BUILD target for a dependency. Appears in the fields of <code><a href='ctx.html#attr'>ctx.attr</a></code> corresponding to <a href='https://bazel.build/versions/6.2.0/rules/rules#dependency_attributes'>dependency attributes</a> (<code><a href='attr.html#label'>label</a></code> or <code><a href='attr.html#label_list'>label_list</a></code>). Has the following fields:
<ul> <li><h3 id='modules.Target.label'>label</h3> <code><a href='Label.html'>Label</a> Target.label</code>The identifier of the target.</li>
<li><h3 id='modules.Target.files'>files</h3> <code><a href='depset.html'>depset</a> Target.files </code>The set of <code><a href='File.html'>File</a></code>s in the default outputs for this target. Equivalent to <code><a href='DefaultInfo.html#files'>target[DefaultInfo].files</a></code>.</li>
<li><h3 id='modules.Target.aspect_ids'>aspect_ids</h3> <code><a href='list.html'>list</a> Target.aspect_ids </code>The list of <code><a href='ctx.html#aspect_ids'>aspect_ids</a></code> applied to this target.</li>
<li><h3 id='modules.Target.providers'>Providers</h3> The <a href='https://bazel.build/versions/6.2.0/rules/rules#providers'>providers</a> of a rule target can be accessed by type using index notation (<code>target[DefaultInfo]</code>). The presence of providers can be checked using the <code>in</code> operator (<code>SomeInfo in target</code>).If the rule's implementation function returns a <code><a href='struct.html'>struct</a></code> instead of a list of <code><a href='Provider.html'>Provider</a></code> instances, the struct's fields can be accessed via the corresponding fields of the <code>Target</code> (<code>target.some_legacy_info</code>). This behavior <a href='https://bazel.build/versions/6.2.0/rules/rules#migrating_from_legacy_providers'>is deprecated</a>.</li>
</ul> </body> </html> <!-- {% endraw %} -->