docs/versions/7.0.0/rules/lib/globals/bzl.mdx
{% dynamic setvar source_file "NONE" %} {% dynamic setvar version "7.0.0" %} {% dynamic setvar original_path "/rules/lib/globals/bzl" %} {% include "_buttons.html" %}
<!-- {% raw %} -->Global methods available in all .bzl files.
<h2>Members</h2> <ul> <li> <a href="#analysis_test_transition">analysis_test_transition</a> </li> <li> <a href="#aspect">aspect</a> </li> <li> <a href="#configuration_field">configuration_field</a> </li> <li> <a href="#depset">depset</a> </li> <li> <a href="#exec_group">exec_group</a> </li> <li> <a href="#module_extension">module_extension</a> </li> <li> <a href="#provider">provider</a> </li> <li> <a href="#repository_rule">repository_rule</a> </li> <li> <a href="#rule">rule</a> </li> <li> <a href="#select">select</a> </li> <li> <a href="#subrule">subrule</a> </li> <li> <a href="#tag_class">tag_class</a> </li> <li> <a href="#visibility">visibility</a> </li> </ul> <h2 id="analysis_test_transition">analysis_test_transition</h2>
<p><pre class="rule-signature"><a class="anchor" href="../builtins/transition.html">transition</a> analysis_test_transition(settings)</pre></p>
<p> Creates a configuration transition to be applied on an analysis-test rule's dependencies. This transition may only be applied on attributes of rules with <code>analysis_test = True</code>. Such rules are restricted in capabilities (for example, the size of their dependency tree is limited), so transitions created using this function are limited in potential scope as compared to transitions created using <a href="../builtins/transition.html"><code>transition()</code></a>. <p>This function is primarily designed to facilitate the <a href="https://bazel.build/versions/7.0.0/rules/testing">Analysis Test Framework</a> core library. See its documentation (or its implementation) for best practices.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="analysis_test_transition.settings">
<code>settings</code>
</td>
<td>
required
A dictionary containing information about configuration settings which should be set by this configuration transition. Keys are build setting labels and values are their new post-transition values. All other settings are unchanged. Use this to declare specific configuration settings that an analysis test requires to be set in order to pass.
</td>
</tr>
</tbody>
</table>
<h2 id="aspect">aspect</h2>
<p><pre class="rule-signature"><a class="anchor" href="../builtins/Aspect.html">Aspect</a> aspect(implementation, attr_aspects=[], attrs={}, required_providers=[], required_aspect_providers=[], provides=[], requires=[], fragments=[], host_fragments=[], toolchains=[], incompatible_use_toolchain_transition=False, doc=None, *, apply_to_generating_rules=False, exec_compatible_with=[], exec_groups=None, subrules=[])</pre></p>
Creates a new aspect. The result of this function must be stored in a global value. Please see the <a href="https://bazel.build/versions/7.0.0/rules/aspects">introduction to Aspects</a> for more details.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="aspect.implementation">
<code>implementation</code>
</td>
<td>
required
A Starlark function that implements this aspect, with exactly two parameters: <a href="../builtins/Target.html">Target</a> (the target to which the aspect is applied) and <a href="../builtins/ctx.html">ctx</a> (the rule context which the target is created from). Attributes of the target are available via the <code>ctx.rule</code> field. This function is evaluated during the analysis phase for each application of an aspect to a target.
</td>
</tr>
<tr>
<td id="aspect.attr_aspects">
<code>attr_aspects</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
List of attribute names. The aspect propagates along dependencies specified in the attributes of a target with these names. Common values here include <code>deps</code> and <code>exports</code>. The list can also contain a single string <code>"*"</code> to propagate along all dependencies of a target.
</td>
</tr>
<tr>
<td id="aspect.attrs">
<code>attrs</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>;
default is <code>{}</code>
A dictionary declaring all the attributes of the aspect. It maps from an attribute name to an attribute object, like `attr.label` or `attr.string` (see <a href="../toplevel/attr.html">attr</a> module). Aspect attributes are available to implementation function as fields of <code>ctx</code> parameter. <p>Implicit attributes starting with <code>_</code> must have default values, and have type <code>label</code> or <code>label_list</code>. <p>Explicit attributes must have type <code>string</code>, and must use the <code>values</code> restriction. Explicit attributes restrict the aspect to only be used with rules that have attributes of the same name, type, and valid values according to the restriction.
</td>
</tr>
<tr>
<td id="aspect.required_providers">
<code>required_providers</code>
</td>
<td>
default is <code>[]</code>
This attribute allows the aspect to limit its propagation to only the targets whose rules advertise its required providers. The value must be a list containing either individual providers or lists of providers but not both. For example, <code>[[FooInfo], [BarInfo], [BazInfo, QuxInfo]]</code> is a valid value while <code>[FooInfo, BarInfo, [BazInfo, QuxInfo]]</code> is not valid.<p>An unnested list of providers will automatically be converted to a list containing one list of providers. That is, <code>[FooInfo, BarInfo]</code> will automatically be converted to <code>[[FooInfo, BarInfo]]</code>.<p>To make some rule (e.g. <code>some_rule</code>) targets visible to an aspect, <code>some_rule</code> must advertise all providers from at least one of the required providers lists. For example, if the <code>required_providers</code> of an aspect are <code>[[FooInfo], [BarInfo], [BazInfo, QuxInfo]]</code>, this aspect can see <code>some_rule</code> targets if and only if <code>some_rule</code> provides <code>FooInfo</code>, <em>or</em> <code>BarInfo</code>, <em>or</em> both <code>BazInfo</code> <em>and</em> <code>QuxInfo</code>.
</td>
</tr>
<tr>
<td id="aspect.required_aspect_providers">
<code>required_aspect_providers</code>
</td>
<td>
default is <code>[]</code>
This attribute allows this aspect to inspect other aspects. The value must be a list containing either individual providers or lists of providers but not both. For example, <code>[[FooInfo], [BarInfo], [BazInfo, QuxInfo]]</code> is a valid value while <code>[FooInfo, BarInfo, [BazInfo, QuxInfo]]</code> is not valid.<p>An unnested list of providers will automatically be converted to a list containing one list of providers. That is, <code>[FooInfo, BarInfo]</code> will automatically be converted to <code>[[FooInfo, BarInfo]]</code>. <p>To make another aspect (e.g. <code>other_aspect</code>) visible to this aspect, <code>other_aspect</code> must provide all providers from at least one of the lists. In the example of <code>[[FooInfo], [BarInfo], [BazInfo, QuxInfo]]</code>, this aspect can see <code>other_aspect</code> if and only if <code>other_aspect</code> provides <code>FooInfo</code>, <em>or</em> <code>BarInfo</code>, <em>or</em> both <code>BazInfo</code> <em>and</em> <code>QuxInfo</code>.
</td>
</tr>
<tr>
<td id="aspect.provides">
<code>provides</code>
</td>
<td>
default is <code>[]</code>
A list of providers that the implementation function must return.<p>It is an error if the implementation function omits any of the types of providers listed here from its return value. However, the implementation function may return additional providers not listed here.<p>Each element of the list is an <code>*Info</code> object returned by <a href='../globals/bzl.html#provider'><code>provider()</code></a>, except that a legacy provider is represented by its string name instead.When a target of the rule is used as a dependency for a target that declares a required provider, it is not necessary to specify that provider here. It is enough that the implementation function returns it. However, it is considered best practice to specify it, even though this is not required. The <a href='../globals/bzl.html#aspect.required_providers'><code>required_providers</code></a> field of an <a href='../globals/bzl.html#aspect'>aspect</a> does, however, require that providers are specified here.
</td>
</tr>
<tr>
<td id="aspect.requires">
<code>requires</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Aspect.html">Aspect</a>s;
default is <code>[]</code>
List of aspects required to be propagated before this aspect.
</td>
</tr>
<tr>
<td id="aspect.fragments">
<code>fragments</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
List of names of configuration fragments that the aspect requires in target configuration.
</td>
</tr>
<tr>
<td id="aspect.host_fragments">
<code>host_fragments</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
List of names of configuration fragments that the aspect requires in host configuration.
</td>
</tr>
<tr>
<td id="aspect.toolchains">
<code>toolchains</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a>;
default is <code>[]</code>
If set, the set of toolchains this rule requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. Toolchains will be found by checking the current platform, and provided to the rule implementation via <code>ctx.toolchain</code>.
</td>
</tr>
<tr>
<td id="aspect.incompatible_use_toolchain_transition">
<code>incompatible_use_toolchain_transition</code>
</td>
<td>
default is <code>False</code>
Deprecated, this is no longer in use and should be removed.
</td>
</tr>
<tr>
<td id="aspect.doc">
<code>doc</code>
</td>
<td>
<a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
default is <code>None</code>
A description of the aspect that can be extracted by documentation generating tools.
</td>
</tr>
<tr>
<td id="aspect.apply_to_generating_rules">
<code>apply_to_generating_rules</code>
</td>
<td>
default is <code>False</code>
If true, the aspect will, when applied to an output file, instead apply to the output file's generating rule. <p>For example, suppose an aspect propagates transitively through attribute `deps` and it is applied to target `alpha`. Suppose `alpha` has `deps = [':beta_output']`, where `beta_output` is a declared output of a target `beta`. Suppose `beta` has a target `charlie` as one of its `deps`. If `apply_to_generating_rules=True` for the aspect, then the aspect will propagate through `alpha`, `beta`, and `charlie`. If False, then the aspect will propagate only to `alpha`. </p><p>False by default.</p>
</td>
</tr>
<tr>
<td id="aspect.exec_compatible_with">
<code>exec_compatible_with</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
A list of constraints on the execution platform that apply to all instances of this aspect.
</td>
</tr>
<tr>
<td id="aspect.exec_groups">
<code>exec_groups</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>; or <code>None</code>;
default is <code>None</code>
Dict of execution group name (string) to <a href='../globals/bzl.html#exec_group'><code>exec_group</code>s</a>. If set, allows aspects to run actions on multiple execution platforms within a single instance. See <a href='/versions/7.0.0/reference/exec-groups'>execution groups documentation</a> for more info.
</td>
</tr>
<tr>
<td id="aspect.subrules">
<code>subrules</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Subrule.html">Subrule</a>s;
default is <code>[]</code>
Experimental: list of subrules used by this aspect.
</td>
</tr>
</tbody>
</table>
<h2 id="configuration_field">configuration_field</h2>
<p><pre class="rule-signature"><a class="anchor" href="../builtins/LateBoundDefault.html">LateBoundDefault</a> configuration_field(fragment, name)</pre></p>
References a late-bound default value for an attribute of type <a href="../toplevel/attr.html#label">label</a>. A value is 'late-bound' if it requires the configuration to be built before determining the value. Any attribute using this as a value must <a href="https://bazel.build/versions/7.0.0/extending/rules#private-attributes">be private</a>. <p>Example usage: <p>Defining a rule attribute:
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="configuration_field.fragment">
<code>fragment</code>
</td>
<td>
required
The name of a configuration fragment which contains the late-bound value.
</td>
</tr>
<tr>
<td id="configuration_field.name">
<code>name</code>
</td>
<td>
required
The name of the value to obtain from the configuration fragment.
</td>
</tr>
</tbody>
</table>
<h2 id="depset">depset</h2>
<p><pre class="rule-signature"><a class="anchor" href="../builtins/depset.html">depset</a> depset(direct=None, order="default", *, transitive=None)</pre></p>
Creates a <a href="../builtins/depset.html">depset</a>. The <code>direct</code> parameter is a list of direct elements of the depset, and <code>transitive</code> parameter is a list of depsets whose elements become indirect elements of the created depset. The order in which elements are returned when the depset is converted to a list is specified by the <code>order</code> parameter. See the <a href="https://bazel.build/versions/7.0.0/extending/depsets">Depsets overview</a> for more information.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="depset.direct">
<code>direct</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a>; or <code>None</code>;
default is <code>None</code>
A list of <i>direct</i> elements of a depset.
</td>
</tr>
<tr>
<td id="depset.order">
<code>order</code>
</td>
<td>
default is <code>"default"</code>
The traversal strategy for the new depset. See <a href="../builtins/depset.html">here</a> for the possible values.
</td>
</tr>
<tr>
<td id="depset.transitive">
<code>transitive</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/depset.html">depset</a>s; or <code>None</code>;
default is <code>None</code>
A list of depsets whose elements will become indirect elements of the depset.
</td>
</tr>
</tbody>
</table>
<h2 id="exec_group">exec_group</h2>
<p><pre class="rule-signature">exec_group exec_group(toolchains=[], exec_compatible_with=[])</pre></p>
Creates an <a href='/versions/7.0.0/reference/exec-groups'>execution group</a> which can be used to create actions for a specific execution platform during rule implementation.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="exec_group.toolchains">
<code>toolchains</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a>;
default is <code>[]</code>
The set of toolchains this execution group requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination.
</td>
</tr>
<tr>
<td id="exec_group.exec_compatible_with">
<code>exec_compatible_with</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
A list of constraints on the execution platform.
</td>
</tr>
</tbody>
</table>
<h2 id="module_extension">module_extension</h2>
<p><pre class="rule-signature">unknown module_extension(implementation, *, tag_classes={}, doc=None, environ=[], os_dependent=False, arch_dependent=False)</pre></p>
Creates a new module extension. Store it in a global value, so that it can be exported and used in a MODULE.bazel file.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="module_extension.implementation">
<code>implementation</code>
</td>
<td>
required
The function that implements this module extension. Must take a single parameter, <code><a href="../builtins/module_ctx.html">module_ctx</a></code>. The function is called once at the beginning of a build to determine the set of available repos.
</td>
</tr>
<tr>
<td id="module_extension.tag_classes">
<code>tag_classes</code>
</td>
<td>
default is <code>{}</code>
A dictionary to declare all the tag classes used by the extension. It maps from the name of the tag class to a <code><a href="../builtins/tag_class.html">tag_class</a></code> object.
</td>
</tr>
<tr>
<td id="module_extension.doc">
<code>doc</code>
</td>
<td>
<a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
default is <code>None</code>
A description of the module extension that can be extracted by documentation generating tools.
</td>
</tr>
<tr>
<td id="module_extension.environ">
<code>environ</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
Provides a list of environment variable that this module extension depends on. If an environment variable in that list changes, the extension will be re-evaluated.
</td>
</tr>
<tr>
<td id="module_extension.os_dependent">
<code>os_dependent</code>
</td>
<td>
default is <code>False</code>
Indicates whether this extension is OS-dependent or not
</td>
</tr>
<tr>
<td id="module_extension.arch_dependent">
<code>arch_dependent</code>
</td>
<td>
default is <code>False</code>
Indicates whether this extension is architecture-dependent or not
</td>
</tr>
</tbody>
</table>
<h2 id="provider">provider</h2>
<p><pre class="rule-signature">unknown provider(doc=None, *, fields=None, init=None)</pre></p>
Defines a provider symbol. The provider may be instantiated by calling it, or used directly as a key for retrieving an instance of that provider from a target. Example:
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="provider.doc">
<code>doc</code>
</td>
<td>
<a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
default is <code>None</code>
A description of the provider that can be extracted by documentation generating tools.
</td>
</tr>
<tr>
<td id="provider.fields">
<code>fields</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s; or <a class="anchor" href="../core/dict.html">dict</a>; or <code>None</code>;
default is <code>None</code>
If specified, restricts the set of allowed fields.
Possible values are:<ul> <li> list of fields: <pre class="language-python">provider(fields = ['a', 'b'])</pre><p> <li> dictionary field name -> documentation: <pre class="language-python">provider( fields = { 'a' : 'Documentation for a', 'b' : 'Documentation for b' })</pre></ul>All fields are optional. </td> </tr> <tr> <td id="provider.init"> <code>init</code> </td> <td> callable; or <code>None</code>; default is <code>None</code>
An optional callback for preprocessing and validating the provider's field values during instantiation. If <code>init</code> is specified, <code>provider()</code> returns a tuple of 2 elements: the normal provider symbol and a <em>raw constructor</em>.<p>A precise description follows; see <a href='https://bazel.build/versions/7.0.0/extending/rules#custom_initialization_of_providers'>Rules (Custom initialization of providers)</a> for an intuitive discussion and use cases.<p>Let <code>P</code> be the provider symbol created by calling <code>provider()</code>. Conceptually, an instance of <code>P</code> is generated by calling a default constructor function <code>c(*args, **kwargs)</code>, which does the following:<ul><li>If <code>args</code> is non-empty, an error occurs.</li><li>If the <code>fields</code> parameter was specified when <code>provider()</code> was called, and if <code>kwargs</code> contains any key that was not listed in <code>fields</code>, an error occurs.</li><li>Otherwise, <code>c</code> returns a new instance that has, for each <code>k: v</code> entry in <code>kwargs</code>, a field named <code>k</code> with value <code>v</code>.</ul>In the case where an <code>init</code> callback is <em>not</em> given, a call to the symbol <code>P</code> itself acts as a call to the default constructor function <code>c</code>; in other words, <code>P(*args, **kwargs)</code> returns <code>c(*args, **kwargs)</code>. For example,<pre class="language-python">MyInfo = provider()
m = MyInfo(foo = 1)</pre>will straightforwardly make it so that <code>m</code> is a <code>MyInfo</code> instance with <code>m.foo == 1</code>.<p>But in the case where <code>init</code> is specified, the call <code>P(*args, **kwargs)</code> will perform the following steps instead:<ol><li>The callback is invoked as <code>init(*args, **kwargs)</code>, that is, with the exact same positional and keyword arguments as were passed to <code>P</code>.</li><li>The return value of <code>init</code> is expected to be a dictionary, <code>d</code>, whose keys are field name strings. If it is not, an error occurs.</li><li>A new instance of <code>P</code> is generated as if by calling the default constructor with <code>d</code>'s entries as keyword arguments, as in <code>c(**d)</code>.</li></ol><p>NB: the above steps imply that an error occurs if <code>*args</code> or <code>**kwargs</code> does not match <code>init</code>'s signature, or the evaluation of <code>init</code>'s body fails (perhaps intentionally via a call to <a href="../globals/all.html#fail"><code>fail()</code></a>), or if the return value of <code>init</code> is not a dictionary with the expected schema.<p>In this way, the <code>init</code> callback generalizes normal provider construction by allowing positional arguments and arbitrary logic for preprocessing and validation. It does <em>not</em> enable circumventing the list of allowed <code>fields</code>.<p>When <code>init</code> is specified, the return value of <code>provider()</code> becomes a tuple <code>(P, r)</code>, where <code>r</code> is the <em>raw constructor</em>. In fact, the behavior of <code>r</code> is exactly that of the default constructor function <code>c</code> discussed above. Typically, <code>r</code> is bound to a variable whose name is prefixed with an underscore, so that only the current .bzl file has direct access to it:<pre class="language-python">MyInfo, _new_myinfo = provider(init = ...)</pre> </td> </tr> </tbody> </table>
<h2 id="repository_rule">repository_rule</h2>
<p><pre class="rule-signature">callable repository_rule(implementation, *, attrs=None, local=False, environ=[], configure=False, remotable=False, doc=None)</pre></p>
Creates a new repository rule. Store it in a global value, so that it can be loaded and called from the WORKSPACE file.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="repository_rule.implementation">
<code>implementation</code>
</td>
<td>
required
the function that implements this rule. Must have a single parameter, <code><a href="../builtins/repository_ctx.html">repository_ctx</a></code>. The function is called during the loading phase for each instance of the rule.
</td>
</tr>
<tr>
<td id="repository_rule.attrs">
<code>attrs</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>; or <code>None</code>;
default is <code>None</code>
dictionary to declare all the attributes of the rule. It maps from an attribute name to an attribute object (see <a href="../toplevel/attr.html">attr</a> module). Attributes starting with <code>_</code> are private, and can be used to add an implicit dependency on a label to a file (a repository rule cannot depend on a generated artifact). The attribute <code>name</code> is implicitly added and must not be specified.
</td>
</tr>
<tr>
<td id="repository_rule.local">
<code>local</code>
</td>
<td>
default is <code>False</code>
Indicate that this rule fetches everything from the local system and should be reevaluated at every fetch.
</td>
</tr>
<tr>
<td id="repository_rule.environ">
<code>environ</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
Provides a list of environment variable that this repository rule depends on. If an environment variable in that list change, the repository will be refetched.
</td>
</tr>
<tr>
<td id="repository_rule.configure">
<code>configure</code>
</td>
<td>
default is <code>False</code>
Indicate that the repository inspects the system for configuration purpose
</td>
</tr>
<tr>
<td id="repository_rule.remotable">
<code>remotable</code>
</td>
<td>
default is <code>False</code>
<b>Experimental</b>. This parameter is experimental and may change at any time. Please do not depend on it. It may be enabled on an experimental basis by setting <code>---experimental_repo_remote_exec</code>
Compatible with remote execution </td> </tr> <tr> <td id="repository_rule.doc"> <code>doc</code> </td> <td> <a class="anchor" href="../core/string.html">string</a>; or <code>None</code>; default is <code>None</code>
A description of the repository rule that can be extracted by documentation generating tools.
</td>
</tr>
</tbody>
</table>
<h2 id="rule">rule</h2>
<p><pre class="rule-signature">callable rule(implementation, *, test=unbound, attrs={}, outputs=None, executable=unbound, output_to_genfiles=False, fragments=[], host_fragments=[], _skylark_testable=False, toolchains=[], incompatible_use_toolchain_transition=False, doc=None, provides=[], exec_compatible_with=[], analysis_test=False, build_setting=None, cfg=None, exec_groups=None, initializer=None, parent=None, extendable=None, subrules=[])</pre></p>
Creates a new rule, which can be called from a BUILD file or a macro to create targets.<p>Rules must be assigned to global variables in a .bzl file; the name of the global variable is the rule's name.<p>Test rules are required to have a name ending in <code>_test</code>, while all other rules must not have this suffix. (This restriction applies only to rules, not to their targets.)
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="rule.implementation">
<code>implementation</code>
</td>
<td>
required
the Starlark function implementing this rule, must have exactly one parameter: <a href="../builtins/ctx.html">ctx</a>. The function is called during the analysis phase for each instance of the rule. It can access the attributes provided by the user. It must create actions to generate all the declared outputs.
</td>
</tr>
<tr>
<td id="rule.test">
<code>test</code>
</td>
<td>
<a class="anchor" href="../core/bool.html">bool</a>;
default is <code>unbound</code>
Whether this rule is a test rule, that is, whether it may be the subject of a <code>blaze test</code> command. All test rules are automatically considered <a href='#rule.executable'>executable</a>; it is unnecessary (and discouraged) to explicitly set <code>executable = True</code> for a test rule. The value defaults to <code>False</code>. See the <a href='https://bazel.build/versions/7.0.0/extending/rules#executable_rules_and_test_rules'> Rules page</a> for more information.
</td>
</tr>
<tr>
<td id="rule.attrs">
<code>attrs</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>;
default is <code>{}</code>
dictionary to declare all the attributes of the rule. It maps from an attribute name to an attribute object (see <a href="../toplevel/attr.html">attr</a> module). Attributes starting with <code>_</code> are private, and can be used to add an implicit dependency on a label. The attribute <code>name</code> is implicitly added and must not be specified. Attributes <code>visibility</code>, <code>deprecation</code>, <code>tags</code>, <code>testonly</code>, and <code>features</code> are implicitly added and cannot be overridden. Most rules need only a handful of attributes. To limit memory usage, the rule function imposes a cap on the size of attrs.
</td>
</tr>
<tr>
<td id="rule.outputs">
<code>outputs</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>; or <code>None</code>; or <a class="anchor" href="../core/function.html">function</a>;
default is <code>None</code>
<b>Deprecated</b>. This parameter is deprecated and will be removed soon. Please do not depend on it. It is <i>disabled</i> with <code>---incompatible_no_rule_outputs_param</code>. Use this flag to verify your code is compatible with its imminent removal.
This parameter has been deprecated. Migrate rules to use <code>OutputGroupInfo</code> or <code>attr.output</code> instead. <p>A schema for defining predeclared outputs. Unlike <a href='../toplevel/attr.html#output'><code>output</code></a> and <a href='../toplevel/attr.html#output_list'><code>output_list</code></a> attributes, the user does not specify the labels for these files. See the <a href='https://bazel.build/versions/7.0.0/extending/rules#files'>Rules page</a> for more on predeclared outputs.<p>The value of this argument is either a dictionary or a callback function that produces a dictionary. The callback works similar to computed dependency attributes: The function's parameter names are matched against the rule's attributes, so for example if you pass <code>outputs = _my_func</code> with the definition <code>def _my_func(srcs, deps): ...</code>, the function has access to the attributes <code>srcs</code> and <code>deps</code>. Whether the dictionary is specified directly or via a function, it is interpreted as follows.<p>Each entry in the dictionary creates a predeclared output where the key is an identifier and the value is a string template that determines the output's label. In the rule's implementation function, the identifier becomes the field name used to access the output's <a href='../builtins/File.html'><code>File</code></a> in <a href='../builtins/ctx.html#outputs'><code>ctx.outputs</code></a>. The output's label has the same package as the rule, and the part after the package is produced by substituting each placeholder of the form <code>"%{ATTR}"</code> with a string formed from the value of the attribute <code>ATTR</code>:<ul><li>String-typed attributes are substituted verbatim.<li>Label-typed attributes become the part of the label after the package, minus the file extension. For example, the label <code>"//pkg:a/b.c"</code> becomes <code>"a/b"</code>.<li>Output-typed attributes become the part of the label after the package, including the file extension (for the above example, <code>"a/b.c"</code>).<li>All list-typed attributes (for example, <code>attr.label_list</code>) used in placeholders are required to have <i>exactly one element</i>. Their conversion is the same as their non-list version (<code>attr.label</code>).<li>Other attribute types may not appear in placeholders.<li>The special non-attribute placeholders <code>%{dirname}</code> and <code>%{basename}</code> expand to those parts of the rule's label, excluding its package. For example, in <code>"//pkg:a/b.c"</code>, the dirname is <code>a</code> and the basename is <code>b.c</code>.</ul><p>In practice, the most common substitution placeholder is <code>"%{name}"</code>. For example, for a target named "foo", the outputs dict <code>{"bin": "%{name}.exe"}</code> predeclares an output named <code>foo.exe</code> that is accessible in the implementation function as <code>ctx.outputs.bin</code>. </td> </tr> <tr> <td id="rule.executable"> <code>executable</code> </td> <td> <a class="anchor" href="../core/bool.html">bool</a>; default is <code>unbound</code>
Whether this rule is considered executable, that is, whether it may be the subject of a <code>blaze run</code> command. It defaults to <code>False</code>. See the <a href='https://bazel.build/versions/7.0.0/extending/rules#executable_rules_and_test_rules'> Rules page</a> for more information.
</td>
</tr>
<tr>
<td id="rule.output_to_genfiles">
<code>output_to_genfiles</code>
</td>
<td>
default is <code>False</code>
If true, the files will be generated in the genfiles directory instead of the bin directory. Unless you need it for compatibility with existing rules (e.g. when generating header files for C++), do not set this flag.
</td>
</tr>
<tr>
<td id="rule.fragments">
<code>fragments</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
List of names of configuration fragments that the rule requires in target configuration.
</td>
</tr>
<tr>
<td id="rule.host_fragments">
<code>host_fragments</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
List of names of configuration fragments that the rule requires in host configuration.
</td>
</tr>
<tr>
<td id="rule._skylark_testable">
<code>_skylark_testable</code>
</td>
<td>
default is <code>False</code>
<i>(Experimental)</i>
If true, this rule will expose its actions for inspection by rules that depend on it via an <code>Actions</code> provider. The provider is also available to the rule itself by calling <a href="../builtins/ctx.html#created_actions">ctx.created_actions()</a>.
This should only be used for testing the analysis-time behavior of Starlark rules. This flag may be removed in the future. </td> </tr> <tr> <td id="rule.toolchains"> <code>toolchains</code> </td> <td> <a class="anchor" href="../core/list.html">sequence</a>; default is <code>[]</code>
If set, the set of toolchains this rule requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. Toolchains will be found by checking the current platform, and provided to the rule implementation via <code>ctx.toolchain</code>.
</td>
</tr>
<tr>
<td id="rule.incompatible_use_toolchain_transition">
<code>incompatible_use_toolchain_transition</code>
</td>
<td>
default is <code>False</code>
Deprecated, this is no longer in use and should be removed.
</td>
</tr>
<tr>
<td id="rule.doc">
<code>doc</code>
</td>
<td>
<a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
default is <code>None</code>
A description of the rule that can be extracted by documentation generating tools.
</td>
</tr>
<tr>
<td id="rule.provides">
<code>provides</code>
</td>
<td>
default is <code>[]</code>
A list of providers that the implementation function must return.<p>It is an error if the implementation function omits any of the types of providers listed here from its return value. However, the implementation function may return additional providers not listed here.<p>Each element of the list is an <code>*Info</code> object returned by <a href='../globals/bzl.html#provider'><code>provider()</code></a>, except that a legacy provider is represented by its string name instead.When a target of the rule is used as a dependency for a target that declares a required provider, it is not necessary to specify that provider here. It is enough that the implementation function returns it. However, it is considered best practice to specify it, even though this is not required. The <a href='../globals/bzl.html#aspect.required_providers'><code>required_providers</code></a> field of an <a href='../globals/bzl.html#aspect'>aspect</a> does, however, require that providers are specified here.
</td>
</tr>
<tr>
<td id="rule.exec_compatible_with">
<code>exec_compatible_with</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
A list of constraints on the execution platform that apply to all targets of this rule type.
</td>
</tr>
<tr>
<td id="rule.analysis_test">
<code>analysis_test</code>
</td>
<td>
default is <code>False</code>
If true, then this rule is treated as an analysis test. <p>Note: Analysis test rules are primarily defined using infrastructure provided in core Starlark libraries. See <a href="https://bazel.build/versions/7.0.0/rules/testing#testing-rules">Testing</a> for guidance. <p>If a rule is defined as an analysis test rule, it becomes allowed to use configuration transitions defined using <a href="#analysis_test_transition">analysis_test_transition</a> on its attributes, but opts into some restrictions: <ul><li>Targets of this rule are limited in the number of transitive dependencies they may have. <li>The rule is considered a test rule (as if <code>test=True</code> were set). This supersedes the value of <code>test</code></li> <li>The rule implementation function may not register actions. Instead, it must register a pass/fail result via providing <a href='../providers/AnalysisTestResultInfo.html'>AnalysisTestResultInfo</a>.</li></ul>
</td>
</tr>
<tr>
<td id="rule.build_setting">
<code>build_setting</code>
</td>
<td>
<a class="anchor" href="../builtins/BuildSetting.html">BuildSetting</a>; or <code>None</code>;
default is <code>None</code>
If set, describes what kind of <a href='/versions/7.0.0/rules/config#user-defined-build-settings'><code>build setting</code></a> this rule is. See the <a href='../toplevel/config.html'><code>config</code></a> module. If this is set, a mandatory attribute named "build_setting_default" is automatically added to this rule, with a type corresponding to the value passed in here.
</td>
</tr>
<tr>
<td id="rule.cfg">
<code>cfg</code>
</td>
<td>
default is <code>None</code>
If set, points to the configuration transition the rule will apply to its own configuration before analysis.
</td>
</tr>
<tr>
<td id="rule.exec_groups">
<code>exec_groups</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>; or <code>None</code>;
default is <code>None</code>
Dict of execution group name (string) to <a href='../globals/bzl.html#exec_group'><code>exec_group</code>s</a>. If set, allows rules to run actions on multiple execution platforms within a single target. See <a href='/versions/7.0.0/reference/exec-groups'>execution groups documentation</a> for more info.
</td>
</tr>
<tr>
<td id="rule.initializer">
<code>initializer</code>
</td>
<td>
default is <code>None</code>
Experimental: the Stalark function initializing the attributes of the rule. <p>The function is called at load time for each instance of the rule. It's called with values of public attributes defined by the rule (not with generic attributes, for example <code>name</code> or <code>tags</code>). <p>It has to return a dictionary from the attribute names to the desired values. The attributes that are not returned are unaffected. Returning <code>None</code> as value results in using the default value specified in the attribute definition. <p>Initializers are evaluated before the default values specified in an attribute definition. Consequently, if a parameter in the initializer's signature contains a default values, it overwrites the default from the attribute definition (except if returning <code>None</code>). <p>Similarly, if a parameter in the initializer's signature doesn't have a default, the parameter will become mandatory. It's a good practice to omit default/mandatory settings on an attribute definition in such cases. <p>It's a good practice to use <code>**kwargs</code> for attributes that are not handled.<p>In case of extended rules, all initializers are called proceeding from child to ancestors. Each initializer is passed only the public attributes it knows about.
</td>
</tr>
<tr>
<td id="rule.parent">
<code>parent</code>
</td>
<td>
default is <code>None</code>
Experimental: the Stalark rule that is extended. When set the public attributes are merged as well as advertised providers. The rule matches <code>executable</code> and <code>test</code> from the parent. Values of <code>fragments</code>, <code>toolchains</code>, <code>exec_compatible_with</code>, and <code>exec_groups</code> are merged. Legacy or deprecated parameters may not be set. Incoming configuration transition <code>cfg</code> of parent is applied after thisrule's incoming configuration.
</td>
</tr>
<tr>
<td id="rule.extendable">
<code>extendable</code>
</td>
<td>
<a class="anchor" href="../core/bool.html">bool</a>; or <a class="anchor" href="../builtins/Label.html">Label</a>; or <a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
default is <code>None</code>
Experimental: A label of an allowlist defining which rules can extending this rule. It can be set also to True/False to always allow/disallow extending. Bazel defaults to always allowing extensions.
</td>
</tr>
<tr>
<td id="rule.subrules">
<code>subrules</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Subrule.html">Subrule</a>s;
default is <code>[]</code>
Experimental: List of subrules used by this rule.
</td>
</tr>
</tbody>
</table>
<h2 id="select">select</h2>
<p><pre class="rule-signature">unknown select(x, no_match_error='')</pre></p>
<code>select()</code> is the helper function that makes a rule attribute <a href="/versions/7.0.0/reference/be/common-definitions#configurable-attributes">configurable</a>. See <a href="/versions/7.0.0/reference/be/functions#select">build encyclopedia</a> for details.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="select.x">
<code>x</code>
</td>
<td>
required
A dict that maps configuration conditions to values. Each key is a <a href="../builtins/Label.html">Label</a> or a label string that identifies a config_setting or constraint_value instance. See the <a href="https://bazel.build/versions/7.0.0/rules/macros#label-resolution">documentation on macros</a> for when to use a Label instead of a string.
</td>
</tr>
<tr>
<td id="select.no_match_error">
<code>no_match_error</code>
</td>
<td>
default is <code>''</code>
Optional custom error to report if no condition matches.
</td>
</tr>
</tbody>
</table>
<h2 id="subrule">subrule</h2>
<p><pre class="rule-signature"><a class="anchor" href="../builtins/Subrule.html">Subrule</a> subrule(implementation, attrs={}, toolchains=[], fragments=[], subrules=[])</pre></p>
Constructs a new instance of a subrule. The result of this function must be stored in a global variable before it can be used.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="subrule.implementation">
<code>implementation</code>
</td>
<td>
<a class="anchor" href="../core/function.html">function</a>;
required
The Starlark function implementing this subrule
</td>
</tr>
<tr>
<td id="subrule.attrs">
<code>attrs</code>
</td>
<td>
<a class="anchor" href="../core/dict.html">dict</a>;
default is <code>{}</code>
A dictionary to declare all the (private) attributes of the subrule. <p/>Subrules may only have private attributes that are label-typed (i.e. label or label-list). The resolved values corresponding to these labels are automatically passed by Bazel to the subrule's implementation function as named arguments (thus the implementation function is required to accept named parameters matching the attribute names). The types of these values will be: <ul><li><code>FilesToRunProvider</code> for label attributes with <code>executable=True</code></li><li><code>File</code> for label attributes with <code>allow_single_file=True</code></li><li><code>Target</code> for all other label attributes</li><li><code>[Target]</code> for all label-list attributes</li></ul>
</td>
</tr>
<tr>
<td id="subrule.toolchains">
<code>toolchains</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a>;
default is <code>[]</code>
If set, the set of toolchains this subrule requires. The list can contain String, Label, or StarlarkToolchainTypeApi objects, in any combination. Toolchains will be found by checking the current platform, and provided to the subrule implementation via <code>ctx.toolchains</code>.
</td>
</tr>
<tr>
<td id="subrule.fragments">
<code>fragments</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../core/string.html">string</a>s;
default is <code>[]</code>
List of names of configuration fragments that the subrule requires in target configuration.
</td>
</tr>
<tr>
<td id="subrule.subrules">
<code>subrules</code>
</td>
<td>
<a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Subrule.html">Subrule</a>s;
default is <code>[]</code>
List of other subrules needed by this subrule.
</td>
</tr>
</tbody>
</table>
<h2 id="tag_class">tag_class</h2>
<p><pre class="rule-signature"><a class="anchor" href="../builtins/tag_class.html">tag_class</a> tag_class(attrs={}, *, doc=None)</pre></p>
Creates a new tag_class object, which defines an attribute schema for a class of tags, which are data objects usable by a module extension.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="tag_class.attrs">
<code>attrs</code>
</td>
<td>
default is <code>{}</code>
A dictionary to declare all the attributes of this tag class. It maps from an attribute name to an attribute object (see <a href="../toplevel/attr.html">attr</a> module).
</td>
</tr>
<tr>
<td id="tag_class.doc">
<code>doc</code>
</td>
<td>
<a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
default is <code>None</code>
A description of the tag class that can be extracted by documentation generating tools.
</td>
</tr>
</tbody>
</table>
<h2 id="visibility">visibility</h2>
<p><pre class="rule-signature"><code>None</code> visibility(value)</pre></p>
<p>Sets the load visibility of the .bzl module currently being initialized.<p>The load visibility of a module governs whether or not other BUILD and .bzl files may load it. (This is distinct from the target visibility of the underlying .bzl source file, which governs whether the file may appear as a dependency of other targets.) Load visibility works at the level of packages: To load a module the file doing the loading must live in a package that has been granted visibility to the module. A module can always be loaded within its own package, regardless of its visibility.<p><code>visibility()</code> may only be called once per .bzl file, and only at the top level, not inside a function. The preferred style is to put this call immediately below the <code>load()</code> statements and any brief logic needed to determine the argument.<p>If the flag <code>--check_bzl_visibility</code> is set to false, load visibility violations will emit warnings but not fail the build.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="visibility.value">
<code>value</code>
</td>
<td>
required
A list of package specification strings, or a single package specification string.<p>Package specifications follow the same format as for <code><a href='/versions/7.0.0/reference/be/functions#package_group'>package_group</a></code>, except that negative package specifications are not permitted. That is, a specification may have the forms:<ul><li><code>"//foo"</code>: the package <code>//foo</code><li><code>"//foo/..."</code>: the package <code>//foo</code> and all of its subpackages.<li><code>"public"</code> or <code>"private"</code>: all packages or no packages, respectively</ul><p>The "@" syntax is not allowed; all specifications are interpreted relative to the current module's repository.<p>If <code>value</code> is a list of strings, the set of packages granted visibility to this module is the union of the packages represented by each specification. (An empty list has the same effect as <code>private</code>.) If <code>value</code> is a single string, it is treated as if it were the singleton list <code>[value]</code>.<p>Note that the flags <code>--incompatible_package_group_has_public_syntax</code> and <code>--incompatible_fix_package_group_reporoot_syntax</code> have no effect on this argument. The <code>"public"</code> and <code>"private"</code> values are always available, and <code>"//..."</code> is always interpreted as "all packages in the current repository".
</td>
</tr>
</tbody>
</table>