Skip to content

Commit

Permalink
refactor: remove legacy node toolchain
Browse files Browse the repository at this point in the history
At this point everything should be using the new one
  • Loading branch information
alexeagle authored and gregmagolan committed Dec 24, 2021
1 parent 52797c0 commit f882d24
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 521 deletions.
66 changes: 0 additions & 66 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ tasks:
- "--test_tag_filters=-e2e,-examples,-manual,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome,-cypress"
test_targets:
- "//..."
# //internal/node/test:nodejs_toolchain_linux_amd64_test is a "manual" test that must be run
# explicitly; it should pass when running on Linux with no --platform set.
- "//internal/node/test:nodejs_toolchain_linux_amd64_test"
ubuntu1804_debug:
name: ubuntu1804_debug
platform: ubuntu1804
Expand Down Expand Up @@ -129,40 +126,6 @@ tasks:
# TODO(gregmagolan): make node_repositories acccept different archives for different platforms
- "//examples:examples_vendored_node"
- "//examples:examples_vendored_node_and_yarn"
ubuntu1804_cross_compile_darwin:
name: ubuntu1804_cross_compile_darwin
platform: ubuntu1804
# Build on linux with the node --platform set to darwin
build_flags:
- "--platforms=@rules_nodejs//nodejs:darwin_amd64"
# TODO(gregmagolan): figure out how to install missing shared libs
# Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs.
- "--build_tag_filters=-cypress"
build_targets:
- "//internal/..."
test_flags:
- "--platforms=@rules_nodejs//nodejs:darwin_amd64"
test_targets:
# //internal/node/test:nodejs_toolchain_darwin_amd64_test is a "manual" test that must be run
# explicitly with --platforms set to darwin_amd64
- "//internal/node/test:nodejs_toolchain_darwin_amd64_test"
ubuntu1804_cross_compile_windows:
name: ubuntu1804_cross_compile_windows
platform: ubuntu1804
# Build on linux with the node --platform set to Windows
build_flags:
- "--platforms=@rules_nodejs//nodejs:windows_amd64"
# TODO(gregmagolan): figure out how to install missing shared libs
# Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs.
- "--build_tag_filters=-cypress"
build_targets:
- "//internal/..."
test_flags:
- "--platforms=@rules_nodejs//nodejs:windows_amd64"
test_targets:
# //internal/node/test:nodejs_toolchain_windows_amd64_test is a "manual" test that must be run
# explicitly with --platforms set to windows_amd64
- "//internal/node/test:nodejs_toolchain_windows_amd64_test"
macos:
name: macos
platform: macos
Expand All @@ -186,9 +149,6 @@ tasks:
- "--test_tag_filters=-e2e,-examples,-manual,-browser:firefox-local"
test_targets:
- "//..."
# //internal/node/test:nodejs_toolchain_darwin_amd64_test is a "manual" test that must be run
# explicitly; it should pass when running on OSX with no --platform set.
- "//internal/node/test:nodejs_toolchain_darwin_amd64_test"
macos_e2e:
name: macos_e2e
platform: macos
Expand Down Expand Up @@ -245,20 +205,6 @@ tasks:
- "--test_arg=--test_tag_filters=-no-bazelci-mac,-manual,-browser:firefox-local"
test_targets:
- "//..."
macos_cross_compile_linux:
name: macos_cross_compile_linux
platform: macos
# Build on mac with the node --platform set to linux
build_flags:
- "--platforms=@rules_nodejs//nodejs:linux_amd64"
build_targets:
- "//internal/..."
test_flags:
- "--platforms=@rules_nodejs//nodejs:linux_amd64"
test_targets:
# //internal/node/test:nodejs_toolchain_linux_amd64_test is a "manual" test that must be run
# explicitly with --platforms set to linux_amd64
- "//internal/node/test:nodejs_toolchain_linux_amd64_test"
# TODO(gregmagolan): fix platform configuraiton for this test job for Bazel 2.0
# macos_fake_rbe:
# name: macos_fake_rbe
Expand Down Expand Up @@ -294,9 +240,6 @@ tasks:
- "--test_tag_filters=-e2e,-examples,-fix-windows,-no-bazelci-windows,-requires-runfiles,-manual,-browser:firefox-local,-cypress"
test_targets:
- "//..."
# //internal/node/test:nodejs_toolchain_windows_amd64_test is a "manual" test that must be run
# explicitly; it should pass when running on Windows with no --platform set.
- "//internal/node/test:nodejs_toolchain_windows_amd64_test"
windows_runfiles_enabled:
name: windows_runfiles_enabled
platform: windows
Expand Down Expand Up @@ -347,15 +290,6 @@ tasks:
- "--test_arg=--test_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles,-manual,-browser:chromium-local,-browser:firefox-local,-cypress"
test_targets:
- "//..."
windows_cross_compile_linux:
name: windows_cross_compile_linux
platform: windows
build_flags:
- "--build_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles"
# Build on windows with the node --platform set to linux
- "--platforms=@rules_nodejs//nodejs:linux_amd64"
build_targets:
- "//internal/..."
rbe_ubuntu1604:
name: rbe_ubuntu1604
platform: rbe_ubuntu1604
Expand Down
1 change: 0 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ pkg_npm(
"//third_party/npm/node_modules/named-amd:package_contents",
"//toolchains/cypress:package_contents",
"//toolchains/esbuild:package_contents",
"//toolchains/node:package_contents",
],
)

Expand Down
70 changes: 0 additions & 70 deletions docs/Toolchains.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,76 +52,6 @@ Defaults to `""`
Defaults to `None`


## node_toolchain

**USAGE**

<pre>
node_toolchain(<a href="#node_toolchain-name">name</a>, <a href="#node_toolchain-target_tool">target_tool</a>, <a href="#node_toolchain-target_tool_path">target_tool_path</a>)
</pre>

Defines a node toolchain.

For usage see https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains.


**ATTRIBUTES**


<h4 id="node_toolchain-name">name</h4>

(*<a href="https://bazel.build/docs/build-ref.html#name">Name</a>, mandatory*): A unique name for this target.


<h4 id="node_toolchain-target_tool">target_tool</h4>

(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): A hermetically downloaded nodejs executable target for the target platform.

Defaults to `None`

<h4 id="node_toolchain-target_tool_path">target_tool_path</h4>

(*String*): Path to an existing nodejs executable for the target platform.

Defaults to `""`


## node_toolchain_configure

**USAGE**

<pre>
node_toolchain_configure(<a href="#node_toolchain_configure-name">name</a>, <a href="#node_toolchain_configure-repo_mapping">repo_mapping</a>, <a href="#node_toolchain_configure-target_tool">target_tool</a>, <a href="#node_toolchain_configure-target_tool_path">target_tool_path</a>)
</pre>

Creates an external repository with a node_toolchain //:toolchain target properly configured.

**ATTRIBUTES**


<h4 id="node_toolchain_configure-name">name</h4>

(*<a href="https://bazel.build/docs/build-ref.html#name">Name</a>, mandatory*): A unique name for this repository.


<h4 id="node_toolchain_configure-repo_mapping">repo_mapping</h4>

(*<a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a>, mandatory*): A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).


<h4 id="node_toolchain_configure-target_tool">target_tool</h4>

(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): Target for a downloaded nodejs binary for the target os.

Defaults to `None`

<h4 id="node_toolchain_configure-target_tool_path">target_tool_path</h4>

(*String*): Absolute path to a pre-installed nodejs binary for the target os.

Defaults to `""`


## configure_esbuild_toolchains

**USAGE**
Expand Down
2 changes: 1 addition & 1 deletion e2e/nodejs_image/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nodejs_binary(
entry_point = "main.js",
)

# bazel run --platforms=@build_bazel_rules_nodejs//toolchains/node:linux_amd64 //:nodejs_image
# bazel run --platforms=@rules_nodejs//:linux_amd64 //:nodejs_image
nodejs_image(
name = "nodejs_image",
binary = ":main",
Expand Down
1 change: 0 additions & 1 deletion internal/node/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ bzl_library(
"//internal/npm_install:bzl",
"//nodejs:bzl",
"//third_party/github.com/bazelbuild/bazel-skylib:bzl",
"//toolchains/node:bzl",
"@rules_nodejs//nodejs:bzl",
],
)
Expand Down
7 changes: 0 additions & 7 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//internal/common:check_bazel_version.bzl", "check_bazel_version")
load("//nodejs/private:os_name.bzl", "OS_ARCH_NAMES", "node_exists_for_os", "os_name")
load("//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", node_repositories_rule = "node_repositories")
load("//toolchains/node:node_toolchain_configure.bzl", "node_toolchain_configure")
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")

def node_repositories(**kwargs):
Expand Down Expand Up @@ -65,12 +64,6 @@ def node_repositories(**kwargs):
name = node_repository_name,
**kwargs
)
target_tool = "@%s//:node_bin" % node_repository_name
native.register_toolchains("@build_bazel_rules_nodejs//toolchains/node:node_%s_toolchain" % os_name)
node_toolchain_configure(
name = "%s_config" % node_repository_name,
target_tool = target_tool,
)

# Install new toolchain under "nodejs" repository name prefix
nodejs_register_toolchains(name = "nodejs")
10 changes: 0 additions & 10 deletions internal/node/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", "nodejs_binary", "nodejs_test", "npm_package_bin")
load("@npm//typescript:index.bzl", "tsc")
load("//:index.bzl", "js_library")
load("//nodejs:repositories.bzl", "BUILT_IN_NODE_PLATFORMS")
load("//packages/jasmine:index.bzl", "jasmine_node_test")
load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file")
load("//third_party/github.com/bazelbuild/bazel-skylib:rules/write_file.bzl", "write_file")
load(":nodejs_toolchain_test.bzl", "nodejs_toolchain_test")

# You can have a nodejs_binary with no node_modules attribute
# and no fine grained deps
Expand Down Expand Up @@ -341,14 +339,6 @@ jasmine_node_test(
],
)

[nodejs_toolchain_test(
name = "nodejs_toolchain_%s_test" % platform,
platform = platform,
# must be run with --platforms=@rules_nodejs//nodejs:PLATFORM
# where PLATFORM is one of BUILT_IN_NODE_PLATFORMS
tags = ["manual"],
) for platform in BUILT_IN_NODE_PLATFORMS]

nodejs_binary(
name = "expand_variables",
entry_point = "expand_variables.js",
Expand Down
63 changes: 0 additions & 63 deletions internal/node/test/nodejs_toolchain_test.bzl

This file was deleted.

1 change: 0 additions & 1 deletion toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ stardoc(
deps = [
"//toolchains/cypress:bzl",
"//toolchains/esbuild:bzl",
"//toolchains/node:bzl",
],
)
4 changes: 0 additions & 4 deletions toolchains/index.for_docs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ load("//toolchains/cypress:cypress_repositories.bzl", _cypress_repositories = "c
load("//toolchains/cypress:cypress_toolchain.bzl", _cypress_toolchain = "cypress_toolchain")
load("//toolchains/esbuild:esbuild_repositories.bzl", _esbuild_repositories = "esbuild_repositories")
load("//toolchains/esbuild:toolchain.bzl", _configure_esbuild_toolchains = "configure_esbuild_toolchains")
load("//toolchains/node:node_toolchain_configure.bzl", _node_toolchain_configure = "node_toolchain_configure")
load("//toolchains/node:node_toolchain.bzl", _node_toolchain = "node_toolchain")

cypress_repositories = _cypress_repositories
cypress_toolchain = _cypress_toolchain
esbuild_repositories = _esbuild_repositories
configure_esbuild_toolchains = _configure_esbuild_toolchains
node_toolchain_configure = _node_toolchain_configure
node_toolchain = _node_toolchain
Loading

0 comments on commit f882d24

Please sign in to comment.