Skip to content

Commit e05a966

Browse files
devversionjelbourn
authored andcommitted
build: fix docs-content release output (#17125)
* build: add workaround for invalid imports generation in bazel Applies a workaround for the invalid imports generation issue in the Bazel `ng_module` rule. Read more about this here: https://hackmd.io/@devversion/ryCOwIKIS. * build: fix missing metadata for example modules Fixes the missing metadata for example modules. This happens because we built the individual example modules without a flat module bundle. Not building with a flat module bundle means that metadata will not be generated in the `ng_module` bazel rule. * build: workaround for creating ng_package on windows Workaround for angular/angular#32603 * build: fix invalid rollup globals for material experimental package * build: do not generate flat module bundles for testonly targets This is necessary as `ng_module` rules with a `module_name` either need a `public-api.ts` or `module.ts` file. * build: fix npm package for google-maps Apparently the `google-maps` package has the same problem as the `material-examples` package where the metadata for the Bazel sub-packages is not incldued in the entry-point of the `@angular/google-maps` entry-point. There are two solutions to make it work with Angular package format: * Making the packages generate flat module bundles and including them as secondary entry-points * Only having one Bazel package so that metadata will be included in the flat module bundle. I chose the latter as the `google-maps` package is still very small and doesn't have a lot of dependencies, so in terms of speed it is even faster to have on package. Also it seems like there were never plans to have secondary entry-points for that package. *Note*: we need this commit as part of the docs-content fix because the google-maps package runs on CI and will fail as it misses various `public-api.ts` files for the flat module bundles. * chore: fix various examples missing button module Looks like a few examples were missing the `MatButtonModule` after the restructuring of the examples. I've noticed these while manually testing the Bazel release output in the docs app. * build: do not build examples package through gulp We no longer can build the examples package through gulp. This is because we did not add individual `tsconfig-build.json` files to the nested entry-points when we did the restructuring of the examples. This now breaks as the primary entry-point uses module name imports as of the docs-content metadata fix. It's okay to not build the examples package through gulp in the `8.2.x` branch as we don't need it in the gulp setup anyway.
1 parent 9e8e4e6 commit e05a966

File tree

111 files changed

+663
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+663
-135
lines changed

WORKSPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ yarn_install(
4242
# are executed in the Bazel sandbox.
4343
data = [
4444
"//:angular-tsconfig.json",
45+
"//:tools/bazel/flat_module_factory_resolution.patch",
4546
"//:tools/bazel/postinstall-patches.js",
47+
"//:tools/bazel/rollup_windows_arguments.patch",
4648
"//:tools/npm/check-npm.js",
4749
],
4850
package_json = "//:package.json",

packages.bzl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,26 @@ ROLLUP_GLOBALS.update({
145145
for p in MATERIAL_PACKAGES
146146
})
147147

148-
# Rollup globals for material experiemental subpackages, e.g., {"@angular/material-experimental/list": "ng.materialExperimental.list"}
148+
# Rollup globals for material experimental subpackages, e.g.,
149+
# {"@angular/material-experimental/list": "ng.materialExperimental.list"}
149150
ROLLUP_GLOBALS.update({
150-
"@angular/material-experiemntal/%s" % p: "ng.materialExperimental.%s" % p
151+
"@angular/material-experimental/%s" % p: "ng.materialExperimental.%s" % p
151152
for p in MATERIAL_EXPERIMENTAL_PACKAGES
152153
})
153154

154-
# UMD bundles for Angular packages and subpackges we depend on for development and testing.
155+
# Rollup globals the examples package. Since individual examples are
156+
# grouped by package and component, the primary entry-point imports
157+
# from entry-points which should be treated as external imports.
158+
ROLLUP_GLOBALS.update({
159+
"@angular/material-examples/cdk/%s" % p: "ng.materialExamples.cdk.%s" % p
160+
for p in CDK_PACKAGES + CDK_EXPERIMENTAL_PACKAGES
161+
})
162+
ROLLUP_GLOBALS.update({
163+
"@angular/material-examples/material/%s" % p: "ng.materialExamples.material.%s" % p
164+
for p in MATERIAL_PACKAGES + MATERIAL_EXPERIMENTAL_PACKAGES
165+
})
166+
167+
# UMD bundles for Angular packages and subpackages we depend on for development and testing.
155168
ANGULAR_LIBRARY_UMDS = [
156169
"@npm//:node_modules/@angular/animations/bundles/animations-browser.umd.js",
157170
"@npm//:node_modules/@angular/animations/bundles/animations.umd.js",

src/cdk-experimental/testing/tests/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ load("//tools:defaults.bzl", "ng_e2e_test_library", "ng_module", "ng_test_librar
44

55
ng_module(
66
name = "test_components",
7+
testonly = True,
78
srcs = glob(
89
["**/*.ts"],
910
exclude = [
@@ -12,7 +13,6 @@ ng_module(
1213
],
1314
),
1415
assets = glob(["**/*.html"]),
15-
module_name = "@angular/cdk-experimental/testing/tests",
1616
deps = [
1717
"//src/cdk/keycodes",
1818
"@npm//@angular/forms",

src/e2e-app/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exports_files([
1313

1414
ng_module(
1515
name = "e2e-app",
16+
testonly = True,
1617
srcs = glob(
1718
["**/*.ts"],
1819
exclude = ["test-util/**"],
@@ -87,6 +88,7 @@ sass_binary(
8788

8889
ts_devserver(
8990
name = "devserver",
91+
testonly = True,
9092
# Root paths can be used simplify the loading of files from external Bazel repositories
9193
# (such as the Bazel managed deps repository called "npm")
9294
additional_root_paths = [

src/e2e-app/component-harness/component-harness-e2e-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {TestComponentsModule} from '@angular/cdk-experimental/testing/tests';
8+
import {TestComponentsModule} from '../../cdk-experimental/testing/tests';
99
import {CommonModule} from '@angular/common';
1010
import {NgModule} from '@angular/core';
1111
import {FormsModule} from '@angular/forms';

src/google-maps/BUILD.bazel

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package(default_visibility = ["//visibility:public"])
22

33
load("//:packages.bzl", "ROLLUP_GLOBALS")
4-
load("//tools:defaults.bzl", "ng_module", "ng_package")
4+
load("//tools:defaults.bzl", "ng_module", "ng_package", "ng_test_library", "ng_web_test_suite")
55

66
ng_module(
77
name = "google-maps",
88
srcs = glob(
9-
["*.ts"],
9+
["**/*.ts"],
1010
exclude = ["**/*.spec.ts"],
1111
),
1212
module_name = "@angular/google-maps",
1313
deps = [
14-
"//src/google-maps/google-map",
15-
"//src/google-maps/map-marker",
1614
"@npm//@angular/core",
1715
"@npm//@types/googlemaps",
1816
],
@@ -32,3 +30,21 @@ filegroup(
3230
name = "source-files",
3331
srcs = glob(["**/*.ts"]),
3432
)
33+
34+
ng_test_library(
35+
name = "unit_test_sources",
36+
srcs = glob(
37+
["**/*.spec.ts"],
38+
exclude = ["**/*.e2e.spec.ts"],
39+
),
40+
deps = [
41+
":google-maps",
42+
"//src/google-maps/testing",
43+
"@npm//@angular/platform-browser",
44+
],
45+
)
46+
47+
ng_web_test_suite(
48+
name = "unit_tests",
49+
deps = [":unit_test_sources"],
50+
)

src/google-maps/google-map/BUILD.bazel

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/google-maps/map-marker/BUILD.bazel

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/google-maps/testing/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ts_library(
77
testonly = 1,
88
srcs = glob(["**/*.ts"]),
99
deps = [
10-
"//src/google-maps/google-map",
10+
"//src/google-maps",
1111
"@npm//@types/googlemaps",
1212
"@npm//@types/jasmine",
1313
],

src/material-examples/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ ng_package(
107107
entry_point = ":public-api.ts",
108108
globals = ROLLUP_GLOBALS,
109109
tags = ["docs-package"],
110-
deps = [":examples"],
110+
deps = [":examples"] + EXAMPLE_PACKAGES,
111111
)
112112

113113
genrule(

src/material-examples/cdk/a11y/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12+
module_name = "@angular/material-examples/cdk/a11y",
1213
deps = [
1314
"//src/cdk/a11y",
1415
"//src/material/select",

src/material-examples/cdk/a11y/module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
} from './focus-monitor-focus-via/focus-monitor-focus-via-example';
1010
import {FocusMonitorOverviewExample} from './focus-monitor-overview/focus-monitor-overview-example';
1111

12+
export {FocusMonitorDirectivesExample, FocusMonitorFocusViaExample, FocusMonitorOverviewExample};
13+
1214
const EXAMPLES = [
1315
FocusMonitorDirectivesExample,
1416
FocusMonitorFocusViaExample,
@@ -25,3 +27,4 @@ const EXAMPLES = [
2527
})
2628
export class CdkA11yExamplesModule {
2729
}
30+

src/material-examples/cdk/drag-drop/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12+
module_name = "@angular/material-examples/cdk/drag-drop",
1213
deps = [
1314
"//src/cdk/drag-drop",
1415
"//src/cdk/overlay",

src/material-examples/cdk/drag-drop/module.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@ import {
3939
} from './cdk-drag-drop-root-element/cdk-drag-drop-root-element-example';
4040
import {CdkDragDropSortingExample} from './cdk-drag-drop-sorting/cdk-drag-drop-sorting-example';
4141

42+
export {
43+
CdkDragDropAxisLockExample,
44+
CdkDragDropBoundaryExample,
45+
CdkDragDropConnectedSortingExample,
46+
CdkDragDropConnectedSortingGroupExample,
47+
CdkDragDropCustomPlaceholderExample,
48+
CdkDragDropCustomPreviewExample,
49+
CdkDragDropDelayExample,
50+
CdkDragDropDisabledExample,
51+
CdkDragDropDisabledSortingExample,
52+
CdkDragDropEnterPredicateExample,
53+
CdkDragDropFreeDragPositionExample,
54+
CdkDragDropHandleExample,
55+
CdkDragDropHorizontalSortingExample,
56+
CdkDragDropOverviewExample,
57+
CdkDragDropRootElementExample,
58+
CdkDragDropSortingExample,
59+
};
60+
4261
const EXAMPLES = [
4362
CdkDragDropAxisLockExample,
4463
CdkDragDropBoundaryExample,

src/material-examples/cdk/platform/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12+
module_name = "@angular/material-examples/cdk/platform",
1213
deps = [
1314
"//src/cdk/platform",
1415
],

src/material-examples/cdk/platform/module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import {PlatformModule} from '@angular/cdk/platform';
22
import {NgModule} from '@angular/core';
33
import {CdkPlatformOverviewExample} from './cdk-platform-overview/cdk-platform-overview-example';
44

5+
export {CdkPlatformOverviewExample};
6+
57
const EXAMPLES = [CdkPlatformOverviewExample];
68

79
@NgModule({

src/material-examples/cdk/popover-edit/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12+
module_name = "@angular/material-examples/cdk/popover-edit",
1213
deps = [
1314
"//src/cdk-experimental/popover-edit",
1415
"//src/cdk/collections",

src/material-examples/cdk/popover-edit/module.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@ import {CdkTableModule} from '@angular/cdk/table';
33
import {CommonModule} from '@angular/common';
44
import {NgModule} from '@angular/core';
55
import {FormsModule} from '@angular/forms';
6-
import {
7-
CdkPopoverEditCdkTableFlexExample
8-
} from './cdk-popover-edit-cdk-table-flex/cdk-popover-edit-cdk-table-flex-example';
9-
import {
10-
CdkPopoverEditCdkTableExample
11-
} from './cdk-popover-edit-cdk-table/cdk-popover-edit-cdk-table-example';
12-
import {
13-
CdkPopoverEditCellSpanVanillaTableExample
14-
} from
15-
'./cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example';
16-
import {
17-
CdkPopoverEditTabOutVanillaTableExample
18-
} from './cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example';
19-
import {
6+
import {CdkPopoverEditCdkTableFlexExample} from './cdk-popover-edit-cdk-table-flex/cdk-popover-edit-cdk-table-flex-example';
7+
import {CdkPopoverEditCdkTableExample} from './cdk-popover-edit-cdk-table/cdk-popover-edit-cdk-table-example';
8+
import {CdkPopoverEditCellSpanVanillaTableExample} from './cdk-popover-edit-cell-span-vanilla-table/cdk-popover-edit-cell-span-vanilla-table-example';
9+
import {CdkPopoverEditTabOutVanillaTableExample} from './cdk-popover-edit-tab-out-vanilla-table/cdk-popover-edit-tab-out-vanilla-table-example';
10+
import {CdkPopoverEditVanillaTableExample} from './cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example';
11+
12+
export {
13+
CdkPopoverEditCdkTableFlexExample,
14+
CdkPopoverEditCdkTableExample,
15+
CdkPopoverEditCellSpanVanillaTableExample,
16+
CdkPopoverEditTabOutVanillaTableExample,
2017
CdkPopoverEditVanillaTableExample
21-
} from './cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example';
18+
};
2219

2320
const EXAMPLES = [
2421
CdkPopoverEditCdkTableExample,

src/material-examples/cdk/portal/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12+
module_name = "@angular/material-examples/cdk/portal",
1213
deps = [
1314
"//src/cdk/portal",
1415
],

src/material-examples/cdk/portal/module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
ComponentPortalExample
66
} from './cdk-portal-overview/cdk-portal-overview-example';
77

8+
export {CdkPortalOverviewExample, ComponentPortalExample};
9+
810
const EXAMPLES = [
911
CdkPortalOverviewExample,
1012
ComponentPortalExample,

src/material-examples/cdk/scrolling/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12+
module_name = "@angular/material-examples/cdk/scrolling",
1213
deps = [
1314
"//src/cdk/scrolling",
1415
],

src/material-examples/cdk/scrolling/module.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ import {
2323
CdkVirtualScrollTemplateCacheExample
2424
} from './cdk-virtual-scroll-template-cache/cdk-virtual-scroll-template-cache-example';
2525

26+
export {
27+
CdkVirtualScrollContextExample,
28+
CdkVirtualScrollCustomStrategyExample,
29+
CdkVirtualScrollDataSourceExample,
30+
CdkVirtualScrollDlExample,
31+
CdkVirtualScrollFixedBufferExample,
32+
CdkVirtualScrollHorizontalExample,
33+
CdkVirtualScrollOverviewExample,
34+
CdkVirtualScrollTemplateCacheExample,
35+
};
36+
2637
const EXAMPLES = [
2738
CdkVirtualScrollContextExample,
2839
CdkVirtualScrollCustomStrategyExample,

0 commit comments

Comments
 (0)