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.
This commit is contained in:
Paul Gschwendtner
2018-11-14 23:18:10 +01:00
committed by Andrew Seguin
parent b21cfb7326
commit dfcba2bc2e
3 changed files with 6 additions and 5 deletions
-1
View File
@@ -6,7 +6,6 @@ ts_library(
name = "coercion",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/coercion",
deps = ["@matdeps//tslib"],
)
ts_library(
-1
View File
@@ -6,7 +6,6 @@ ts_library(
name = "keycodes",
srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
module_name = "@angular/cdk/keycodes",
deps = ["@matdeps//tslib"],
)
ts_library(
+6 -3
View File
@@ -15,13 +15,17 @@ def _getDefaultTsConfig(testonly):
else:
return _DEFAULT_TSCONFIG_BUILD
def ts_library(tsconfig = None, testonly = False, **kwargs):
def ts_library(tsconfig = None, deps = [], testonly = False, **kwargs):
# Add tslib because we use import helpers for all public packages.
local_deps = ["@matdeps//tslib"] + deps
if not tsconfig:
tsconfig = _getDefaultTsConfig(testonly)
_ts_library(
tsconfig = tsconfig,
testonly = testonly,
deps = local_deps,
node_modules = _DEFAULT_TS_TYPINGS,
**kwargs
)
@@ -31,8 +35,7 @@ def ng_module(deps = [], tsconfig = None, testonly = False, **kwargs):
tsconfig = _getDefaultTsConfig(testonly)
local_deps = [
# Since we use the TypeScript import helpers (tslib) for each TypeScript configuration,
# we declare TSLib as default dependency
# Add tslib because we use import helpers for all public packages.
"@matdeps//tslib",
# Depend on the module typings for each `ng_module`. Since all components within the project