Skip to content

Commit

Permalink
build: add target to generate api manifest (angular#52472)
Browse files Browse the repository at this point in the history
This adds a target to generate a manifest of all public api symbols. The majority of inputs are generated from the extraction rules, but API entries that don't have a TypeScript source symbol (elements and blocks) are defined in hand-written json collections.

PR Close angular#52472
  • Loading branch information
jelbourn authored and alxhub committed Nov 2, 2023
1 parent 91ee269 commit a3abe16
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 148 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ yarn_install(
"//:.yarnrc",
"//:tools/npm-patches/@bazel+jasmine+5.8.1.patch",
"//tools:postinstall-patches.js",
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-680aab4562e5bb684518ca496cb449a6c447601d.patch",
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-b2cec2dcba358f9dc7111800a3d65738f57abe8f.patch",
"//tools/esm-interop:patches/npm/@bazel+concatjs+5.8.1.patch",
"//tools/esm-interop:patches/npm/@bazel+esbuild+5.7.1.patch",
"//tools/esm-interop:patches/npm/@bazel+protractor+5.7.1.patch",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"// 2": "devDependencies are not used under Bazel. Many can be removed after test.sh is deleted.",
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#8fa10a4dc43b9780f09c99f11d805e733107ed70",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#cf8da67c048dde33354eb64e18b60eced1f62ea6",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#c773500c56bada879d4a5a4169a04bdb039262d1",
"@babel/helper-remap-async-to-generator": "^7.18.9",
"@babel/plugin-proposal-async-generator-functions": "^7.20.7",
Expand Down
35 changes: 35 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("//tools:defaults.bzl", "ts_config", "ts_library")
load("//:packages.bzl", "DOCS_ENTRYPOINTS")
load("@npm//@angular/build-tooling/bazel/api-gen/manifest:generate_api_manifest.bzl", "generate_api_manifest")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -43,3 +44,37 @@ filegroup(
name = "files_for_docgen",
srcs = ["//packages/%s:files_for_docgen" % entrypoint for entrypoint in DOCS_ENTRYPOINTS],
)

generate_api_manifest(
name = "docs_api_manifest",
srcs = [
"//packages/animations:animations_docs_extraction",
"//packages/animations/browser:animations_browser_docs_extraction",
"//packages/animations/browser/testing:animations_browser_testing_docs_extraction",
"//packages/common:common_docs_extraction",
"//packages/common/http:http_docs_extraction",
"//packages/common/testing:common_testing_docs_extraction",
"//packages/common/upgrade:common_upgrade_docs_extraction",
"//packages/core:core_docs_extraction",
"//packages/core/reference-manifests",
"//packages/core/rxjs-interop:core_rxjs-interop_docs_extraction",
"//packages/core/testing:core_testing_docs_extraction",
"//packages/elements:elements_docs_extraction",
"//packages/forms:forms_docs_extraction",
"//packages/localize:localize_docs_extraction",
"//packages/platform-browser:platform-browser_docs_extraction",
"//packages/platform-browser-dynamic:platform-browser_dynamic_docs_extraction",
"//packages/platform-browser-dynamic/testing:platform-browser_dynamic_testing_docs_extraction",
"//packages/platform-browser/animations:platform-browser_animations_docs_extraction",
"//packages/platform-browser/testing:platform-browser_testing_docs_extraction",
"//packages/platform-server:platform-server_docs_extraction",
"//packages/platform-server/testing:platform-server_testing_docs_extraction",
"//packages/router:router_docs_extraction",
"//packages/router/testing:router_testing_docs_extraction",
"//packages/router/upgrade:router_upgrade_docs_extraction",
"//packages/service-worker:service-worker_docs_extraction",
"//packages/upgrade:upgrade_docs_extraction",
"//packages/upgrade/static:upgrade_static_docs_extraction",
"//packages/upgrade/static/testing:upgrade_static_testing_docs_extraction",
],
)
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/docs/src/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/** Type of top-level documentation entry. */
export enum EntryType {
Block = 'Block',
Block = 'block',
Component = 'component',
Constant = 'constant',
Decorator = 'decorator',
Expand Down
5 changes: 5 additions & 0 deletions packages/core/reference-manifests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "reference-manifests",
srcs = glob(["*.json"]),
visibility = ["//visibility:public"],
)
4 changes: 4 additions & 0 deletions packages/core/reference-manifests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Manual API manifests

This directory contains handwritten JSON entries that are aggregated into Angular's
API documentation manifest.
25 changes: 25 additions & 0 deletions packages/core/reference-manifests/block-api-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"moduleName": "@angular/core",
"entries": [
{
"name": "@if",
"entryType": "block",
"jsdocTags": []
},
{
"name": "@for",
"entryType": "block",
"jsdocTags": []
},
{
"name": "@switch",
"entryType": "block",
"jsdocTags": []
},
{
"name": "@defer",
"entryType": "block",
"jsdocTags": []
}
]
}
20 changes: 20 additions & 0 deletions packages/core/reference-manifests/element-api-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"moduleName": "@angular/core",
"entries": [
{
"name": "ng-content",
"entryType": "element",
"jsdocTags": []
},
{
"name": "ng-template",
"entryType": "element",
"jsdocTags": []
},
{
"name": "ng-container",
"entryType": "element",
"jsdocTags": []
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,37 @@ index afe4e5c..095a8f0 100755
- "@npm//@angular/compiler",
- "@npm//@angular/compiler-cli",
+ "@angular//packages/compiler",
+ "@angular//packages/compiler-cli",
],
entry_point = "bin.mjs",
# Note: Using the linker here as we need it for ESM. The linker is not
diff --git a/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel b/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel
index 26563a7..f7bc080 100755
--- a/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel
+++ b/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel
@@ -15,7 +15,7 @@ esbuild_esm_bundle(
target = "es2022",
deps = [
":generate_api_manifest_lib",
- "@npm//@angular/compiler-cli",
+ "@angular//packages/compiler-cli",
],
)

@@ -25,7 +25,7 @@ ts_library(
devmode_module = "commonjs",
tsconfig = "@npm//@angular/build-tooling:tsconfig.json",
deps = [
- "@npm//@angular/compiler-cli",
+ "@angular//packages/compiler-cli",
"@npm//@bazel/runfiles",
"@npm//@types/node",
],
@@ -36,7 +36,7 @@ nodejs_binary(
name = "generate_api_manifest",
data = [
":bin",
- "@npm//@angular/compiler-cli",
+ "@angular//packages/compiler-cli",
],
entry_point = "bin.mjs",
Expand Down
Loading

0 comments on commit a3abe16

Please sign in to comment.