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

bazel: update rules_nodejs and migrate to rules_js #1436

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
29 changes: 23 additions & 6 deletions bazel/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,30 @@ def deps():
)
maybe(
http_archive,
name = "rules_nodejs",
sha256 = "08337d4fffc78f7fe648a93be12ea2fc4e8eb9795a4e6aa48595b66b34555626",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-core-5.8.0.tar.gz"],
name = "aspect_rules_js",
strip_prefix = "rules_js-1.42.0",
sha256 = "5a00869efaeb308245f8132a671fe86524bdfc4f8bfd1976d26f862b316dc3c9",
urls = ["https://github.com/aspect-build/rules_js/releases/download/v1.42.0/rules_js-v1.42.0.tar.gz"],
)
# Transitive dependencies of aspect_rules_js. We explicitly pull them here instead of calling their
# provided function to avoid requiring a call to rules_js_dependencies in WORKSPACE.
maybe(
http_archive,
name = "aspect_bazel_lib",
sha256 = "714cf8ce95a198bab0a6a3adaffea99e929d2f01bf6d4a59a2e6d6af72b4818c",
strip_prefix = "bazel-lib-2.7.8",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.8/bazel-lib-v2.7.8.tar.gz",
)
maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "dcc55f810142b6cf46a44d0180a5a7fb923c04a5061e2e8d8eb05ccccc60864b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-5.8.0.tar.gz"],
name = "rules_nodejs",
strip_prefix = "rules_nodejs-6.2.0",
sha256 = "87c6171c5be7b69538d4695d9ded29ae2626c5ed76a9adeedce37b63c73bef67",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/v6.2.0/rules_nodejs-v6.2.0.tar.gz"],
)
http_archive(
name = "bazel_features",
sha256 = "f3082bfcdca73dc77dcd68faace806135a2e08c230b02b1d9fbdbd7db9d9c450",
strip_prefix = "bazel_features-0.1.0",
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v0.1.0/bazel_features-v0.1.0.tar.gz",
)
35 changes: 18 additions & 17 deletions bazel/emscripten_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install")
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
load(":revisions.bzl", "EMSCRIPTEN_TAGS")

def _parse_version(v):
Expand Down Expand Up @@ -118,7 +119,7 @@ def emscripten_deps(emscripten_version = "latest"):
excludes = native.existing_rules().keys()
if "nodejs_toolchains" not in excludes:
# Node 16 is the first version that supports darwin_arm64
node_repositories(
nodejs_register_toolchains(
node_version = "16.6.2",
)

Expand Down Expand Up @@ -174,36 +175,36 @@ def emscripten_deps(emscripten_version = "latest"):
)

if "emscripten_npm_linux" not in excludes:
npm_install(
npm_translate_lock(
name = "emscripten_npm_linux",
package_json = "@emscripten_bin_linux//:emscripten/package.json",
package_lock_json = "@emscripten_bin_linux//:emscripten/package-lock.json",
data = ["@emscripten_bin_linux//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_linux//:emscripten/package-lock.json",
)

if "emscripten_npm_linux_arm64" not in excludes:
npm_install(
npm_translate_lock(
name = "emscripten_npm_linux_arm64",
package_json = "@emscripten_bin_linux_arm64//:emscripten/package.json",
package_lock_json = "@emscripten_bin_linux_arm64//:emscripten/package-lock.json",
data = ["@emscripten_bin_linux_arm64//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_linux_arm64//:emscripten/package-lock.json",
)

if "emscripten_npm_mac" not in excludes:
npm_install(
npm_translate_lock(
name = "emscripten_npm_mac",
package_json = "@emscripten_bin_mac//:emscripten/package.json",
package_lock_json = "@emscripten_bin_mac//:emscripten/package-lock.json",
data = ["@emscripten_bin_mac//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_mac//:emscripten/package-lock.json",
)

if "emscripten_npm_mac_arm64" not in excludes:
npm_install(
npm_translate_lock(
name = "emscripten_npm_mac",
package_json = "@emscripten_bin_mac_arm64//:emscripten/package.json",
package_lock_json = "@emscripten_bin_mac_arm64//:emscripten/package-lock.json",
data = ["@emscripten_bin_mac_arm64//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_mac_arm64//:emscripten/package-lock.json",
)

if "emscripten_npm_win" not in excludes:
npm_install(
npm_translate_lock(
name = "emscripten_npm_win",
package_json = "@emscripten_bin_win//:emscripten/package.json",
package_lock_json = "@emscripten_bin_win//:emscripten/package-lock.json",
data = ["@emscripten_bin_win//:emscripten/package.json"],
npm_package_lock = "@emscripten_bin_win//:emscripten/package-lock.json",
)