diff --git a/e2e/smoke/MODULE.bazel b/e2e/smoke/MODULE.bazel index d41d17aa88..12968458b3 100644 --- a/e2e/smoke/MODULE.bazel +++ b/e2e/smoke/MODULE.bazel @@ -7,6 +7,7 @@ module( bazel_dep(name = "rules_nodejs", dev_dependency = True, version = "0.0.0") bazel_dep(name = "bazel_skylib", dev_dependency = True, version = "1.3.0") +bazel_dep(name = "aspect_bazel_lib", dev_dependency = True, version = "1.30.2") local_path_override( module_name = "rules_nodejs", @@ -38,28 +39,3 @@ use_repo( "node16_darwin_amd64", "node16_windows_amd64", ) - -http = use_extension("//:deps.bzl", "http") - -http.archive( - name = "npm_acorn-8.5.0", - build_file_content = """ -load("@rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") - -# Turn a source directory into a TreeArtifact for RBE-compat -copy_file( - name = "npm_acorn-8.5.0", - src = "package", - # This attribute comes from rules_nodejs patch of - # https://github.com/bazelbuild/bazel-skylib/pull/323 - is_directory = True, - # We must give this as the directory in order for it to appear on NODE_PATH - out = "acorn", - visibility = ["//visibility:public"], -) -""", - sha256 = "d8f9d40c4656537a60bf0c6daae6f0553f54df5ff2518f86464b7c785f20376b", - urls = ["https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz"], -) - -use_repo(http, "npm_acorn-8.5.0") diff --git a/e2e/smoke/WORKSPACE.bazel b/e2e/smoke/WORKSPACE.bazel index c3b2b245f0..a754bd4235 100644 --- a/e2e/smoke/WORKSPACE.bazel +++ b/e2e/smoke/WORKSPACE.bazel @@ -8,14 +8,26 @@ http_archive( urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.2/rules_nodejs-core-5.8.2.tar.gz"], ) -# Note: skylib 1.1.1 has some bug on Windows with diff_test, which we use in this example http_archive( name = "bazel_skylib", - sha256 = "afbe4d9d033c007940acd24bb9becf1580a0280ae0b2ebbb5a7cb12912d2c115", - strip_prefix = "bazel-skylib-ffad33e9bfc60bdfa98292ca655a4e7035792046", - urls = ["https://github.com/bazelbuild/bazel-skylib/archive/ffad33e9bfc60bdfa98292ca655a4e7035792046.tar.gz"], + sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", + ], ) +http_archive( + name = "aspect_bazel_lib", + sha256 = "97fa63d95cc9af006c4c7b2123ddd2a91fb8d273012f17648e6423bae2c69470", + strip_prefix = "bazel-lib-1.30.2", + url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.30.2/bazel-lib-v1.30.2.tar.gz", +) + +load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies") + +aspect_bazel_lib_dependencies() + load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") # The order matters because Bazel will provide the first registered toolchain when a rule asks Bazel to select it @@ -32,21 +44,7 @@ nodejs_register_toolchains( http_archive( name = "npm_acorn-8.5.0", - build_file_content = """ -load("@rules_nodejs//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") - -# Turn a source directory into a TreeArtifact for RBE-compat -copy_file( - name = "npm_acorn-8.5.0", - src = "package", - # This attribute comes from rules_nodejs patch of - # https://github.com/bazelbuild/bazel-skylib/pull/323 - is_directory = True, - # We must give this as the directory in order for it to appear on NODE_PATH - out = "acorn", - visibility = ["//visibility:public"], -) -""", + build_file = "acorn.BUILD", sha256 = "d8f9d40c4656537a60bf0c6daae6f0553f54df5ff2518f86464b7c785f20376b", urls = ["https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz"], ) diff --git a/e2e/smoke/WORKSPACE.bzlmod b/e2e/smoke/WORKSPACE.bzlmod index 1839888b53..aede9808b5 100644 --- a/e2e/smoke/WORKSPACE.bzlmod +++ b/e2e/smoke/WORKSPACE.bzlmod @@ -1 +1,10 @@ # Replaces WORKSPACE.bazel under --enable_bzlmod + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "npm_acorn-8.5.0", + build_file = "acorn.BUILD", + sha256 = "d8f9d40c4656537a60bf0c6daae6f0553f54df5ff2518f86464b7c785f20376b", + urls = ["https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz"], +) diff --git a/e2e/smoke/deps.bzl b/e2e/smoke/deps.bzl deleted file mode 100644 index 2d65349dd4..0000000000 --- a/e2e/smoke/deps.bzl +++ /dev/null @@ -1,29 +0,0 @@ -"""Module extension to fetch dependencies - -Most users are better served using aspect_rules_js to fetch dependencies. - -This is just http_archive wrapped, see -https://github.com/bazelbuild/bazel/issues/17141 -""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -def _http_impl(ctx): - for mod in ctx.modules: - for pkg in mod.tags.archive: - http_archive( - name = pkg.name, - build_file_content = pkg.build_file_content, - sha256 = pkg.sha256, - urls = pkg.urls, - ) - -http = module_extension( - implementation = _http_impl, - tag_classes = {"archive": tag_class(attrs = { - "name": attr.string(), - "build_file_content": attr.string(), - "sha256": attr.string(), - "urls": attr.string_list(), - })}, -) diff --git a/e2e/smoke/external/acorn.BUILD b/e2e/smoke/external/acorn.BUILD new file mode 100644 index 0000000000..caac6be637 --- /dev/null +++ b/e2e/smoke/external/acorn.BUILD @@ -0,0 +1,10 @@ +load("@aspect_bazel_lib//lib:copy_directory.bzl", "copy_directory") + +# Turn a source directory into a TreeArtifact for RBE-compat +copy_directory( + name = "npm_acorn-8.5.0", + src = "package", + # We must give this as the directory in order for it to appear on NODE_PATH + out = "acorn", + visibility = ["//visibility:public"], +) diff --git a/repositories.bzl b/repositories.bzl index 3deb434ea0..69b3e0a594 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -60,14 +60,6 @@ def build_bazel_rules_nodejs_dev_dependencies(): ], ) - maybe( - http_archive, - name = "com_google_protobuf", - sha256 = "98e615d592d237f94db8bf033fba78cd404d979b0b70351a9e5aaff725398357", - strip_prefix = "protobuf-3.9.1", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.9.1.tar.gz"], - ) - # Needed for com_google_protobuf maybe( http_archive,