diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-27 06:19:58 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-27 06:23:37 -0700 |
commit | 77e2686a2958eb76e0164828d5d536b86c72464b (patch) | |
tree | 08dd3d4637f6fd170a5fe353853825b98e943c74 /tensorflow/tensorflow.bzl | |
parent | abf26356209cba1ba895a06d9ce55ad01dad7fc6 (diff) |
Reduce the size of //tensorflow/tools/pip_package:simple_console_windows
This change reduce the size of //tensorflow/tools/pip_package:simple_console_windows's zip file from 1000027677 bytes to 47690474 bytes for a CPU build. For GPU build, it will avoid going over 4GB when multiple CUDA compatibility are specified.
To fix #22390
PiperOrigin-RevId: 214764423
Diffstat (limited to 'tensorflow/tensorflow.bzl')
-rw-r--r-- | tensorflow/tensorflow.bzl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index d6c75d675c..8f8bfadf78 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -1693,6 +1693,29 @@ register_extension_info( label_regex_for_dep = "{extension_name}", ) +# Similar to py_test above, this macro is used to exclude dependencies for some py_binary +# targets in order to reduce the size of //tensorflow/tools/pip_package:simple_console_windows. +# See https://github.com/tensorflow/tensorflow/issues/22390 +def py_binary(name, deps = [], **kwargs): + # Add an extra target for dependencies to avoid nested select statement. + native.py_library( + name = name + "_deps", + deps = deps, + ) + native.py_binary( + name = name, + deps = select({ + "//conditions:default": [":" + name + "_deps"], + clean_dep("//tensorflow:no_tensorflow_py_deps"): [], + }), + **kwargs + ) + +register_extension_info( + extension_name = "py_binary", + label_regex_for_dep = "{extension_name}", +) + def tf_py_test( name, srcs, |