Support building on arm Mac, Linux environments #1790
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #1593. Modify build config to support building on arm Mac, Linux environments.
Introduced support by upgrading the
rules_nodejs
package and its dependencies, and by extending platform-specific build scripts to download the appropriate executables.Tested by locally executing the
scripts/run
,scripts/run_tests
scripts (needed to use own GCP project and own encrypted key). I also applied this change on top of the3.0.0
tag and checked that the builtcli
,core
packages contain identical files to those published on NPM. Tested that build works on an Intel and an ARM Linux box (WSL), as well as an Apple Silicon Mac.Overview of changes:
rules_nodejs
from1.6.1
to3.8.0
. Arm targets inrepository_rules
can only be specified after the update (darwin support introduced in3.5.0
, linux support in2.x
. Upgraded to3.8.0
as point release upgrade worked without modifications),install_bazel_dependencies
steps (https://github.com/bazelbuild/rules_nodejs/wiki#removal-of-install_bazel_dependencies-1877) from/WORKSPACE
,install_source_map_support
flags from/BUILD
file (https://github.com/bazelbuild/rules_nodejs/wiki#removal-of-install_source_map_support),bazel_patch_module_resolver
flag to emulate legacy behavior (https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324),testing/index.ts
,tools/gcloud/repository_rules.bzl
(the second one wasn't necessary as even x64 packages worked fine and used locally installed arm python, but this felt more correct).rules_nodejs
2.0
(https://github.com/bazelbuild/rules_nodejs/wiki#loading-custom-rules-from-npm-packages),@bazel/tsetse
lint rule introduced inrules_nodejs
3.0
,grpc
dependency, whichnode_gyp
failed to build on Apple Silicon. It does not seem like it's used anywhere (and I don't understand why eithercore
orcli
would need interprocess communication besides the fork used during compile). Make explicit thesource_map_support
dependency.There are likely parts of the build system that I couldn't test. For example, I don't have access to the CI pipeline.