Fix dynamic kernels dependencies for python build and test rules.

Bazel does not allow python rules to directly depend on c++ rules.
So I have to separately manage static dependencies, unfortunately avoiding
"kernels" option for now.

PiperOrigin-RevId: 214532631
This commit is contained in:
Gunhan Gulsoy 2018-09-25 17:25:56 -07:00 committed by TensorFlower Gardener
parent 05d103bf25
commit f97610daf8
2 changed files with 13 additions and 3 deletions

View File

@ -144,6 +144,7 @@ load(
) )
load( load(
"//tensorflow/core:platform/default/build_config_root.bzl", "//tensorflow/core:platform/default/build_config_root.bzl",
"if_dynamic_kernels",
"if_static", "if_static",
"tf_cuda_tests_tags", "tf_cuda_tests_tags",
) )
@ -1292,8 +1293,8 @@ cc_library(
# This includes implementations of all kernels built into TensorFlow. # This includes implementations of all kernels built into TensorFlow.
cc_library( cc_library(
name = "all_kernels", name = "all_kernels_statically_linked",
visibility = ["//visibility:public"], visibility = ["//visibility:private"],
deps = [ deps = [
"//tensorflow/core/kernels:array", "//tensorflow/core/kernels:array",
"//tensorflow/core/kernels:audio", "//tensorflow/core/kernels:audio",
@ -1372,6 +1373,15 @@ cc_library(
]), ]),
) )
cc_library(
name = "all_kernels",
visibility = ["//visibility:public"],
deps = if_dynamic_kernels(
[],
otherwise = [":all_kernels_statically_linked"],
),
)
tf_cuda_library( tf_cuda_library(
name = "tensorflow_opensource", name = "tensorflow_opensource",
copts = tf_copts(), copts = tf_copts(),

View File

@ -1677,7 +1677,7 @@ def py_test(deps = [], data = [], kernels = [], **kwargs):
deps = select({ deps = select({
"//conditions:default": deps, "//conditions:default": deps,
clean_dep("//tensorflow:no_tensorflow_py_deps"): [], clean_dep("//tensorflow:no_tensorflow_py_deps"): [],
}) + tf_binary_dynamic_kernel_deps(kernels), }),
data = data + select({ data = data + select({
"//conditions:default": [], "//conditions:default": [],
clean_dep("//tensorflow:no_tensorflow_py_deps"): ["//tensorflow/tools/pip_package:win_pip_package_marker"], clean_dep("//tensorflow:no_tensorflow_py_deps"): ["//tensorflow/tools/pip_package:win_pip_package_marker"],