Skip to content

Commit 786560e

Browse files
devversionmmalerba
authored andcommitted
build: fine-grain dependencies for mdc prototypes (#16071)
Currently all mdc prototype secondary entry-points specify all CDK and Material Bazel targets as dependencies. This causes significant slower builds and also doesn't follow the fine-grained dependency pattern. Fine-grained dependencies have various benefits over coarced dependencies. We should consider putting this into a Bazel guide somewhere inside the repository at some point.
1 parent 3a237bd commit 786560e

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

src/material-experimental/mdc-button/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility = ["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-button",
@@ -12,7 +11,9 @@ ng_module(
1211
deps = [
1312
"@npm//@angular/animations",
1413
"@npm//material-components-web",
15-
] + CDK_TARGETS + MATERIAL_TARGETS,
14+
"//src/cdk/platform",
15+
"//src/material/core",
16+
],
1617
)
1718

1819
sass_library(

src/material-experimental/mdc-card/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-card",
@@ -11,7 +10,8 @@ ng_module(
1110
assets = [":card_scss"] + glob(["**/*.html"]),
1211
deps = [
1312
"@npm//material-components-web",
14-
] + CDK_TARGETS + MATERIAL_TARGETS,
13+
"//src/material/core",
14+
],
1515
)
1616

1717
sass_library(

src/material-experimental/mdc-checkbox/BUILD.bazel

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-checkbox",
@@ -15,7 +14,11 @@ ng_module(
1514
"@npm//@angular/core",
1615
"@npm//@angular/forms",
1716
"@npm//material-components-web",
18-
] + CDK_TARGETS + MATERIAL_TARGETS,
17+
"//src/cdk/coercion",
18+
"//src/cdk/platform",
19+
"//src/material/core",
20+
"//src/material/checkbox",
21+
],
1922
)
2023

2124
sass_library(

src/material-experimental/mdc-chips/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-chips",
@@ -13,7 +12,8 @@ ng_module(
1312
"@npm//@angular/common",
1413
"@npm//@angular/core",
1514
"@npm//material-components-web",
16-
] + CDK_TARGETS + MATERIAL_TARGETS,
15+
"//src/material/core",
16+
],
1717
)
1818

1919
sass_library(

src/material-experimental/mdc-helpers/BUILD.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-helpers",
@@ -11,7 +10,7 @@ ng_module(
1110
assets = glob(["**/*.html"]),
1211
deps = [
1312
"@npm//@angular/core",
14-
] + CDK_TARGETS + MATERIAL_TARGETS,
13+
],
1514
)
1615

1716
# Add all MDC Sass files that we depend on here. After updating MDC dependencies, use the following

src/material-experimental/mdc-menu/BUILD.bazel

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-menu",
@@ -14,7 +13,10 @@ ng_module(
1413
"@npm//@angular/common",
1514
"@npm//@angular/core",
1615
"@npm//material-components-web",
17-
] + CDK_TARGETS + MATERIAL_TARGETS,
16+
"//src/cdk/overlay",
17+
"//src/material/menu",
18+
"//src/material/core",
19+
],
1820
)
1921

2022
sass_library(

src/material-experimental/mdc-radio/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-radio",
@@ -11,7 +10,8 @@ ng_module(
1110
assets = [":radio_scss"] + glob(["**/*.html"]),
1211
deps = [
1312
"@npm//material-components-web",
14-
] + CDK_TARGETS + MATERIAL_TARGETS,
13+
"//src/material/core",
14+
],
1515
)
1616

1717
sass_library(

src/material-experimental/mdc-slide-toggle/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package(default_visibility=["//visibility:public"])
22

33
load("@io_bazel_rules_sass//:defs.bzl", "sass_library", "sass_binary")
44
load("//tools:defaults.bzl", "ng_module")
5-
load("//:packages.bzl", "CDK_TARGETS", "MATERIAL_TARGETS")
65

76
ng_module(
87
name = "mdc-slide-toggle",
@@ -15,7 +14,9 @@ ng_module(
1514
"@npm//@angular/forms",
1615
"@npm//@angular/animations",
1716
"@npm//material-components-web",
18-
] + CDK_TARGETS + MATERIAL_TARGETS,
17+
"//src/cdk/coercion",
18+
"//src/material/core",
19+
],
1920
)
2021

2122
sass_library(

0 commit comments

Comments
 (0)