Skip to content

Commit

Permalink
feat: extract npm package tars into virtual store as action using tar…
Browse files Browse the repository at this point in the history
… toolchain from bazel-lib (#1538)
  • Loading branch information
gregmagolan authored Mar 27, 2024
1 parent 783dbee commit 2712ca7
Show file tree
Hide file tree
Showing 39 changed files with 154 additions and 73 deletions.
7 changes: 0 additions & 7 deletions .aspect/bazelrc/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# We recommend enforcing a policy that keeps your CI from being slowed down
# by individual test targets that should be optimized
# or split up into multiple test targets with sharding or manually.
# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
test --test_timeout_filters=-eternal

# Set this flag to enable re-tries of failed tests on CI.
# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
# tag appears on the target definition.
Expand Down
4 changes: 3 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module(

# Lower-bounds for runtime dependencies.
# Do not bump these unless rules_js requires a newer version to function.
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_lint", version = "0.12.0")
bazel_dep(name = "bazel_features", version = "0.1.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
Expand Down Expand Up @@ -43,6 +43,7 @@ pnpm.pnpm(
use_repo(pnpm, "pnpm", "pnpm__links")

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib_toolchains.tar()
use_repo(bazel_lib_toolchains, "coreutils_toolchains")
use_repo(bazel_lib_toolchains, "yq_darwin_amd64")
use_repo(bazel_lib_toolchains, "yq_darwin_arm64")
Expand All @@ -51,6 +52,7 @@ use_repo(bazel_lib_toolchains, "yq_linux_arm64")
use_repo(bazel_lib_toolchains, "yq_linux_ppc64le")
use_repo(bazel_lib_toolchains, "yq_linux_s390x")
use_repo(bazel_lib_toolchains, "yq_windows_amd64")
use_repo(bazel_lib_toolchains, "bsd_tar_toolchains")

####### Dev dependencies ########

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.

2 changes: 1 addition & 1 deletion e2e/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")

local_path_override(
Expand Down
2 changes: 1 addition & 1 deletion e2e/gyp_no_install_script/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
6 changes: 3 additions & 3 deletions e2e/gyp_no_install_script/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ local_repository(

http_archive(
name = "aspect_bazel_lib",
sha256 = "f75d03783588e054899eb0729a97fb5b8973c1a26f30373fafd485c90bf207d1",
strip_prefix = "bazel-lib-2.4.2",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.4.2/bazel-lib-v2.4.2.tar.gz",
sha256 = "3e0a430ada9b8f0f845767a267cf584bc94b8ec642d6093f31dca3938b18f6a1",
strip_prefix = "bazel-lib-2.6.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.6.0/bazel-lib-v2.6.0.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
Expand Down
2 changes: 1 addition & 1 deletion e2e/js_run_devserver/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_go", version = "0.41.0")
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock_auth/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock_empty/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock_git+ssh/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock_multi/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock_partial_clone/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_lock_subdir_patch/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_package_lock/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
Expand Down
2 changes: 1 addition & 1 deletion e2e/npm_translate_yarn_lock/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
Expand Down
2 changes: 1 addition & 1 deletion e2e/package_json_module/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/patch_from_repo/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "local_repo", version = "0.0.0")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")

local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/pnpm_workspace/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module(

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_nodejs", version = "6.0.5")
bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
6 changes: 3 additions & 3 deletions e2e/pnpm_workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ local_repository(

http_archive(
name = "aspect_bazel_lib",
sha256 = "8d71a578e4e1b6a54aea7598ebfbd8fc9e3be5da881ff9d2b80249577b933a40",
strip_prefix = "bazel-lib-2.2.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.2.0/bazel-lib-v2.2.0.tar.gz",
sha256 = "3e0a430ada9b8f0f845767a267cf584bc94b8ec642d6093f31dca3938b18f6a1",
strip_prefix = "bazel-lib-2.6.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.6.0/bazel-lib-v2.6.0.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains")
Expand Down
2 changes: 1 addition & 1 deletion e2e/pnpm_workspace_deps/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
6 changes: 3 additions & 3 deletions e2e/pnpm_workspace_deps/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ local_repository(

http_archive(
name = "aspect_bazel_lib",
sha256 = "8d71a578e4e1b6a54aea7598ebfbd8fc9e3be5da881ff9d2b80249577b933a40",
strip_prefix = "bazel-lib-2.2.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.2.0/bazel-lib-v2.2.0.tar.gz",
sha256 = "3e0a430ada9b8f0f845767a267cf584bc94b8ec642d6093f31dca3938b18f6a1",
strip_prefix = "bazel-lib-2.6.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.6.0/bazel-lib-v2.6.0.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_coreutils_toolchains")
Expand Down
2 changes: 1 addition & 1 deletion e2e/pnpm_workspace_rerooted/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "rules_nodejs", version = "6.0.5")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/stamped_package_json/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
)

bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.0")

local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/update_pnpm_lock/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/update_pnpm_lock_with_import/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/vendored_node/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
bazel_dep(name = "rules_nodejs", version = "6.0.5")
bazel_dep(name = "platforms", version = "0.0.4")
Expand Down
2 changes: 1 addition & 1 deletion e2e/vendored_tarfile/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/verify_patches/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/webpack_devserver/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_go", version = "0.41.0")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
2 changes: 1 addition & 1 deletion e2e/webpack_devserver_esm/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "rules_go", version = "0.41.0")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.3")
bazel_dep(name = "aspect_bazel_lib", version = "1.42.0")
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
local_path_override(
module_name = "aspect_rules_js",
Expand Down
6 changes: 3 additions & 3 deletions js/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def rules_js_dependencies():

http_archive(
name = "aspect_bazel_lib",
sha256 = "f2c1f91cc0a55f7a44c94b8a79974f21349b844075740c01045acaa49e731307",
strip_prefix = "bazel-lib-1.40.3",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.40.3/bazel-lib-v1.40.3.tar.gz",
sha256 = "6e729e4900695623efa5e9c73b10b0509eb1606b73cafc374a359aed4c9e6958",
strip_prefix = "bazel-lib-1.42.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.42.0/bazel-lib-v1.42.0.tar.gz",
)

http_archive(
Expand Down
1 change: 1 addition & 0 deletions npm/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def _npm_extension_impl(module_ctx):
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_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,
root_package = attr.root_package,
run_lifecycle_hooks = attr.run_lifecycle_hooks,
Expand Down
Loading

0 comments on commit 2712ca7

Please sign in to comment.