Revert "refactor: handle breaking changes in rules_nodejs 1.0.0 (#34589)" (#34730)

This reverts commit 9bb349e1c8.

PR Close #34730
This commit is contained in:
atscott
2020-01-10 13:40:02 -08:00
parent 0e01d5c5de
commit 4955c256d2
69 changed files with 131 additions and 318 deletions

View File

@ -1,6 +1,6 @@
"""Re-export of some bazel rules with repository-wide defaults."""
load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _pkg_npm = "pkg_npm")
load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _npm_package = "npm_package")
load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test")
load("@npm_bazel_karma//:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", _ts_devserver = "ts_devserver", _ts_library = "ts_library")
@ -93,7 +93,7 @@ def ts_devserver(**kwargs):
**kwargs
)
def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name = None, **kwargs):
def ts_library(tsconfig = None, testonly = False, deps = [], module_name = None, **kwargs):
"""Default values for ts_library"""
deps = deps + ["@npm//tslib"]
if testonly:
@ -108,7 +108,6 @@ def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name =
module_name = _default_module_name(testonly)
_ts_library(
name = name,
tsconfig = tsconfig,
testonly = testonly,
deps = deps,
@ -116,17 +115,6 @@ def ts_library(name, tsconfig = None, testonly = False, deps = [], module_name =
**kwargs
)
# Select the es5 .js output of the ts_library for use in downstream boostrap targets
# with `output_group = "es5_sources"`. This exposes an internal detail of ts_library
# that is not ideal.
# TODO(gregmagolan): clean this up by using tsc() in these cases rather than ts_library
native.filegroup(
name = "%s_es5" % name,
srcs = [":%s" % name],
testonly = testonly,
output_group = "es5_sources",
)
def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], module_name = None, bundle_dts = True, **kwargs):
"""Default values for ng_module"""
deps = deps + ["@npm//tslib"]

View File

@ -6,15 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
if (process.env['TEST_SRCDIR']) {
// bootstrap the bazel require resolve patch since this
// script is a bootstrap script loaded with --node_options=--require=...
const path = require('path');
require(path.posix.join(
process.env['TEST_SRCDIR'], process.env['TEST_WORKSPACE'],
(process.env['TEST_BINARY'] as string).replace(/\.(sh|bat)$/, '_loader.js'), ));
}
import 'zone.js/lib/node/rollup-main';
import 'zone.js/lib/zone-spec/long-stack-trace';
import 'zone.js/lib/zone-spec/task-tracking';

View File

@ -55,10 +55,7 @@ pkg_npm(
ts_library(
name = "test_lib",
testonly = True,
srcs = glob(
["test/*.ts"],
exclude = ["test/bootstrap.ts"],
),
srcs = glob(["test/*.ts"]),
tsconfig = "//tools:tsconfig-test",
deps = [
":lib",
@ -71,40 +68,18 @@ ts_library(
],
)
ts_library(
name = "bootstrap",
testonly = True,
srcs = ["test/bootstrap.ts"],
tsconfig = "//tools:tsconfig-test",
deps = ["@npm//@types/node"],
)
# Select the es5 .js output of the ts_library :boostrap target
# with `output_group = "es5_sources"` for use in the jasmine_node_test
# below. This exposes an internal detail of ts_library that is not ideal.
# TODO(gregmagolan): clean this up by using tsc() in this case rather than ts_library
filegroup(
name = "bootstrap_es5",
testonly = True,
srcs = [":bootstrap"],
output_group = "es5_sources",
)
jasmine_node_test(
name = "tests",
srcs = [
":test_lib",
],
srcs = [":test_lib"],
bootstrap = ["angular/tools/ts-api-guardian/test/bootstrap.js"],
data = glob([
"test/fixtures/*.ts",
"test/fixtures/*.patch",
]) + [
":bootstrap_es5",
":ts-api-guardian",
# TODO: remove this once the boostrap.js workaround has been removed.
":package.json",
],
templated_args = ["--node_options=--require=$(rlocation $(location :bootstrap_es5))"],
)
# END-INTERNAL