Skip to content

Commit 7359f75

Browse files
committed
Manually migrate top-level protobuf unittest protos from edition 2023 to edition 2024.
PiperOrigin-RevId: 791221060
1 parent 6f4a990 commit 7359f75

27 files changed

+196
-126
lines changed

cmake/tests.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ foreach(proto_file ${tests_protos})
3737
PROTOS ${proto_file}
3838
LANGUAGE cpp
3939
OUT_VAR pb_generated_files
40-
IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
40+
IMPORT_DIRS ${protobuf_SOURCE_DIR}/src ${protobuf_SOURCE_DIR}/java/core/src/main/resources
4141
)
4242
set(tests_proto_files ${tests_proto_files} ${pb_generated_files})
4343
endforeach(proto_file)

csharp/generate_protos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
5050
# Note that this deliberately does *not* include old_extensions1.proto
5151
# and old_extensions2.proto, which are generated with an older version
5252
# of protoc.
53-
$PROTOC -Isrc -I. \
53+
$PROTOC -Isrc -I. -Ijava/core/src/main/resources/ \
5454
--experimental_allow_proto3_optional \
5555
--experimental_editions \
5656
--csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \

java/core/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ cc_proto_library(
217217
filegroup(
218218
name = "java_features_proto_srcs",
219219
srcs = ["src/main/resources/google/protobuf/java_features.proto"],
220-
visibility = ["//pkg:__pkg__"],
220+
visibility = [
221+
"//pkg:__pkg__",
222+
"//python:__pkg__",
223+
],
221224
)
222225

223226
compile_edition_defaults(

python/build_targets.bzl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,23 @@ def build_targets(name):
258258
)
259259

260260
internal_copy_files(
261-
name = "copied_test_dependency_proto_files",
261+
name = "copied_cpp_features_test_dependency_proto_files",
262262
srcs = [
263263
"//src/google/protobuf:cpp_features_proto_srcs",
264264
],
265265
strip_prefix = "src",
266266
)
267267

268+
internal_copy_files(
269+
name = "copied_java_features_test_dependency_proto_files",
270+
srcs = [
271+
"//java/core:java_features_proto_srcs",
272+
],
273+
strip_prefix = "java/core/src/main/resources",
274+
)
268275
internal_py_proto_library(
269276
name = "test_dependency_proto_py_pb2",
270-
srcs = [":copied_test_dependency_proto_files"],
277+
srcs = [":copied_cpp_features_test_dependency_proto_files", ":copied_java_features_test_dependency_proto_files"],
271278
include = ".",
272279
default_runtime = "",
273280
protoc = "//:protoc",

python/google/protobuf/internal/descriptor_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ class ReturnObject:
14731473
)
14741474
],
14751475
minimum_edition=descriptor_pb2.Edition.EDITION_PROTO2,
1476-
maximum_edition=descriptor_pb2.Edition.EDITION_2023,
1476+
maximum_edition=descriptor_pb2.Edition.EDITION_2024,
14771477
)
14781478
defaults.defaults[0].overridable_features.Extensions[
14791479
unittest_features_pb2.test

src/google/protobuf/BUILD.bazel

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ filegroup(
10531053
visibility = ["//:__subpackages__"],
10541054
)
10551055

1056-
proto_library(
1056+
protobuf_test_proto_library(
10571057
name = "test_protos",
10581058
srcs = [
10591059
"any_test.proto",
@@ -1095,6 +1095,10 @@ proto_library(
10951095
"unittest_string_view.proto",
10961096
"unittest_well_known_types.proto",
10971097
],
1098+
option_deps = [
1099+
":cpp_features_proto",
1100+
"//:java_features_proto",
1101+
],
10981102
strip_import_prefix = "/src",
10991103
visibility = ["//:__subpackages__"],
11001104
deps = [
@@ -1190,9 +1194,10 @@ cc_proto_library(
11901194
deps = [":unittest_features_proto"],
11911195
)
11921196

1193-
proto_library(
1197+
protobuf_test_proto_library(
11941198
name = "generic_test_protos",
11951199
srcs = [":test_proto_srcs"],
1200+
option_deps = [":cpp_features_proto"],
11961201
strip_import_prefix = "/src",
11971202
visibility = ["//:__subpackages__"],
11981203
deps = [
@@ -1211,9 +1216,13 @@ proto_library(
12111216
],
12121217
)
12131218

1214-
proto_library(
1219+
protobuf_test_proto_library(
12151220
name = "generic_test_editions_protos",
12161221
srcs = [":test_proto_editions_srcs"],
1222+
option_deps = [
1223+
":cpp_features_proto",
1224+
"//:java_features_proto",
1225+
],
12171226
strip_import_prefix = "/src",
12181227
visibility = ["//:__subpackages__"],
12191228
deps = [

0 commit comments

Comments
 (0)