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

refactor: also register bazel-lib coreutils toolchain now that we depend on a mininum bazel-lib 2.7.1 #1582

Merged
merged 1 commit into from
Apr 3, 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
11 changes: 0 additions & 11 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,3 @@ EOF

awk 'f;/--SNIP--/{f=1}' e2e/workspace/WORKSPACE
echo "\`\`\`"

cat <<EOF

To use rules_js with bazel-lib 2.x, you must additionally register the coreutils toolchain.

\`\`\`starlark
load("@aspect_bazel_lib//lib:repositories.bzl", "register_coreutils_toolchains")

register_coreutils_toolchains()
\`\`\`
EOF
4 changes: 1 addition & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ load("//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains", "register_jq_toolchains")
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_jq_toolchains")

aspect_bazel_lib_dependencies()

register_jq_toolchains()

register_coreutils_toolchains()

load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")

nodejs_register_toolchains(
Expand Down
5 changes: 3 additions & 2 deletions docs/npm_translate_lock.md

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

4 changes: 1 addition & 3 deletions e2e/pnpm_workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ http_archive(
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.6.1/bazel-lib-v2.6.1.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains")
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")

aspect_bazel_lib_dependencies()

register_coreutils_toolchains()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()
Expand Down
4 changes: 1 addition & 3 deletions e2e/pnpm_workspace_deps/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ http_archive(
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.6.1/bazel-lib-v2.6.1.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains")
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")

aspect_bazel_lib_dependencies()

register_coreutils_toolchains()

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()
Expand Down
1 change: 1 addition & 0 deletions npm/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _npm_extension_impl(module_ctx):
quiet = attr.quiet,
register_copy_directory_toolchains = False, # this registration is handled elsewhere with bzlmod
register_copy_to_directory_toolchains = False, # this registration is handled elsewhere with bzlmod
register_coreutils_toolchains = False, # this registration is handled elsewhere with bzlmod
register_yq_toolchains = False, # this registration is handled elsewhere with bzlmod
register_tar_toolchains = False, # this registration is handled elsewhere with bzlmod
replace_packages = attr.replace_packages,
Expand Down
14 changes: 13 additions & 1 deletion npm/private/npm_translate_lock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ Advanced users may want to directly fetch a package from npm rather than start f
"""

load("@bazel_skylib//lib:paths.bzl", "paths")
load("@aspect_bazel_lib//lib:repositories.bzl", _register_copy_directory_toolchains = "register_copy_directory_toolchains", _register_copy_to_directory_toolchains = "register_copy_to_directory_toolchains", _register_tar_toolchains = "register_tar_toolchains", _register_yq_toolchains = "register_yq_toolchains")
load(
"@aspect_bazel_lib//lib:repositories.bzl",
_register_copy_directory_toolchains = "register_copy_directory_toolchains",
_register_copy_to_directory_toolchains = "register_copy_to_directory_toolchains",
_register_coreutils_toolchains = "register_coreutils_toolchains",
_register_tar_toolchains = "register_tar_toolchains",
_register_yq_toolchains = "register_yq_toolchains",
)
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file")
load(":list_sources.bzl", "list_sources")
load(":npm_translate_lock_generate.bzl", "generate_repository_files")
Expand Down Expand Up @@ -188,6 +195,7 @@ def npm_translate_lock(
use_pnpm = None,
register_copy_directory_toolchains = True,
register_copy_to_directory_toolchains = True,
register_coreutils_toolchains = True,
register_yq_toolchains = True,
register_tar_toolchains = True,
npm_package_target_name = "{dirname}",
Expand Down Expand Up @@ -514,6 +522,8 @@ def npm_translate_lock(

register_copy_to_directory_toolchains: if True, `@aspect_bazel_lib//lib:repositories.bzl` `register_copy_to_directory_toolchains()` is called if the toolchain is not already registered

register_coreutils_toolchains: if True, `@aspect_bazel_lib//lib:repositories.bzl` `register_coreutils_toolchains()` is called if the toolchain is not already registered

register_yq_toolchains: if True, `@aspect_bazel_lib//lib:repositories.bzl` `register_yq_toolchains()` is called if the toolchain is not already registered

register_tar_toolchains: if True, `@aspect_bazel_lib//lib:repositories.bzl` `register_tar_toolchains()` is called if the toolchain is not already registered
Expand Down Expand Up @@ -560,6 +570,8 @@ def npm_translate_lock(
_register_copy_directory_toolchains()
if register_copy_to_directory_toolchains and not native.existing_rule("copy_to_directory_toolchains"):
_register_copy_to_directory_toolchains()
if register_coreutils_toolchains and not native.existing_rule("register_coreutils_toolchains"):
_register_coreutils_toolchains()
if register_yq_toolchains and not native.existing_rule("yq_toolchains"):
_register_yq_toolchains()
if register_tar_toolchains and not native.existing_rule("tar_toolchains"):
Expand Down