build: use api-golden tool from dev-infra for testing public API (#42688)

Switches our TS API guardian targets to rather use the new tool from
dev-infra that relies on Microsoft's API extractor.

PR Close #42688
This commit is contained in:
Paul Gschwendtner 2021-06-28 19:50:44 +02:00 committed by Jessica Janiuk
parent 56bd21de6f
commit 9db69a9c9e
15 changed files with 64 additions and 64 deletions

View File

@ -7,6 +7,6 @@ exports_files([
filegroup( filegroup(
name = "public-api", name = "public-api",
srcs = glob([ srcs = glob([
"public-api/**/*.d.ts", "public-api/**/*.md",
]), ]),
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -40,12 +40,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "animations_api", name = "animations_api",
actualDir = "angular/packages/animations/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/animations", golden_dir = "angular/goldens/public-api/animations",
npm_package = "angular/packages/animations/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -52,12 +52,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "common_api", name = "common_api",
actualDir = "angular/packages/common/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/common", golden_dir = "angular/goldens/public-api/common",
npm_package = "angular/packages/common/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "pkg_npm", "ts_api_guardian_test", "ts_config", "ts_library") load("//tools:defaults.bzl", "api_golden_test", "pkg_npm", "ts_config", "ts_library")
# Load ng_perf_flag explicitly from ng_perf.bzl as it's private API, and not exposed to other # Load ng_perf_flag explicitly from ng_perf.bzl as it's private API, and not exposed to other
# consumers of @angular/bazel. # consumers of @angular/bazel.
@ -73,24 +73,24 @@ pkg_npm(
], ],
) )
ts_api_guardian_test( api_golden_test(
name = "error_code_api", name = "error_code_api",
actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/diagnostics/src/error_code.d.ts",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
golden = "angular/goldens/public-api/compiler-cli/error_code.d.ts", entry_point = "angular/packages/compiler-cli/npm_package/src/ngtsc/diagnostics/src/error_code.d.ts",
golden = "angular/goldens/public-api/compiler-cli/error_code.md",
) )
ts_api_guardian_test( api_golden_test(
name = "compiler_options_api", name = "compiler_options_api",
actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/core/api/src/public_options.d.ts",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
golden = "angular/goldens/public-api/compiler-cli/compiler_options.d.ts", entry_point = "angular/packages/compiler-cli/npm_package/src/ngtsc/core/api/src/public_options.d.ts",
golden = "angular/goldens/public-api/compiler-cli/compiler_options.md",
) )
# Controls whether the Ivy compiler produces performance traces as part of each build # Controls whether the Ivy compiler produces performance traces as part of each build

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -55,22 +55,22 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "core_api", name = "core_api",
actualDir = "angular/packages/core/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/core", golden_dir = "angular/goldens/public-api/core",
npm_package = "angular/packages/core/npm_package",
) )
ts_api_guardian_test( api_golden_test(
name = "ng_global_utils_api", name = "ng_global_utils_api",
actual = "angular/packages/core/src/render3/global_utils_api.d.ts",
data = [ data = [
"//goldens:public-api", "//goldens:public-api",
"//packages/core", "//packages/core",
], ],
golden = "angular/goldens/public-api/core/global_utils.d.ts", entry_point = "angular/packages/core/src/render3/global_utils_api.d.ts",
golden = "angular/goldens/public-api/core/global_utils.md",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -35,12 +35,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "elements_api", name = "elements_api",
actualDir = "angular/packages/elements/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/elements", golden_dir = "angular/goldens/public-api/elements",
npm_package = "angular/packages/elements/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -38,12 +38,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "forms_api", name = "forms_api",
actualDir = "angular/packages/forms/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/forms", golden_dir = "angular/goldens/public-api/forms",
npm_package = "angular/packages/forms/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_package", "ts_api_guardian_test_npm_package", "ts_library") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_package", "ts_library")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -37,12 +37,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "localize_api", name = "localize_api",
actualDir = "angular/packages/localize/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/localize", golden_dir = "angular/goldens/public-api/localize",
npm_package = "angular/packages/localize/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -41,12 +41,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "platform-browser-dynamic_api", name = "platform-browser-dynamic_api",
actualDir = "angular/packages/platform-browser-dynamic/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/platform-browser-dynamic", golden_dir = "angular/goldens/public-api/platform-browser-dynamic",
npm_package = "angular/packages/platform-browser-dynamic/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -44,12 +44,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "platform-browser_api", name = "platform-browser_api",
actualDir = "angular/packages/platform-browser/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/platform-browser", golden_dir = "angular/goldens/public-api/platform-browser",
npm_package = "angular/packages/platform-browser/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -50,12 +50,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "platform-server_api", name = "platform-server_api",
actualDir = "angular/packages/platform-server/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/platform-server", golden_dir = "angular/goldens/public-api/platform-server",
npm_package = "angular/packages/platform-server/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -44,12 +44,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "router_api", name = "router_api",
actualDir = "angular/packages/router/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/router", golden_dir = "angular/goldens/public-api/router",
npm_package = "angular/packages/router/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -59,12 +59,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "service-worker_api", name = "service-worker_api",
actualDir = "angular/packages/service-worker/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/service-worker", golden_dir = "angular/goldens/public-api/service-worker",
npm_package = "angular/packages/service-worker/npm_package",
) )

View File

@ -1,4 +1,4 @@
load("//tools:defaults.bzl", "ng_module", "ng_package", "ts_api_guardian_test_npm_package") load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
@ -39,12 +39,12 @@ ng_package(
], ],
) )
ts_api_guardian_test_npm_package( api_golden_test_npm_package(
name = "upgrade_api", name = "upgrade_api",
actualDir = "angular/packages/upgrade/npm_package",
data = [ data = [
":npm_package", ":npm_package",
"//goldens:public-api", "//goldens:public-api",
], ],
goldenDir = "angular/goldens/public-api/upgrade", golden_dir = "angular/goldens/public-api/upgrade",
npm_package = "angular/packages/upgrade/npm_package",
) )

View File

@ -12,7 +12,7 @@ load("@npm//typescript:index.bzl", "tsc")
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package") load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
load("//dev-infra/benchmark/ng_rollup_bundle:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle") load("//dev-infra/benchmark/ng_rollup_bundle:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup_bundle")
load("//tools:ng_benchmark.bzl", _ng_benchmark = "ng_benchmark") load("//tools:ng_benchmark.bzl", _ng_benchmark = "ng_benchmark")
load("//tools/ts-api-guardian:index.bzl", _ts_api_guardian_test = "ts_api_guardian_test", _ts_api_guardian_test_npm_package = "ts_api_guardian_test_npm_package") load("//dev-infra/bazel/api-golden:index.bzl", _api_golden_test = "api_golden_test", _api_golden_test_npm_package = "api_golden_test_npm_package")
_DEFAULT_TSCONFIG_TEST = "//packages:tsconfig-test" _DEFAULT_TSCONFIG_TEST = "//packages:tsconfig-test"
_INTERNAL_NG_MODULE_API_EXTRACTOR = "//packages/bazel/src/api-extractor:api_extractor" _INTERNAL_NG_MODULE_API_EXTRACTOR = "//packages/bazel/src/api-extractor:api_extractor"
@ -495,16 +495,16 @@ def rollup_bundle(name, testonly = False, sourcemap = "true", **kwargs):
terser_minified(name = name + ".min.es5umd", testonly = testonly, src = name + ".es5umd", **common_terser_args) terser_minified(name = name + ".min.es5umd", testonly = testonly, src = name + ".es5umd", **common_terser_args)
native.filegroup(name = name + ".min.es5umd.js", testonly = testonly, srcs = [name + ".min.es5umd"]) native.filegroup(name = name + ".min.es5umd.js", testonly = testonly, srcs = [name + ".min.es5umd"])
def ts_api_guardian_test(**kwargs): def api_golden_test(**kwargs):
_ts_api_guardian_test( _api_golden_test(
tags = [ tags = [
"fixme-ivy-aot", "fixme-ivy-aot",
], ],
**kwargs **kwargs
) )
def ts_api_guardian_test_npm_package(**kwargs): def api_golden_test_npm_package(**kwargs):
_ts_api_guardian_test_npm_package( _api_golden_test_npm_package(
tags = [ tags = [
"fixme-ivy-aot", "fixme-ivy-aot",
], ],