Skip to content

Commit 6b3f87e

Browse files
devversionmmalerba
authored andcommitted
build: generate api docs for all tertiary entry-points (#17293)
Updates our Dgeni setup to generate API docs for all entry-points which are configured in the `cdk/config.bzl` or `material/config.bzl` file. This basically means that we now generate API docs for `material/*/testing` entry-points and for `cdk/testing/*`. Removes the code that made `cdk/testing` a separate sub package. This involves more code than just treating it as "real" entry-point (for which we generate bundles etc.).
1 parent 711a33e commit 6b3f87e

File tree

30 files changed

+238
-97
lines changed

30 files changed

+238
-97
lines changed

src/BUILD.bazel

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ package(default_visibility = ["//visibility:public"])
22

33
load("@npm_bazel_typescript//:index.bzl", "ts_config")
44
load("//src/cdk:config.bzl", "CDK_ENTRYPOINTS")
5-
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS")
5+
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS", "MATERIAL_TESTING_ENTRYPOINTS")
66
load("//tools:defaults.bzl", "ts_library")
77
load("//tools/dgeni:index.bzl", "dgeni_api_docs")
88

9+
cdkApiEntryPoints = CDK_ENTRYPOINTS
10+
11+
materialApiEntryPoints = MATERIAL_ENTRYPOINTS + MATERIAL_TESTING_ENTRYPOINTS
12+
913
# List that contains all source files that need to be processed by Dgeni.
10-
apiSourceFiles = ["//src/cdk/%s:source-files" % name for name in CDK_ENTRYPOINTS] + [
11-
"//src/material/%s:source-files" % name
12-
for name in MATERIAL_ENTRYPOINTS
13-
]
14+
apiSourceFiles = ["//src/cdk/%s:source-files" % name for name in cdkApiEntryPoints] + \
15+
["//src/material/%s:source-files" % name for name in materialApiEntryPoints]
1416

1517
exports_files([
1618
"bazel-tsconfig-build.json",
@@ -42,8 +44,8 @@ dgeni_api_docs(
4244
"@npm//@angular/platform-browser",
4345
],
4446
entry_points = {
45-
"cdk": CDK_ENTRYPOINTS,
46-
"material": MATERIAL_ENTRYPOINTS,
47+
"cdk": cdkApiEntryPoints,
48+
"material": materialApiEntryPoints,
4749
},
4850
tags = ["docs-package"],
4951
)

src/cdk/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ ng_package(
5757
entry_point = ":public-api.ts",
5858
packages = [
5959
"//src/cdk/schematics:npm_package",
60-
"//src/cdk/testing:npm_package",
6160
],
6261
tags = ["release-package"],
6362
deps = CDK_TARGETS,
6463
)
6564

6665
filegroup(
6766
name = "overviews",
68-
srcs = ["//src/cdk/%s:overview" % name for name in CDK_ENTRYPOINTS],
67+
# Only secondary entry-points declare overview files currently. Entry-points
68+
# which contain a slash are not in the top-level and do not have an overview.
69+
srcs = ["//src/cdk/%s:overview" % ep for ep in CDK_ENTRYPOINTS if not "/" in ep],
6970
)

src/cdk/config.bzl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ CDK_ENTRYPOINTS = [
1818
"text-field",
1919
"tree",
2020
"testing",
21+
"testing/protractor",
22+
"testing/testbed",
2123
]
2224

23-
# List of all entry-point targets of the Angular Material package. Note that
24-
# we do not want to include "testing" here as it will be treated as a standalone
25-
# sub-package of the "ng_package".
26-
CDK_TARGETS = ["//src/cdk"] + \
27-
["//src/cdk/%s" % ep for ep in CDK_ENTRYPOINTS if not ep == "testing"]
25+
# List of all entry-point targets of the Angular Material package.
26+
CDK_TARGETS = ["//src/cdk"] + ["//src/cdk/%s" % ep for ep in CDK_ENTRYPOINTS]
2827

2928
# Within the CDK, only a few targets have sass libraries which need to be
3029
# part of the release package. This list declares all CDK targets with sass

src/cdk/testing/BUILD.bazel

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
43
load("//src/e2e-app:test_suite.bzl", "e2e_test_suite")
54
load("//tools:defaults.bzl", "markdown_to_html", "ng_web_test_suite", "ts_library")
65

@@ -15,15 +14,6 @@ ts_library(
1514
module_name = "@angular/cdk/testing",
1615
)
1716

18-
npm_package(
19-
name = "npm_package",
20-
deps = [
21-
":testing",
22-
"//src/cdk/testing/protractor",
23-
"//src/cdk/testing/testbed",
24-
],
25-
)
26-
2717
markdown_to_html(
2818
name = "overview",
2919
srcs = ["testing.md"],

src/cdk/testing/protractor/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ ts_library(
1414
"@npm//protractor",
1515
],
1616
)
17+
18+
filegroup(
19+
name = "source-files",
20+
srcs = glob(["**/*.ts"]),
21+
)

src/cdk/testing/testbed/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ ts_library(
1515
"@npm//@angular/core",
1616
],
1717
)
18+
19+
filegroup(
20+
name = "source-files",
21+
srcs = glob(["**/*.ts"]),
22+
)

src/material/autocomplete/testing/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ ts_library(
1515
],
1616
)
1717

18+
filegroup(
19+
name = "source-files",
20+
srcs = glob(["**/*.ts"]),
21+
)
22+
1823
ng_test_library(
1924
name = "harness_tests_lib",
2025
srcs = ["shared.spec.ts"],

src/material/button/testing/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ ts_library(
1515
],
1616
)
1717

18+
filegroup(
19+
name = "source-files",
20+
srcs = glob(["**/*.ts"]),
21+
)
22+
1823
ng_test_library(
1924
name = "harness_tests_lib",
2025
srcs = ["shared.spec.ts"],

src/material/checkbox/testing/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ ts_library(
1515
],
1616
)
1717

18+
filegroup(
19+
name = "source-files",
20+
srcs = glob(["**/*.ts"]),
21+
)
22+
1823
ng_test_library(
1924
name = "harness_tests_lib",
2025
srcs = ["shared.spec.ts"],

src/material/dialog/testing/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ ts_library(
1616
],
1717
)
1818

19+
filegroup(
20+
name = "source-files",
21+
srcs = glob(["**/*.ts"]),
22+
)
23+
1924
ng_test_library(
2025
name = "harness_tests_lib",
2126
srcs = ["shared.spec.ts"],

0 commit comments

Comments
 (0)