Skip to content

Commit

Permalink
deps: Update protbuf to v23.1 (envoyproxy#28075)
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Avlasov <yavlasov@google.com>

Signed-off-by: yanavlasov <yavlasov@google.com>
  • Loading branch information
yanavlasov authored and phlax committed Oct 9, 2023
1 parent 2dee2ab commit 3d4696f
Show file tree
Hide file tree
Showing 37 changed files with 346 additions and 244 deletions.
2 changes: 2 additions & 0 deletions api/bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def api_dependencies():
)
external_http_archive(
name = "com_envoyproxy_protoc_gen_validate",
patch_args = ["-p1"],
patches = ["@envoy//bazel:pgv.patch"],
)
external_http_archive(
name = "com_google_googleapis",
Expand Down
6 changes: 3 additions & 3 deletions api/bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_desc = "xDS API Working Group (xDS-WG)",
project_url = "https://github.com/cncf/xds",
# During the UDPA -> xDS migration, we aren't working with releases.
version = "1e77728a1eaa11d6c931ec2ccd6e95f516a7ef94",
sha256 = "57d8a0d8c8412dbe31dae34b576498c5f8b1fd523a2fcd4f5e5154870b043fe8",
release_date = "2022-05-20",
version = "e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7",
sha256 = "0d33b83f8c6368954e72e7785539f0d272a8aba2f6e2e336ed15fd1514bc9899",
release_date = "2023-06-07",
strip_prefix = "xds-{version}",
urls = ["https://github.com/cncf/xds/archive/{version}.tar.gz"],
use_category = ["api"],
Expand Down
9 changes: 9 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -808,3 +808,12 @@ platform(
"@build_bazel_apple_support//constraints:device",
],
)

# A dependency required by python protobuf
# Envoy does not have any C++ code that includes python.h so this dummy
# target is enough. However if such code is added in the future when this
# should be changed to alias "@system_python//:python_headers"
cc_library(
name = "python_headers",
visibility = ["//visibility:public"],
)
24 changes: 24 additions & 0 deletions bazel/abseil.patch
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,27 @@ index f2fa08977f..8e97fdb0ca 100644

private:
friend class flags_internal::PrivateHandleAccessor;
diff --git a/absl/debugging/internal/stacktrace_config.h b/absl/debugging/internal/stacktrace_config.h
--- a/absl/debugging/internal/stacktrace_config.h 2023-06-30 13:00:30.464949167 +0000
+++ b/absl/debugging/internal/stacktrace_config.h 2023-06-30 13:01:11.844904587 +0000
@@ -40,7 +40,7 @@
// Emscripten stacktraces rely on JS. Do not use them in standalone mode.
#elif defined(__EMSCRIPTEN__) && !defined(STANDALONE_WASM)
#define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_emscripten-inl.inc"
+ "absl/debugging/internal/stacktrace_unimplemented-inl.inc"

#elif defined(__linux__) && !defined(__ANDROID__)

diff --git a/absl/debugging/symbolize.cc b/absl/debugging/symbolize.cc
--- a/absl/debugging/symbolize.cc 2023-06-30 13:11:48.688535829 +0000
+++ b/absl/debugging/symbolize.cc 2023-06-30 13:12:03.960525578 +0000
@@ -37,7 +37,7 @@
#elif defined(__APPLE__)
#include "absl/debugging/symbolize_darwin.inc"
#elif defined(ABSL_INTERNAL_HAVE_SYMBOLIZE_WASM)
-#include "absl/debugging/symbolize_emscripten.inc"
+#include "absl/debugging/symbolize_unimplemented.inc"
#else
#include "absl/debugging/symbolize_unimplemented.inc"
#endif
3 changes: 2 additions & 1 deletion bazel/envoy_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def envoy_proto_descriptor(name, out, srcs = [], external_deps = []):
include_paths.append("external/com_google_googleapis")

if "well_known_protos" in external_deps:
srcs.append("@com_google_protobuf//:well_known_protos")
srcs.append("@com_google_protobuf//:well_known_type_protos")
srcs.append("@com_google_protobuf//:descriptor_proto_srcs")
include_paths.append("external/com_google_protobuf/src")

options = ["--include_imports"]
Expand Down
13 changes: 13 additions & 0 deletions bazel/pgv.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/templates/cc/register.go 2023-06-22 14:25:05.776175085 +0000
+++ b/templates/cc/register.go 2023-06-22 14:26:33.008090583 +0000
@@ -116,6 +116,10 @@
func (fns CCFuncs) methodName(name interface{}) string {
nameStr := fmt.Sprintf("%s", name)
switch nameStr {
+ case "concept":
+ return "concept_"
+ case "requires":
+ return "requires_"
case "const":
return "const_"
case "inline":
96 changes: 55 additions & 41 deletions bazel/protobuf.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,19 @@ diff --git a/BUILD.bazel b/BUILD.bazel
index 0f6e41e3a..c0d2bbccf 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -138,7 +138,7 @@ cc_library(
visibility = ["//visibility:public"],
deps = [":protobuf_lite"] + select({
"//build_defs:config_msvc": [],
- "//conditions:default": ["@zlib//:zlib"],
+ "//conditions:default": ["//external:zlib"],
}),
)

@@ -454,14 +454,79 @@ cc_library(
deps = [":protobuf"],
visibility = ["//visibility:public"],
)

+# Envoy: Patch
+
cc_binary(
- name = "protoc",
+ name = "compiled_protoc",
srcs = ["src/google/protobuf/compiler/main.cc"],
linkopts = LINK_OPTS + PROTOC_LINK_OPTS,
copts = COPTS,
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
deps = [":protoc_lib"],
deps = ["//src/google/protobuf/compiler:protoc_lib"],
)

+# Lifted from `rules_proto`
Expand Down Expand Up @@ -83,52 +74,75 @@ index 0f6e41e3a..c0d2bbccf 100644
+
+alias(
+ name = "protobuf_python_genproto",
+ actual = "well_known_types_py_pb2_genproto",
+ actual = "//python:well_known_types_py_pb2_genproto",
+ visibility = ["//visibility:public"],
+)
+
+# /Envoy: Patch
+
################################################################################
# Tests
################################################################################
@@ -755,7 +820,7 @@ cc_test(
"@com_google_googletest//:gtest_main",
] + select({
"//build_defs:config_msvc": [],
- "//conditions:default": ["@zlib//:zlib"],
+ "//conditions:default": ["//external:zlib"],
}),
)

cc_binary(
name = "protoc_static",
copts = COPTS,
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index e7555ee10..a93beb1c5 100644
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -31,3 +31,10 @@
# Copyright 2007 Google Inc. All Rights Reserved.

__version__ = '4.21.12'
__version__ = '4.23.1'
+
+
+if __name__ != '__main__':
+ try:
+ __import__('pkg_resources').declare_namespace(__name__)
+ except ImportError:
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc
index 9993811dc..d80006af7 100644
--- a/src/google/protobuf/generated_message_tctable_lite.cc
+++ b/src/google/protobuf/generated_message_tctable_lite.cc
@@ -343,11 +343,6 @@ const char* TcParser::MiniParse(PROTOBUF_TC_PARAM_DECL) {
diff --git a/src/google/protobuf/io/BUILD.bazel b/src/google/protobuf/io/BUILD.bazel
--- a/src/google/protobuf/io/BUILD.bazel
+++ b/src/google/protobuf/io/BUILD.bazel
@@ -138,7 +138,7 @@ cc_library(
"@com_google_absl//absl/log:absl_log",
] + select({
"//build_defs:config_msvc": [],
- "//conditions:default": ["@zlib//:zlib"],
+ "//conditions:default": ["//external:zlib"],
}),
)

diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
--- a/src/google/protobuf/port_def.inc 2023-06-27 01:17:34.917105764 +0000
+++ b/src/google/protobuf/port_def.inc 2023-06-27 01:18:12.069060142 +0000
@@ -1004,7 +1004,7 @@
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
// Turn on -Wdeprecated-enum-enum-conversion. This deprecation comes in C++20
// via http://wg21.link/p1120r0.
-#pragma clang diagnostic error "-Wdeprecated-enum-enum-conversion"
+// #pragma clang diagnostic error "-Wdeprecated-enum-enum-conversion"
// This error has been generally flaky, but we need to disable it specifically
// to fix https://github.com/protocolbuffers/protobuf/issues/12313
#pragma clang diagnostic ignored "-Wunused-parameter"
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
--- a/src/google/protobuf/map.h 2023-06-30 14:32:34.892148233 +0000
+++ b/src/google/protobuf/map.h 2023-06-30 14:35:37.447992493 +0000
@@ -883,7 +883,7 @@
TreeConvert(b);
}
ABSL_DCHECK(TableEntryIsTree(b))
- << (void*)table_[b] << " " << (uintptr_t)table_[b];
+ << reinterpret_cast<void*>(table_[b]) << " " << static_cast<uintptr_t>(table_[b]);
InsertUniqueInTree(b, node);
index_of_first_non_null_ = (std::min)(index_of_first_non_null_, b);
}
diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h
--- a/src/google/protobuf/map_field.h 2023-06-30 17:14:18.934528580 +0000
+++ b/src/google/protobuf/map_field.h 2023-06-30 17:14:52.098500807 +0000
@@ -345,7 +345,7 @@

namespace {
protected:
// "protected" stops users from deleting a `MapFieldBase *`
- ~MapFieldBase();
+ virtual ~MapFieldBase();

-// Offset returns the address `offset` bytes after `base`.
-inline void* Offset(void* base, uint32_t offset) {
- return static_cast<uint8_t*>(base) + offset;
-}
-
// InvertPacked changes tag bits from the given wire type to length
// delimited. This is the difference expected between packed and non-packed
// repeated fields.
public:
// Returns reference to internal repeated field. Data written using
16 changes: 15 additions & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def envoy_repo():
# Bazel native C++ dependencies. For the dependencies that doesn't provide autoconf/automake builds.
def _cc_deps():
external_http_archive("grpc_httpjson_transcoding")
external_http_archive("com_google_protoconverter")
native.bind(
name = "path_matcher",
actual = "@grpc_httpjson_transcoding//src:path_matcher",
Expand Down Expand Up @@ -260,6 +261,8 @@ def envoy_dependencies(skip_targets = []):
external_http_archive("proxy_wasm_rust_sdk")
_com_google_cel_cpp()
_com_github_google_perfetto()
_utf8_range()
_rules_ruby()
external_http_archive("com_github_google_flatbuffers")
external_http_archive("bazel_toolchains")
external_http_archive("bazel_compdb")
Expand Down Expand Up @@ -847,7 +850,7 @@ def _com_google_protobuf():
# https://github.com/google/protobuf/blob/v3.6.1/util/python/BUILD#L6-L9
native.bind(
name = "python_headers",
actual = "@com_google_protobuf//util/python:python_headers",
actual = "//bazel:python_headers",
)

def _io_opencensus_cpp():
Expand Down Expand Up @@ -1024,6 +1027,11 @@ def _com_github_grpc_grpc():
actual = "@com_github_grpc_grpc//test/core/tsi/alts/fake_handshaker:transport_security_common_proto",
)

native.bind(
name = "upb_collections_lib",
actual = "@upb//:collections",
)

native.bind(
name = "upb_lib_descriptor",
actual = "@upb//:descriptor_upb_proto",
Expand Down Expand Up @@ -1296,6 +1304,12 @@ def _com_github_fdio_vpp_vcl():
patches = ["@envoy//bazel/foreign_cc:vpp_vcl.patch"],
)

def _utf8_range():
external_http_archive("utf8_range")

def _rules_ruby():
external_http_archive("rules_ruby")

def _foreign_cc_dependencies():
external_http_archive("rules_foreign_cc")

Expand Down
Loading

0 comments on commit 3d4696f

Please # to comment.