Skip to content

Commit

Permalink
Create constants for Angular-related BUILD deps
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen committed Dec 5, 2023
1 parent ca80cac commit b438f8b
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 40 deletions.
13 changes: 13 additions & 0 deletions build_defs/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ npm_sass_library = _npm_sass_library
sass_binary = _sass_binary
ts_library = _ts_library

# Constants for deps
ANGULAR_CORE_DEPS = [
"@npm//@angular/compiler",
]

ANGULAR_MATERIAL_DEPS = [
"@npm//@angular/material",
]

ANGULAR_CDK_DEPS = [
"@npm//@angular/cdk",
]

def jspb_proto_library(name, deps):
"""
Shim for JS proto.
Expand Down
10 changes: 3 additions & 7 deletions web/src/app/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "esbuild_config", "ng_module", "npm_sass_library", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CDK_DEPS", "ANGULAR_CORE_DEPS", "ANGULAR_MATERIAL_DEPS", "esbuild_config", "ng_module", "npm_sass_library", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -18,8 +18,7 @@ ng_module(
"//web/src/dev_tools",
"//web/src/error",
"//web/src/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

esbuild_config(
Expand All @@ -29,10 +28,7 @@ esbuild_config(

npm_sass_library(
name = "material_sass_deps",
deps = [
"@npm//@angular/cdk",
"@npm//@angular/material",
],
deps = ANGULAR_CDK_DEPS + ANGULAR_MATERIAL_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/app/dev/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "devmode_esbuild", "http_server", "ng_module")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "devmode_esbuild", "http_server", "ng_module")
load("//tools/angular:index.bzl", "LINKER_PROCESSED_FW_PACKAGES")

package(
Expand All @@ -12,8 +12,7 @@ ng_module(
]),
deps = [
"//web/src/app",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

devmode_esbuild(
Expand Down
5 changes: 2 additions & 3 deletions web/src/app/prod/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("//build_defs:defaults.bzl", "esbuild", "ng_module")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "esbuild", "ng_module")
load("//tools/angular:index.bzl", "LINKER_PROCESSED_FW_PACKAGES")

package(
Expand All @@ -13,8 +13,7 @@ ng_module(
]),
deps = [
"//web/src/app",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

esbuild(
Expand Down
5 changes: 2 additions & 3 deletions web/src/component_renderer/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -20,6 +20,5 @@ ng_module(
"//optic/components/checkbox:ng",
"//optic/components/text:ng",
"//protos:ui_jspb_proto",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)
5 changes: 2 additions & 3 deletions web/src/dev_tools/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -16,8 +16,7 @@ ng_module(
"//protos:ui_jspb_proto",
"//web/src/dev_tools/components_panel",
"//web/src/dev_tools/logs_panel",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/dev_tools/component_tree/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -16,8 +16,7 @@ ng_module(
"//protos:ui_jspb_proto",
"//web/src/component_renderer",
"//web/src/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/dev_tools/components_panel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -17,8 +17,7 @@ ng_module(
"//web/src/dev_tools/component_tree",
"//web/src/dev_tools/object_tree",
"//web/src/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/dev_tools/logs_panel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -17,8 +17,7 @@ ng_module(
"//web/src/component_renderer",
"//web/src/dev_tools/object_tree",
"//web/src/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/dev_tools/object_tree/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -16,8 +16,7 @@ ng_module(
"//protos:ui_jspb_proto",
"//web/src/component_renderer",
"//web/src/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/dev_tools/services/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -17,6 +17,5 @@ ng_module(
"//optic/components/text:text_jspb_proto",
"//optic/components/text_input:text_input_jspb_proto",
"//protos:ui_jspb_proto",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)
5 changes: 2 additions & 3 deletions web/src/error/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module", "sass_binary")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module", "sass_binary")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -16,8 +16,7 @@ ng_module(
"//protos:ui_jspb_proto",
"//web/src/component_renderer",
"//web/src/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

sass_binary(
Expand Down
5 changes: 2 additions & 3 deletions web/src/services/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//build_defs:defaults.bzl", "ng_module")
load("//build_defs:defaults.bzl", "ANGULAR_CORE_DEPS", "ng_module")

package(
default_visibility = ["//:optic_internal"],
Expand All @@ -12,6 +12,5 @@ ng_module(
deps = [
"//protos:ui_jspb_proto",
"//web/src/dev_tools/services",
"@npm//@angular/compiler",
],
] + ANGULAR_CORE_DEPS,
)

0 comments on commit b438f8b

Please sign in to comment.