From d6f278867f1b877df4e39747507f09eecc43dc2a Mon Sep 17 00:00:00 2001 From: Keen Yee Liau Date: Wed, 4 Dec 2019 13:37:09 -0800 Subject: [PATCH] build: Enable ivy in google3 if ng_module attr is True (#34238) This commit creates a way for `ng_module` rule to compile with Ivy based on the `ivy` attribute. This enables google3 targets to pick the compiler without using `define` flags. PR Close #34238 --- packages/bazel/src/ng_module.bzl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index c758e047e2..3e1329f025 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -42,6 +42,11 @@ def is_ivy_enabled(ctx): attr = "ng_module", ) + # This attribute is only defined in google's private ng_module rule and not + # available externally. For external users, this is effectively a no-op. + if hasattr(ctx.attr, "ivy") and ctx.attr.ivy == True: + return True + # TODO(josephperrott): Remove configuration via compile=aot define flag. if ctx.var.get("compile", None) == "aot": # buildifier: disable=print