build: use fine grain dependencies for ts-api-guardian (#30051)

At the moment `ts_api_guardian_test` rule depends on the entire node_modules tree, this is causing an input file tree of over 71473 in the material repo which is failing RBE

With this change we add only the required dependencies to as data attribute instead of the `@npm//:node_modules`

With this change we should also reduce the `Too many open files in system` error that sometimes crops up

PR Close #30051
This commit is contained in:
Alan Agius 2019-04-23 14:47:18 +02:00 committed by Ben Lesh
parent 9873356bd0
commit f7960c024c
2 changed files with 7 additions and 10 deletions

View File

@ -16,6 +16,7 @@ ts_library(
"@npm//@types/diff", "@npm//@types/diff",
"@npm//@types/minimist", "@npm//@types/minimist",
"@npm//@types/node", "@npm//@types/node",
"@npm//chalk",
"@npm//diff", "@npm//diff",
"@npm//minimist", "@npm//minimist",
"@npm//typescript", "@npm//typescript",
@ -41,7 +42,8 @@ npm_package(
"package.json", "package.json",
], ],
replacements = { replacements = {
"@angular//tools/ts-api-guardian": "@npm_ts_api_guardian//", "@angular//tools/ts-api-guardian:bin": "@npm_ts_api_guardian//:bin",
"@angular//tools/ts-api-guardian:lib": "@npm//ts-api-guardian",
"angular/tools/ts-api-guardian/": "npm_ts_api_guardian/", "angular/tools/ts-api-guardian/": "npm_ts_api_guardian/",
}, },
deps = [ deps = [
@ -78,7 +80,6 @@ jasmine_node_test(
"test/fixtures/*.patch", "test/fixtures/*.patch",
]) + [ ]) + [
":ts-api-guardian", ":ts-api-guardian",
"@npm//chalk",
# TODO: remove this once the boostrap.js workaround has been removed. # TODO: remove this once the boostrap.js workaround has been removed.
":package.json", ":package.json",
], ],
@ -86,8 +87,7 @@ jasmine_node_test(
) )
# END-INTERNAL # END-INTERNAL
filegroup( exports_files(
name = "bin", ["bin/ts-api-guardian"],
srcs = glob(["lib/*.js"]) + ["bin/ts-api-guardian"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View File

@ -33,11 +33,10 @@ def ts_api_guardian_test(
"""Runs ts_api_guardian """Runs ts_api_guardian
""" """
data += [ data += [
# BEGIN-INTERNAL
# Locally we need to add the TS build target # Locally we need to add the TS build target
# But it will replaced to @npm//ts-api-guardian when publishing
"@angular//tools/ts-api-guardian:lib", "@angular//tools/ts-api-guardian:lib",
# END-INTERNAL "@angular//tools/ts-api-guardian:bin/ts-api-guardian",
"@angular//tools/ts-api-guardian:bin",
] ]
args = [ args = [
@ -58,7 +57,6 @@ def ts_api_guardian_test(
nodejs_test( nodejs_test(
name = name, name = name,
data = data, data = data,
node_modules = "@npm//:node_modules",
entry_point = "angular/tools/ts-api-guardian/bin/ts-api-guardian", entry_point = "angular/tools/ts-api-guardian/bin/ts-api-guardian",
templated_args = args + ["--verify", golden, actual], templated_args = args + ["--verify", golden, actual],
**kwargs **kwargs
@ -68,7 +66,6 @@ def ts_api_guardian_test(
name = name + ".accept", name = name + ".accept",
testonly = True, testonly = True,
data = data, data = data,
node_modules = "@npm//:node_modules",
entry_point = "angular/tools/ts-api-guardian/bin/ts-api-guardian", entry_point = "angular/tools/ts-api-guardian/bin/ts-api-guardian",
templated_args = args + ["--out", golden, actual], templated_args = args + ["--out", golden, actual],
**kwargs **kwargs