<html devsite>
<head>
  <meta name="project_path" value="/_project.yaml">
  <meta name="book_path" value="/versions/8.2.0/_book.yaml">
</head>
<body>

<h1 class="page-title" id="modules.ctx">ctx</h1>

{% dynamic setvar source_file "src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkRuleContextApi.java" %}
{% dynamic setvar version "8.2.0" %}
{% dynamic setvar original_path "/rules/lib/builtins/ctx" %}
{% include "_buttons.html" %}
<!-- {% raw %} -->

A context object that is passed to the implementation function for a rule or aspect. It provides access to the information and methods needed to analyze the current target.<p>In particular, it lets the implementation function access the current target's label, attributes, configuration, and the providers of its dependencies. It has methods for declaring output files and the actions that produce them.<p>Context objects essentially live for the duration of the call to the implementation function. It is not useful to access these objects outside of their associated function. See the <a href='https://bazel.build/versions/8.2.0/extending/rules#implementation_function'>Rules page</a> for more information.

<h2>Members</h2>
<ul>
    <li>
    <a href="#actions">actions</a>
  </li>
      <li>
    <a href="#aspect_ids">aspect_ids</a>
  </li>
      <li>
    <a href="#attr">attr</a>
  </li>
      <li>
    <a href="#bin_dir">bin_dir</a>
  </li>
      <li>
    <a href="#build_file_path">build_file_path</a>
  </li>
      <li>
    <a href="#build_setting_value">build_setting_value</a>
  </li>
      <li>
    <a href="#configuration">configuration</a>
  </li>
      <li>
    <a href="#coverage_instrumented">coverage_instrumented</a>
  </li>
      <li>
    <a href="#created_actions">created_actions</a>
  </li>
      <li>
    <a href="#disabled_features">disabled_features</a>
  </li>
      <li>
    <a href="#exec_groups">exec_groups</a>
  </li>
      <li>
    <a href="#executable">executable</a>
  </li>
      <li>
    <a href="#expand_location">expand_location</a>
  </li>
      <li>
    <a href="#expand_make_variables">expand_make_variables</a>
  </li>
      <li>
    <a href="#features">features</a>
  </li>
      <li>
    <a href="#file">file</a>
  </li>
      <li>
    <a href="#files">files</a>
  </li>
      <li>
    <a href="#fragments">fragments</a>
  </li>
      <li>
    <a href="#genfiles_dir">genfiles_dir</a>
  </li>
      <li>
    <a href="#info_file">info_file</a>
  </li>
      <li>
    <a href="#label">label</a>
  </li>
      <li>
    <a href="#outputs">outputs</a>
  </li>
      <li>
    <a href="#resolve_command">resolve_command</a>
  </li>
      <li>
    <a href="#resolve_tools">resolve_tools</a>
  </li>
      <li>
    <a href="#rule">rule</a>
  </li>
      <li>
    <a href="#runfiles">runfiles</a>
  </li>
      <li>
    <a href="#split_attr">split_attr</a>
  </li>
      <li>
    <a href="#super">super</a>
  </li>
      <li>
    <a href="#target_platform_has_constraint">target_platform_has_constraint</a>
  </li>
      <li>
    <a href="#toolchains">toolchains</a>
  </li>
      <li>
    <a href="#var">var</a>
  </li>
      <li>
    <a href="#version_file">version_file</a>
  </li>
      <li>
    <a href="#workspace_name">workspace_name</a>
  </li>
  </ul>

      <h2 id="actions">actions</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/actions.html">actions</a> ctx.actions</pre></p>

    Contains methods for declaring output files and the actions that produce them.


        <h2 id="aspect_ids">aspect_ids</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/list.html">list</a> ctx.aspect_ids</pre></p>

    A list of ids for all aspects applied to the target. Only available in aspect implementation functions.


        <h2 id="attr">attr</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/struct.html">struct</a> ctx.attr</pre></p>

    A struct to access the values of the <a href='https://bazel.build/versions/8.2.0/extending/rules#attributes'>attributes</a>. The values are provided by the user (if not, a default value is used). The attributes of the struct and the types of their values correspond to the keys and values of the <a href='../globals/bzl.html#rule.attrs'><code>attrs</code> dict</a> provided to the <a href='../globals/bzl.html#rule'><code>rule</code> function</a>. <a href="https://github.com/bazelbuild/examples/blob/main/rules/attributes/printer.bzl">See example of use</a>.


        <h2 id="bin_dir">bin_dir</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/root.html">root</a> ctx.bin_dir</pre></p>

    The root corresponding to bin directory.


        <h2 id="build_file_path">build_file_path</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/string.html">string</a> ctx.build_file_path</pre></p>

    Deprecated: Use <code>ctx.label.package + '/BUILD'</code>. The path to the BUILD file for this rule, relative to the source root.


        <h2 id="build_setting_value">build_setting_value</h2>
        <p><pre class="rule-signature">unknown ctx.build_setting_value</pre></p>

    Value of the build setting represented by the current target. If this isn't the context for an instance of a rule that sets the <a href="https://bazel.build/versions/8.2.0/extending/config#rule-parameter"><code>build_setting</code></a> attribute, reading this is an error.


        <h2 id="configuration">configuration</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/configuration.html">configuration</a> ctx.configuration</pre></p>

    The default configuration. See the <a href="../builtins/configuration.html">configuration</a> type for more details.


        <h2 id="coverage_instrumented">coverage_instrumented</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> ctx.coverage_instrumented(target=None)</pre></p>

    Returns whether code coverage instrumentation should be generated when performing compilation actions for this rule or, if <code>target</code> is provided, the rule specified by that Target. (If a non-rule or a Starlark rule Target is provided, this returns False.) Checks if the sources of the current rule (if no Target is provided) or the sources of Target should be instrumented based on the --instrumentation_filter and --instrument_test_targets config settings. This differs from <code>coverage_enabled</code> in the <a href="../builtins/configuration.html">configuration</a>, which notes whether coverage data collection is enabled for the entire run, but not whether a specific target should be instrumented.

          <!-- 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="coverage_instrumented.target">
              <code>target</code>
            </td>
            <td>
                          <a class="anchor" href="../builtins/Target.html">Target</a>; or <code>None</code>;
                                     default is <code>None</code><br/>
                          A Target specifying a rule. If not provided, defaults to the current rule.
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="created_actions">created_actions</h2>
        <p><pre class="rule-signature">StarlarkValue ctx.created_actions()</pre></p>

    For rules with <a href="../globals/bzl.html#rule._skylark_testable">_skylark_testable</a> set to <code>True</code>, this returns an <code>Actions</code> provider representing all actions created so far for the current rule. For all other rules, returns <code>None</code>. Note that the provider is not updated when subsequent actions are created, so you will have to call this function again if you wish to inspect them. <br/><br/>This is intended to help write tests for rule-implementation helper functions, which may take in a <code>ctx</code> object and create actions on it.


        <h2 id="disabled_features">disabled_features</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/list.html">list</a> ctx.disabled_features</pre></p>

    The set of features that are explicitly disabled by the user for this rule.


        <h2 id="exec_groups">exec_groups</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/ExecGroupCollection.html">ExecGroupCollection</a> ctx.exec_groups</pre></p>

    A collection of the execution groups available for this rule, indexed by their name. Access with <code>ctx.exec_groups[name_of_group]</code>.


        <h2 id="executable">executable</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/struct.html">struct</a> ctx.executable</pre></p>

    A <code>struct</code> containing executable files defined in <a href='../toplevel/attr.html#label'>label type attributes</a> marked as <a href='../toplevel/attr.html#label.executable'><code>executable=True</code></a>. The struct fields correspond to the attribute names. Each value in the struct is either a <a href='../builtins/File.html'><code>File</code></a> or <code>None</code>. If an optional attribute is not specified in the rule then the corresponding struct value is <code>None</code>. If a label type is not marked as <code>executable=True</code>, no corresponding struct field is generated. <a href="https://github.com/bazelbuild/examples/blob/main/rules/actions_run/execute.bzl">See example of use</a>.


        <h2 id="expand_location">expand_location</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/string.html">string</a> ctx.expand_location(input, targets=[])</pre></p>

    Expands all <code>$(location ...)</code> templates in the given string by replacing <code>$(location //x)</code> with the path of the output file of target //x. Expansion only works for labels that point to direct dependencies of this rule or that are explicitly listed in the optional argument <code>targets</code>. <br/><br/><code>$(location ...)</code> will cause an error if the referenced target has multiple outputs. In this case, please use <code>$(locations ...)</code> since it produces a space-separated list of output paths. It can be safely used for a single output file, too.<br/><br/>This function is useful to let the user specify a command in a BUILD file (like for <code>genrule</code>). In other cases, it is often better to manipulate labels directly.

          <!-- 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="expand_location.input">
              <code>input</code>
            </td>
            <td>
                          <a class="anchor" href="../core/string.html">string</a>;
                                     required<br/>
                          String to be expanded.
            </td>
          </tr>
                  <tr>
            <td id="expand_location.targets">
              <code>targets</code>
            </td>
            <td>
                          <a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Target.html">Target</a>s;
                                     default is <code>[]</code><br/>
                          List of targets for additional lookup information. These are expanded as follows: A target with a single file in <code>DefaultInfo.files</code> expands to that file. Other targets expand to their <code>DefaultInfo.executable</code> file if set and if <code>--incompatible_locations_prefers_executable</code> is enabled, otherwise they expand to <code>DefaultInfo.files</code>.
            </td>
          </tr>
                </tbody>
      </table>
         May return <code>None</code>.

        <h2 id="expand_make_variables">expand_make_variables</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/string.html">string</a> ctx.expand_make_variables(attribute_name, command, additional_substitutions)</pre></p>

    <b>Deprecated.</b> Use <a href="../builtins/ctx.html#var">ctx.var</a> to access the variables instead.<br>Returns a string after expanding all references to "Make variables". The variables must have the following format: <code>$(VAR_NAME)</code>. Also, <code>$$VAR_NAME</code> expands to <code>$VAR_NAME</code>. Examples:<pre class=language-python>
ctx.expand_make_variables("cmd", "$(MY_VAR)", {"MY_VAR": "Hi"})  # == "Hi"
ctx.expand_make_variables("cmd", "$$PWD", {})  # == "$PWD"
</pre>Additional variables may come from other places, such as configurations. Note that this function is experimental.

          <!-- 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="expand_make_variables.attribute_name">
              <code>attribute_name</code>
            </td>
            <td>
                          <a class="anchor" href="../core/string.html">string</a>;
                                     required<br/>
                          The attribute name. Used for error reporting.
            </td>
          </tr>
                  <tr>
            <td id="expand_make_variables.command">
              <code>command</code>
            </td>
            <td>
                          <a class="anchor" href="../core/string.html">string</a>;
                                     required<br/>
                          The expression to expand. It can contain references to "Make variables".
            </td>
          </tr>
                  <tr>
            <td id="expand_make_variables.additional_substitutions">
              <code>additional_substitutions</code>
            </td>
            <td>
                          <a class="anchor" href="../core/dict.html">dict</a>;
                                     required<br/>
                          Additional substitutions to make beyond the default make variables.
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="features">features</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/list.html">list</a> ctx.features</pre></p>

    The set of features that are explicitly enabled by the user for this rule. <a href="https://github.com/bazelbuild/examples/blob/main/rules/features/rule.bzl">See example of use</a>.


        <h2 id="file">file</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/struct.html">struct</a> ctx.file</pre></p>

    A <code>struct</code> containing files defined in <a href='../toplevel/attr.html#label'>label type attributes</a> marked as <a href='../toplevel/attr.html#label.allow_single_file'><code>allow_single_file</code></a>. The struct fields correspond to the attribute names. The struct value is always a <a href='../builtins/File.html'><code>File</code></a> or <code>None</code>. If an optional attribute is not specified in the rule then the corresponding struct value is <code>None</code>. If a label type is not marked as <code>allow_single_file</code>, no corresponding struct field is generated. It is a shortcut for:<pre class=language-python>list(ctx.attr.&lt;ATTR&gt;.files)[0]</pre>In other words, use <code>file</code> to access the (singular) <a href="https://bazel.build/versions/8.2.0/extending/rules#requesting_output_files">default output</a> of a dependency. <a href="https://github.com/bazelbuild/examples/blob/main/rules/expand_template/hello.bzl">See example of use</a>.


        <h2 id="files">files</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/struct.html">struct</a> ctx.files</pre></p>

    A <code>struct</code> containing files defined in <a href='../toplevel/attr.html#label'>label</a> or <a href='../toplevel/attr.html#label_list'>label list</a> type attributes. The struct fields correspond to the attribute names. The struct values are <code>list</code> of <a href='../builtins/File.html'><code>File</code></a>s.  It is a shortcut for:<pre class=language-python>[f for t in ctx.attr.&lt;ATTR&gt; for f in t.files]</pre> In other words, use <code>files</code> to access the <a href="https://bazel.build/versions/8.2.0/extending/rules#requesting_output_files"> default outputs</a> of a dependency. <a href="https://github.com/bazelbuild/examples/blob/main/rules/depsets/foo.bzl">See example of use</a>.


        <h2 id="fragments">fragments</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/fragments.html">fragments</a> ctx.fragments</pre></p>

    Allows access to configuration fragments in target configuration.


        <h2 id="genfiles_dir">genfiles_dir</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/root.html">root</a> ctx.genfiles_dir</pre></p>

    The root corresponding to genfiles directory.


        <h2 id="info_file">info_file</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/File.html">File</a> ctx.info_file</pre></p>

    The file that is used to hold the non-volatile workspace status for the current build request. See documentation for --workspace_status_command for more information.


        <h2 id="label">label</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/Label.html">Label</a> ctx.label</pre></p>

    The label of the target currently being analyzed.


        <h2 id="outputs">outputs</h2>
        <p><pre class="rule-signature">structure ctx.outputs</pre></p>

    A pseudo-struct containing all the predeclared output files, represented by <a href='../builtins/File.html'><code>File</code></a> objects. See the <a href='https://bazel.build/versions/8.2.0/extending/rules#files'>Rules page</a> for more information and examples.<p>This field does not exist on aspect contexts, since aspects do not have predeclared outputs.<p>The fields of this object are defined as follows. It is an error if two outputs produce the same field name or have the same label.<ul><li> If the rule declares an <a href='../globals/bzl.html#rule.outputs'><code>outputs</code></a> dict, then for every entry in the dict, there is a field whose name is the key and whose value is the corresponding <code>File</code>.<li>For every attribute of type <a href='../toplevel/attr.html#output'><code>attr.output</code></a> that the rule declares, there is a field whose name is the attribute's name. If the target specified a label for that attribute, then the field value is the corresponding <code>File</code>; otherwise the field value is <code>None</code>.<li>For every attribute of type <a href='../toplevel/attr.html#output_list'><code>attr.output_list</code></a> that the rule declares, there is a field whose name is the attribute's name. The field value is a list of <code>File</code> objects corresponding to the labels given for that attribute in the target, or an empty list if the attribute was not specified in the target.<li><b>(Deprecated)</b> If the rule is marked <a href='../globals/bzl.html#rule.executable'><code>executable</code></a> or <a href='../globals/bzl.html#rule.test'><code>test</code></a>, there is a field named <code>"executable"</code>, which is the default executable. It is recommended that instead of using this, you pass another file (either predeclared or not) to the <code>executable</code> arg of <a href='../providers/DefaultInfo.html'><code>DefaultInfo</code></a>.</ul>


        <h2 id="resolve_command">resolve_command</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/tuple.html">tuple</a> ctx.resolve_command(command='', attribute=None, expand_locations=False, make_variables=None, tools=[], label_dict={}, execution_requirements={})</pre></p>

    <i>(Experimental)</i> Returns a tuple <code>(inputs, command, empty list)</code> of the list of resolved inputs and the argv list for the resolved command both of them suitable for passing as the same-named arguments of the  <code>ctx.action</code> method.<br/><b>Note for Windows users</b>: this method requires Bash (MSYS2). Consider using <code>resolve_tools()</code> instead (if that fits your needs). The empty list is returned as the third member of the tuple for backwards compatibility.

          <!-- 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="resolve_command.command">
              <code>command</code>
            </td>
            <td>
                          <a class="anchor" href="../core/string.html">string</a>;
                                     default is <code>''</code><br/>
                          Command to resolve.
            </td>
          </tr>
                  <tr>
            <td id="resolve_command.attribute">
              <code>attribute</code>
            </td>
            <td>
                          <a class="anchor" href="../core/string.html">string</a>; or <code>None</code>;
                                     default is <code>None</code><br/>
                          Name of the associated attribute for which to issue an error, or None.
            </td>
          </tr>
                  <tr>
            <td id="resolve_command.expand_locations">
              <code>expand_locations</code>
            </td>
            <td>
                          <a class="anchor" href="../core/bool.html">bool</a>;
                                     default is <code>False</code><br/>
                          Shall we expand $(location) variables? See <a href="#expand_location">ctx.expand_location()</a> for more details.
            </td>
          </tr>
                  <tr>
            <td id="resolve_command.make_variables">
              <code>make_variables</code>
            </td>
            <td>
                          <a class="anchor" href="../core/dict.html">dict</a>; or <code>None</code>;
                                     default is <code>None</code><br/>
                          Make variables to expand, or None.
            </td>
          </tr>
                  <tr>
            <td id="resolve_command.tools">
              <code>tools</code>
            </td>
            <td>
                          <a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Target.html">Target</a>s;
                                     default is <code>[]</code><br/>
                          List of tools (list of targets).
            </td>
          </tr>
                  <tr>
            <td id="resolve_command.label_dict">
              <code>label_dict</code>
            </td>
            <td>
                          <a class="anchor" href="../core/dict.html">dict</a>;
                                     default is <code>{}</code><br/>
                          Dictionary of resolved labels and the corresponding list of Files (a dict of Label : list of Files).
            </td>
          </tr>
                  <tr>
            <td id="resolve_command.execution_requirements">
              <code>execution_requirements</code>
            </td>
            <td>
                          <a class="anchor" href="../core/dict.html">dict</a>;
                                     default is <code>{}</code><br/>
                          Information for scheduling the action to resolve this command. See <a href="/versions/8.2.0/reference/be/common-definitions#common.tags">tags</a> for useful keys.
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="resolve_tools">resolve_tools</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/tuple.html">tuple</a> ctx.resolve_tools(tools=[])</pre></p>

    Returns a tuple <code>(inputs, empty list)</code> of the depset of resolved inputs required to run the tools, suitable for passing as the same-named argument of the <code>ctx.actions.run</code> and <code>ctx.actions.run_shell</code> methods. <br/><br/>In contrast to <code>ctx.resolve_command</code>, this method does not require that Bash be installed on the machine, so it's suitable for rules built on Windows. The empty list is returned as part of the tuple for backward compatibility.

          <!-- 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="resolve_tools.tools">
              <code>tools</code>
            </td>
            <td>
                          <a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/Target.html">Target</a>s;
                                     default is <code>[]</code><br/>
                          List of tools (list of targets).
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="rule">rule</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/rule_attributes.html">rule_attributes</a> ctx.rule</pre></p>

    Rule attributes descriptor for the rule that the aspect is applied to. Only available in aspect implementation functions.


        <h2 id="runfiles">runfiles</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/runfiles.html">runfiles</a> ctx.runfiles(files=[], transitive_files=None, collect_data=False, collect_default=False, symlinks={}, root_symlinks={})</pre></p>

    Creates a runfiles object.

          <!-- 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="runfiles.files">
              <code>files</code>
            </td>
            <td>
                          <a class="anchor" href="../core/list.html">sequence</a> of <a class="anchor" href="../builtins/File.html">File</a>s;
                                     default is <code>[]</code><br/>
                          The list of files to be added to the runfiles.
            </td>
          </tr>
                  <tr>
            <td id="runfiles.transitive_files">
              <code>transitive_files</code>
            </td>
            <td>
                          <a class="anchor" href="../builtins/depset.html">depset</a> of <a class="anchor" href="../builtins/File.html">File</a>s; or <code>None</code>;
                                     default is <code>None</code><br/>
                          The (transitive) set of files to be added to the runfiles. The depset should use the <code>default</code> order (which, as the name implies, is the default).
            </td>
          </tr>
                  <tr>
            <td id="runfiles.collect_data">
              <code>collect_data</code>
            </td>
            <td>
                          <a class="anchor" href="../core/bool.html">bool</a>;
                                     default is <code>False</code><br/>
                          <b>Use of this parameter is not recommended. See <a href="https://bazel.build/versions/8.2.0/extending/rules#runfiles">runfiles guide</a></b>. <p>Whether to collect the data runfiles from the dependencies in srcs, data and deps attributes.
            </td>
          </tr>
                  <tr>
            <td id="runfiles.collect_default">
              <code>collect_default</code>
            </td>
            <td>
                          <a class="anchor" href="../core/bool.html">bool</a>;
                                     default is <code>False</code><br/>
                          <b>Use of this parameter is not recommended. See <a href="https://bazel.build/versions/8.2.0/extending/rules#runfiles">runfiles guide</a></b>. <p>Whether to collect the default runfiles from the dependencies in srcs, data and deps attributes.
            </td>
          </tr>
                  <tr>
            <td id="runfiles.symlinks">
              <code>symlinks</code>
            </td>
            <td>
                          <a class="anchor" href="../core/dict.html">dict</a>; or <a class="anchor" href="../builtins/depset.html">depset</a> of <a class="anchor" href="../builtins/SymlinkEntry.html">SymlinkEntry</a>s;
                                     default is <code>{}</code><br/>
                          Either a SymlinkEntry depset or the map of symlinks to be added to the runfiles. Symlinks are always added under the main workspace's runfiles directory (e.g. <code>&lt;runfiles_root>/_main/&lt;symlink_path></code>, <b>not</b> the directory corresponding to the current target's repository. See <a href="https://bazel.build/versions/8.2.0/extending/rules#runfiles_symlinks">Runfiles symlinks</a> in the rules guide.
            </td>
          </tr>
                  <tr>
            <td id="runfiles.root_symlinks">
              <code>root_symlinks</code>
            </td>
            <td>
                          <a class="anchor" href="../core/dict.html">dict</a>; or <a class="anchor" href="../builtins/depset.html">depset</a> of <a class="anchor" href="../builtins/SymlinkEntry.html">SymlinkEntry</a>s;
                                     default is <code>{}</code><br/>
                          Either a SymlinkEntry depset or a map of symlinks to be added to the runfiles. See <a href="https://bazel.build/versions/8.2.0/extending/rules#runfiles_symlinks">Runfiles symlinks</a> in the rules guide.
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="split_attr">split_attr</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/struct.html">struct</a> ctx.split_attr</pre></p>

    A struct to access the values of attributes with split configurations. If the attribute is a label list, the value of split_attr is a dict of the keys of the split (as strings) to lists of the ConfiguredTargets in that branch of the split. If the attribute is a label, then the value of split_attr is a dict of the keys of the split (as strings) to single ConfiguredTargets. Attributes with split configurations still appear in the attr struct, but their values will be single lists with all the branches of the split merged together.


        <h2 id="super">super</h2>
        <p><pre class="rule-signature">unknown ctx.super()</pre></p>

    Experimental: Calls parent's implementation function and returns its providers


        <h2 id="target_platform_has_constraint">target_platform_has_constraint</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> ctx.target_platform_has_constraint(constraintValue)</pre></p>

    Returns true if the given constraint value is part of the current target platform.

          <!-- 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="target_platform_has_constraint.constraintValue">
              <code>constraintValue</code>
            </td>
            <td>
                          <a class="anchor" href="../providers/ConstraintValueInfo.html">ConstraintValueInfo</a>;
                                     required<br/>
                          The constraint value to check the target platform against.
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="toolchains">toolchains</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/ToolchainContext.html">ToolchainContext</a> ctx.toolchains</pre></p>

    Toolchains for the default exec group of this rule.


        <h2 id="var">var</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/dict.html">dict</a> ctx.var</pre></p>

    Dictionary (String to String) of configuration variables.


        <h2 id="version_file">version_file</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../builtins/File.html">File</a> ctx.version_file</pre></p>

    The file that is used to hold the volatile workspace status for the current build request. See documentation for --workspace_status_command for more information.


        <h2 id="workspace_name">workspace_name</h2>
        <p><pre class="rule-signature"><a class="anchor" href="../core/string.html">string</a> ctx.workspace_name</pre></p>

    The name of the workspace, which is effectively the execution root name and runfiles prefix for the main repo. If <code>--enable_bzlmod</code> is on, this is the fixed string <code>_main</code>. Otherwise, this is the workspace name as defined in the WORKSPACE file.



</body>
</html>

<!-- {% endraw %} -->
