diff --git a/build_defs/defaults.bzl b/build_defs/defaults.bzl index 289b9603d..812207683 100644 --- a/build_defs/defaults.bzl +++ b/build_defs/defaults.bzl @@ -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. diff --git a/web/src/app/BUILD b/web/src/app/BUILD index 5d2d71ba4..05373e083 100644 --- a/web/src/app/BUILD +++ b/web/src/app/BUILD @@ -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"], @@ -18,8 +18,7 @@ ng_module( "//web/src/dev_tools", "//web/src/error", "//web/src/services", - "@npm//@angular/compiler", - ], + ] + ANGULAR_CORE_DEPS, ) esbuild_config( @@ -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( diff --git a/web/src/app/dev/BUILD b/web/src/app/dev/BUILD index 37dbd83b5..6a3307553 100644 --- a/web/src/app/dev/BUILD +++ b/web/src/app/dev/BUILD @@ -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( @@ -12,8 +12,7 @@ ng_module( ]), deps = [ "//web/src/app", - "@npm//@angular/compiler", - ], + ] + ANGULAR_CORE_DEPS, ) devmode_esbuild( diff --git a/web/src/app/prod/BUILD b/web/src/app/prod/BUILD index 8c1b427f9..8f90b41d7 100644 --- a/web/src/app/prod/BUILD +++ b/web/src/app/prod/BUILD @@ -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( @@ -13,8 +13,7 @@ ng_module( ]), deps = [ "//web/src/app", - "@npm//@angular/compiler", - ], + ] + ANGULAR_CORE_DEPS, ) esbuild( diff --git a/web/src/component_renderer/BUILD b/web/src/component_renderer/BUILD index 113d2ae2e..898a25eb5 100644 --- a/web/src/component_renderer/BUILD +++ b/web/src/component_renderer/BUILD @@ -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"], @@ -20,6 +20,5 @@ ng_module( "//optic/components/checkbox:ng", "//optic/components/text:ng", "//protos:ui_jspb_proto", - "@npm//@angular/compiler", - ], + ] + ANGULAR_CORE_DEPS, ) diff --git a/web/src/dev_tools/BUILD b/web/src/dev_tools/BUILD index 02566ad04..bc2229f64 100644 --- a/web/src/dev_tools/BUILD +++ b/web/src/dev_tools/BUILD @@ -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"], @@ -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( diff --git a/web/src/dev_tools/component_tree/BUILD b/web/src/dev_tools/component_tree/BUILD index 656395e8c..266667383 100644 --- a/web/src/dev_tools/component_tree/BUILD +++ b/web/src/dev_tools/component_tree/BUILD @@ -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"], @@ -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( diff --git a/web/src/dev_tools/components_panel/BUILD b/web/src/dev_tools/components_panel/BUILD index b19392671..3b6c7e4a9 100644 --- a/web/src/dev_tools/components_panel/BUILD +++ b/web/src/dev_tools/components_panel/BUILD @@ -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"], @@ -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( diff --git a/web/src/dev_tools/logs_panel/BUILD b/web/src/dev_tools/logs_panel/BUILD index c0ac9f147..d294b0a84 100644 --- a/web/src/dev_tools/logs_panel/BUILD +++ b/web/src/dev_tools/logs_panel/BUILD @@ -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"], @@ -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( diff --git a/web/src/dev_tools/object_tree/BUILD b/web/src/dev_tools/object_tree/BUILD index daf4eb743..ca1de265a 100644 --- a/web/src/dev_tools/object_tree/BUILD +++ b/web/src/dev_tools/object_tree/BUILD @@ -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"], @@ -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( diff --git a/web/src/dev_tools/services/BUILD b/web/src/dev_tools/services/BUILD index c9af69477..ff49ab838 100644 --- a/web/src/dev_tools/services/BUILD +++ b/web/src/dev_tools/services/BUILD @@ -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"], @@ -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, ) diff --git a/web/src/error/BUILD b/web/src/error/BUILD index c5bc0b828..a42f4acdf 100644 --- a/web/src/error/BUILD +++ b/web/src/error/BUILD @@ -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"], @@ -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( diff --git a/web/src/services/BUILD b/web/src/services/BUILD index 839df2480..afb6fa453 100644 --- a/web/src/services/BUILD +++ b/web/src/services/BUILD @@ -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"], @@ -12,6 +12,5 @@ ng_module( deps = [ "//protos:ui_jspb_proto", "//web/src/dev_tools/services", - "@npm//@angular/compiler", - ], + ] + ANGULAR_CORE_DEPS, )