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
This commit is contained in:
Keen Yee Liau 2019-12-04 13:37:09 -08:00 committed by Andrew Kushnir
parent 0341f3239a
commit d6f278867f
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,11 @@ def is_ivy_enabled(ctx):
attr = "ng_module", 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. # TODO(josephperrott): Remove configuration via compile=aot define flag.
if ctx.var.get("compile", None) == "aot": if ctx.var.get("compile", None) == "aot":
# buildifier: disable=print # buildifier: disable=print