diff --git a/.bazelrc b/.bazelrc
index 23e19094d..f406f5a10 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -26,6 +26,9 @@ common:release -c opt
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0
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`.
# 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
diff --git a/docs/copy_directory.md b/docs/copy_directory.md
index 0ac184c87..fdb72da33 100644
--- a/docs/copy_directory.md
+++ b/docs/copy_directory.md
@@ -53,7 +53,8 @@ for more context.
## copy_directory_bin_action
-copy_directory_bin_action(ctx, src, dst, copy_directory_bin, hardlink, verbose, preserve_mtime)
+copy_directory_bin_action(ctx, src, dst, copy_directory_bin, copy_directory_toolchain, hardlink,
+ verbose, preserve_mtime)
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.
| src | The source directory to copy. | none |
| dst | The directory to copy to. Must be a TreeArtifact. | none |
| copy_directory_bin | Copy to directory tool binary. | none |
+| 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"` |
| hardlink | Controls when to use hardlinks to files instead of making copies.
See copy_directory rule documentation for more details. | `"auto"` |
| verbose | print verbose logs to stdout | `False` |
| preserve_mtime | preserve the modified time from the source. See the caveats above about interactions with remote execution and caching. | `False` |
diff --git a/docs/copy_to_directory.md b/docs/copy_to_directory.md
index 949e781dd..b202598af 100644
--- a/docs/copy_to_directory.md
+++ b/docs/copy_to_directory.md
@@ -70,10 +70,11 @@ for more information on supported globbing patterns.
## copy_to_directory_bin_action
-copy_to_directory_bin_action(ctx, name, dst, copy_to_directory_bin, files, targets, root_paths,
- include_external_repositories, include_srcs_packages,
- exclude_srcs_packages, include_srcs_patterns, exclude_srcs_patterns,
- replace_prefixes, allow_overwrites, hardlink, preserve_mtime, verbose)
+copy_to_directory_bin_action(ctx, name, dst, copy_to_directory_bin, copy_to_directory_toolchain,
+ files, targets, root_paths, include_external_repositories,
+ include_srcs_packages, exclude_srcs_packages, include_srcs_patterns,
+ exclude_srcs_patterns, replace_prefixes, allow_overwrites, hardlink,
+ preserve_mtime, verbose)
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.
| name | Name of target creating this action used for config file generation. | none |
| dst | The directory to copy to. Must be a TreeArtifact. | none |
| copy_to_directory_bin | Copy to directory tool binary. | none |
+| 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"` |
| files | List of files to copy into the output directory. | `[]` |
| targets | List of targets that provide `DirectoryPathInfo` to copy into the output directory. | `[]` |
| root_paths | List of paths that are roots in the output directory.
See copy_to_directory rule documentation for more details. | `["."]` |
diff --git a/lib/private/copy_directory.bzl b/lib/private/copy_directory.bzl
index c25e67525..65b35ab2e 100644
--- a/lib/private/copy_directory.bzl
+++ b/lib/private/copy_directory.bzl
@@ -10,6 +10,7 @@ def copy_directory_bin_action(
src,
dst,
copy_directory_bin,
+ copy_directory_toolchain = "@aspect_bazel_lib//lib:copy_directory_toolchain_type",
hardlink = "auto",
verbose = False,
preserve_mtime = False):
@@ -30,6 +31,8 @@ def copy_directory_bin_action(
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.
See copy_directory rule documentation for more details.
@@ -63,6 +66,7 @@ def copy_directory_bin_action(
mnemonic = "CopyDirectory",
progress_message = "Copying directory %{input}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
+ toolchain = copy_directory_toolchain,
)
def _copy_directory_impl(ctx):
diff --git a/lib/private/copy_file.bzl b/lib/private/copy_file.bzl
index f9e771b2e..5489d83b6 100644
--- a/lib/private/copy_file.bzl
+++ b/lib/private/copy_file.bzl
@@ -85,6 +85,7 @@ def copy_file_action(ctx, src, dst, dir_path = None):
mnemonic = "CopyFile",
progress_message = "Copying file %{input}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
+ toolchain = "@aspect_bazel_lib//lib:coreutils_toolchain_type",
)
def _copy_file_impl(ctx):
diff --git a/lib/private/copy_to_directory.bzl b/lib/private/copy_to_directory.bzl
index d36dfb591..0e5626b23 100644
--- a/lib/private/copy_to_directory.bzl
+++ b/lib/private/copy_to_directory.bzl
@@ -330,6 +330,7 @@ def copy_to_directory_bin_action(
name,
dst,
copy_to_directory_bin,
+ copy_to_directory_toolchain = "@aspect_bazel_lib//lib:copy_to_directory_toolchain_type",
files = [],
targets = [],
root_paths = ["."],
@@ -360,6 +361,8 @@ def copy_to_directory_bin_action(
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.
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",
progress_message = "Copying files to directory %{output}",
execution_requirements = _COPY_EXECUTION_REQUIREMENTS,
+ toolchain = copy_to_directory_toolchain,
)
copy_to_directory_lib = struct(
diff --git a/lib/private/expand_template.bzl b/lib/private/expand_template.bzl
index 9b5a14234..bf3334194 100644
--- a/lib/private/expand_template.bzl
+++ b/lib/private/expand_template.bzl
@@ -49,6 +49,7 @@ def _expand_template_impl(ctx):
outputs = [output],
inputs = inputs,
executable = expand_template_info.bin,
+ toolchain = "@aspect_bazel_lib//lib:expand_template_toolchain_type",
)
else:
ctx.actions.expand_template(
diff --git a/lib/private/jq.bzl b/lib/private/jq.bzl
index 97815fac3..1f84e5d50 100644
--- a/lib/private/jq.bzl
+++ b/lib/private/jq.bzl
@@ -67,6 +67,7 @@ def _jq_impl(ctx):
out = stamp_json.path,
),
mnemonic = "ConvertStatusToJson",
+ toolchain = "@aspect_bazel_lib//lib:jq_toolchain_type",
)
inputs.append(stamp_json)
@@ -93,6 +94,7 @@ def _jq_impl(ctx):
outputs = [out],
command = cmd,
mnemonic = "Jq",
+ toolchain = "@aspect_bazel_lib//lib:jq_toolchain_type",
)
return DefaultInfo(files = depset([out]), runfiles = ctx.runfiles([out]))
diff --git a/lib/private/tar.bzl b/lib/private/tar.bzl
index 3e96ef136..7def71820 100644
--- a/lib/private/tar.bzl
+++ b/lib/private/tar.bzl
@@ -273,6 +273,7 @@ def _configured_unused_inputs_file(ctx, srcs, keep):
"UNUSED_INPUTS": unused_inputs.path,
},
mnemonic = "UnusedTarInputs",
+ toolchain = "@aspect_bazel_lib//lib:coreutils_toolchain_type",
)
return unused_inputs
@@ -326,6 +327,7 @@ def _tar_impl(ctx):
arguments = [args],
mnemonic = "Tar",
unused_inputs_list = unused_inputs_file,
+ toolchain = "@aspect_bazel_lib//lib:tar_toolchain_type",
)
# TODO(3.0): Always return a list of providers.
diff --git a/lib/private/yq.bzl b/lib/private/yq.bzl
index 29ca3d757..006054508 100644
--- a/lib/private/yq.bzl
+++ b/lib/private/yq.bzl
@@ -60,6 +60,7 @@ def _yq_impl(ctx):
out = stamp_yaml.path,
),
mnemonic = "ConvertStatusToYaml",
+ toolchain = "@aspect_bazel_lib//lib:yq_toolchain_type",
)
else:
# create an empty stamp file as placeholder
@@ -91,6 +92,7 @@ def _yq_impl(ctx):
command = cmd,
env = {"STAMP": escape_bin_dir + stamp_yaml.path},
mnemonic = "Yq",
+ toolchain = "@aspect_bazel_lib//lib:yq_toolchain_type",
)
return DefaultInfo(files = depset(outs), runfiles = ctx.runfiles(outs))
diff --git a/lib/tests/copy_directory_bin_action/pkg.bzl b/lib/tests/copy_directory_bin_action/pkg.bzl
index 8c4546e16..22a380268 100644
--- a/lib/tests/copy_directory_bin_action/pkg.bzl
+++ b/lib/tests/copy_directory_bin_action/pkg.bzl
@@ -25,6 +25,7 @@ def _pkg_impl(ctx):
src = ctx.file.src,
dst = dst,
copy_directory_bin = ctx.executable._tool,
+ copy_directory_toolchain = None,
hardlink = "auto",
verbose = True,
)
diff --git a/lib/tests/copy_to_directory_bin_action/pkg.bzl b/lib/tests/copy_to_directory_bin_action/pkg.bzl
index 8c47e74ea..b586db424 100644
--- a/lib/tests/copy_to_directory_bin_action/pkg.bzl
+++ b/lib/tests/copy_to_directory_bin_action/pkg.bzl
@@ -59,6 +59,7 @@ def _pkg_impl(ctx):
files = ctx.files.srcs + symlinks + depset(transitive = additional_files_depsets).to_list(),
dst = dst,
copy_to_directory_bin = ctx.executable._tool,
+ copy_to_directory_toolchain = None,
hardlink = "auto",
verbose = True,
)
diff --git a/tools/release/hashes.bzl b/tools/release/hashes.bzl
index 2227c39a6..1627d64b6 100644
--- a/tools/release/hashes.bzl
+++ b/tools/release/hashes.bzl
@@ -21,6 +21,7 @@ def _hash(ctx, algo, file):
basename = file.basename,
out = out.path,
),
+ toolchain = "@aspect_bazel_lib//lib:coreutils_toolchain_type",
)
return out