refactor(bazel): allow google3 overrides for external deps (#26488)

PR Close #26488
This commit is contained in:
Alex Eagle 2018-10-17 11:25:22 -07:00 committed by Igor Minar
parent 2b3cac5b31
commit 2132c8f461
2 changed files with 19 additions and 8 deletions

View File

@ -13,10 +13,20 @@ load(
_compile_ts = "compile_ts",
_ts_providers_dict_to_struct = "ts_providers_dict_to_struct",
)
load(
"@build_bazel_rules_nodejs//internal/common:node_module_info.bzl",
_NodeModuleInfo = "NodeModuleInfo",
_collect_node_modules_aspect = "collect_node_modules_aspect",
)
NodeModuleInfo = _NodeModuleInfo
collect_node_modules_aspect = _collect_node_modules_aspect
tsc_wrapped_tsconfig = _tsc_wrapped_tsconfig
COMMON_ATTRIBUTES = _COMMON_ATTRIBUTES
COMMON_OUTPUTS = _COMMON_OUTPUTS
compile_ts = _compile_ts
DEPS_ASPECTS = _DEPS_ASPECTS
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"

View File

@ -6,18 +6,18 @@
"""
load(
":rules_typescript.bzl",
":external.bzl",
"COMMON_ATTRIBUTES",
"COMMON_OUTPUTS",
"DEPS_ASPECTS",
"DEFAULT_NG_COMPILER",
"DEFAULT_NG_XI18N",
"collect_node_modules_aspect",
"compile_ts",
"ts_providers_dict_to_struct",
"tsc_wrapped_tsconfig",
"NodeModuleInfo",
)
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleInfo", "collect_node_modules_aspect")
_DEFAULT_COMPILER = "@angular//:@angular/bazel/ngc-wrapped"
_DEFAULT_NG_XI18N = "@npm//@angular/bazel/bin:xi18n"
def compile_strategy(ctx):
"""Detect which strategy should be used to implement ng_module.
@ -396,7 +396,8 @@ def _compile_action(ctx, inputs, outputs, messages_out, tsconfig_file, node_opts
# Give the Angular compiler all the user-listed assets
file_inputs = list(ctx.files.assets)
file_inputs.extend(_filter_ts_inputs(ctx.files.node_modules))
if hasattr(ctx.attr, "node_modules"):
file_inputs.extend(_filter_ts_inputs(ctx.files.node_modules))
# If the user supplies a tsconfig.json file, the Angular compiler needs to read it
if hasattr(ctx.attr, "tsconfig") and ctx.file.tsconfig:
@ -533,12 +534,12 @@ NG_MODULE_ATTRIBUTES = {
compiler works out of the box. Otherwise, you'll have to override
the compiler attribute manually.
""",
default = Label(_DEFAULT_COMPILER),
default = Label(DEFAULT_NG_COMPILER),
executable = True,
cfg = "host",
),
"ng_xi18n": attr.label(
default = Label(_DEFAULT_NG_XI18N),
default = Label(DEFAULT_NG_XI18N),
executable = True,
cfg = "host",
),