Skip to content

Commit 4e82af4

Browse files
laramielcopybara-github
authored andcommitted
Update protobuf library version
As of Sept, upb has moved into protobuf; update to support that. This reworks how protos are generated to feel a bit closer to the aspect-like code generation of Bazel. Now each proto generator is registered, and each proto_library() rule will invoke all registered aspects; this will allow consistent and reliable invocation of protoc across all sub-repositories. The change permits removing duplicate .proto files from local_proto_mirror, and simplifies the boostrapping process. Also note, on windows the updated protobuf is more likely to trigger file not found issues due to path length; if this happens, add the bazel startup option: startup --output_user_root=C:/_out See also: bazelbuild/bazel#18683 protocolbuffers/protobuf#12947 grpc/grpc#33986 PiperOrigin-RevId: 588606143 Change-Id: Iafa5f16b0a9bbc1058a876c0cc739d82743f96a4
1 parent b179155 commit 4e82af4

File tree

65 files changed

+2237
-4923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2237
-4923
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.1.0
1+
6.4.0

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# build.
1717

1818
cmake_minimum_required(VERSION 3.24)
19-
project(tensorstore LANGUAGES CXX)
19+
project(tensorstore LANGUAGES C CXX)
2020

2121
# Enable CMP0077 (option honors variables) for subprojects.
2222
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
@@ -92,6 +92,7 @@ bazel_to_cmake(
9292
--ignore-library "//docs:doctest.bzl"
9393
--ignore-library "//bazel:non_compile.bzl"
9494
--ignore-library "@com_google_protobuf//:protobuf.bzl"
95+
--ignore-library "@rules_python//python:packaging.bzl"
9596
--bazelrc .bazelrc
9697
--module bazel_to_cmake.bzl_library.grpc_generate_cc
9798
--module bazel_to_cmake.bzl_library.local_mirror

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ load("//:external.bzl", "tensorstore_dependencies")
77
tensorstore_dependencies()
88

99
register_toolchains("@local_config_python//:py_toolchain")
10+
11+
# Register proto toolchains.
12+
load("@rules_proto//proto:repositories.bzl", "rules_proto_toolchains")
13+
14+
rules_proto_toolchains()

third_party/com_github_cncf_udpa/cmake_extra.BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# patching the repository.
1313

1414
load(
15-
"@com_google_protobuf_upb//bazel:upb_proto_library.bzl",
15+
"@com_google_protobuf//bazel:upb_proto_library.bzl",
1616
"upb_proto_library",
1717
"upb_proto_reflection_library",
1818
)

third_party/com_github_grpc_grpc/patches/update_build_system.diff

Lines changed: 145 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,114 @@
1515
# NOTE: The second patch to includes has no change, but is intended to signal
1616
# whether we still need a workaround in bazel_to_cmake/emit_cc.py
1717
#
18-
diff -u -Nur a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl
19-
--- a/bazel/grpc_build_system.bzl 2023-09-13 20:33:23.000000000 +0000
20-
+++ b/bazel/grpc_build_system.bzl 2023-10-04 01:16:42.011957527 +0000
21-
@@ -32,8 +32,14 @@
18+
diff -Nur a/BUILD b/BUILD
19+
--- a/BUILD 2023-09-13 13:33:23
20+
+++ b/BUILD 2023-12-04 22:12:55
21+
@@ -194,6 +194,13 @@
22+
)
23+
24+
config_setting(
25+
+ name = "mingw-gcc",
26+
+ flag_values = {
27+
+ "@bazel_tools//tools/cpp:compiler": "mingw-gcc",
28+
+ },
29+
+)
30+
+
31+
+config_setting(
32+
name = "mac_x86_64",
33+
values = {"cpu": "darwin_x86_64"},
34+
)
35+
@@ -1116,6 +1123,7 @@
36+
"//src/core:slice_refcount",
37+
"//src/core:status_helper",
38+
"//src/core:transport_fwd",
39+
+ "//src/core:notification",
40+
],
41+
)
42+
43+
@@ -1842,6 +1850,7 @@
44+
deps = [
45+
"gpr",
46+
"grpc_trace",
47+
+ "grpc_public_hdrs",
48+
],
49+
)
50+
51+
@@ -1924,6 +1933,8 @@
52+
"absl/memory",
53+
"absl/types:optional",
54+
"upb_lib",
55+
+ "upb_base",
56+
+ "upb_mem",
57+
"protobuf_headers",
58+
"absl/container:inlined_vector",
59+
],
60+
@@ -2075,6 +2086,7 @@
61+
external_deps = [
62+
"protobuf_headers",
63+
"protobuf",
64+
+ "absl/status",
65+
],
66+
language = "c++",
67+
public_hdrs = [
68+
@@ -2738,6 +2750,7 @@
69+
external_deps = [
70+
"absl/strings",
71+
"absl/strings:str_format",
72+
+ "absl/types:optional",
73+
],
74+
tags = ["nofixdeps"],
75+
visibility = ["@grpc:iomgr_buffer_list"],
76+
@@ -3016,6 +3029,7 @@
77+
"absl/types:variant",
78+
"upb_collections_lib",
79+
"upb_lib",
80+
+ "upb_base",
81+
],
82+
language = "c++",
83+
visibility = ["@grpc:client_channel"],
84+
@@ -3620,6 +3634,8 @@
85+
"upb_textformat_lib",
86+
"upb_json_lib",
87+
"upb_reflection",
88+
+ "upb_mem",
89+
+ "upb_base",
90+
],
91+
language = "c++",
92+
tags = ["nofixdeps"],
93+
@@ -3647,6 +3663,7 @@
94+
"protobuf_struct_upb",
95+
"protobuf_timestamp_upb",
96+
"ref_counted_ptr",
97+
+ ":server_address",
98+
"uri_parser",
99+
"work_serializer",
100+
"//src/core:default_event_engine",
101+
diff -Nur a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl
102+
--- a/bazel/grpc_build_system.bzl 2023-09-13 13:33:23
103+
+++ b/bazel/grpc_build_system.bzl 2023-12-04 22:07:56
104+
@@ -32,9 +32,15 @@
22105
load("//bazel:experiments.bzl", "EXPERIMENTS")
23106
load("//bazel:test_experiments.bzl", "TEST_EXPERIMENTS")
24107
load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library", "upb_proto_reflection_library")
25108
-load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
26109
-load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner")
27110
+# load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
28111
+# load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner")
29-
+
112+
30113
+def ios_unit_test(**kwargs):
31114
+ pass
32115
+
33116
+def ios_test_runner(**kwargs):
34117
+ pass
35-
118+
+
36119
# The set of pollers to test against if a test exercises polling
37120
POLLERS = ["epoll1", "poll"]
121+
38122
@@ -55,6 +61,12 @@
39123
"//conditions:default": [],
40124
})
41-
125+
42126
+def if_mingw(a):
43127
+ return select({
44128
+ "//:mingw-gcc": a,
@@ -75,71 +159,67 @@ diff -u -Nur a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl
75159
"size": size,
76160
"timeout": timeout,
77161
"exec_compatible_with": exec_compatible_with,
78-
diff -u -Nur a/BUILD b/BUILD
79-
--- a/BUILD 2023-09-13 20:33:23.000000000 +0000
80-
+++ b/BUILD 2023-10-04 01:20:07.264833917 +0000
81-
@@ -194,6 +194,13 @@
82-
)
83-
84-
config_setting(
85-
+ name = "mingw-gcc",
86-
+ flag_values = {
87-
+ "@bazel_tools//tools/cpp:compiler": "mingw-gcc",
88-
+ },
89-
+)
90-
+
91-
+config_setting(
92-
name = "mac_x86_64",
93-
values = {"cpu": "darwin_x86_64"},
94-
)
95-
@@ -1116,6 +1123,7 @@
96-
"//src/core:slice_refcount",
97-
"//src/core:status_helper",
98-
"//src/core:transport_fwd",
99-
+ "//src/core:notification",
162+
diff -Nur a/src/core/BUILD b/src/core/BUILD
163+
--- a/src/core/BUILD 2023-09-13 13:33:23
164+
+++ b/src/core/BUILD 2023-12-05 09:20:07
165+
@@ -271,6 +271,8 @@
166+
"absl/time",
167+
"absl/types:optional",
168+
"upb_lib",
169+
+ "upb_base",
170+
+ "upb_mem",
100171
],
101-
)
102-
103-
@@ -1842,6 +1850,7 @@
172+
language = "c++",
104173
deps = [
105-
"gpr",
106-
"grpc_trace",
107-
+ "grpc_public_hdrs",
174+
@@ -3125,6 +3127,7 @@
175+
"//:exec_ctx",
176+
"//:gpr",
177+
"//:tsi_base",
178+
+ "//:grpc_public_hdrs",
108179
],
109180
)
110-
111-
@@ -2075,6 +2084,7 @@
112-
external_deps = [
113-
"protobuf_headers",
114-
"protobuf",
115-
+ "absl/status",
181+
182+
@@ -3993,6 +3996,8 @@
183+
"absl/types:optional",
184+
"absl/types:variant",
185+
"upb_lib",
186+
+ "upb_mem",
187+
+ "upb_base",
116188
],
117189
language = "c++",
118-
public_hdrs = [
119-
@@ -2738,6 +2748,7 @@
120-
external_deps = [
121-
"absl/strings",
190+
deps = [
191+
@@ -4097,6 +4102,7 @@
122192
"absl/strings:str_format",
123-
+ "absl/types:optional",
193+
"absl/types:optional",
194+
"upb_lib",
195+
+ "upb_base",
196+
],
197+
language = "c++",
198+
deps = [
199+
@@ -4220,6 +4226,8 @@
200+
"re2",
201+
"upb_reflection",
202+
"upb_collections_lib",
203+
+ "upb_base",
204+
+ "upb_mem",
124205
],
206+
language = "c++",
125207
tags = ["nofixdeps"],
126-
visibility = ["@grpc:iomgr_buffer_list"],
127-
@@ -3647,6 +3658,7 @@
128-
"protobuf_struct_upb",
129-
"protobuf_timestamp_upb",
130-
"ref_counted_ptr",
131-
+ ":server_address",
132-
"uri_parser",
133-
"work_serializer",
134-
"//src/core:default_event_engine",
135-
diff -u -Nur a/src/core/BUILD b/src/core/BUILD
136-
--- a/src/core/BUILD 2023-09-13 20:33:23.000000000 +0000
137-
+++ b/src/core/BUILD 2023-10-04 01:16:42.015957934 +0000
138-
@@ -3125,6 +3125,7 @@
139-
"//:exec_ctx",
140-
"//:gpr",
141-
"//:tsi_base",
142-
+ "//:grpc_public_hdrs",
208+
@@ -4696,6 +4704,8 @@
209+
"absl/strings",
210+
"absl/types:optional",
211+
"upb_lib",
212+
+ "upb_base",
213+
+ "upb_mem",
143214
],
144-
)
145-
215+
language = "c++",
216+
deps = [
217+
@@ -5187,6 +5197,8 @@
218+
"absl/strings",
219+
"absl/types:optional",
220+
"upb_lib",
221+
+ "upb_base",
222+
+ "upb_mem",
223+
],
224+
language = "c++",
225+
deps = [

third_party/com_github_grpc_grpc/workspace.bzl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
load(
16-
"//third_party:repo.bzl",
17-
"third_party_http_archive",
18-
)
15+
load("//third_party:repo.bzl", "third_party_http_archive")
1916
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
2017

2118
# NOTE: Switch back to a tagged release with darwin-arm64
@@ -36,7 +33,7 @@ def repo():
3633
],
3734
patch_args = ["-p1"],
3835
repo_mapping = {
39-
"@upb": "@com_google_protobuf_upb",
36+
"@upb": "@com_google_protobuf",
4037
"@com_googlesource_code_re2": "@com_google_re2",
4138
"@com_github_google_benchmark": "@com_google_benchmark",
4239
"@io_bazel_rules_go": "@local_proto_mirror",
@@ -96,13 +93,15 @@ GRPC_NATIVE_BINDINGS = {
9693
"protocol_compiler": "@com_google_protobuf//:protoc",
9794

9895
# upb mappings.
99-
"upb_json_lib": "@com_google_protobuf_upb//:json",
100-
"upb_lib": "@com_google_protobuf_upb//:upb",
101-
"upb_lib_descriptor": "@com_google_protobuf_upb//:cmake_descriptor_upb",
102-
"upb_lib_descriptor_reflection": "@com_google_protobuf_upb//:cmake_descriptor_upbdefs",
103-
"upb_reflection": "@com_google_protobuf_upb//:reflection",
104-
"upb_textformat_lib": "@com_google_protobuf_upb//:textformat",
105-
"upb_collections_lib": "@com_google_protobuf_upb//:collections",
96+
"upb_json_lib": "@com_google_protobuf//upb:json",
97+
"upb_lib": "@com_google_protobuf//upb:upb",
98+
"upb_lib_descriptor": "@com_google_protobuf//upb:cmake_descriptor_upb",
99+
"upb_lib_descriptor_reflection": "@com_google_protobuf//upb:cmake_descriptor_upbdefs",
100+
"upb_reflection": "@com_google_protobuf//upb:reflection",
101+
"upb_textformat_lib": "@com_google_protobuf//upb:text",
102+
"upb_collections_lib": "@com_google_protobuf//upb:collections",
103+
"upb_base": "@com_google_protobuf//upb:base",
104+
"upb_mem": "@com_google_protobuf//upb:mem",
106105

107106
# These exist to be used by grpc_build_system.bzl
108107
"benchmark": "@com_google_benchmark//:benchmark",
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From 2f77684e8dc473a48dbc19167ffe69c40ce8ada4 Mon Sep 17 00:00:00 2001
2+
From: Derek Mauro <[email protected]>
3+
Date: Wed, 8 Nov 2023 09:55:31 -0800
4+
Subject: [PATCH] Avoid using both Win32Waiter and PthreadWaiter on MinGW, and
5+
use StdcppWaiter instead.
6+
7+
There are various flavors of MinGW, some of which support pthread,
8+
and some of which support Win32. Instead of figuring out which
9+
platform is being used, just use the generic implementation.
10+
11+
PiperOrigin-RevId: 580565507
12+
Change-Id: Ia85fd7496f1e6ebdeadb95202f0039e844826118
13+
---
14+
absl/synchronization/internal/pthread_waiter.h | 4 ++--
15+
absl/synchronization/internal/win32_waiter.h | 6 ++++--
16+
2 files changed, 6 insertions(+), 4 deletions(-)
17+
18+
diff --git a/absl/synchronization/internal/pthread_waiter.h b/absl/synchronization/internal/pthread_waiter.h
19+
index 206aefa47c0..23db76ad442 100644
20+
--- a/absl/synchronization/internal/pthread_waiter.h
21+
+++ b/absl/synchronization/internal/pthread_waiter.h
22+
@@ -16,7 +16,7 @@
23+
#ifndef ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_
24+
#define ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_
25+
26+
-#ifndef _WIN32
27+
+#if !defined(_WIN32) && !defined(__MINGW32__)
28+
#include <pthread.h>
29+
30+
#include "absl/base/config.h"
31+
@@ -55,6 +55,6 @@ class PthreadWaiter : public WaiterCrtp<PthreadWaiter> {
32+
ABSL_NAMESPACE_END
33+
} // namespace absl
34+
35+
-#endif // ndef _WIN32
36+
+#endif // !defined(_WIN32) && !defined(__MINGW32__)
37+
38+
#endif // ABSL_SYNCHRONIZATION_INTERNAL_PTHREAD_WAITER_H_
39+
diff --git a/absl/synchronization/internal/win32_waiter.h b/absl/synchronization/internal/win32_waiter.h
40+
index 87eb617cbd1..fdab264e8cb 100644
41+
--- a/absl/synchronization/internal/win32_waiter.h
42+
+++ b/absl/synchronization/internal/win32_waiter.h
43+
@@ -20,7 +20,8 @@
44+
#include <sdkddkver.h>
45+
#endif
46+
47+
-#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
48+
+#if defined(_WIN32) && !defined(__MINGW32__) && \
49+
+ _WIN32_WINNT >= _WIN32_WINNT_VISTA
50+
51+
#include "absl/base/config.h"
52+
#include "absl/synchronization/internal/kernel_timeout.h"
53+
@@ -65,6 +66,7 @@ class Win32Waiter : public WaiterCrtp<Win32Waiter> {
54+
ABSL_NAMESPACE_END
55+
} // namespace absl
56+
57+
-#endif // defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
58+
+#endif // defined(_WIN32) && !defined(__MINGW32__) &&
59+
+ // _WIN32_WINNT >= _WIN32_WINNT_VISTA
60+
61+
#endif // ABSL_SYNCHRONIZATION_INTERNAL_WIN32_WAITER_H_

0 commit comments

Comments
 (0)