Upgrade and rename external dependency grpc in workspace for bazel.

Fixes #33758

Downstream projects depending on TensorFlow: If bazel complains, please substitute `@zlib_archive` with `@zlib`, and `@grpc` with `@com_github_grpc_grpc` in WORKPLACE.

PiperOrigin-RevId: 295824868
Change-Id: If2259d59e9d82543369e5670916b1398374c9889
This commit is contained in:
A. Unique TensorFlower 2020-02-18 14:36:47 -08:00 committed by TensorFlower Gardener
parent b391cb55c2
commit f396035891
18 changed files with 91 additions and 48 deletions

View File

@ -113,3 +113,28 @@ http_archive(
"https://storage.googleapis.com/download.tensorflow.org/models/speech_commands_v0.01.zip", "https://storage.googleapis.com/download.tensorflow.org/models/speech_commands_v0.01.zip",
], ],
) )
# Required for dependency @com_github_grpc_grpc
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)
apple_rules_dependencies()
load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)
apple_support_dependencies()
load("@upb//bazel:repository_defs.bzl", "bazel_version_repository")
bazel_version_repository(name = "bazel_version")

View File

@ -547,8 +547,8 @@ cc_library(
name = "grpc", name = "grpc",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = select({ deps = select({
":linux_s390x": ["@grpc//:grpc_unsecure"], ":linux_s390x": ["@com_github_grpc_grpc//:grpc_unsecure"],
"//conditions:default": ["@grpc"], "//conditions:default": ["@com_github_grpc_grpc//:grpc"],
}), }),
) )
@ -556,8 +556,8 @@ cc_library(
name = "grpc++", name = "grpc++",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = select({ deps = select({
":linux_s390x": ["@grpc//:grpc++_unsecure"], ":linux_s390x": ["@com_github_grpc_grpc//:grpc++_unsecure"],
"//conditions:default": ["@grpc//:grpc++"], "//conditions:default": ["@com_github_grpc_grpc//:grpc++"],
}), }),
) )

View File

@ -1997,7 +1997,7 @@ cc_library(
"//tensorflow/core/util:env_var", "//tensorflow/core/util:env_var",
"//tensorflow/core/util:reporter", # TODO(gunan): REMOVE as soon as cc_shared_library is supported. "//tensorflow/core/util:reporter", # TODO(gunan): REMOVE as soon as cc_shared_library is supported.
"@snappy", "@snappy",
"@zlib_archive//:zlib", "@zlib",
"@double_conversion//:double-conversion", "@double_conversion//:double-conversion",
"@com_google_protobuf//:protobuf", "@com_google_protobuf//:protobuf",
] + tf_protos_all_impl() + tf_protos_grappler_impl() + tf_protos_profiler_impl(), ] + tf_protos_all_impl() + tf_protos_grappler_impl() + tf_protos_profiler_impl(),
@ -3077,7 +3077,7 @@ tf_cc_tests(
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_absl//absl/types:optional", "@com_google_absl//absl/types:optional",
"@zlib_archive//:zlib", "@zlib",
], ],
) )

View File

@ -38,7 +38,7 @@ package(
# Check that tensorflow/core:tensorflow does not depend on grpc. # Check that tensorflow/core:tensorflow does not depend on grpc.
check_deps( check_deps(
name = "core_tensorflow_check_deps", name = "core_tensorflow_check_deps",
disallowed_deps = ["@grpc//:grpc++"], disallowed_deps = ["@com_github_grpc_grpc//:grpc++"],
deps = ["//tensorflow/core:tensorflow"], deps = ["//tensorflow/core:tensorflow"],
) )

View File

@ -240,7 +240,7 @@ cc_library(
hdrs = ["zlib_compression_options.h"], hdrs = ["zlib_compression_options.h"],
deps = [ deps = [
"//tensorflow/core/platform:types", "//tensorflow/core/platform:types",
"@zlib_archive//:zlib", "@zlib",
], ],
alwayslink = True, alwayslink = True,
) )
@ -258,7 +258,7 @@ cc_library(
"//tensorflow/core/platform:macros", "//tensorflow/core/platform:macros",
"//tensorflow/core/platform:strcat", "//tensorflow/core/platform:strcat",
"//tensorflow/core/platform:types", "//tensorflow/core/platform:types",
"@zlib_archive//:zlib", "@zlib",
], ],
alwayslink = True, alwayslink = True,
) )
@ -275,7 +275,7 @@ cc_library(
"//tensorflow/core/platform:env", "//tensorflow/core/platform:env",
"//tensorflow/core/platform:macros", "//tensorflow/core/platform:macros",
"//tensorflow/core/platform:types", "//tensorflow/core/platform:types",
"@zlib_archive//:zlib", "@zlib",
], ],
alwayslink = True, alwayslink = True,
) )

View File

@ -22,7 +22,7 @@ cc_library(
"//tensorflow/core/platform:stringpiece", "//tensorflow/core/platform:stringpiece",
"//tensorflow/core/platform:types", "//tensorflow/core/platform:types",
"@com_google_absl//absl/base", "@com_google_absl//absl/base",
"@zlib_archive//:zlib", "@zlib",
], ],
) )

View File

@ -899,7 +899,7 @@ tf_cc_tests(
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_absl//absl/types:optional", "@com_google_absl//absl/types:optional",
"@zlib_archive//:zlib", "@zlib",
], ],
) )

View File

@ -153,7 +153,7 @@ cc_library(
"@farmhash_archive//:farmhash", "@farmhash_archive//:farmhash",
"@fft2d", "@fft2d",
"@highwayhash//:sip_hash", "@highwayhash//:sip_hash",
"@zlib_archive//:zlib", "@zlib",
], ],
) )
@ -178,7 +178,7 @@ cc_library(
copts = tf_copts(), copts = tf_copts(),
deps = [ deps = [
"@png", "@png",
"@zlib_archive//:zlib", "@zlib",
], ],
) )

View File

@ -1758,7 +1758,7 @@ def transitive_hdrs(name, deps = [], **kwargs):
# #
# For: # For:
# * Eigen: it's a header-only library. Add it directly to your deps. # * Eigen: it's a header-only library. Add it directly to your deps.
# * GRPC: add a direct dep on @grpc//:grpc++_public_hdrs. # * GRPC: add a direct dep on @com_github_grpc_grpc//:grpc++_public_hdrs.
# #
def cc_header_only_library(name, deps = [], includes = [], extra_deps = [], **kwargs): def cc_header_only_library(name, deps = [], includes = [], extra_deps = [], **kwargs):
_transitive_hdrs(name = name + "_gather", deps = deps) _transitive_hdrs(name = name + "_gather", deps = deps)

View File

@ -357,12 +357,32 @@ do_external_licenses_check(){
# Blacklist # Blacklist
echo ${MISSING_LICENSES_FILE} echo ${MISSING_LICENSES_FILE}
grep -e "@bazel_tools//third_party/" -e "@bazel_tools//tools" -e "@local" -e "@com_google_absl//absl" -e "@org_tensorflow//" -e "@com_github_googlecloudplatform_google_cloud_cpp//google" -v ${MISSING_LICENSES_FILE} > temp.txt grep \
-e "@bazel_tools//third_party/" \
-e "@bazel_tools//tools" \
-e "@local" \
-e "@com_google_absl//absl" \
-e "@org_tensorflow//" \
-e "@com_github_googlecloudplatform_google_cloud_cpp//google" \
-e "@com_github_grpc_grpc//src/compiler" \
-e "@platforms//os" \
-v ${MISSING_LICENSES_FILE} > temp.txt
mv temp.txt ${MISSING_LICENSES_FILE} mv temp.txt ${MISSING_LICENSES_FILE}
# Whitelist # Whitelist
echo ${EXTRA_LICENSE_FILE} echo ${EXTRA_LICENSE_FILE}
grep -e "//third_party/mkl_dnn" -e "@bazel_tools//src" -e "@bazel_tools//tools/" -e "@org_tensorflow//tensorflow" -e "@com_google_absl//" -e "//external" -e "@local" -e "@com_github_googlecloudplatform_google_cloud_cpp//" -e "@embedded_jdk//" -e "^//$" -v ${EXTRA_LICENSES_FILE} > temp.txt grep \
-e "//third_party/mkl_dnn" \
-e "@bazel_tools//src" \
-e "@bazel_tools//tools/" \
-e "@org_tensorflow//tensorflow" \
-e "@com_google_absl//" \
-e "//external" \
-e "@local" \
-e "@com_github_googlecloudplatform_google_cloud_cpp//" \
-e "@embedded_jdk//" \
-e "^//$" \
-v ${EXTRA_LICENSES_FILE} > temp.txt
mv temp.txt ${EXTRA_LICENSES_FILE} mv temp.txt ${EXTRA_LICENSES_FILE}

View File

@ -164,7 +164,7 @@ genrule(
"@six_archive//:LICENSE", "@six_archive//:LICENSE",
"@snappy//:COPYING", "@snappy//:COPYING",
"@sobol_data//:LICENSE", "@sobol_data//:LICENSE",
"@zlib_archive//:zlib.h", "@zlib//:zlib.h",
] + select({ ] + select({
"//tensorflow:android": [], "//tensorflow:android": [],
"//tensorflow:ios": [], "//tensorflow:ios": [],
@ -200,10 +200,10 @@ genrule(
"//third_party/mkl:LICENSE", "//third_party/mkl:LICENSE",
"//third_party/mkl_dnn:LICENSE", "//third_party/mkl_dnn:LICENSE",
]) + if_not_system_lib( ]) + if_not_system_lib(
"grpc", "com_github_grpc_grpc",
[ [
"@grpc//:LICENSE", "@com_github_grpc_grpc//:LICENSE",
"@grpc//third_party/address_sorting:LICENSE", "@com_github_grpc_grpc//third_party/address_sorting:LICENSE",
], ],
) + tf_additional_license_deps(), ) + tf_additional_license_deps(),
outs = ["THIRD_PARTY_TF_C_LICENSES"], outs = ["THIRD_PARTY_TF_C_LICENSES"],
@ -228,8 +228,8 @@ genrule(
"@fft2d//:fft2d/readme2d.txt", "@fft2d//:fft2d/readme2d.txt",
"@gemmlowp//:LICENSE", "@gemmlowp//:LICENSE",
"@gif//:COPYING", "@gif//:COPYING",
"@grpc//:LICENSE", "@com_github_grpc_grpc//:LICENSE",
"@grpc//third_party/address_sorting:LICENSE", "@com_github_grpc_grpc//third_party/address_sorting:LICENSE",
"@highwayhash//:LICENSE", "@highwayhash//:LICENSE",
"@icu//:icu4j/main/shared/licenses/LICENSE", "@icu//:icu4j/main/shared/licenses/LICENSE",
"@libjpeg_turbo//:LICENSE.md", "@libjpeg_turbo//:LICENSE.md",
@ -244,7 +244,7 @@ genrule(
"@six_archive//:LICENSE", "@six_archive//:LICENSE",
"@snappy//:COPYING", "@snappy//:COPYING",
"@sobol_data//:LICENSE", "@sobol_data//:LICENSE",
"@zlib_archive//:zlib.h", "@zlib//:zlib.h",
] + select({ ] + select({
"//tensorflow:android": [], "//tensorflow:android": [],
"//tensorflow:ios": [], "//tensorflow:ios": [],

View File

@ -190,7 +190,7 @@ filegroup(
"@sobol_data//:LICENSE", "@sobol_data//:LICENSE",
"@swig//:LICENSE", "@swig//:LICENSE",
"@termcolor_archive//:COPYING.txt", "@termcolor_archive//:COPYING.txt",
"@zlib_archive//:zlib.h", "@zlib//:zlib.h",
] + select({ ] + select({
"//tensorflow:android": [], "//tensorflow:android": [],
"//tensorflow:ios": [], "//tensorflow:ios": [],
@ -235,10 +235,10 @@ filegroup(
"@absl_py//absl/third_party/unittest3_backport:LICENSE", "@absl_py//absl/third_party/unittest3_backport:LICENSE",
], ],
) + if_not_system_lib( ) + if_not_system_lib(
"grpc", "com_github_grpc_grpc",
[ [
"@grpc//:LICENSE", "@com_github_grpc_grpc//:LICENSE",
"@grpc//third_party/address_sorting:LICENSE", "@com_github_grpc_grpc//third_party/address_sorting:LICENSE",
], ],
) + if_ngraph([ ) + if_ngraph([
"@ngraph//:LICENSE", "@ngraph//:LICENSE",

View File

@ -476,8 +476,6 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
PROTOBUF_SHA256 = "b9e92f9af8819bbbc514e2902aec860415b70209f31dfc8c4fa72515a5df9d59" PROTOBUF_SHA256 = "b9e92f9af8819bbbc514e2902aec860415b70209f31dfc8c4fa72515a5df9d59"
PROTOBUF_STRIP_PREFIX = "protobuf-310ba5ee72661c081129eb878c1bbcec936b20f0" PROTOBUF_STRIP_PREFIX = "protobuf-310ba5ee72661c081129eb878c1bbcec936b20f0"
# protobuf depends on @zlib, it has to be renamed to @zlib_archive because "zlib" is already
# defined using bind for grpc.
PROTOBUF_PATCH = "//third_party/protobuf:protobuf.patch" PROTOBUF_PATCH = "//third_party/protobuf:protobuf.patch"
tf_http_archive( tf_http_archive(
@ -562,20 +560,20 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
# WARNING: make sure ncteisen@ and vpai@ are cc-ed on any CL to change the below rule # WARNING: make sure ncteisen@ and vpai@ are cc-ed on any CL to change the below rule
tf_http_archive( tf_http_archive(
name = "grpc", name = "com_github_grpc_grpc",
sha256 = "67a6c26db56f345f7cee846e681db2c23f919eba46dd639b09462d1b6203d28c", sha256 = "b956598d8cbe168b5ee717b5dafa56563eb5201a947856a6688bbeac9cac4e1f",
strip_prefix = "grpc-4566c2a29ebec0835643b972eb99f4306c4234a3", strip_prefix = "grpc-b54a5b338637f92bfcf4b0bc05e0f57a5fd8fadd",
system_build_file = clean_dep("//third_party/systemlibs:grpc.BUILD"), system_build_file = clean_dep("//third_party/systemlibs:grpc.BUILD"),
urls = [ urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/grpc/grpc/archive/4566c2a29ebec0835643b972eb99f4306c4234a3.tar.gz", "https://storage.googleapis.com/mirror.tensorflow.org/github.com/grpc/grpc/archive/b54a5b338637f92bfcf4b0bc05e0f57a5fd8fadd.tar.gz",
"https://github.com/grpc/grpc/archive/4566c2a29ebec0835643b972eb99f4306c4234a3.tar.gz", "https://github.com/grpc/grpc/archive/b54a5b338637f92bfcf4b0bc05e0f57a5fd8fadd.tar.gz",
], ],
) )
tf_http_archive( tf_http_archive(
name = "com_github_nanopb_nanopb", name = "com_github_nanopb_nanopb",
sha256 = "8bbbb1e78d4ddb0a1919276924ab10d11b631df48b657d960e0c795a25515735", sha256 = "8bbbb1e78d4ddb0a1919276924ab10d11b631df48b657d960e0c795a25515735",
build_file = "@grpc//third_party:nanopb.BUILD", build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD",
strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b", strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b",
urls = [ urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz", "https://storage.googleapis.com/mirror.tensorflow.org/github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz",
@ -649,7 +647,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
) )
tf_http_archive( tf_http_archive(
name = "zlib_archive", name = "zlib",
build_file = clean_dep("//third_party:zlib.BUILD"), build_file = clean_dep("//third_party:zlib.BUILD"),
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11", strip_prefix = "zlib-1.2.11",
@ -1071,21 +1069,21 @@ def tf_bind():
# Needed by Protobuf # Needed by Protobuf
native.bind( native.bind(
name = "grpc_cpp_plugin", name = "grpc_cpp_plugin",
actual = "@grpc//:grpc_cpp_plugin", actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
) )
native.bind( native.bind(
name = "grpc_python_plugin", name = "grpc_python_plugin",
actual = "@grpc//:grpc_python_plugin", actual = "@com_github_grpc_grpc//src/compiler:grpc_python_plugin",
) )
native.bind( native.bind(
name = "grpc_lib", name = "grpc_lib",
actual = "@grpc//:grpc++", actual = "@com_github_grpc_grpc//:grpc++",
) )
native.bind( native.bind(
name = "grpc_lib_unsecure", name = "grpc_lib_unsecure",
actual = "@grpc//:grpc++_unsecure", actual = "@com_github_grpc_grpc//:grpc++_unsecure",
) )
# Needed by gRPC # Needed by gRPC
@ -1134,5 +1132,5 @@ def tf_bind():
# Needed by gRPC # Needed by gRPC
native.bind( native.bind(
name = "zlib", name = "zlib",
actual = "@zlib_archive//:zlib", actual = "@zlib",
) )

View File

@ -321,7 +321,7 @@ cc_library(
}), }),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"@zlib_archive//:zlib", "@zlib",
] + select({ ] + select({
"@org_tensorflow//tensorflow:ios": [], "@org_tensorflow//tensorflow:ios": [],
"@org_tensorflow//tensorflow:windows": [], "@org_tensorflow//tensorflow:windows": [],

View File

@ -3752,7 +3752,7 @@ cc_library(
deps = [ deps = [
":config", ":config",
":demangle", ":demangle",
"@zlib_archive//:zlib", "@zlib",
], ],
) )

View File

@ -54,7 +54,7 @@ cc_library(
"//conditions:default": ["-lm"], "//conditions:default": ["-lm"],
}), }),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["@zlib_archive//:zlib"], deps = ["@zlib"],
) )
genrule( genrule(

View File

@ -7,7 +7,7 @@ index 2fb26050..c2744d5b 100644
################################################################################ ################################################################################
-ZLIB_DEPS = ["@zlib//:zlib"] -ZLIB_DEPS = ["@zlib//:zlib"]
+ZLIB_DEPS = ["@zlib_archive//:zlib"] +ZLIB_DEPS = ["@zlib"]
################################################################################ ################################################################################
# Protobuf Runtime Library # Protobuf Runtime Library

View File

@ -14,6 +14,7 @@ VALID_LIBS = [
"boringssl", "boringssl",
"com_github_googleapis_googleapis", "com_github_googleapis_googleapis",
"com_github_googlecloudplatform_google_cloud_cpp", "com_github_googlecloudplatform_google_cloud_cpp",
"com_github_grpc_grpc",
"com_google_protobuf", "com_google_protobuf",
"com_googlesource_code_re2", "com_googlesource_code_re2",
"curl", "curl",
@ -24,7 +25,6 @@ VALID_LIBS = [
"functools32_archive", "functools32_archive",
"gast_archive", "gast_archive",
"gif", "gif",
"grpc",
"hwloc", "hwloc",
"icu", "icu",
"jsoncpp_git", "jsoncpp_git",
@ -42,7 +42,7 @@ VALID_LIBS = [
"swig", "swig",
"termcolor_archive", "termcolor_archive",
"wrapt", "wrapt",
"zlib_archive", "zlib",
] ]
def auto_configure_fail(msg): def auto_configure_fail(msg):