build: provide full paths to `ts_api_guardian_test_npm_package` and `ts_api_guardian_test` (#36034)

ts-api-guardian uses `require.resolve` to resolve the actual and golden files under bazel. In Windows for these files to be resolved correct the full path including the workspace name as per the MANIFEST entries is required.

This used to be the case until the recent changes done to use npm_integration tests

83c74ceacf/tools/public_api_guard/public_api_guard.bzl (L19)
83c74ceacf/tools/public_api_guard/public_api_guard.bzl (L28)

```
bazel test //packages/... --test_tag_filters=api_guard

//packages/animations:animations_api                            (cached) PASSED in 18.4s
//packages/common:common_api                                    (cached) PASSED in 25.5s
//packages/compiler-cli:compiler_options_api                    (cached) PASSED in 12.4s
//packages/compiler-cli:error_code_api                          (cached) PASSED in 11.6s
//packages/core:core_api                                        (cached) PASSED in 20.6s
//packages/core:ng_global_utils_api                             (cached) PASSED in 13.5s
//packages/elements:elements_api                                (cached) PASSED in 11.9s
//packages/forms:forms_api                                      (cached) PASSED in 13.9s
//packages/http:http_api                                        (cached) PASSED in 14.8s
//packages/localize:localize_api                                (cached) PASSED in 6.3s
//packages/platform-browser:platform-browser_api                (cached) PASSED in 18.1s
//packages/platform-browser-dynamic:platform-browser-dynamic_api (cached) PASSED in 14.0s
//packages/platform-server:platform-server_api                  (cached) PASSED in 13.9s
//packages/platform-webworker:platform-webworker_api            (cached) PASSED in 13.7s
//packages/platform-webworker-dynamic:platform-webworker-dynamic_api (cached) PASSED in 11.7s
//packages/router:router_api                                    (cached) PASSED in 19.9s
//packages/service-worker:service-worker_api                    (cached) PASSED in 18.1s
//packages/upgrade:upgrade_api                                  (cached) PASSED in 13.5s
```

Reference: DEV-71

PR Close #36034
This commit is contained in:
Alan Agius 2020-03-12 12:36:28 +01:00 committed by Andrew Kushnir
parent 43635a6c54
commit 2e493edf80
17 changed files with 38 additions and 38 deletions

View File

@ -42,10 +42,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "animations_api",
actualDir = "packages/animations/npm_package",
actualDir = "angular/packages/animations/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/animations",
goldenDir = "angular/goldens/public-api/animations",
)

View File

@ -54,10 +54,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "common_api",
actualDir = "packages/common/npm_package",
actualDir = "angular/packages/common/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/common",
goldenDir = "angular/goldens/public-api/common",
)

View File

@ -62,20 +62,20 @@ pkg_npm(
ts_api_guardian_test(
name = "error_code_api",
actual = "packages/compiler-cli/npm_package/src/ngtsc/diagnostics/src/error_code.d.ts",
actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/diagnostics/src/error_code.d.ts",
data = [
":npm_package",
"//goldens:public-api",
],
golden = "goldens/public-api/compiler-cli/error_code.d.ts",
golden = "angular/goldens/public-api/compiler-cli/error_code.d.ts",
)
ts_api_guardian_test(
name = "compiler_options_api",
actual = "packages/compiler-cli/npm_package/src/ngtsc/core/api/src/public_options.d.ts",
actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/core/api/src/public_options.d.ts",
data = [
":npm_package",
"//goldens:public-api",
],
golden = "goldens/public-api/compiler-cli/compiler_options.d.ts",
golden = "angular/goldens/public-api/compiler-cli/compiler_options.d.ts",
)

View File

@ -57,20 +57,20 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "core_api",
actualDir = "packages/core/npm_package",
actualDir = "angular/packages/core/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/core",
goldenDir = "angular/goldens/public-api/core",
)
ts_api_guardian_test(
name = "ng_global_utils_api",
actual = "packages/core/src/render3/global_utils_api.d.ts",
actual = "angular/packages/core/src/render3/global_utils_api.d.ts",
data = [
"//goldens:public-api",
"//packages/core",
],
golden = "goldens/public-api/core/global_utils.d.ts",
golden = "angular/goldens/public-api/core/global_utils.d.ts",
)

View File

@ -40,10 +40,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "elements_api",
actualDir = "packages/elements/npm_package",
actualDir = "angular/packages/elements/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/elements",
goldenDir = "angular/goldens/public-api/elements",
)

View File

@ -40,10 +40,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "forms_api",
actualDir = "packages/forms/npm_package",
actualDir = "angular/packages/forms/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/forms",
goldenDir = "angular/goldens/public-api/forms",
)

View File

@ -45,10 +45,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "http_api",
actualDir = "packages/http/npm_package",
actualDir = "angular/packages/http/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/http",
goldenDir = "angular/goldens/public-api/http",
)

View File

@ -39,10 +39,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "localize_api",
actualDir = "packages/localize/npm_package",
actualDir = "angular/packages/localize/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/localize",
goldenDir = "angular/goldens/public-api/localize",
)

View File

@ -43,10 +43,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "platform-browser-dynamic_api",
actualDir = "packages/platform-browser-dynamic/npm_package",
actualDir = "angular/packages/platform-browser-dynamic/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/platform-browser-dynamic",
goldenDir = "angular/goldens/public-api/platform-browser-dynamic",
)

View File

@ -46,10 +46,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "platform-browser_api",
actualDir = "packages/platform-browser/npm_package",
actualDir = "angular/packages/platform-browser/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/platform-browser",
goldenDir = "angular/goldens/public-api/platform-browser",
)

View File

@ -49,10 +49,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "platform-server_api",
actualDir = "packages/platform-server/npm_package",
actualDir = "angular/packages/platform-server/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/platform-server",
goldenDir = "angular/goldens/public-api/platform-server",
)

View File

@ -34,10 +34,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "platform-webworker-dynamic_api",
actualDir = "packages/platform-webworker-dynamic/npm_package",
actualDir = "angular/packages/platform-webworker-dynamic/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/platform-webworker-dynamic",
goldenDir = "angular/goldens/public-api/platform-webworker-dynamic",
)

View File

@ -40,10 +40,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "platform-webworker_api",
actualDir = "packages/platform-webworker/npm_package",
actualDir = "angular/packages/platform-webworker/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/platform-webworker",
goldenDir = "angular/goldens/public-api/platform-webworker",
)

View File

@ -46,10 +46,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "router_api",
actualDir = "packages/router/npm_package",
actualDir = "angular/packages/router/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/router",
goldenDir = "angular/goldens/public-api/router",
)

View File

@ -61,10 +61,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "service-worker_api",
actualDir = "packages/service-worker/npm_package",
actualDir = "angular/packages/service-worker/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/service-worker",
goldenDir = "angular/goldens/public-api/service-worker",
)

View File

@ -41,10 +41,10 @@ ng_package(
ts_api_guardian_test_npm_package(
name = "upgrade_api",
actualDir = "packages/upgrade/npm_package",
actualDir = "angular/packages/upgrade/npm_package",
data = [
":npm_package",
"//goldens:public-api",
],
goldenDir = "goldens/public-api/upgrade",
goldenDir = "angular/goldens/public-api/upgrade",
)

View File

@ -123,7 +123,7 @@ def ts_api_guardian_test_npm_package(
data = data,
entry_point = "@angular//tools/ts-api-guardian:bin/ts-api-guardian",
tags = kwargs.pop("tags", []) + ["api_guard"],
templated_args = args + ["--autoDiscoverEntrypoints", "--verifyDir", goldenDir, "--rootDir", actualDir],
templated_args = args + ["--autoDiscoverEntrypoints", "--verifyDir", goldenDir, "--rootDir", "$(rlocation %s)" % actualDir],
**kwargs
)
@ -133,6 +133,6 @@ def ts_api_guardian_test_npm_package(
data = data,
entry_point = "@angular//tools/ts-api-guardian:bin/ts-api-guardian",
tags = kwargs.pop("tags", []) + ["api_guard"],
templated_args = args + ["--autoDiscoverEntrypoints", "--outDir", goldenDir, "--rootDir", actualDir],
templated_args = args + ["--autoDiscoverEntrypoints", "--outDir", goldenDir, "--rootDir", "$(rlocation %s)" % actualDir],
**kwargs
)