From 9db69a9c9e3ce92e83dc9d1f4363b4d34f468769 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 28 Jun 2021 19:50:44 +0200 Subject: [PATCH] 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 --- goldens/BUILD.bazel | 2 +- packages/animations/BUILD.bazel | 8 ++++---- packages/common/BUILD.bazel | 8 ++++---- packages/compiler-cli/BUILD.bazel | 14 +++++++------- packages/core/BUILD.bazel | 14 +++++++------- packages/elements/BUILD.bazel | 8 ++++---- packages/forms/BUILD.bazel | 8 ++++---- packages/localize/BUILD.bazel | 8 ++++---- packages/platform-browser-dynamic/BUILD.bazel | 8 ++++---- packages/platform-browser/BUILD.bazel | 8 ++++---- packages/platform-server/BUILD.bazel | 8 ++++---- packages/router/BUILD.bazel | 8 ++++---- packages/service-worker/BUILD.bazel | 8 ++++---- packages/upgrade/BUILD.bazel | 8 ++++---- tools/defaults.bzl | 10 +++++----- 15 files changed, 64 insertions(+), 64 deletions(-) diff --git a/goldens/BUILD.bazel b/goldens/BUILD.bazel index 5ce0cc2a75..a841e8a70d 100644 --- a/goldens/BUILD.bazel +++ b/goldens/BUILD.bazel @@ -7,6 +7,6 @@ exports_files([ filegroup( name = "public-api", srcs = glob([ - "public-api/**/*.d.ts", + "public-api/**/*.md", ]), ) diff --git a/packages/animations/BUILD.bazel b/packages/animations/BUILD.bazel index ae37978d31..57a464e0c6 100644 --- a/packages/animations/BUILD.bazel +++ b/packages/animations/BUILD.bazel @@ -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"]) @@ -40,12 +40,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "animations_api", - actualDir = "angular/packages/animations/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/animations", + golden_dir = "angular/goldens/public-api/animations", + npm_package = "angular/packages/animations/npm_package", ) diff --git a/packages/common/BUILD.bazel b/packages/common/BUILD.bazel index f37222c517..ac47bac7cb 100644 --- a/packages/common/BUILD.bazel +++ b/packages/common/BUILD.bazel @@ -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"]) @@ -52,12 +52,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "common_api", - actualDir = "angular/packages/common/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/common", + golden_dir = "angular/goldens/public-api/common", + npm_package = "angular/packages/common/npm_package", ) diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index 345efc96e8..e3fb053342 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -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 # consumers of @angular/bazel. @@ -73,24 +73,24 @@ pkg_npm( ], ) -ts_api_guardian_test( +api_golden_test( name = "error_code_api", - actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/diagnostics/src/error_code.d.ts", data = [ ":npm_package", "//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", - actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/core/api/src/public_options.d.ts", data = [ ":npm_package", "//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 diff --git a/packages/core/BUILD.bazel b/packages/core/BUILD.bazel index 15b435131b..f357974524 100644 --- a/packages/core/BUILD.bazel +++ b/packages/core/BUILD.bazel @@ -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"]) @@ -55,22 +55,22 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "core_api", - actualDir = "angular/packages/core/npm_package", data = [ ":npm_package", "//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", - actual = "angular/packages/core/src/render3/global_utils_api.d.ts", data = [ "//goldens:public-api", "//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", ) diff --git a/packages/elements/BUILD.bazel b/packages/elements/BUILD.bazel index 465b8cbeaa..2574d84676 100644 --- a/packages/elements/BUILD.bazel +++ b/packages/elements/BUILD.bazel @@ -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"]) @@ -35,12 +35,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "elements_api", - actualDir = "angular/packages/elements/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/elements", + golden_dir = "angular/goldens/public-api/elements", + npm_package = "angular/packages/elements/npm_package", ) diff --git a/packages/forms/BUILD.bazel b/packages/forms/BUILD.bazel index 6466bc700f..90fb3fb7f2 100644 --- a/packages/forms/BUILD.bazel +++ b/packages/forms/BUILD.bazel @@ -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"]) @@ -38,12 +38,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "forms_api", - actualDir = "angular/packages/forms/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/forms", + golden_dir = "angular/goldens/public-api/forms", + npm_package = "angular/packages/forms/npm_package", ) diff --git a/packages/localize/BUILD.bazel b/packages/localize/BUILD.bazel index e768811b95..252da8efd6 100644 --- a/packages/localize/BUILD.bazel +++ b/packages/localize/BUILD.bazel @@ -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"]) @@ -37,12 +37,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "localize_api", - actualDir = "angular/packages/localize/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/localize", + golden_dir = "angular/goldens/public-api/localize", + npm_package = "angular/packages/localize/npm_package", ) diff --git a/packages/platform-browser-dynamic/BUILD.bazel b/packages/platform-browser-dynamic/BUILD.bazel index 5dc308f172..b18b113cfa 100644 --- a/packages/platform-browser-dynamic/BUILD.bazel +++ b/packages/platform-browser-dynamic/BUILD.bazel @@ -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"]) @@ -41,12 +41,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "platform-browser-dynamic_api", - actualDir = "angular/packages/platform-browser-dynamic/npm_package", data = [ ":npm_package", "//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", ) diff --git a/packages/platform-browser/BUILD.bazel b/packages/platform-browser/BUILD.bazel index 857ec5093a..4f09dabc9f 100644 --- a/packages/platform-browser/BUILD.bazel +++ b/packages/platform-browser/BUILD.bazel @@ -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"]) @@ -44,12 +44,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "platform-browser_api", - actualDir = "angular/packages/platform-browser/npm_package", data = [ ":npm_package", "//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", ) diff --git a/packages/platform-server/BUILD.bazel b/packages/platform-server/BUILD.bazel index eade038378..130308d1a5 100644 --- a/packages/platform-server/BUILD.bazel +++ b/packages/platform-server/BUILD.bazel @@ -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"]) @@ -50,12 +50,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "platform-server_api", - actualDir = "angular/packages/platform-server/npm_package", data = [ ":npm_package", "//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", ) diff --git a/packages/router/BUILD.bazel b/packages/router/BUILD.bazel index 3415be9ee0..4555ed360f 100644 --- a/packages/router/BUILD.bazel +++ b/packages/router/BUILD.bazel @@ -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"]) @@ -44,12 +44,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "router_api", - actualDir = "angular/packages/router/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/router", + golden_dir = "angular/goldens/public-api/router", + npm_package = "angular/packages/router/npm_package", ) diff --git a/packages/service-worker/BUILD.bazel b/packages/service-worker/BUILD.bazel index 0d3ea6c507..79df7c2851 100644 --- a/packages/service-worker/BUILD.bazel +++ b/packages/service-worker/BUILD.bazel @@ -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"]) @@ -59,12 +59,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "service-worker_api", - actualDir = "angular/packages/service-worker/npm_package", data = [ ":npm_package", "//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", ) diff --git a/packages/upgrade/BUILD.bazel b/packages/upgrade/BUILD.bazel index 576adf70e4..e0772833ba 100644 --- a/packages/upgrade/BUILD.bazel +++ b/packages/upgrade/BUILD.bazel @@ -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"]) @@ -39,12 +39,12 @@ ng_package( ], ) -ts_api_guardian_test_npm_package( +api_golden_test_npm_package( name = "upgrade_api", - actualDir = "angular/packages/upgrade/npm_package", data = [ ":npm_package", "//goldens:public-api", ], - goldenDir = "angular/goldens/public-api/upgrade", + golden_dir = "angular/goldens/public-api/upgrade", + npm_package = "angular/packages/upgrade/npm_package", ) diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 728bdda096..61b816e527 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -12,7 +12,7 @@ load("@npm//typescript:index.bzl", "tsc") 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("//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" _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) native.filegroup(name = name + ".min.es5umd.js", testonly = testonly, srcs = [name + ".min.es5umd"]) -def ts_api_guardian_test(**kwargs): - _ts_api_guardian_test( +def api_golden_test(**kwargs): + _api_golden_test( tags = [ "fixme-ivy-aot", ], **kwargs ) -def ts_api_guardian_test_npm_package(**kwargs): - _ts_api_guardian_test_npm_package( +def api_golden_test_npm_package(**kwargs): + _api_golden_test_npm_package( tags = [ "fixme-ivy-aot", ],