-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce "core" package at /nodejs
Motivation is described by #2892 Some advantages of this approach: - We now follow the style guide at https://docs.bazel.build/versions/main/skylark/deploying.html - Gives us a 'clean room' to eventually reduce the scope of the project. - Allows others to develop their own competing nodejs rules without having to start from scratch. - Allows the user to declare two different node versions since they control the name of the external repository we create
- Loading branch information
Showing
23 changed files
with
866 additions
and
723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load("@bazel_skylib//rules:diff_test.bzl", "diff_test") | ||
|
||
write_file( | ||
name = "js", | ||
out = "some.js", | ||
content = ["require('fs').writeFileSync(process.argv[2], 'stuff')"], | ||
) | ||
|
||
# Temporary fixture until we have toolchains hooked up in the core package | ||
alias( | ||
name = "node_bin", | ||
actual = select({ | ||
"@bazel_tools//src/conditions:darwin_arm64": "@node16_darwin_arm64//:node_bin", | ||
"@bazel_tools//src/conditions:darwin_x86_64": "@node16_darwin_amd64//:node_bin", | ||
"@bazel_tools//src/conditions:linux_aarch64": "@node16_linux_arm64//:node_bin", | ||
"@bazel_tools//src/conditions:linux_s390x": "@node16_linux_s390x//:node_bin", | ||
"@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_bin", | ||
"@bazel_tools//src/conditions:linux_ppc64le": "@node16_linux_ppc64le//:node_bin", | ||
"@bazel_tools//src/conditions:windows": "@node16_windows_amd64//:node_bin", | ||
"//conditions:default": "@node16_linux_amd64//:node_bin", | ||
}), | ||
) | ||
|
||
genrule( | ||
name = "try", | ||
srcs = ["some.js"], | ||
outs = ["thing"], | ||
cmd = "$(execpath :node_bin) $(execpath some.js) $@", | ||
tools = [":node_bin"], | ||
) | ||
|
||
write_file( | ||
name = "write_expected", | ||
out = "expected", | ||
content = ["stuff"], | ||
) | ||
|
||
diff_test( | ||
name = "test", | ||
file1 = "expected", | ||
file2 = "thing", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
workspace(name = "e2e_core") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "rules_nodejs", | ||
sha256 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", | ||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.1.0/rules_nodejs-core-4.1.0.tar.gz"], | ||
) | ||
|
||
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains", "rules_nodejs_dependencies") | ||
|
||
# This just gives us bazel-skylib | ||
rules_nodejs_dependencies() | ||
|
||
nodejs_register_toolchains( | ||
name = "node16", | ||
node_version = "16.9.0", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.