diff --git a/docs/copy_directory.md b/docs/copy_directory.md index 407124b40..bbc6449fd 100644 --- a/docs/copy_directory.md +++ b/docs/copy_directory.md @@ -42,7 +42,7 @@ for more context. ## copy_directory_bin_action
-copy_directory_bin_action(ctx, src, dst, copy_directory_bin, hardlink, verbose) +copy_directory_bin_action(ctx, src, dst, copy_directory_bin, hardlink, verbose, toolchain_type)Factory function that creates an action to copy a directory from src to dst using a tool binary. @@ -65,5 +65,6 @@ within other rule implementations. | copy_directory_bin | Copy to directory tool binary. | none | | hardlink | Controls when to use hardlinks to files instead of making copies.
"auto"
|
| verbose | If true, prints out verbose logs to stdout | False
|
+| toolchain_type | -
|"@aspect_bazel_lib//lib:copy_directory_toolchain_type"
|
diff --git a/lib/private/copy_directory.bzl b/lib/private/copy_directory.bzl
index 5d15db97d..99505bb5e 100644
--- a/lib/private/copy_directory.bzl
+++ b/lib/private/copy_directory.bzl
@@ -12,7 +12,8 @@ def copy_directory_bin_action(
dst,
copy_directory_bin,
hardlink = "auto",
- verbose = False):
+ verbose = False,
+ toolchain_type = "@aspect_bazel_lib//lib:copy_directory_toolchain_type"):
"""Factory function that creates an action to copy a directory from src to dst using a tool binary.
The tool binary will typically be the `@aspect_bazel_lib//tools/copy_directory` `go_binary`
@@ -52,6 +53,7 @@ def copy_directory_bin_action(
inputs = [src],
outputs = [dst],
executable = copy_directory_bin,
+ toolchain = toolchain_type,
arguments = args,
mnemonic = "CopyDirectory",
progress_message = "Copying directory %s" % _progress_path(src),
diff --git a/lib/private/copy_file.bzl b/lib/private/copy_file.bzl
index 81a268acc..ff0c4d49b 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):
ctx.actions.run(
executable = coreutils.bin,
+ toolchain = _COREUTILS_TOOLCHAIN,
arguments = ["cp", src_path, dst.path],
inputs = [src],
outputs = [dst],
diff --git a/lib/private/copy_to_directory.bzl b/lib/private/copy_to_directory.bzl
index 6a6ca3d98..2cf0ff5f3 100644
--- a/lib/private/copy_to_directory.bzl
+++ b/lib/private/copy_to_directory.bzl
@@ -488,6 +488,7 @@ def copy_to_directory_bin_action(
inputs = file_inputs + [config_file],
outputs = [dst],
executable = copy_to_directory_bin,
+ toolchain = "@aspect_bazel_lib//lib:copy_to_directory_toolchain_type",
arguments = [config_file.path, ctx.label.workspace_name],
mnemonic = "CopyToDirectory",
progress_message = "Copying files to directory %s" % _progress_path(dst),
diff --git a/lib/private/expand_template.bzl b/lib/private/expand_template.bzl
index a98426b8e..0c9ac0008 100644
--- a/lib/private/expand_template.bzl
+++ b/lib/private/expand_template.bzl
@@ -52,6 +52,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 aa03d8a22..b30a424b3 100644
--- a/lib/private/jq.bzl
+++ b/lib/private/jq.bzl
@@ -44,6 +44,7 @@ def _jq_impl(ctx):
stamp_json = ctx.actions.declare_file("_%s_stamp.json" % ctx.label.name)
ctx.actions.run_shell(
tools = [jq_bin],
+ toolchain = "@aspect_bazel_lib//lib:jq_toolchain_type",
inputs = [stamp.stable_status_file, stamp.volatile_status_file, ctx.file._parse_status_file_filter],
outputs = [stamp_json],
command = "{jq} -s -R -f {filter} {stable} {volatile} > {out}".format(
@@ -69,6 +70,7 @@ def _jq_impl(ctx):
ctx.actions.run_shell(
tools = [jq_bin],
+ toolchain = "@aspect_bazel_lib//lib:jq_toolchain_type",
inputs = inputs,
outputs = [out],
command = cmd,
diff --git a/lib/private/run_binary.bzl b/lib/private/run_binary.bzl
index 30167907a..31f1d70f6 100644
--- a/lib/private/run_binary.bzl
+++ b/lib/private/run_binary.bzl
@@ -79,6 +79,7 @@ Possible fixes:
use_default_shell_env = False,
env = dicts.add(ctx.configuration.default_shell_env, envs),
input_manifests = tool_input_mfs,
+ toolchain = None,
)
return DefaultInfo(
files = depset(outputs),
diff --git a/lib/private/tar.bzl b/lib/private/tar.bzl
index df53c4295..6df9e3a4d 100644
--- a/lib/private/tar.bzl
+++ b/lib/private/tar.bzl
@@ -108,6 +108,7 @@ def _tar_impl(ctx):
ctx.actions.run(
executable = bsdtar.tarinfo.binary,
+ toolchain = "@aspect_bazel_lib//lib:tar_toolchain_type",
inputs = depset(direct = inputs, transitive = [bsdtar.default.files] + [
src[DefaultInfo].default_runfiles.files
for src in ctx.attr.srcs
diff --git a/lib/private/yq.bzl b/lib/private/yq.bzl
index 29ca3d757..3525f86fb 100644
--- a/lib/private/yq.bzl
+++ b/lib/private/yq.bzl
@@ -50,6 +50,7 @@ def _yq_impl(ctx):
# create an action that gives a YAML representation of the stamp keys
ctx.actions.run_shell(
tools = [yq_bin],
+ toolchain = "@aspect_bazel_lib//lib:yq_toolchain_type",
inputs = [stamp.stable_status_file, stamp.volatile_status_file, ctx.file._parse_status_file_expression],
outputs = [stamp_yaml],
command = "{yq} --from-file {expression} {stable} {volatile} > {out}".format(
@@ -86,6 +87,7 @@ def _yq_impl(ctx):
ctx.actions.run_shell(
tools = [yq_bin],
+ toolchain = "@aspect_bazel_lib//lib:yq_toolchain_type",
inputs = inputs,
outputs = outs,
command = cmd,
diff --git a/lib/tests/copy_directory_bin_action/pkg.bzl b/lib/tests/copy_directory_bin_action/pkg.bzl
index 8c4546e16..2300d13de 100644
--- a/lib/tests/copy_directory_bin_action/pkg.bzl
+++ b/lib/tests/copy_directory_bin_action/pkg.bzl
@@ -27,6 +27,7 @@ def _pkg_impl(ctx):
copy_directory_bin = ctx.executable._tool,
hardlink = "auto",
verbose = True,
+ toolchain_type = None,
)
return [