Skip to content

Commit d3a9a20

Browse files
devversionjelbourn
authored andcommitted
build: group examples by package and entry-point name (angular#16822)
Groups the examples by package and entry-point name. This allows us have a bazel build target for each group and also allows us to separate MDC prototypes from standard implementations.
1 parent c791926 commit d3a9a20

File tree

776 files changed

+3023
-262
lines changed

Some content is hidden

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

776 files changed

+3023
-262
lines changed

.circleci/bazel.rc

+8
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ common --announce_rc
99
# Save downloaded repositories in a location that can be cached by CircleCI. This helps us
1010
# speeding up the analysis time significantly with Bazel managed node dependencies on the CI.
1111
build --repository_cache=/home/circleci/bazel_repository_cache
12+
13+
# Workaround https://github.com/bazelbuild/bazel/issues/3645. Bazel doesn't calculate the
14+
# memory ceiling correctly when running under Docker. Limit Bazel to consuming resources that
15+
# fit in CircleCI "xlarge" class. https://circleci.com/docs/2.0/configuration-reference/#resource_class
16+
# Note that we use less than the available RAM as bazel only estimates memory for actions
17+
# and we don't want to accidentally run out of memory.
18+
build --local_ram_resources=14336
19+
build --local_cpu_resources=8

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
- *yarn_install
152152
- *setup_bazel_binary
153153

154-
- run: bazel build src/... --build_tag_filters=-docs-package
154+
- run: bazel build src/...
155155

156156
# --------------------------------------------------------------------------------------------
157157
# Job that runs ts-api-guardian against our API goldens in "tools/public_api_guard".

src/material-examples/BUILD.bazel

+54-21
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,72 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("//:packages.bzl", "CDK_EXPERIMENTAL_TARGETS", "CDK_TARGETS", "MATERIAL_EXPERIMENTAL_TARGETS", "MATERIAL_PACKAGES", "ROLLUP_GLOBALS")
3+
load("//:packages.bzl", "ROLLUP_GLOBALS")
44
load("//tools:defaults.bzl", "ng_module", "ng_package")
55
load("//tools/highlight-files:index.bzl", "highlight_files")
66
load("//tools/package-docs-content:index.bzl", "package_docs_content")
77

8+
EXAMPLE_PACKAGES = [
9+
# TODO(devversion): try to have for each entry-point a bazel package so that
10+
# we can automate this using the "package.bzl" variables.
11+
"//src/material-examples/cdk/a11y",
12+
"//src/material-examples/cdk/drag-drop",
13+
"//src/material-examples/cdk/platform",
14+
"//src/material-examples/cdk/popover-edit",
15+
"//src/material-examples/cdk/portal",
16+
"//src/material-examples/cdk/scrolling",
17+
"//src/material-examples/cdk/stepper",
18+
"//src/material-examples/cdk/table",
19+
"//src/material-examples/cdk/text-field",
20+
"//src/material-examples/cdk/tree",
21+
"//src/material-examples/material/autocomplete",
22+
"//src/material-examples/material/badge",
23+
"//src/material-examples/material/bottom-sheet",
24+
"//src/material-examples/material/button",
25+
"//src/material-examples/material/button-toggle",
26+
"//src/material-examples/material/card",
27+
"//src/material-examples/material/checkbox",
28+
"//src/material-examples/material/chips",
29+
"//src/material-examples/material/core",
30+
"//src/material-examples/material/datepicker",
31+
"//src/material-examples/material/dialog",
32+
"//src/material-examples/material/divider",
33+
"//src/material-examples/material/expansion",
34+
"//src/material-examples/material/form-field",
35+
"//src/material-examples/material/grid-list",
36+
"//src/material-examples/material/icon",
37+
"//src/material-examples/material/input",
38+
"//src/material-examples/material/list",
39+
"//src/material-examples/material/menu",
40+
"//src/material-examples/material/paginator",
41+
"//src/material-examples/material/popover-edit",
42+
"//src/material-examples/material/progress-bar",
43+
"//src/material-examples/material/progress-spinner",
44+
"//src/material-examples/material/radio",
45+
"//src/material-examples/material/select",
46+
"//src/material-examples/material/sidenav",
47+
"//src/material-examples/material/slide-toggle",
48+
"//src/material-examples/material/slider",
49+
"//src/material-examples/material/snack-bar",
50+
"//src/material-examples/material/sort",
51+
"//src/material-examples/material/stepper",
52+
"//src/material-examples/material/table",
53+
"//src/material-examples/material/tabs",
54+
"//src/material-examples/material/toolbar",
55+
"//src/material-examples/material/tooltip",
56+
"//src/material-examples/material/tree",
57+
]
58+
859
ng_module(
960
name = "examples",
1061
# TODO(paul): re-add the example-module genfile once angular/angular#30259 is resolved.
1162
srcs = glob(["**/*.ts"]),
12-
assets = glob([
13-
"**/*.html",
14-
"**/*.css",
15-
]),
1663
module_name = "@angular/material-examples",
17-
# Specify the tsconfig that is also used by Gulp. We need to explicitly use this tsconfig
18-
# because in order to import Moment with TypeScript, some specific options need to be set.
19-
tsconfig = ":tsconfig-build.json",
20-
deps = [
21-
"@npm//@angular/animations",
22-
"@npm//@angular/common",
23-
"@npm//@angular/core",
24-
"@npm//@angular/forms",
25-
"@npm//moment",
26-
"//src/material-moment-adapter",
27-
] + CDK_TARGETS + CDK_EXPERIMENTAL_TARGETS + MATERIAL_EXPERIMENTAL_TARGETS + ["//src/material/%s" % p for p in MATERIAL_PACKAGES],
64+
deps = EXAMPLE_PACKAGES,
2865
)
2966

3067
filegroup(
3168
name = "example-source-files",
32-
srcs = glob([
33-
"*/*.html",
34-
"*/*.css",
35-
"*/*.ts",
36-
]),
69+
srcs = ["%s:source-files" % pkg for pkg in EXAMPLE_PACKAGES],
3770
)
3871

3972
highlight_files(
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("//tools:defaults.bzl", "ng_module")
4+
5+
ng_module(
6+
name = "a11y",
7+
srcs = glob(["**/*.ts"]),
8+
assets = glob([
9+
"**/*.html",
10+
"**/*.css",
11+
]),
12+
deps = [
13+
"//src/cdk/a11y",
14+
"//src/material/select",
15+
],
16+
)
17+
18+
filegroup(
19+
name = "source-files",
20+
srcs = glob([
21+
"*/*.html",
22+
"*/*.css",
23+
"*/*.ts",
24+
]),
25+
)
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {A11yModule} from '@angular/cdk/a11y';
2+
import {NgModule} from '@angular/core';
3+
import {MatSelectModule} from '@angular/material/select';
4+
import {
5+
FocusMonitorDirectivesExample
6+
} from './focus-monitor-directives/focus-monitor-directives-example';
7+
import {
8+
FocusMonitorFocusViaExample
9+
} from './focus-monitor-focus-via/focus-monitor-focus-via-example';
10+
import {FocusMonitorOverviewExample} from './focus-monitor-overview/focus-monitor-overview-example';
11+
12+
const EXAMPLES = [
13+
FocusMonitorDirectivesExample,
14+
FocusMonitorFocusViaExample,
15+
FocusMonitorOverviewExample,
16+
];
17+
18+
@NgModule({
19+
imports: [
20+
A11yModule,
21+
MatSelectModule,
22+
],
23+
declarations: EXAMPLES,
24+
exports: EXAMPLES,
25+
})
26+
export class CdkA11yExamplesModule {
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("//tools:defaults.bzl", "ng_module")
4+
5+
ng_module(
6+
name = "drag-drop",
7+
srcs = glob(["**/*.ts"]),
8+
assets = glob([
9+
"**/*.html",
10+
"**/*.css",
11+
]),
12+
deps = [
13+
"//src/cdk/drag-drop",
14+
"//src/cdk/overlay",
15+
"//src/cdk/portal",
16+
],
17+
)
18+
19+
filegroup(
20+
name = "source-files",
21+
srcs = glob([
22+
"*/*.html",
23+
"*/*.css",
24+
"*/*.ts",
25+
]),
26+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import {DragDropModule} from '@angular/cdk/drag-drop';
2+
import {OverlayModule} from '@angular/cdk/overlay';
3+
import {CommonModule} from '@angular/common';
4+
import {NgModule} from '@angular/core';
5+
import {
6+
CdkDragDropAxisLockExample
7+
} from './cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example';
8+
import {CdkDragDropBoundaryExample} from './cdk-drag-drop-boundary/cdk-drag-drop-boundary-example';
9+
import {
10+
CdkDragDropConnectedSortingGroupExample
11+
} from './cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example';
12+
import {
13+
CdkDragDropConnectedSortingExample
14+
} from './cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example';
15+
import {
16+
CdkDragDropCustomPlaceholderExample
17+
} from './cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example';
18+
import {
19+
CdkDragDropCustomPreviewExample
20+
} from './cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example';
21+
import {CdkDragDropDelayExample} from './cdk-drag-drop-delay/cdk-drag-drop-delay-example';
22+
import {
23+
CdkDragDropDisabledSortingExample
24+
} from './cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example';
25+
import {CdkDragDropDisabledExample} from './cdk-drag-drop-disabled/cdk-drag-drop-disabled-example';
26+
import {
27+
CdkDragDropEnterPredicateExample
28+
} from './cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example';
29+
import {
30+
CdkDragDropFreeDragPositionExample
31+
} from './cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example';
32+
import {CdkDragDropHandleExample} from './cdk-drag-drop-handle/cdk-drag-drop-handle-example';
33+
import {
34+
CdkDragDropHorizontalSortingExample
35+
} from './cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example';
36+
import {CdkDragDropOverviewExample} from './cdk-drag-drop-overview/cdk-drag-drop-overview-example';
37+
import {
38+
CdkDragDropRootElementExample
39+
} from './cdk-drag-drop-root-element/cdk-drag-drop-root-element-example';
40+
import {CdkDragDropSortingExample} from './cdk-drag-drop-sorting/cdk-drag-drop-sorting-example';
41+
42+
const EXAMPLES = [
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+
61+
@NgModule({
62+
imports: [
63+
DragDropModule,
64+
OverlayModule,
65+
CommonModule,
66+
],
67+
declarations: EXAMPLES,
68+
exports: EXAMPLES,
69+
})
70+
export class CdkDragDropExamplesModule {
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("//tools:defaults.bzl", "ng_module")
4+
5+
ng_module(
6+
name = "platform",
7+
srcs = glob(["**/*.ts"]),
8+
assets = glob([
9+
"**/*.html",
10+
"**/*.css",
11+
]),
12+
deps = [
13+
"//src/cdk/platform",
14+
],
15+
)
16+
17+
filegroup(
18+
name = "source-files",
19+
srcs = glob([
20+
"*/*.html",
21+
"*/*.css",
22+
"*/*.ts",
23+
]),
24+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {PlatformModule} from '@angular/cdk/platform';
2+
import {NgModule} from '@angular/core';
3+
import {CdkPlatformOverviewExample} from './cdk-platform-overview/cdk-platform-overview-example';
4+
5+
const EXAMPLES = [CdkPlatformOverviewExample];
6+
7+
@NgModule({
8+
imports: [
9+
PlatformModule,
10+
],
11+
declarations: EXAMPLES,
12+
exports: EXAMPLES,
13+
})
14+
export class CdkPlatformExamplesModule {
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("//tools:defaults.bzl", "ng_module")
4+
5+
ng_module(
6+
name = "popover-edit",
7+
srcs = glob(["**/*.ts"]),
8+
assets = glob([
9+
"**/*.html",
10+
"**/*.css",
11+
]),
12+
deps = [
13+
"//src/cdk-experimental/popover-edit",
14+
"//src/cdk/collections",
15+
"//src/cdk/table",
16+
"@npm//@angular/forms",
17+
],
18+
)
19+
20+
filegroup(
21+
name = "source-files",
22+
srcs = glob([
23+
"*/*.html",
24+
"*/*.css",
25+
"*/*.ts",
26+
]),
27+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {CdkPopoverEditModule} from '@angular/cdk-experimental/popover-edit';
2+
import {CdkTableModule} from '@angular/cdk/table';
3+
import {CommonModule} from '@angular/common';
4+
import {NgModule} from '@angular/core';
5+
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 {
20+
CdkPopoverEditVanillaTableExample
21+
} from './cdk-popover-edit-vanilla-table/cdk-popover-edit-vanilla-table-example';
22+
23+
const EXAMPLES = [
24+
CdkPopoverEditCdkTableExample,
25+
CdkPopoverEditCdkTableFlexExample,
26+
CdkPopoverEditCellSpanVanillaTableExample,
27+
CdkPopoverEditTabOutVanillaTableExample,
28+
CdkPopoverEditVanillaTableExample,
29+
];
30+
31+
@NgModule({
32+
imports: [
33+
CdkPopoverEditModule,
34+
CdkTableModule,
35+
FormsModule,
36+
CommonModule,
37+
],
38+
declarations: EXAMPLES,
39+
exports: EXAMPLES,
40+
})
41+
export class CdkPopoverEditExamplesModule {
42+
}

0 commit comments

Comments
 (0)