feat(bazel): add ts_config extending support for ng_module (#21883)

PR Close #21883
This commit is contained in:
Adam Yi 2018-01-30 15:33:22 +08:00 committed by Miško Hevery
parent 3cb497c6ac
commit edb6c2d814
2 changed files with 9 additions and 0 deletions

View File

@ -18,9 +18,14 @@ load(
_NodeModuleInfo = "NodeModuleInfo",
_collect_node_modules_aspect = "collect_node_modules_aspect",
)
load(
"@npm_bazel_typescript//internal:ts_config.bzl",
_TsConfigInfo = "TsConfigInfo",
)
NodeModuleInfo = _NodeModuleInfo
collect_node_modules_aspect = _collect_node_modules_aspect
tsc_wrapped_tsconfig = _tsc_wrapped_tsconfig
COMMON_ATTRIBUTES = _COMMON_ATTRIBUTES
COMMON_OUTPUTS = _COMMON_OUTPUTS
@ -31,3 +36,4 @@ ts_providers_dict_to_struct = _ts_providers_dict_to_struct
DEFAULT_NG_COMPILER = "@angular//:@angular/bazel/ngc-wrapped"
DEFAULT_NG_XI18N = "@npm//@angular/bazel/bin:xi18n"
FLAT_DTS_FILE_SUFFIX = ".bundle.d.ts"
TsConfigInfo = _TsConfigInfo

View File

@ -13,6 +13,7 @@ load(
"DEFAULT_NG_XI18N",
"DEPS_ASPECTS",
"NodeModuleInfo",
"TsConfigInfo",
"collect_node_modules_aspect",
"compile_ts",
"ts_providers_dict_to_struct",
@ -463,6 +464,8 @@ def _compile_action(ctx, inputs, outputs, dts_bundle_out, messages_out, tsconfig
# If the user supplies a tsconfig.json file, the Angular compiler needs to read it
if hasattr(ctx.attr, "tsconfig") and ctx.file.tsconfig:
file_inputs.append(ctx.file.tsconfig)
if TsConfigInfo in ctx.attr.tsconfig:
file_inputs += ctx.attr.tsconfig[TsConfigInfo].deps
# Also include files from npm fine grained deps as action_inputs.
# These deps are identified by the NodeModuleInfo provider.