refactor: handle breaking changes in rules_nodejs 1.0.0 (#34736)

The major one that affects the angular repo is the removal of the bootstrap attribute in nodejs_binary, nodejs_test and jasmine_node_test in favor of using templated_args --node_options=--require=/path/to/script. The side-effect of this is that the bootstrap script does not get the require.resolve patches with explicitly loading the targets _loader.js file.

PR Close #34736
This commit is contained in:
Greg Magolan
2019-12-28 18:14:36 -08:00
committed by Matias Niemelä
parent ba662fa7a9
commit dcff76e8b9
70 changed files with 319 additions and 133 deletions

View File

@ -68,8 +68,6 @@ ts_library(
testonly = True,
srcs = glob(["node/*.ts"]) + [
"node-env-setup.ts",
"node_entry_point.ts",
"node_entry_point_no_patch_clock.ts",
"test-env-setup-jasmine-no-patch-clock.ts",
],
deps = [
@ -85,12 +83,45 @@ ts_library(
],
)
ts_library(
name = "node_entry_point",
testonly = True,
srcs = ["node_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_srcs",
":common_spec_util",
"//packages/zone.js/lib",
"@npm//@types/shelljs",
"@npm//@types/systemjs",
"@npm//rxjs",
"@npm//shelljs",
"@npm//systemjs",
],
)
ts_library(
name = "node_entry_point_no_patch_clock",
testonly = True,
srcs = ["node_entry_point_no_patch_clock.ts"],
deps = [
":common_spec_env",
":common_spec_srcs",
":common_spec_util",
"//packages/zone.js/lib",
"@npm//@types/shelljs",
"@npm//@types/systemjs",
"@npm//rxjs",
"@npm//shelljs",
"@npm//systemjs",
],
)
ts_library(
name = "bluebird_spec",
testonly = True,
srcs = [
"extra/bluebird.spec.ts",
"node_bluebird_entry_point.ts",
],
deps = [
":common_spec_env",
@ -100,13 +131,33 @@ ts_library(
)
ts_library(
name = "error_spec",
name = "node_bluebird_entry_point",
testonly = True,
srcs = [
"node_error_disable_policy_entry_point.ts",
"node_error_entry_point.ts",
"node_error_lazy_policy_entry_point.ts",
srcs = ["node_bluebird_entry_point.ts"],
deps = [
":common_spec_env",
"//packages/zone.js/lib",
"@npm//bluebird",
],
)
ts_library(
name = "node_error_disable_policy_entry_point",
testonly = True,
srcs = ["node_error_disable_policy_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_util",
":error_spec_srcs",
":node_error_entry_point",
"//packages/zone.js/lib",
],
)
ts_library(
name = "node_error_entry_point",
testonly = True,
srcs = ["node_error_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_util",
@ -115,53 +166,61 @@ ts_library(
],
)
ts_library(
name = "node_error_lazy_policy_entry_point",
testonly = True,
srcs = ["node_error_lazy_policy_entry_point.ts"],
deps = [
":common_spec_env",
":common_spec_util",
":error_spec_srcs",
":node_error_entry_point",
"//packages/zone.js/lib",
],
)
jasmine_node_test(
name = "test_node",
bootstrap = [
"angular/packages/zone.js/test/node_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_entry_point_es5))"],
deps = [
":node_entry_point_es5",
":test_node_lib",
],
)
jasmine_node_test(
name = "test_node_no_jasmine_clock",
bootstrap = [
"angular/packages/zone.js/test/node_entry_point_no_patch_clock.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_entry_point_no_patch_clock_es5))"],
deps = [
":node_entry_point_no_patch_clock_es5",
":test_node_lib",
],
)
jasmine_node_test(
name = "test_node_bluebird",
bootstrap = [
"angular/packages/zone.js/test/node_bluebird_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_bluebird_entry_point_es5))"],
deps = [
":bluebird_spec",
":node_bluebird_entry_point_es5",
],
)
jasmine_node_test(
name = "test_node_error_disable_policy",
bootstrap = [
"angular/packages/zone.js/test/node_error_disable_policy_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_error_disable_policy_entry_point_es5))"],
deps = [
":error_spec",
":node_error_disable_policy_entry_point",
":node_error_disable_policy_entry_point_es5",
],
)
jasmine_node_test(
name = "test_node_error_lazy_policy",
bootstrap = [
"angular/packages/zone.js/test/node_error_lazy_policy_entry_point.js",
],
templated_args = ["--node_options=--require=$(rlocation $(location :node_error_lazy_policy_entry_point_es5))"],
deps = [
":error_spec",
":node_error_lazy_policy_entry_point",
":node_error_lazy_policy_entry_point_es5",
],
)