Skip to content

Commit 5705913

Browse files
devversionjosephperrott
authored andcommitted
build: add tslib to ts_library rules by default (#14128)
* Similar to how `angular/angular` provides defaults for the `ts_library` macro, we should also add `tslib` as default dependency. This spares us some duplications and makes it easier to use the default `bazel-tsconfig` files.
1 parent 183e936 commit 5705913

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/cdk/coercion/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ts_library(
66
name = "coercion",
77
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
88
module_name = "@angular/cdk/coercion",
9-
deps = ["@matdeps//tslib"],
109
)
1110

1211
ts_library(

src/cdk/keycodes/BUILD.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ load("//tools:defaults.bzl", "ts_library")
44

55
ts_library(
66
name = "keycodes",
7-
module_name = "@angular/cdk/keycodes",
87
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
9-
deps = ["@matdeps//tslib"],
8+
module_name = "@angular/cdk/keycodes",
109
)

tools/defaults.bzl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ def _getDefaultTsConfig(testonly):
1515
else:
1616
return _DEFAULT_TSCONFIG_BUILD
1717

18-
def ts_library(tsconfig = None, testonly = False, **kwargs):
18+
def ts_library(tsconfig = None, deps = [], testonly = False, **kwargs):
19+
# Add tslib because we use import helpers for all public packages.
20+
local_deps = ["@matdeps//tslib"] + deps
21+
1922
if not tsconfig:
2023
tsconfig = _getDefaultTsConfig(testonly)
2124

2225
_ts_library(
2326
tsconfig = tsconfig,
2427
testonly = testonly,
28+
deps = local_deps,
2529
node_modules = _DEFAULT_TS_TYPINGS,
2630
**kwargs
2731
)
@@ -31,8 +35,7 @@ def ng_module(deps = [], tsconfig = None, testonly = False, **kwargs):
3135
tsconfig = _getDefaultTsConfig(testonly)
3236

3337
local_deps = [
34-
# Since we use the TypeScript import helpers (tslib) for each TypeScript configuration,
35-
# we declare TSLib as default dependency
38+
# Add tslib because we use import helpers for all public packages.
3639
"@matdeps//tslib",
3740

3841
# Depend on the module typings for each `ng_module`. Since all components within the project

0 commit comments

Comments
 (0)