diff --git a/packages/bazel/src/external.bzl b/packages/bazel/src/external.bzl index 32b640ae30..73c74ddf59 100644 --- a/packages/bazel/src/external.bzl +++ b/packages/bazel/src/external.bzl @@ -35,6 +35,11 @@ compile_ts = _compile_ts DEPS_ASPECTS = _DEPS_ASPECTS ts_providers_dict_to_struct = _ts_providers_dict_to_struct +# Should be defined as `BuildSettingInfo` from Skylib, but a dependency on +# Skylib is not necessary here because this is only used in google3 where Skylib +# is loaded differently anyways where this file is overridden. +BuildSettingInfo = provider(doc = "Not used outside google3.") + DEFAULT_API_EXTRACTOR = "@npm//@angular/bazel/bin:api-extractor" DEFAULT_NG_COMPILER = "@npm//@angular/bazel/bin:ngc-wrapped" DEFAULT_NG_XI18N = "@npm//@angular/bazel/bin:xi18n" diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index 35da43a239..eb158626b7 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -7,6 +7,7 @@ load( ":external.bzl", + "BuildSettingInfo", "COMMON_ATTRIBUTES", "COMMON_OUTPUTS", "DEFAULT_API_EXTRACTOR", @@ -36,6 +37,15 @@ def is_ivy_enabled(ctx): Boolean, Whether the ivy compiler should be used. """ + # Check the renderer flag to see if Ivy is enabled. + # This is intended to support a transition use case for google3 migration. + # The `_renderer` attribute will never be set externally, but will always be + # set internally as a `string_flag()` with the allowed values of: + # "view_engine" or "ivy". + if ((hasattr(ctx.attr, "_renderer") and + ctx.attr._renderer[BuildSettingInfo].value == "ivy")): + return True + # TODO(josephperott): Remove after ~Feb 2020, to allow local script migrations if "compile" in ctx.var and ctx.workspace_name == "angular": fail(