Upgrade protobuf to 3.8.0
The custom commit contains a fix to make protobuf.bzl compatible with Bazel 0.26 or later version. Also fix WORKSPACE file to make sure tf_workspace() always takes priority over dependency definitions of other repositories. PiperOrigin-RevId: 253970221
This commit is contained in:
parent
a98b7819eb
commit
508f76b1d9
14
WORKSPACE
14
WORKSPACE
@ -12,6 +12,12 @@ http_archive(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Load tf_workspace() before loading dependencies for other repository so that
|
||||||
|
# dependencies like com_google_protobuf won't be overridden.
|
||||||
|
load("//tensorflow:workspace.bzl", "tf_workspace")
|
||||||
|
# Please add all new TensorFlow dependencies in workspace.bzl.
|
||||||
|
tf_workspace()
|
||||||
|
|
||||||
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
|
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
|
||||||
|
|
||||||
closure_repositories()
|
closure_repositories()
|
||||||
@ -83,15 +89,15 @@ swift_rules_dependencies()
|
|||||||
load("//tensorflow:version_check.bzl", "check_bazel_version_at_least")
|
load("//tensorflow:version_check.bzl", "check_bazel_version_at_least")
|
||||||
check_bazel_version_at_least("0.19.0")
|
check_bazel_version_at_least("0.19.0")
|
||||||
|
|
||||||
load("//tensorflow:workspace.bzl", "tf_workspace")
|
|
||||||
|
|
||||||
load("//third_party/android:android_configure.bzl", "android_configure")
|
load("//third_party/android:android_configure.bzl", "android_configure")
|
||||||
android_configure(name="local_config_android")
|
android_configure(name="local_config_android")
|
||||||
load("@local_config_android//:android.bzl", "android_workspace")
|
load("@local_config_android//:android.bzl", "android_workspace")
|
||||||
android_workspace()
|
android_workspace()
|
||||||
|
|
||||||
# Please add all new TensorFlow dependencies in workspace.bzl.
|
# If a target is bound twice, the later one wins, so we have to do tf bindings
|
||||||
tf_workspace()
|
# at the end of the WORKSPACE file.
|
||||||
|
load("//tensorflow:workspace.bzl", "tf_bind")
|
||||||
|
tf_bind()
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "inception_v1",
|
name = "inception_v1",
|
||||||
|
@ -371,16 +371,21 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
# 5902e759108d14ee8e6b0b07653dac2f4e70ac73 is based on 3.7.1 with a fix for BUILD file.
|
# 310ba5ee72661c081129eb878c1bbcec936b20f0 is based on 3.8.0 with a fix for protobuf.bzl.
|
||||||
PROTOBUF_URLS = [
|
PROTOBUF_URLS = [
|
||||||
"http://mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/5902e759108d14ee8e6b0b07653dac2f4e70ac73.tar.gz",
|
"http://mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/310ba5ee72661c081129eb878c1bbcec936b20f0.tar.gz",
|
||||||
"https://github.com/protocolbuffers/protobuf/archive/5902e759108d14ee8e6b0b07653dac2f4e70ac73.tar.gz",
|
"https://github.com/protocolbuffers/protobuf/archive/310ba5ee72661c081129eb878c1bbcec936b20f0.tar.gz",
|
||||||
]
|
]
|
||||||
PROTOBUF_SHA256 = "1c020fafc84acd235ec81c6aac22d73f23e85a700871466052ff231d69c1b17a"
|
PROTOBUF_SHA256 = "b9e92f9af8819bbbc514e2902aec860415b70209f31dfc8c4fa72515a5df9d59"
|
||||||
PROTOBUF_STRIP_PREFIX = "protobuf-5902e759108d14ee8e6b0b07653dac2f4e70ac73"
|
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"
|
||||||
|
|
||||||
tf_http_archive(
|
tf_http_archive(
|
||||||
name = "protobuf_archive",
|
name = "protobuf_archive",
|
||||||
|
patch_file = PROTOBUF_PATCH,
|
||||||
sha256 = PROTOBUF_SHA256,
|
sha256 = PROTOBUF_SHA256,
|
||||||
strip_prefix = PROTOBUF_STRIP_PREFIX,
|
strip_prefix = PROTOBUF_STRIP_PREFIX,
|
||||||
system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
|
system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
|
||||||
@ -395,6 +400,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
|
|||||||
# Unfortunately there is no way to alias http_archives at the moment.
|
# Unfortunately there is no way to alias http_archives at the moment.
|
||||||
tf_http_archive(
|
tf_http_archive(
|
||||||
name = "com_google_protobuf",
|
name = "com_google_protobuf",
|
||||||
|
patch_file = PROTOBUF_PATCH,
|
||||||
sha256 = PROTOBUF_SHA256,
|
sha256 = PROTOBUF_SHA256,
|
||||||
strip_prefix = PROTOBUF_STRIP_PREFIX,
|
strip_prefix = PROTOBUF_STRIP_PREFIX,
|
||||||
system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
|
system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
|
||||||
@ -406,6 +412,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
|
|||||||
|
|
||||||
tf_http_archive(
|
tf_http_archive(
|
||||||
name = "com_google_protobuf_cc",
|
name = "com_google_protobuf_cc",
|
||||||
|
patch_file = PROTOBUF_PATCH,
|
||||||
sha256 = PROTOBUF_SHA256,
|
sha256 = PROTOBUF_SHA256,
|
||||||
strip_prefix = PROTOBUF_STRIP_PREFIX,
|
strip_prefix = PROTOBUF_STRIP_PREFIX,
|
||||||
system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
|
system_build_file = clean_dep("//third_party/systemlibs:protobuf.BUILD"),
|
||||||
@ -920,6 +927,8 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def tf_bind():
|
||||||
|
"""Bind targets for some external repositories"""
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# BIND DEFINITIONS
|
# BIND DEFINITIONS
|
||||||
#
|
#
|
||||||
|
22
third_party/protobuf/protobuf.patch
vendored
Normal file
22
third_party/protobuf/protobuf.patch
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
diff --git a/BUILD b/BUILD
|
||||||
|
index 2fb26050..c2744d5b 100644
|
||||||
|
--- a/BUILD
|
||||||
|
+++ b/BUILD
|
||||||
|
@@ -19,7 +19,7 @@ config_setting(
|
||||||
|
# ZLIB configuration
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
-ZLIB_DEPS = ["@zlib//:zlib"]
|
||||||
|
+ZLIB_DEPS = ["@zlib_archive//:zlib"]
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Protobuf Runtime Library
|
||||||
|
@@ -218,7 +218,7 @@ cc_library(
|
||||||
|
# TODO(keveman): Remove this target once the support gets added to Bazel.
|
||||||
|
cc_library(
|
||||||
|
name = "protobuf_headers",
|
||||||
|
- hdrs = glob(["src/**/*.h"]),
|
||||||
|
+ hdrs = glob(["src/**/*.h", "src/**/*.inc"]),
|
||||||
|
includes = ["src/"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user