Skip to content

Commit 2befef6

Browse files
committed
fix(2.x): reference aspect_bazel_lib toolchains in public consts
1 parent 056e03d commit 2befef6

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

e2e/copy_action/copy.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Rule that uses copy actions"""
22

33
load("@aspect_bazel_lib//lib:copy_file.bzl", "COPY_FILE_TOOLCHAINS", "copy_file_action")
4+
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "COPY_FILE_TO_BIN_TOOLCHAINS")
45

56
def _simple_copy_file_impl(ctx):
67
if len(ctx.files.src) != 1:
@@ -22,5 +23,5 @@ simple_copy_file = rule(
2223
"src": attr.label(mandatory = True, allow_files = True),
2324
"out": attr.output(mandatory = True),
2425
},
25-
toolchains = COPY_FILE_TOOLCHAINS,
26+
toolchains = COPY_FILE_TOOLCHAINS + COPY_FILE_TO_BIN_TOOLCHAINS,
2627
)

lib/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ bzl_library(
169169
bzl_library(
170170
name = "copy_to_bin",
171171
srcs = ["copy_to_bin.bzl"],
172-
deps = ["@bazel_lib//lib:copy_to_bin"],
172+
deps = [
173+
":copy_file",
174+
"@bazel_lib//lib:copy_to_bin",
175+
],
173176
)
174177

175178
#keep

lib/copy_to_bin.bzl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ https://github.com/bazel-contrib/rules_nodejs/blob/8b5d27400db51e7027fe95ae413ee
99

1010
load(
1111
"@bazel_lib//lib:copy_to_bin.bzl",
12-
_COPY_FILE_TO_BIN_TOOLCHAINS = "COPY_FILE_TO_BIN_TOOLCHAINS",
1312
_copy_file_to_bin_action = "copy_file_to_bin_action",
1413
_copy_files_to_bin_actions = "copy_files_to_bin_actions",
1514
_copy_to_bin = "copy_to_bin",
1615
)
1716

17+
# bazel-lib 3.x COPY_FILE_TO_BIN_TOOLCHAINS references COPY_FILE_TOOLCHAINS.
18+
# bazel-lib 2.x COPY_FILE_[TO_BIN_]TOOLCHAINS must only expose the @aspect_bazel_lib toolchain
19+
# names, which may alias to bazel-lib 3.x
20+
load(":copy_file.bzl", "COPY_FILE_TOOLCHAINS")
21+
1822
copy_file_to_bin_action = _copy_file_to_bin_action
1923
copy_files_to_bin_actions = _copy_files_to_bin_actions
2024
copy_to_bin = _copy_to_bin
21-
COPY_FILE_TO_BIN_TOOLCHAINS = _COPY_FILE_TO_BIN_TOOLCHAINS
25+
COPY_FILE_TO_BIN_TOOLCHAINS = COPY_FILE_TOOLCHAINS

0 commit comments

Comments
 (0)