Skip to content

Commit 18628c2

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

File tree

37 files changed

+1314
-13
lines changed

37 files changed

+1314
-13
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# For some reason, circleci needs the postinstall to be run explicitly.
3535
# This may be unnecessary once ngcontainer 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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"tsconfig-paths": "^2.3.0",
124124
"tslint": "^5.8.0",
125125
"tsutils": "^2.6.0",
126-
"typescript": "~2.4.2",
126+
"typescript": "~2.5.3",
127127
"uglify-js": "^2.8.14",
128128
"web-animations-js": "^2.2.5"
129129
}

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

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

src/lib/button/BUILD.bazel

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package(default_visibility=["//visibility:public"])
2+
load("@angular//:index.bzl", "ng_module")
3+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library")
4+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
5+
6+
7+
ng_module(
8+
name = "button",
9+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
10+
module_name = "@angular/material/button",
11+
assets = [":button_css"],
12+
deps = [
13+
"//src/lib/core",
14+
"//src/cdk/a11y",
15+
"//src/cdk/platform",
16+
],
17+
tsconfig = ":tsconfig-build.json",
18+
)
19+
20+
21+
# Library of all button scss partials.
22+
sass_library(
23+
name = "button_scss_lib",
24+
srcs = glob(["**/_*.scss"]),
25+
deps = ["//src/lib/core:core_scss_lib"],
26+
)
27+
28+
sass_binary(
29+
name = "button_scss",
30+
src = "button.scss",
31+
deps = [":button_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 = "button_css",
38+
srcs = [":button_scss"],
39+
outs = ["button.css"],
40+
cmd = "cat $(locations :button_scss) > $@",
41+
)
42+

src/lib/card/BUILD.bazel

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

src/lib/checkbox/BUILD.bazel

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

src/lib/chips/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")
4+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
5+
6+
7+
ng_module(
8+
name = "chips",
9+
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
10+
module_name = "@angular/material/chips",
11+
assets = [":chips_css"],
12+
deps = [
13+
"//src/lib/core",
14+
"//src/lib/form-field",
15+
"//src/cdk/a11y",
16+
"//src/cdk/bidi",
17+
"//src/cdk/coercion",
18+
"//src/cdk/collections",
19+
"//src/cdk/keycodes",
20+
],
21+
tsconfig = ":tsconfig-build.json",
22+
)
23+
24+
25+
sass_binary(
26+
name = "chips_scss",
27+
src = "chips.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 = "chips_css",
35+
srcs = [":chips_scss"],
36+
outs = ["chips.css"],
37+
cmd = "cat $(locations :chips_scss) > $@",
38+
)
39+

src/lib/core/BUILD.bazel

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

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

0 commit comments

Comments
 (0)