aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorflow.bzl
diff options
context:
space:
mode:
authorGravatar Guangda Lai <laigd@google.com>2018-02-12 14:52:47 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-12 14:56:45 -0800
commit41402e7d92b6ead102fb58e424be55611983cb17 (patch)
treeb3cebec5dec86a1cc2c5df11e664d8ecc527e159 /tensorflow/tensorflow.bzl
parent5760acee1e214865870b835000285c92820ca879 (diff)
Add an option to tf_gen_op_wrapper_py to make it able to run the genrule
locally. PiperOrigin-RevId: 185439892
Diffstat (limited to 'tensorflow/tensorflow.bzl')
-rw-r--r--tensorflow/tensorflow.bzl8
1 files changed, 7 insertions, 1 deletions
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
index 411b393b0a..82142fa21d 100644
--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -498,6 +498,9 @@ def tf_gen_op_wrappers_cc(name,
# is invalid to specify both "hidden" and "op_whitelist".
# cc_linkopts: Optional linkopts to be added to tf_cc_binary that contains the
# specified ops.
+# gen_locally: if True, the genrule to generate the Python library will be run
+# without sandboxing. This would help when the genrule depends on symlinks
+# which may not be supported in the sandbox.
def tf_gen_op_wrapper_py(name,
out=None,
hidden=None,
@@ -508,7 +511,8 @@ def tf_gen_op_wrapper_py(name,
generated_target_name=None,
op_whitelist=[],
cc_linkopts=[],
- api_def_srcs=[]):
+ api_def_srcs=[],
+ gen_locally=False):
if (hidden or hidden_file) and op_whitelist:
fail('Cannot pass specify both hidden and op_whitelist.')
@@ -563,6 +567,7 @@ def tf_gen_op_wrapper_py(name,
outs=[out],
srcs=api_def_srcs + [hidden_file],
tools=[tool_name] + tf_binary_additional_srcs(),
+ local = (1 if gen_locally else 0),
cmd=("$(location " + tool_name + ") " + api_def_args_str +
" @$(location " + hidden_file + ") " +
("1" if require_shape_functions else "0") + " > $@"))
@@ -572,6 +577,7 @@ def tf_gen_op_wrapper_py(name,
outs=[out],
srcs=api_def_srcs,
tools=[tool_name] + tf_binary_additional_srcs(),
+ local = (1 if gen_locally else 0),
cmd=("$(location " + tool_name + ") " + api_def_args_str + " " +
op_list_arg + " " +
("1" if require_shape_functions else "0") + " " +