Skip to content

Commit 56aea99

Browse files
committed
build(material): add bazel rules for all components
Part of #8369
1 parent 541a95e commit 56aea99

File tree

36 files changed

+1283
-13
lines changed

36 files changed

+1283
-13
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232

3333
- run: bazel run @nodejs//:npm install
3434
# For some reason, circleci needs the postinstall to be run explicitly.
35-
# This may be unnecessary once ngcontainer uses nodejs 8
35+
# This may be unnecessary once rules_nodejs uses nodejs 8
3636
- run: bazel run @nodejs//:npm run postinstall
37-
- run: bazel build src/cdk/...
37+
- run: bazel build src/...
3838
- save_cache:
3939
key: material2-{{ .Branch }}-{{ checksum "package-lock.json" }}
4040
paths:

WORKSPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ workspace(name = "angular_material_src")
44
git_repository(
55
name = "build_bazel_rules_nodejs",
66
remote = "https://github.com/bazelbuild/rules_nodejs.git",
7-
# TODO(jelbourn): use the correct tag here.
8-
commit = "31d36ff2acdf630d1e331f38006cf1a5d303d338",
7+
tag = "0.2.2",
98
)
109

1110
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install

src/cdk/a11y/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package(default_visibility=["//visibility:public"])
22
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library")
4+
5+
sass_library(
6+
name = "a11y_scss_lib",
7+
srcs = glob(["**/_*.scss"]),
8+
)
39

410
ng_module(
511
name = "a11y",

src/lib/autocomplete/BUILD.bazel

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "autocomplete",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/autocomplete",
10+
assets = [":autocomplete_css"],
11+
deps = [
12+
"//src/lib/core",
13+
"//src/lib/form-field",
14+
"//src/cdk/a11y",
15+
"//src/cdk/bidi",
16+
"//src/cdk/collections",
17+
"//src/cdk/keycodes",
18+
"//src/cdk/portal",
19+
"//src/cdk/overlay",
20+
],
21+
tsconfig = ":tsconfig-build.json",
22+
)
23+
24+
25+
sass_binary(
26+
name = "autocomplete_scss",
27+
src = "autocomplete.scss",
28+
deps = ["//src/lib/core:core_scss_lib"],
29+
)
30+
31+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
32+
# Copy the output of the sass_binary such that the filename and path match what we expect.
33+
genrule(
34+
name = "autocomplete_css",
35+
srcs = [":autocomplete_scss"],
36+
outs = ["autocomplete.css"],
37+
cmd = "cat $(locations :autocomplete_scss) > $@",
38+
)
39+

src/lib/button-toggle/BUILD.bazel

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "button-toggle",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/button_toggle",
10+
assets = [":button_toggle_css"],
11+
deps = [
12+
"//src/lib/core",
13+
"//src/cdk/a11y",
14+
"//src/cdk/coercion",
15+
"//src/cdk/collections",
16+
],
17+
tsconfig = ":tsconfig-build.json",
18+
)
19+
20+
21+
sass_binary(
22+
name = "button_toggle_scss",
23+
src = "button-toggle.scss",
24+
deps = ["//src/lib/core:core_scss_lib"],
25+
)
26+
27+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
28+
# Copy the output of the sass_binary such that the filename and path match what we expect.
29+
genrule(
30+
name = "button_toggle_css",
31+
srcs = [":button_toggle_scss"],
32+
outs = ["button-toggle.css"],
33+
cmd = "cat $(locations :button_toggle_scss) > $@",
34+
)

src/lib/button/BUILD.bazel

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "button",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/button",
10+
assets = [":button_css"],
11+
deps = [
12+
"//src/lib/core",
13+
"//src/cdk/a11y",
14+
"//src/cdk/platform",
15+
],
16+
tsconfig = ":tsconfig-build.json",
17+
)
18+
19+
20+
# Library of all button scss partials.
21+
sass_library(
22+
name = "button_scss_lib",
23+
srcs = glob(["**/_*.scss"]),
24+
deps = ["//src/lib/core:core_scss_lib"],
25+
)
26+
27+
sass_binary(
28+
name = "button_scss",
29+
src = "button.scss",
30+
deps = [":button_scss_lib"],
31+
)
32+
33+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
34+
# Copy the output of the sass_binary such that the filename and path match what we expect.
35+
genrule(
36+
name = "button_css",
37+
srcs = [":button_scss"],
38+
outs = ["button.css"],
39+
cmd = "cat $(locations :button_scss) > $@",
40+
)
41+

src/lib/card/BUILD.bazel

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "card",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/card",
10+
assets = [":card_css"],
11+
deps = [
12+
"//src/lib/core",
13+
],
14+
tsconfig = ":tsconfig-build.json",
15+
)
16+
17+
18+
sass_binary(
19+
name = "card_scss",
20+
src = "card.scss",
21+
deps = ["//src/lib/core:core_scss_lib"],
22+
)
23+
24+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
25+
# Copy the output of the sass_binary such that the filename and path match what we expect.
26+
genrule(
27+
name = "card_css",
28+
srcs = [":card_scss"],
29+
outs = ["card.css"],
30+
cmd = "cat $(locations :card_scss) > $@",
31+
)

src/lib/checkbox/BUILD.bazel

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "checkbox",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/checkbox",
10+
assets = [":checkbox_css"],
11+
deps = [
12+
"//src/lib/core",
13+
"//src/cdk/a11y",
14+
"//src/cdk/coercion",
15+
"//src/cdk/observers",
16+
],
17+
tsconfig = ":tsconfig-build.json",
18+
)
19+
20+
21+
sass_binary(
22+
name = "checkbox_scss",
23+
src = "checkbox.scss",
24+
deps = ["//src/lib/core:core_scss_lib"],
25+
)
26+
27+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
28+
# Copy the output of the sass_binary such that the filename and path match what we expect.
29+
genrule(
30+
name = "checkbox_css",
31+
srcs = [":checkbox_scss"],
32+
outs = ["checkbox.css"],
33+
cmd = "cat $(locations :checkbox_scss) > $@",
34+
)
35+

src/lib/chips/BUILD.bazel

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "chips",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/chips",
10+
assets = [":chips_css"],
11+
deps = [
12+
"//src/lib/core",
13+
"//src/lib/form-field",
14+
"//src/cdk/a11y",
15+
"//src/cdk/bidi",
16+
"//src/cdk/coercion",
17+
"//src/cdk/collections",
18+
"//src/cdk/keycodes",
19+
],
20+
tsconfig = ":tsconfig-build.json",
21+
)
22+
23+
24+
sass_binary(
25+
name = "chips_scss",
26+
src = "chips.scss",
27+
deps = ["//src/lib/core:core_scss_lib"],
28+
)
29+
30+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
31+
# Copy the output of the sass_binary such that the filename and path match what we expect.
32+
genrule(
33+
name = "chips_css",
34+
srcs = [":chips_scss"],
35+
outs = ["chips.css"],
36+
cmd = "cat $(locations :chips_scss) > $@",
37+
)
38+

src/lib/core/BUILD.bazel

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "core",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/core",
10+
assets = [":pseudo_checkbox_css"],
11+
deps = [
12+
"//src/cdk/bidi",
13+
"//src/cdk/coercion",
14+
"//src/cdk/keycodes",
15+
"//src/cdk/platform",
16+
],
17+
tsconfig = ":tsconfig-build.json",
18+
)
19+
20+
21+
# Library of all core scss partials.
22+
sass_library(
23+
name = "core_scss_lib",
24+
srcs = glob(["**/_*.scss"]),
25+
deps = ["//src/cdk/a11y:a11y_scss_lib"],
26+
)
27+
28+
sass_binary(
29+
name = "pseudo_checkbox_scss",
30+
src = "selection/pseudo-checkbox/pseudo-checkbox.scss",
31+
deps = [":core_scss_lib"],
32+
)
33+
34+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
35+
# Copy the output of the sass_binary such that the filename and path match what we expect.
36+
genrule(
37+
name = "pseudo_checkbox_css",
38+
srcs = [":pseudo_checkbox_scss"],
39+
outs = ["selection/pseudo-checkbox/pseudo-checkbox.css"],
40+
cmd = "cat $(locations :pseudo_checkbox_scss) > $@",
41+
)

src/lib/core/typings.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare var module: {id: string};

src/lib/datepicker/BUILD.bazel

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library", "sass_binary")
4+
5+
6+
ng_module(
7+
name = "datepicker",
8+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9+
module_name = "@angular/material/datepicker",
10+
assets = [
11+
":datepicker_content_css",
12+
":calendar_body_css",
13+
":calendar_css",
14+
],
15+
deps = [
16+
"//src/lib/core",
17+
"//src/lib/button",
18+
"//src/lib/dialog",
19+
"//src/lib/icon",
20+
"//src/lib/input",
21+
"//src/cdk/a11y",
22+
"//src/cdk/bidi",
23+
"//src/cdk/coercion",
24+
"//src/cdk/keycodes",
25+
"//src/cdk/portal",
26+
"//src/cdk/overlay",
27+
],
28+
tsconfig = ":tsconfig-build.json",
29+
)
30+
31+
32+
sass_binary(
33+
name = "datepicker_content_scss",
34+
src = "datepicker-content.scss",
35+
deps = ["//src/lib/core:core_scss_lib"],
36+
)
37+
38+
sass_binary(
39+
name = "calendar_scss",
40+
src = "calendar.scss",
41+
deps = ["//src/lib/core:core_scss_lib"],
42+
)
43+
44+
sass_binary(
45+
name = "calendar_body_scss",
46+
src = "calendar-body.scss",
47+
deps = ["//src/lib/core:core_scss_lib"],
48+
)
49+
50+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
51+
# Copy the output of the sass_binary such that the filename and path match what we expect.
52+
genrule(
53+
name = "datepicker_content_css",
54+
srcs = [":datepicker_content_scss"],
55+
outs = ["datepicker-content.css"],
56+
cmd = "cat $(locations :datepicker_content_scss) > $@",
57+
)
58+
59+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
60+
# Copy the output of the sass_binary such that the filename and path match what we expect.
61+
genrule(
62+
name = "calendar_css",
63+
srcs = [":calendar_scss"],
64+
outs = ["calendar.css"],
65+
cmd = "cat $(locations :calendar_scss) > $@",
66+
)
67+
68+
# TODO(jelbourn): remove this when sass_binary supports specifying an output filename and dir.
69+
# Copy the output of the sass_binary such that the filename and path match what we expect.
70+
genrule(
71+
name = "calendar_body_css",
72+
srcs = [":calendar_body_scss"],
73+
outs = ["calendar-body.css"],
74+
cmd = "cat $(locations :calendar_body_scss) > $@",
75+
)

0 commit comments

Comments
 (0)