Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make build pass with --incompatible_auto_exec_groups #963

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/copy_directory.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions docs/copy_to_directory.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/private/copy_directory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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.
Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions lib/private/copy_file.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions lib/private/copy_to_directory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ["."],
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/private/expand_template.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions lib/private/jq.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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]))
Expand Down
2 changes: 2 additions & 0 deletions lib/private/tar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions lib/private/yq.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions lib/tests/copy_directory_bin_action/pkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions lib/tests/copy_to_directory_bin_action/pkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions tools/release/hashes.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading