From dfcba2bc2e36237cc92b11c850447b5b634b57bc Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 14 Nov 2018 23:18:10 +0100 Subject: [PATCH] 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. --- src/cdk/coercion/BUILD.bazel | 1 - src/cdk/keycodes/BUILD.bazel | 1 - tools/defaults.bzl | 9 ++++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cdk/coercion/BUILD.bazel b/src/cdk/coercion/BUILD.bazel index 23aa13dfe4c..3f01ece0796 100644 --- a/src/cdk/coercion/BUILD.bazel +++ b/src/cdk/coercion/BUILD.bazel @@ -6,7 +6,6 @@ ts_library( name = "coercion", srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]), module_name = "@angular/cdk/coercion", - deps = ["@matdeps//tslib"], ) ts_library( diff --git a/src/cdk/keycodes/BUILD.bazel b/src/cdk/keycodes/BUILD.bazel index da35d5b73e2..d4523da2703 100644 --- a/src/cdk/keycodes/BUILD.bazel +++ b/src/cdk/keycodes/BUILD.bazel @@ -6,7 +6,6 @@ ts_library( name = "keycodes", srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]), module_name = "@angular/cdk/keycodes", - deps = ["@matdeps//tslib"], ) ts_library( diff --git a/tools/defaults.bzl b/tools/defaults.bzl index f76cb976c2e..7d3a734ecfe 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -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