Make build pass with --incompatible_auto_exec_groups (#963)

This commit is contained in:
David Zbarsky 2024-10-15 13:16:11 -04:00 committed by GitHub
parent 64eb5f8cea
commit 43f8b3e524
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 31 additions and 5 deletions

View File

@ -26,6 +26,9 @@ common:release -c opt
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0 # https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0
common --check_direct_dependencies=off common --check_direct_dependencies=off
# Make sure we don't regress this.
common --incompatible_auto_exec_groups
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`. # Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This # This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from # should be last statement in this config so the user configuration is able to overwrite flags from

View File

@ -53,7 +53,8 @@ for more context.
## copy_directory_bin_action ## copy_directory_bin_action
<pre> <pre>
copy_directory_bin_action(<a href="#copy_directory_bin_action-ctx">ctx</a>, <a href="#copy_directory_bin_action-src">src</a>, <a href="#copy_directory_bin_action-dst">dst</a>, <a href="#copy_directory_bin_action-copy_directory_bin">copy_directory_bin</a>, <a href="#copy_directory_bin_action-hardlink">hardlink</a>, <a href="#copy_directory_bin_action-verbose">verbose</a>, <a href="#copy_directory_bin_action-preserve_mtime">preserve_mtime</a>) copy_directory_bin_action(<a href="#copy_directory_bin_action-ctx">ctx</a>, <a href="#copy_directory_bin_action-src">src</a>, <a href="#copy_directory_bin_action-dst">dst</a>, <a href="#copy_directory_bin_action-copy_directory_bin">copy_directory_bin</a>, <a href="#copy_directory_bin_action-copy_directory_toolchain">copy_directory_toolchain</a>, <a href="#copy_directory_bin_action-hardlink">hardlink</a>,
<a href="#copy_directory_bin_action-verbose">verbose</a>, <a href="#copy_directory_bin_action-preserve_mtime">preserve_mtime</a>)
</pre> </pre>
Factory function that creates an action to copy a directory from src to dst using a tool binary. Factory function that creates an action to copy a directory from src to dst using a tool binary.
@ -74,6 +75,7 @@ within other rule implementations.
| <a id="copy_directory_bin_action-src"></a>src | The source directory to copy. | none | | <a id="copy_directory_bin_action-src"></a>src | The source directory to copy. | none |
| <a id="copy_directory_bin_action-dst"></a>dst | The directory to copy to. Must be a TreeArtifact. | none | | <a id="copy_directory_bin_action-dst"></a>dst | The directory to copy to. Must be a TreeArtifact. | none |
| <a id="copy_directory_bin_action-copy_directory_bin"></a>copy_directory_bin | Copy to directory tool binary. | none | | <a id="copy_directory_bin_action-copy_directory_bin"></a>copy_directory_bin | Copy to directory tool binary. | none |
| <a id="copy_directory_bin_action-copy_directory_toolchain"></a>copy_directory_toolchain | The toolchain type for Auto Exec Groups. The default is probably what you want. | `"@aspect_bazel_lib//lib:copy_directory_toolchain_type"` |
| <a id="copy_directory_bin_action-hardlink"></a>hardlink | Controls when to use hardlinks to files instead of making copies.<br><br>See copy_directory rule documentation for more details. | `"auto"` | | <a id="copy_directory_bin_action-hardlink"></a>hardlink | Controls when to use hardlinks to files instead of making copies.<br><br>See copy_directory rule documentation for more details. | `"auto"` |
| <a id="copy_directory_bin_action-verbose"></a>verbose | print verbose logs to stdout | `False` | | <a id="copy_directory_bin_action-verbose"></a>verbose | print verbose logs to stdout | `False` |
| <a id="copy_directory_bin_action-preserve_mtime"></a>preserve_mtime | preserve the modified time from the source. See the caveats above about interactions with remote execution and caching. | `False` | | <a id="copy_directory_bin_action-preserve_mtime"></a>preserve_mtime | preserve the modified time from the source. See the caveats above about interactions with remote execution and caching. | `False` |

View File

@ -70,10 +70,11 @@ for more information on supported globbing patterns.
## copy_to_directory_bin_action ## copy_to_directory_bin_action
<pre> <pre>
copy_to_directory_bin_action(<a href="#copy_to_directory_bin_action-ctx">ctx</a>, <a href="#copy_to_directory_bin_action-name">name</a>, <a href="#copy_to_directory_bin_action-dst">dst</a>, <a href="#copy_to_directory_bin_action-copy_to_directory_bin">copy_to_directory_bin</a>, <a href="#copy_to_directory_bin_action-files">files</a>, <a href="#copy_to_directory_bin_action-targets">targets</a>, <a href="#copy_to_directory_bin_action-root_paths">root_paths</a>, copy_to_directory_bin_action(<a href="#copy_to_directory_bin_action-ctx">ctx</a>, <a href="#copy_to_directory_bin_action-name">name</a>, <a href="#copy_to_directory_bin_action-dst">dst</a>, <a href="#copy_to_directory_bin_action-copy_to_directory_bin">copy_to_directory_bin</a>, <a href="#copy_to_directory_bin_action-copy_to_directory_toolchain">copy_to_directory_toolchain</a>,
<a href="#copy_to_directory_bin_action-include_external_repositories">include_external_repositories</a>, <a href="#copy_to_directory_bin_action-include_srcs_packages">include_srcs_packages</a>, <a href="#copy_to_directory_bin_action-files">files</a>, <a href="#copy_to_directory_bin_action-targets">targets</a>, <a href="#copy_to_directory_bin_action-root_paths">root_paths</a>, <a href="#copy_to_directory_bin_action-include_external_repositories">include_external_repositories</a>,
<a href="#copy_to_directory_bin_action-exclude_srcs_packages">exclude_srcs_packages</a>, <a href="#copy_to_directory_bin_action-include_srcs_patterns">include_srcs_patterns</a>, <a href="#copy_to_directory_bin_action-exclude_srcs_patterns">exclude_srcs_patterns</a>, <a href="#copy_to_directory_bin_action-include_srcs_packages">include_srcs_packages</a>, <a href="#copy_to_directory_bin_action-exclude_srcs_packages">exclude_srcs_packages</a>, <a href="#copy_to_directory_bin_action-include_srcs_patterns">include_srcs_patterns</a>,
<a href="#copy_to_directory_bin_action-replace_prefixes">replace_prefixes</a>, <a href="#copy_to_directory_bin_action-allow_overwrites">allow_overwrites</a>, <a href="#copy_to_directory_bin_action-hardlink">hardlink</a>, <a href="#copy_to_directory_bin_action-preserve_mtime">preserve_mtime</a>, <a href="#copy_to_directory_bin_action-verbose">verbose</a>) <a href="#copy_to_directory_bin_action-exclude_srcs_patterns">exclude_srcs_patterns</a>, <a href="#copy_to_directory_bin_action-replace_prefixes">replace_prefixes</a>, <a href="#copy_to_directory_bin_action-allow_overwrites">allow_overwrites</a>, <a href="#copy_to_directory_bin_action-hardlink">hardlink</a>,
<a href="#copy_to_directory_bin_action-preserve_mtime">preserve_mtime</a>, <a href="#copy_to_directory_bin_action-verbose">verbose</a>)
</pre> </pre>
Factory function to copy files to a directory using a tool binary. Factory function to copy files to a directory using a tool binary.
@ -94,6 +95,7 @@ other rule implementations where additional_files can also be passed in.
| <a id="copy_to_directory_bin_action-name"></a>name | Name of target creating this action used for config file generation. | none | | <a id="copy_to_directory_bin_action-name"></a>name | Name of target creating this action used for config file generation. | none |
| <a id="copy_to_directory_bin_action-dst"></a>dst | The directory to copy to. Must be a TreeArtifact. | none | | <a id="copy_to_directory_bin_action-dst"></a>dst | The directory to copy to. Must be a TreeArtifact. | none |
| <a id="copy_to_directory_bin_action-copy_to_directory_bin"></a>copy_to_directory_bin | Copy to directory tool binary. | none | | <a id="copy_to_directory_bin_action-copy_to_directory_bin"></a>copy_to_directory_bin | Copy to directory tool binary. | none |
| <a id="copy_to_directory_bin_action-copy_to_directory_toolchain"></a>copy_to_directory_toolchain | The toolchain type for Auto Exec Groups. The default is probably what you want. | `"@aspect_bazel_lib//lib:copy_to_directory_toolchain_type"` |
| <a id="copy_to_directory_bin_action-files"></a>files | List of files to copy into the output directory. | `[]` | | <a id="copy_to_directory_bin_action-files"></a>files | List of files to copy into the output directory. | `[]` |
| <a id="copy_to_directory_bin_action-targets"></a>targets | List of targets that provide `DirectoryPathInfo` to copy into the output directory. | `[]` | | <a id="copy_to_directory_bin_action-targets"></a>targets | List of targets that provide `DirectoryPathInfo` to copy into the output directory. | `[]` |
| <a id="copy_to_directory_bin_action-root_paths"></a>root_paths | List of paths that are roots in the output directory.<br><br>See copy_to_directory rule documentation for more details. | `["."]` | | <a id="copy_to_directory_bin_action-root_paths"></a>root_paths | List of paths that are roots in the output directory.<br><br>See copy_to_directory rule documentation for more details. | `["."]` |

View File

@ -10,6 +10,7 @@ def copy_directory_bin_action(
src, src,
dst, dst,
copy_directory_bin, copy_directory_bin,
copy_directory_toolchain = "@aspect_bazel_lib//lib:copy_directory_toolchain_type",
hardlink = "auto", hardlink = "auto",
verbose = False, verbose = False,
preserve_mtime = False): preserve_mtime = False):
@ -30,6 +31,8 @@ def copy_directory_bin_action(
copy_directory_bin: Copy to directory tool binary. copy_directory_bin: Copy to directory tool binary.
copy_directory_toolchain: The toolchain type for Auto Exec Groups. The default is probably what you want.
hardlink: Controls when to use hardlinks to files instead of making copies. hardlink: Controls when to use hardlinks to files instead of making copies.
See copy_directory rule documentation for more details. See copy_directory rule documentation for more details.
@ -63,6 +66,7 @@ def copy_directory_bin_action(
mnemonic = "CopyDirectory", mnemonic = "CopyDirectory",
progress_message = "Copying directory %{input}", progress_message = "Copying directory %{input}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS, execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
toolchain = copy_directory_toolchain,
) )
def _copy_directory_impl(ctx): def _copy_directory_impl(ctx):

View File

@ -85,6 +85,7 @@ def copy_file_action(ctx, src, dst, dir_path = None):
mnemonic = "CopyFile", mnemonic = "CopyFile",
progress_message = "Copying file %{input}", progress_message = "Copying file %{input}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS, execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
toolchain = "@aspect_bazel_lib//lib:coreutils_toolchain_type",
) )
def _copy_file_impl(ctx): def _copy_file_impl(ctx):

View File

@ -330,6 +330,7 @@ def copy_to_directory_bin_action(
name, name,
dst, dst,
copy_to_directory_bin, copy_to_directory_bin,
copy_to_directory_toolchain = "@aspect_bazel_lib//lib:copy_to_directory_toolchain_type",
files = [], files = [],
targets = [], targets = [],
root_paths = ["."], root_paths = ["."],
@ -360,6 +361,8 @@ def copy_to_directory_bin_action(
copy_to_directory_bin: Copy to directory tool binary. copy_to_directory_bin: Copy to directory tool binary.
copy_to_directory_toolchain: The toolchain type for Auto Exec Groups. The default is probably what you want.
files: List of files to copy into the output directory. files: List of files to copy into the output directory.
targets: List of targets that provide `DirectoryPathInfo` to copy into the output directory. targets: List of targets that provide `DirectoryPathInfo` to copy into the output directory.
@ -510,6 +513,7 @@ def copy_to_directory_bin_action(
mnemonic = "CopyToDirectory", mnemonic = "CopyToDirectory",
progress_message = "Copying files to directory %{output}", progress_message = "Copying files to directory %{output}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS, execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
toolchain = copy_to_directory_toolchain,
) )
copy_to_directory_lib = struct( copy_to_directory_lib = struct(

View File

@ -49,6 +49,7 @@ def _expand_template_impl(ctx):
outputs = [output], outputs = [output],
inputs = inputs, inputs = inputs,
executable = expand_template_info.bin, executable = expand_template_info.bin,
toolchain = "@aspect_bazel_lib//lib:expand_template_toolchain_type",
) )
else: else:
ctx.actions.expand_template( ctx.actions.expand_template(

View File

@ -67,6 +67,7 @@ def _jq_impl(ctx):
out = stamp_json.path, out = stamp_json.path,
), ),
mnemonic = "ConvertStatusToJson", mnemonic = "ConvertStatusToJson",
toolchain = "@aspect_bazel_lib//lib:jq_toolchain_type",
) )
inputs.append(stamp_json) inputs.append(stamp_json)
@ -93,6 +94,7 @@ def _jq_impl(ctx):
outputs = [out], outputs = [out],
command = cmd, command = cmd,
mnemonic = "Jq", mnemonic = "Jq",
toolchain = "@aspect_bazel_lib//lib:jq_toolchain_type",
) )
return DefaultInfo(files = depset([out]), runfiles = ctx.runfiles([out])) return DefaultInfo(files = depset([out]), runfiles = ctx.runfiles([out]))

View File

@ -273,6 +273,7 @@ def _configured_unused_inputs_file(ctx, srcs, keep):
"UNUSED_INPUTS": unused_inputs.path, "UNUSED_INPUTS": unused_inputs.path,
}, },
mnemonic = "UnusedTarInputs", mnemonic = "UnusedTarInputs",
toolchain = "@aspect_bazel_lib//lib:coreutils_toolchain_type",
) )
return unused_inputs return unused_inputs
@ -326,6 +327,7 @@ def _tar_impl(ctx):
arguments = [args], arguments = [args],
mnemonic = "Tar", mnemonic = "Tar",
unused_inputs_list = unused_inputs_file, unused_inputs_list = unused_inputs_file,
toolchain = "@aspect_bazel_lib//lib:tar_toolchain_type",
) )
# TODO(3.0): Always return a list of providers. # TODO(3.0): Always return a list of providers.

View File

@ -60,6 +60,7 @@ def _yq_impl(ctx):
out = stamp_yaml.path, out = stamp_yaml.path,
), ),
mnemonic = "ConvertStatusToYaml", mnemonic = "ConvertStatusToYaml",
toolchain = "@aspect_bazel_lib//lib:yq_toolchain_type",
) )
else: else:
# create an empty stamp file as placeholder # create an empty stamp file as placeholder
@ -91,6 +92,7 @@ def _yq_impl(ctx):
command = cmd, command = cmd,
env = {"STAMP": escape_bin_dir + stamp_yaml.path}, env = {"STAMP": escape_bin_dir + stamp_yaml.path},
mnemonic = "Yq", mnemonic = "Yq",
toolchain = "@aspect_bazel_lib//lib:yq_toolchain_type",
) )
return DefaultInfo(files = depset(outs), runfiles = ctx.runfiles(outs)) return DefaultInfo(files = depset(outs), runfiles = ctx.runfiles(outs))

View File

@ -25,6 +25,7 @@ def _pkg_impl(ctx):
src = ctx.file.src, src = ctx.file.src,
dst = dst, dst = dst,
copy_directory_bin = ctx.executable._tool, copy_directory_bin = ctx.executable._tool,
copy_directory_toolchain = None,
hardlink = "auto", hardlink = "auto",
verbose = True, verbose = True,
) )

View File

@ -59,6 +59,7 @@ def _pkg_impl(ctx):
files = ctx.files.srcs + symlinks + depset(transitive = additional_files_depsets).to_list(), files = ctx.files.srcs + symlinks + depset(transitive = additional_files_depsets).to_list(),
dst = dst, dst = dst,
copy_to_directory_bin = ctx.executable._tool, copy_to_directory_bin = ctx.executable._tool,
copy_to_directory_toolchain = None,
hardlink = "auto", hardlink = "auto",
verbose = True, verbose = True,
) )

View File

@ -21,6 +21,7 @@ def _hash(ctx, algo, file):
basename = file.basename, basename = file.basename,
out = out.path, out = out.path,
), ),
toolchain = "@aspect_bazel_lib//lib:coreutils_toolchain_type",
) )
return out return out