Skip to content

Commit cad753e

Browse files
authored
Merge branch 'main' into proper-fix-none-ascii-issue
2 parents 2129e3f + 06327f0 commit cad753e

469 files changed

Lines changed: 46284 additions & 44076 deletions

File tree

Some content is hidden

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

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr
2626
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
2727
# https://github.com/protocolbuffers/protobuf/issues/14313
2828
common --noenable_bzlmod
29+
30+
# Important: this flag ensures that we remain compliant with the C++ layering
31+
# check.
32+
build --features=layering_check

.github/workflows/clear_caches.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Clear expensive caches to prevent unbounded growth
33
on:
44
schedule:
55
# Run every 4 months at 10 AM UTC (2 AM PDT)
6-
- cron: 0 10 1 */4 *
6+
- cron: 0 10 5 */4 *
77

88
# manual
99
workflow_dispatch:
@@ -31,5 +31,5 @@ jobs:
3131
- name: Create an empty cache with a single file
3232
run: |
3333
rm -rf .repository-cache
34-
mkdir -p .repository-cache'
34+
mkdir -p .repository-cache
3535
touch .repository-cache/reset_file

.github/workflows/test_cpp.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- targets: //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/...
3131

3232
# Override cases with custom images
33+
- config: { name: "Bazel7" }
34+
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.0.0-a04396cc76704d4b7c722789e9c08df18f47df53"
35+
targets: "//src/... //third_party/utf8_range/..."
3336
- config: { name: "TCMalloc" }
3437
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:bd39119d74b8a3fad4ae335d4cf5294e70384676331b7e19949459fc7a8d8328"
3538
targets: "//src/... //third_party/utf8_range/..."
@@ -313,21 +316,32 @@ jobs:
313316
fail-fast: false # Don't cancel all jobs if one fails.
314317
matrix:
315318
include:
316-
- name: MacOS
319+
- name: MacOS Bazel
317320
os: macos-12
318321
cache_key: macos-12
319322
bazel: test //src/... //third_party/utf8_range/...
320-
- name: MacOS Apple Silicon (build only)
323+
# TODO Enable these once mac setup is working for Bazel 7
324+
#- name: MacOS Bazel 7
325+
# os: macos-12
326+
# cache_key: macos-12-bazel7
327+
# bazel: test //src/... //third_party/utf8_range/...
328+
# bazel_version: '7.0.0'
329+
- name: MacOS Apple Silicon (build only) Bazel
321330
os: macos-12
322331
cache_key: macos-12-arm
323332
# Current github runners are all Intel based, so just build/compile
324333
# for Apple Silicon to detect issues there.
325334
bazel: build --cpu=darwin_arm64 //src/... //third_party/utf8_range/...
326-
- name: Windows
335+
- name: Windows Bazel
327336
os: windows-2022
328337
cache_key: windows-2022
329338
bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance
330-
name: ${{ matrix.name }} Bazel
339+
- name: Windows Bazel 7
340+
os: windows-2022
341+
cache_key: windows-2022-bazel7
342+
bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance
343+
bazel_version: '7.0.0'
344+
name: ${{ matrix.name }}
331345
runs-on: ${{ matrix.os }}
332346
steps:
333347
- name: Checkout pending changes
@@ -340,16 +354,18 @@ jobs:
340354
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
341355
bazel: ${{ matrix.bazel }}
342356
bazel-cache: cpp_${{ matrix.cache_key }}
357+
version: ${{ matrix.bazel_version || '6.3.0' }}
343358

344359
non-linux-cmake:
345360
strategy:
346361
fail-fast: false # Don't cancel all jobs if one fails.
347362
matrix:
348363
include:
349-
- name: MacOS CMake
350-
os: macos-12
351-
flags: -DCMAKE_CXX_STANDARD=14
352-
cache-prefix: macos-cmake
364+
# TODO: investigate and fix
365+
# - name: MacOS CMake
366+
# os: macos-12
367+
# flags: -DCMAKE_CXX_STANDARD=14
368+
# cache-prefix: macos-cmake
353369
- name: Windows CMake
354370
os: windows-2022
355371
flags: >-

.github/workflows/test_java.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ jobs:
2020
- name: OpenJDK 8
2121
version: '8'
2222
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
23-
targets: //java/... //java/internal:java_version
23+
# TODO: b/318555165 - enable the layering check. Currently it does
24+
# not work correctly with the toolchain in this Docker image.
25+
targets: //java/... //java/internal:java_version --features=-layering_check
2426
- name: OpenJDK 11
2527
version: '11'
2628
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
@@ -63,7 +65,9 @@ jobs:
6365
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
6466
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
6567
bazel-cache: java_linux/8
66-
bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone
68+
# TODO: b/318555165 - enable the layering check. Currently it does
69+
# not work correctly with the toolchain in this Docker image.
70+
bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone --features=-layering_check
6771

6872
protobuf-bom:
6973
name: Protobuf Maven BOM

.github/workflows/test_ruby.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ jobs:
2424
#- { name: Ruby 2.7, ruby: ruby-2.7.0, ffi: FFI }
2525
- { name: Ruby 3.0, ruby: ruby-3.0.2 }
2626
- { name: Ruby 3.1, ruby: ruby-3.1.0 }
27-
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: NATIVE }
27+
- { name: Ruby 3.2, ruby: ruby-3.2.0 }
28+
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE }
2829
# TODO Re-enable these once flakes are fixed
29-
#- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: FFI }
30+
#- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI }
3031
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: NATIVE }
3132
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: FFI }
3233

@@ -40,7 +41,7 @@ jobs:
4041
- name: Run tests
4142
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
4243
with:
43-
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea', matrix.ruby) }}
44+
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-6.3.0-904cad5249547845454998ca3837a34c71fabf96', matrix.ruby) }}
4445
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
4546
bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }}
4647
bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
@@ -67,9 +68,10 @@ jobs:
6768
with:
6869
image: i386/ruby:2.7.3-buster
6970
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
71+
# Pin to Ruby 2.7 compatible bundler version.
7072
command: >-
7173
/bin/bash -cex '
72-
gem install bundler;
74+
gem install bundler -v 2.4.22;
7375
cd /workspace/ruby;
7476
bundle;
7577
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
@@ -98,9 +100,10 @@ jobs:
98100
with:
99101
image: arm64v8/ruby:2.7.3-buster
100102
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
103+
# Pin to Ruby 2.7 compatible bundler version.
101104
command: >-
102105
/bin/bash -cex '
103-
gem install bundler;
106+
gem install bundler -v 2.4.22;
104107
cd /workspace/ruby;
105108
bundle;
106109
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
@@ -120,9 +123,10 @@ jobs:
120123
#- { version: "2.7", ffi: FFI }
121124
- { version: "3.0" }
122125
- { version: "3.1" }
123-
- { version: "3.2", ffi: NATIVE }
126+
- { version: "3.2" }
127+
- { version: "3.3", ffi: NATIVE }
124128
# TODO Re-enable these once flakes are fixed
125-
#- { version: "3.2", ffi: FFI }
129+
#- { version: "3.3", ffi: FFI }
126130

127131
name: MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
128132
runs-on: macos-12
@@ -133,7 +137,7 @@ jobs:
133137
ref: ${{ inputs.safe-checkout }}
134138

135139
- name: Pin Ruby version
136-
uses: ruby/setup-ruby@ee26e27437bde475b19a6bf8cb73c9fa658876a2 # v1.134.0
140+
uses: ruby/setup-ruby@961f85197f92e4842e3cb92a4f97bd8e010cdbaf # v1.165.0
137141
with:
138142
ruby-version: ${{ matrix.version }}
139143

@@ -158,8 +162,9 @@ jobs:
158162
- { name: Ruby 2.7, ruby: ruby-2.7.0, ffi: FFI }
159163
- { name: Ruby 3.0, ruby: ruby-3.0.2}
160164
- { name: Ruby 3.1, ruby: ruby-3.1.0}
161-
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: NATIVE }
162-
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: FFI }
165+
- { name: Ruby 3.2, ruby: ruby-3.2.0}
166+
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE }
167+
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI }
163168
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: NATIVE }
164169
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: FFI }
165170
name: Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
@@ -172,7 +177,7 @@ jobs:
172177
- name: Run tests
173178
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
174179
with:
175-
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea
180+
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-6.3.0-904cad5249547845454998ca3837a34c71fabf96
176181
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
177182
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
178183
bash: >

.github/workflows/test_rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Run tests
2424
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
2525
with:
26-
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d
26+
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.0.0-a04396cc76704d4b7c722789e9c08df18f47df53"
2727
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
2828
bazel-cache: rust_linux
2929
bazel: >-

.github/workflows/test_upb.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
fail-fast: false # Don't cancel all jobs if one fails.
1818
matrix:
1919
config:
20+
- { name: "Bazel 7", bazel_version: "7.0.0" }
2021
- { name: "Fastbuild" }
2122
- { name: "Optimized", flags: "-c opt" }
22-
- { name: "FastTable", flags: "--//upb:fasttable_enabled=true" }
23-
- { name: "FastTable ASAN", flags: "--//upb:fasttable_enabled=true --config=asan", exclude-targets: "-//benchmarks:benchmark -//python/..." }
2423
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/..." }
2524
- { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/... -//lua/..." }
2625
- { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-//benchmarks:benchmark -//python/..." }
27-
# TODO: b/297027295 - Add 32-bit ASAN test
26+
# TODO: Add 32-bit ASAN test
27+
# TODO: Restore the FastTable tests
2828

2929
name: ${{ matrix.config.name }}
3030
runs-on: ubuntu-latest
@@ -37,7 +37,7 @@ jobs:
3737
- name: Run tests
3838
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
3939
with:
40-
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb
40+
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.3.0' }}-d07b7d649401d147e71e7182d2832cc8344f1f35
4141
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
4242
bazel-cache: upb-bazel
4343
bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //protos/... //protos_generator/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
@@ -81,6 +81,7 @@ jobs:
8181
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
8282
bazel-cache: "upb-bazel-windows"
8383
bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/... //protos/... //protos_generator/...
84+
version: 6.3.0
8485
exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test
8586

8687
macos:
@@ -107,6 +108,7 @@ jobs:
107108
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
108109
bazel-cache: "upb-bazel-macos"
109110
bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //protos/... //protos_generator/... //python/... //upb/... //upb_generator/...
111+
version: 6.3.0
110112

111113
no-python:
112114
strategy:

BUILD.bazel

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,68 @@ alias(
8585
visibility = ["//visibility:public"],
8686
)
8787

88+
# C++ targets for the well-known types
89+
90+
alias(
91+
name = "any_cc_proto",
92+
actual = "//src/google/protobuf:any_cc_proto",
93+
visibility = ["//visibility:public"],
94+
)
95+
96+
alias(
97+
name = "api_cc_proto",
98+
actual = "//src/google/protobuf:api_cc_proto",
99+
visibility = ["//visibility:public"],
100+
)
101+
102+
alias(
103+
name = "duration_cc_proto",
104+
actual = "//src/google/protobuf:duration_cc_proto",
105+
visibility = ["//visibility:public"],
106+
)
107+
108+
alias(
109+
name = "empty_cc_proto",
110+
actual = "//src/google/protobuf:empty_cc_proto",
111+
visibility = ["//visibility:public"],
112+
)
113+
114+
alias(
115+
name = "field_mask_cc_proto",
116+
actual = "//src/google/protobuf:field_mask_cc_proto",
117+
visibility = ["//visibility:public"],
118+
)
119+
120+
alias(
121+
name = "source_context_cc_proto",
122+
actual = "//src/google/protobuf:source_context_cc_proto",
123+
visibility = ["//visibility:public"],
124+
)
125+
126+
alias(
127+
name = "struct_cc_proto",
128+
actual = "//src/google/protobuf:struct_cc_proto",
129+
visibility = ["//visibility:public"],
130+
)
131+
132+
alias(
133+
name = "timestamp_cc_proto",
134+
actual = "//src/google/protobuf:timestamp_cc_proto",
135+
visibility = ["//visibility:public"],
136+
)
137+
138+
alias(
139+
name = "type_cc_proto",
140+
actual = "//src/google/protobuf:type_cc_proto",
141+
visibility = ["//visibility:public"],
142+
)
143+
144+
alias(
145+
name = "wrappers_cc_proto",
146+
actual = "//src/google/protobuf:wrappers_cc_proto",
147+
visibility = ["//visibility:public"],
148+
)
149+
88150
# Source files: these are aliases to a filegroup, not a `proto_library`.
89151
#
90152
# (This is _probably_ not what you want.)
@@ -189,9 +251,16 @@ cc_binary(
189251

190252
# Expose the runtime for the proto_lang_toolchain so that it can also be used in
191253
# a user-defined proto_lang_toolchain.
254+
alias(
255+
name = "protobuf",
256+
actual = "//src/google/protobuf",
257+
visibility = ["//visibility:public"],
258+
)
259+
192260
alias(
193261
name = "protobuf_nowkt",
194262
actual = "//src/google/protobuf:protobuf_nowkt",
263+
deprecation = "Use //:protobuf instead",
195264
visibility = ["//visibility:public"],
196265
)
197266

@@ -210,23 +279,6 @@ alias(
210279
visibility = ["//visibility:public"],
211280
)
212281

213-
cc_library(
214-
name = "protobuf",
215-
copts = COPTS,
216-
linkopts = LINK_OPTS,
217-
visibility = ["//visibility:public"],
218-
deps = [
219-
"//src/google/protobuf",
220-
"//src/google/protobuf/compiler:importer",
221-
"//src/google/protobuf/util:delimited_message_util",
222-
"//src/google/protobuf/util:differencer",
223-
"//src/google/protobuf/util:field_mask_util",
224-
"//src/google/protobuf/util:json_util",
225-
"//src/google/protobuf/util:time_util",
226-
"//src/google/protobuf/util:type_resolver_util",
227-
],
228-
)
229-
230282
# This provides just the header files for use in projects that need to build
231283
# shared libraries for dynamic loading. This target is available until Bazel
232284
# adds native support for such use cases.
@@ -324,7 +376,7 @@ proto_lang_toolchain(
324376
"//:descriptor_proto",
325377
],
326378
command_line = "--cpp_out=$(OUT)",
327-
runtime = "//src/google/protobuf:protobuf_nowkt",
379+
runtime = "//src/google/protobuf",
328380
visibility = ["//visibility:public"],
329381
)
330382

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ endif (MSVC)
279279
include_directories(
280280
${ZLIB_INCLUDE_DIRECTORIES}
281281
${protobuf_BINARY_DIR}
282+
# Support #include-ing other top-level directories, i.e. upb_generator.
283+
${protobuf_SOURCE_DIR}
282284
${protobuf_SOURCE_DIR}/src)
283285

284286
set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library")

WORKSPACE

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ load("@fuzzing_py_deps//:requirements.bzl", fuzzing_py_deps_install_deps = "inst
191191

192192
fuzzing_py_deps_install_deps()
193193

194-
bind(
195-
name = "python_headers",
196-
actual = "@system_python//:python_headers",
197-
)
198-
199194
http_archive(
200195
name = "rules_rust",
201196
sha256 = "9ecd0f2144f0a24e6bc71ebcc50a1ee5128cedeceb32187004532c9710cb2334",

0 commit comments

Comments
 (0)