emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3k stars 683 forks source link

bazel: update rules_nodejs and migrate to rules_js #1436

Open eric-higgins-ai opened 1 month ago

eric-higgins-ai commented 1 month ago

This finishes the work started in https://github.com/emscripten-core/emsdk/pull/1388 by fixing CI. It avoids a breaking change by:

Context from the previous PR:

Bazel's Node.js dependency comes from rules_nodejs. Previously, bazel/deps.bzl was using rules_nodejs 5.8.0, released in 2022 and only supported Node.js toolchains up to 18.12.1.

This PR bumps rules_nodejs to latest 6.1.1. It also replaces build_bazel_rules_nodejs with rules_js, since npm_install that bazel/emscripten_deps.bzl used was deprecated. The README of rules_nodejs now recommends migrating to rules_js for everything other than the Node.js toolchain: (https://github.com/bazelbuild/rules_nodejs/commit/371e8cab15f9db444217703144b2eb71d0e13235)

Impetus Our repo builds with Bazel and uses Emscripten and Node.js. Tried to upgrade Node.js 18 to Node.js 20 and saw that emsdk didn't support rules_nodejs 6+ in the same workspace.

Similarly, it's not possible to update to rules_js v2 in a workspace that also references emsdk.