Skip to content

Commit 3713621

Browse files
authored
fix(2.x): alias coreutils and copy toolchains to bazel_lib (#1216)
Fixes JS action de-duplication, where ruleset A still uses aspect_bazel_lib to create actions, while ruleset B uses bazel_lib and creates identical actions. Confirmed working in aspect-build/rules_lint#666
1 parent 1326ff2 commit 3713621

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

MODULE.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ bazel_dep(name = "platforms", version = "0.0.10")
1313
bazel_dep(name = "stardoc", version = "0.7.1")
1414
bazel_dep(name = "rules_shell", version = "0.4.1")
1515

16+
# Depend on our own renamed module, providing back-compat to make migration easier.
17+
# See https://github.com/aspect-build/rules_lint/pull/666 as an example where it's needed,
18+
# because JS actions often rely on action deduplication.
19+
bazel_dep(name = "bazel_lib", version = "3.0.0")
20+
1621
# TODO(3.0): remove this back-compat
1722
bazel_dep(name = "jq.bzl", version = "0.1.0")
1823
bazel_dep(name = "yq.bzl", version = "0.1.1")

lib/BUILD.bazel

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,24 @@ toolchain_type(
4747
name = "yq_toolchain_type",
4848
)
4949

50-
toolchain_type(
50+
alias(
5151
name = "copy_directory_toolchain_type",
52+
actual = "@bazel_lib//lib:copy_directory_toolchain_type",
5253
)
5354

54-
toolchain_type(
55+
alias(
5556
name = "copy_to_directory_toolchain_type",
57+
actual = "@bazel_lib//lib:copy_to_directory_toolchain_type",
5658
)
5759

58-
toolchain_type(
60+
alias(
5961
name = "coreutils_toolchain_type",
62+
actual = "@bazel_lib//lib:coreutils_toolchain_type",
6063
)
6164

62-
toolchain_type(
65+
alias(
6366
name = "expand_template_toolchain_type",
67+
actual = "@bazel_lib//lib:expand_template_toolchain_type",
6468
)
6569

6670
# TODO(3.0): remove

lib/repositories.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ def aspect_bazel_lib_dependencies():
3333
],
3434
sha256 = "3384eb1c30762704fbe38e440204e114154086c8fc8a8c2e3e28441028c019a8",
3535
)
36+
http_archive(
37+
name = "bazel_lib",
38+
sha256 = "6fd3b1e1a38ca744f9664be4627ced80895c7d2ee353891c172f1ab61309c933",
39+
strip_prefix = "bazel-lib-3.0.0",
40+
url = "https://github.com/bazel-contrib/bazel-lib/releases/download/v3.0.0/bazel-lib-v3.0.0.tar.gz",
41+
)
3642
http_archive(
3743
name = "tar.bzl",
3844
sha256 = "b47e3c83a0c1440ce335aa1ae18753da6eb7cd551d4946fa303de2abde07e20b",

0 commit comments

Comments
 (0)