Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renderer flag #37529

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/bazel/src/external.bzl
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions packages/bazel/src/ng_module.bzl
Expand Up @@ -7,6 +7,7 @@

load(
":external.bzl",
"BuildSettingInfo",
"COMMON_ATTRIBUTES",
"COMMON_OUTPUTS",
"DEFAULT_API_EXTRACTOR",
Expand Down Expand Up @@ -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(
Expand Down