Roll protobuf to v31.0
R=sophiechang@chromium.org Bug: 417774625 NO_IFTTT=This is a protobuf roll, and we do not use the relevant files. Cq-Include-Trybots: luci.chromium.try:chromeos-amd64-generic-cfi-thin-lto-rel,linux_chromium_cfi_rel_ng;luci.chrome.try:chromeos-arm-generic-cfi-thin-lto-chrome,chromeos-arm64-generic-cfi-thin-lto-chrome,chromeos-betty-cfi-thin-lto-chrome Change-Id: I3d05526b3b18b7aa6a49a8c488b9b375841177be Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6549497 Commit-Queue: Tommy Nyquist <nyquist@chromium.org> Reviewed-by: Danil Chapovalov <danilchap@chromium.org> Reviewed-by: Sophie Chang <sophiechang@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463751}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
936154f4e8
commit
d893a0c472
.vpython3DEPSBUILD.bazelBUILD.gnCMakeLists.txtCargo.bazel.lockCargo.lockDisable_bundle_install.patchMODULE.bazelNeverlink_jruby_jars.patchProtobuf.podspecREADME.chromiumWORKSPACEWORKSPACE.bzlmod
third_party
abseil-cpp
protobuf-javascript
protobuf
.bazelci
.bazelrc.bcr
.github
ISSUE_TEMPLATE
workflows
bazel
benchmarks
build_defs
ci
cmake
abseil-cpp.cmakedependencies.cmakedependencies_generator.pyinstall.cmakeinstalled_bin_golden.txtinstalled_include_golden.txtlibprotoc.cmakeprotobuf-configure-target.cmaketests.cmakeupb_generators.cmake
conformance
BUILD.bazelbazel_conformance_test_runner.shbinary_json_conformance_suite.ccbinary_json_conformance_suite.hconformance_objc.mconformance_ruby.rbconformance_test.hdefs.bzlfailure_list_python_upb.txtfailure_list_ruby.txttext_format_conformance_suite.h
csharp
BUILD.bazelGoogle.Protobuf.Tools.nuspec
src
Google.Protobuf.Test.TestProtos
TestMessagesProto2.pb.csTestMessagesProto2Editions.pb.csTestMessagesProto3.pb.csTestMessagesProto3Editions.pb.cs
Google.Protobuf.Test
Google.Protobuf
docs
editions
generated_files_test.cc
golden
compare_cpp_codegen_failure.xmleditions_transform_noop.protoeditions_transform_proto2.protoeditions_transform_proto2_lite.protoeditions_transform_proto2_utf8_disabled.protoeditions_transform_proto3.protoeditions_transform_proto3_utf8_disabled.prototest_messages_proto2_editions.prototest_messages_proto3_editions.proto
internal_defaults_escape.ccproto
hpb
hpb_generator
gen_accessors.hgen_enums.ccgen_enums.hgen_extensions.ccgen_extensions.hgen_messages.ccgen_messages.hgen_repeated_fields.hgen_utils.ccgen_utils.hkeywords.hnames.ccnames.hprotoc-gen-hpb.cc
tests
java
BUILD.bazel
bom
core
BUILD.bazel
src
main
java
com
google
protobuf
AbstractMessage.javaBinaryReader.javaCodedInputStream.javaCodedInputStreamReader.javaDescriptorMessageInfoFactory.javaDescriptors.javaDynamicMessage.javaExtensionSchemaFull.javaGenerated.javaGeneratedMessage.javaGeneratedMessageLite.javaInvalidProtocolBufferException.javaIterableByteBufferInputStream.javaJavaEditionDefaults.javaLazyFieldLite.javaLazyStringArrayList.javaLegacyUnredactedTextFormat.javaMessageSchema.javaProtocolStringList.javaRepeatedFieldBuilder.javaRuntimeVersion.javaTextFormat.javaUnredactedDebugFormatForTest.java
resources
google
protobuf
test
kotlin-lite
kotlin
pom.xmlprotoc
util
src
main
java
com
google
test
java
com
google
protobuf
lua
objectivec
BUILD.bazelGPBAny.pbobjc.hGPBAny.pbobjc.mGPBApi.pbobjc.hGPBApi.pbobjc.mGPBArray.mGPBBootstrap.hGPBDescriptor.hGPBDescriptor.mGPBDescriptor_PackagePrivate.hGPBDuration.pbobjc.hGPBDuration.pbobjc.mGPBEmpty.pbobjc.hGPBEmpty.pbobjc.mGPBExtensionInternals.mGPBFieldMask.pbobjc.hGPBFieldMask.pbobjc.mGPBMessage.mGPBSourceContext.pbobjc.hGPBSourceContext.pbobjc.mGPBStruct.pbobjc.hGPBStruct.pbobjc.mGPBTimestamp.pbobjc.hGPBTimestamp.pbobjc.mGPBType.pbobjc.hGPBType.pbobjc.mGPBUtilities.mGPBUtilities_PackagePrivate.hGPBWrappers.pbobjc.hGPBWrappers.pbobjc.m
Tests
patches
0004-fix-shared-library-exports.patch0008-uninline_get_empty_string.patch0010-uninline-generated-code.patch0022-Allow-deprecated-fields.patch0029-make-initializers-optimizable.patch0030-workaround-windows-constinit.patch0031-workaround-cfi-unrelated-cast.patch0039-generate-mediapipe-anylite.patch0042-fix-undefined-protobuf-custom-vtable.patch0043-unreachable-code-return.patch0044-trim-protoc-main.patch0045-string-resize.patch0048-csharp-names-redirect.patch0049-deprecated-declarations-pragma.patch0050-remove-unreachable-code.patch0051-export-template-define.patch0052-remove-dynamic-annotations.patch0053-ignore-compatibility-dir.patch0055-optimize-compile-time.patch
php
BUILD.bazelinternal_generated_files.bzl
ext
google
src
GPBMetadata
Google
Protobuf
Internal
Google
Protobuf
Any.phpApi.phpBoolValue.phpBytesValue.phpDoubleValue.phpDuration.phpEnum.phpEnumValue.phpField.phpFieldDescriptor.phpFieldMask.phpFloatValue.phpGPBEmpty.phpInt32Value.phpInt64Value.php
Internal
CodedOutputStream.phpDescriptorProto.php
ListValue.phpMethod.phpMixin.phpOption.phpPrintOptions.phpRepeatedField.phpSourceContext.phpStringValue.phpStruct.phpTimestamp.phpType.phpUInt32Value.phpUInt64Value.phpValue.phpDescriptorProto
EnumDescriptorProto.phpEnumDescriptorProto
EnumOptions.phpEnumValueDescriptorProto.phpEnumValueOptions.phpExtensionRangeOptions.phpExtensionRangeOptions
FeatureSet.phpFeatureSet
FeatureSetDefaults.phpFeatureSetDefaults
FieldDescriptor.phpFieldDescriptorProto.phpFieldOptions.phpFieldOptions
FileDescriptorProto.phpFileDescriptorSet.phpFileOptions.phpGPBJsonWire.phpGPBUtil.phpGeneratedCodeInfo.phpGeneratedCodeInfo
Message.phpMessageOptions.phpMethodDescriptorProto.phpMethodOptions.phpOneofDescriptorProto.phpOneofOptions.phpRepeatedField.phpServiceDescriptorProto.phpServiceOptions.phpSourceCodeInfo.phpSourceCodeInfo
SymbolVisibility.phpUninterpretedOption.phpUninterpretedOption
tests
pkg
proto_sources.gniprotobuf.bzlprotobuf_deps.bzlprotobuf_version.bzlpython
BUILD.bazeldescriptor.cdescriptor_pool.cmessage.crepeated.c
regenerate_stale_files.shdocs
extension_dict.cgoogle
protobuf
__init__.pyany.py
compiler
descriptor.pydescriptor_pb2.pydescriptor_pool.pyinternal
any_test.pydecoder.pydescriptor_pool_test.pydescriptor_test.pyduration_test.pyfield_mask.pyfield_mask_test.pymessage_test.pypython_edition_defaults.pypython_message.pypython_protobuf.ccreflection_test.pyself_recursive.prototest_util.pytesting_refleaks.pytext_format_test.pytimestamp_test.pywell_known_types.pywell_known_types_test.py
json_format.pymessage_factory.pyproto_api.ccpyext
descriptor.ccdescriptor_database.ccmap_container.ccmessage.ccmessage.hrepeated_composite_container.ccrepeated_scalar_container.cc
runtime_version.pytext_format.pyruby
BUILD.bazelGemfileGemfile.lockREADME.mdRakefiledefs.bzlpom.xml
ext
google-protobuf.gemspeclib
google
src
main
java
tests
rust
BUILDupb.rs
bazel
codegen_traits.rscpp.rsdefs.bzlmap.rsprelude.rsproto_proc_macro
release_crates
BUILDcargo_test.sh
repeated.rsshared.rsprotobuf
protobuf_codegen
protobuf_example
protobuf_macros
protobuf_well_known_types
release.shsubstitute_rust_release_version.bzltest
rust_proto_library_unit_test
shared
upb
src
file_lists.cmake
google
protobuf
BUILD.bazelany.ccany.hany.pb.ccany.pb.hany_lite.ccany_test.ccapi.pb.ccapi.pb.harena.ccarena.harena_align.ccarena_cleanup.harena_test_util.ccarena_test_util.harena_unittest.ccarenastring.ccarenastring_unittest.ccarenaz_sampler.h
bridge
compiler
BUILD.bazelcode_generator.cccode_generator_unittest.cccommand_line_interface.cccommand_line_interface_unittest.cc
cpp_edition_defaults.hcpp_features.pb.cccpp_features.pb.hdebug_counter_test.ccdescriptor.ccdescriptor.hdescriptor.pb.ccdescriptor.pb.hdescriptor.protodescriptor_database.ccdescriptor_database.hdescriptor_database_unittest.ccdescriptor_legacy.hdescriptor_unittest.ccduration.pb.ccduration.pb.hdynamic_message.ccdynamic_message.hdynamic_message_unittest.ccedition_message_unittest.ccempty.pb.ccempty.pb.hextension_set.ccextension_set.hextension_set_unittest.ccfeature_resolver.ccfeature_resolver_test.ccfield_mask.pb.ccfield_mask.pb.hgenerated_enum_reflection.hgenerated_message_bases.ccgenerated_message_reflection.ccgenerated_message_reflection.hgenerated_message_reflection_unittest.ccgenerated_message_tctable_decl.hgenerated_message_tctable_gen.ccgenerated_message_tctable_gen.hgenerated_message_tctable_impl.hgenerated_message_tctable_lite.ccgenerated_message_util.cccpp
BUILD.bazelbootstrap_unittest.cccopy_unittest.ccenum.ccextension.hfield.hfield_chunk.ccfield_chunk.hfield_chunk_test.cc
field_generators
cord_field.ccenum_field.ccmap_field.ccmessage_field.ccprimitive_field.ccstring_field.ccstring_view_field.cc
file.cchelpers.cchelpers.hmessage.ccmessage.hmessage_layout_helper.ccmessage_layout_helper.hmove_unittest.ccoptions.hpadding_optimizer.ccpadding_optimizer.hparse_function_generator.ccparse_function_generator.htest_bad_identifiers_editions.prototest_bad_identifiers_proto2.prototools
analyze_profile_proto.ccanalyze_profile_proto.hanalyze_profile_proto_main.ccanalyze_profile_proto_test.cc
tracker.ccunittest.ccunittest.inccsharp
csharp_doc_comment.cccsharp_doc_comment.hcsharp_enum.hcsharp_enum_field.hcsharp_field_base.hcsharp_generator.hcsharp_helpers.hcsharp_map_field.hcsharp_message.hcsharp_message_field.hcsharp_options.hcsharp_primitive_field.hcsharp_reflection_class.cccsharp_reflection_class.hcsharp_repeated_enum_field.hcsharp_repeated_message_field.hcsharp_repeated_primitive_field.hcsharp_source_generator_base.hcsharp_wrapper_field.hnames.cc
java
BUILD.bazeldoc_comment.ccdoc_comment.hfile.cc
full
enum.ccenum.henum_field.ccenum_field.hextension.hmap_field.hmessage.ccmessage.hmessage_builder.ccmessage_builder.hmessage_field.ccmessage_field.hprimitive_field.ccprimitive_field.hservice.hstring_field.ccstring_field.h
generator.hgenerator_common.hgenerator_unittest.cchelpers.cchelpers.hinternal_helpers.ccinternal_helpers.hjava_features.pb.ccjava_features.pb.hlite
name_resolver.ccname_resolver.hname_resolver_test.ccplugin_unittest.cckotlin
mock_code_generator.ccobjectivec
parser.ccparser.hparser_unittest.ccphp
plugin.ccplugin.pb.ccplugin.pb.hpython
ruby
ruby_generated_code_pb.rbruby_generated_code_proto2_pb.rbruby_generated_pkg_explicit_legacy_pb.rbruby_generated_pkg_explicit_pb.rbruby_generated_pkg_implicit_pb.rbruby_generator.ccruby_generator.h
rust
versions.hio
BUILD.bazelcoded_stream.cccoded_stream_unittest.ccprinter.ccprinter.htokenizer.cctokenizer_unittest.cczero_copy_sink.hzero_copy_sink_test.cczero_copy_stream.hzero_copy_stream_impl.hzero_copy_stream_impl_lite.cczero_copy_stream_impl_lite.h
json
BUILD.bazel
lazily_build_dependencies_test.cclite_arena_unittest.cclite_unittest.ccmap.hmap_field.ccmap_field.hmap_field_inl.hmap_field_test.ccmap_lite_test_util.ccmap_lite_test_util.hmap_test.ccmap_test.incmap_test_util.hmap_test_util.incmap_test_util_impl.hmap_type_handler.hmessage.hmessage_lite.ccmessage_lite.hmessage_unittest.ccmessage_unittest.incmessage_unittest_legacy_apis.incmicro_string.ccmicro_string.hmicro_string_test.ccno_field_presence_map_test.ccno_field_presence_test.ccparse_context.ccparse_context.hport.ccport.hport_def.incport_undef.increflection.hreflection_ops.ccreflection_ops_unittest.ccrepeated_field.hrepeated_field_reflection_unittest.ccrepeated_field_unittest.ccrepeated_ptr_field.hrepeated_ptr_field_unittest.ccruntime_version.hsource_context.pb.ccsource_context.pb.hstruct.pb.ccstruct.pb.hinternal
descriptor_traits.hlexer.cclexer.hlexer_test.ccparser.hunparser.ccunparser.hunparser_traits.huntyped_message.ccuntyped_message.hwriter.hzero_copy_buffered_stream.h
json.ccjson.hstubs
test_messages_proto2.prototest_messages_proto3.prototest_util.htest_util.inctesting
text_format.cctext_format.htimestamp.pb.cctimestamp.pb.htype.pb.cctype.pb.hunittest.protounittest_large_oneof.protounknown_field_set.hunknown_field_set_unittest.ccutil
BUILD.bazeldelimited_message_util_test.ccmessage_differencer.ccmessage_differencer.hmessage_differencer_unittest.cctime_util.cctype_resolver_util.cc
wire_format.ccwire_format.hwire_format_lite.ccwire_format_lite.hwire_format_unittest.ccwire_format_unittest.incwrappers.pb.ccwrappers.pb.hthird_party
upb
BUILD
bazel
cmake
BUILD.bazel
google
conformance
hash
json
mem
message
BUILDaccessors.caccessors_test.ccarray.carray.hcopy_test.cc
internal
map.cmap.hmap_gencode_util.hmap_sorter.cmerge.hmessage.cmessage.hpromote.cpromote_test.cctest.cctest.protomini_descriptor
mini_table
port
reflection
BUILD
cmake
def_pool.hdescriptor_bootstrap.henum_def.cenum_reserved_range.cenum_value_def.cextension_range.cfield_def.cfield_def.hfile_def.cinternal
message_def.cmessage_reserved_range.cmethod_def.coneof_def.cservice_def.cstage0
google
protobuf
text
wire
upb_generator
version.json@ -43,7 +43,7 @@ verify_pep425_tag: [
|
||||
# //tools/perf/crossbench
|
||||
wheel: <
|
||||
name: "infra/python/wheels/protobuf-py3"
|
||||
version: "version:6.30.2"
|
||||
version: "version:6.31.0"
|
||||
>
|
||||
|
||||
# TODO(https://crbug.com/898348): Add in necessary wheels as Python3 versions
|
||||
|
2
DEPS
2
DEPS
@ -2689,7 +2689,7 @@ deps = {
|
||||
},
|
||||
|
||||
'src/third_party/protobuf-javascript/src':
|
||||
Var('chromium_git') + '/external/github.com/protocolbuffers/protobuf-javascript' + '@' + 'eb785a9363664a402b6336dfe96aad27fb33ffa8',
|
||||
Var('chromium_git') + '/external/github.com/protocolbuffers/protobuf-javascript' + '@' + '28bf5df73ef2f345a936d9cc95d64ba8ed426a53',
|
||||
|
||||
'src/third_party/pthreadpool/src':
|
||||
Var('chromium_git') + '/external/github.com/google/pthreadpool.git' + '@' + 'dcc9f28589066af0dbd4555579281230abbf74dd',
|
||||
|
1
third_party/abseil-cpp/BUILD.gn
vendored
1
third_party/abseil-cpp/BUILD.gn
vendored
@ -102,6 +102,7 @@ group("absl_component_deps") {
|
||||
"//third_party/abseil-cpp/absl/status",
|
||||
"//third_party/abseil-cpp/absl/status:statusor",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/strings:charset",
|
||||
"//third_party/abseil-cpp/absl/strings:cord",
|
||||
"//third_party/abseil-cpp/absl/strings:has_ostream_operator",
|
||||
"//third_party/abseil-cpp/absl/strings:str_format",
|
||||
|
@ -3,7 +3,7 @@ Short Name: protobuf-javascript
|
||||
URL: https://github.com/protocolbuffers/protobuf-javascript
|
||||
License: BSD-3-Clause
|
||||
License File: LICENSE
|
||||
Version: 3.21.2
|
||||
Revision: eb785a9363664a402b6336dfe96aad27fb33ffa8
|
||||
Version: 3.21.4 (plus fixes)
|
||||
Revision: 28bf5df73ef2f345a936d9cc95d64ba8ed426a53
|
||||
Security Critical: yes
|
||||
Shipped: yes
|
||||
|
2
third_party/protobuf-javascript/src
vendored
2
third_party/protobuf-javascript/src
vendored
Submodule third_party/protobuf-javascript/src updated: eb785a9363...28bf5df73e
6
third_party/protobuf/.bazelci/README.md
vendored
Normal file
6
third_party/protobuf/.bazelci/README.md
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
# Bazel CI test
|
||||
|
||||
The `.bazelci/presubmit.yml` file is used by https://buildkite.com/bazel/protobuf
|
||||
to test building protobuf with Bazel on Bazel CI. It should contain the same
|
||||
set of tests as `.bcr/presubmit.yml` which is the tests that will run before
|
||||
publishing protobuf to BCR.
|
21
third_party/protobuf/.bazelci/presubmit.yml
vendored
Normal file
21
third_party/protobuf/.bazelci/presubmit.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# LINT.IfChange(bazelci_presubmit)
|
||||
matrix:
|
||||
platform: ["debian10", "macos", "macos_arm64", "ubuntu2004", "windows"]
|
||||
bazel: [7.x, 8.x]
|
||||
|
||||
tasks:
|
||||
verify_targets:
|
||||
name: "Verify build targets"
|
||||
working_directory: examples
|
||||
platform: ${{ platform }}
|
||||
bazel: ${{ bazel }}
|
||||
build_targets:
|
||||
- '//...'
|
||||
- '@com_google_protobuf//:protobuf'
|
||||
- '@com_google_protobuf//:protobuf_lite'
|
||||
- '@com_google_protobuf//:protobuf_python'
|
||||
- '@com_google_protobuf//:protobuf_java'
|
||||
- '@com_google_protobuf//:protoc'
|
||||
- '@com_google_protobuf//:test_messages_proto2_cc_proto'
|
||||
- '@com_google_protobuf//:test_messages_proto3_cc_proto'
|
||||
# LINT.ThenChange(<ROOT_DIR>/.bcr/presubmit.yml)
|
5
third_party/protobuf/.bazelrc
vendored
5
third_party/protobuf/.bazelrc
vendored
@ -3,6 +3,9 @@ build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
|
||||
# TODO: ErrorProne's SelfAssertions are violated in protobuf's test
|
||||
build --javacopt=-Xep:SelfAssertion:WARN
|
||||
|
||||
# This flag works around some issues with Rust linking.
|
||||
build --@rules_rust//rust/settings:experimental_use_cc_common_link=True
|
||||
|
||||
build:dbg --compilation_mode=dbg
|
||||
|
||||
build:opt --compilation_mode=opt
|
||||
@ -32,8 +35,6 @@ build:ubsan --copt=-fno-sanitize=nonnull-attribute
|
||||
# check.
|
||||
build --features=layering_check
|
||||
|
||||
common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
|
||||
|
||||
common --enable_platform_specific_config
|
||||
|
||||
# Use clang-cl by default on Windows (see https://github.com/protocolbuffers/protobuf/issues/20085).
|
||||
|
@ -81,12 +81,6 @@
|
||||
"name": "Dennis Shao",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "theodorerose@google.com",
|
||||
"github": "theodorerose",
|
||||
"name": "Theodore Rose",
|
||||
"do_not_notify": true
|
||||
},
|
||||
{
|
||||
"email": "tonyliaoss@google.com",
|
||||
"github": "tonyliaoss",
|
||||
|
6
third_party/protobuf/.bcr/presubmit.yml
vendored
6
third_party/protobuf/.bcr/presubmit.yml
vendored
@ -1,7 +1,8 @@
|
||||
# LINT.IfChange(bcr_presubmit)
|
||||
bcr_test_module:
|
||||
module_path: examples
|
||||
matrix:
|
||||
platform: ["debian10", "macos", "ubuntu2004", "windows"]
|
||||
platform: ["debian10", "macos", "macos_arm64", "ubuntu2004", "windows"]
|
||||
bazel: [7.x, 8.x]
|
||||
|
||||
tasks:
|
||||
@ -17,4 +18,5 @@ bcr_test_module:
|
||||
- '@com_google_protobuf//:protobuf_java'
|
||||
- '@com_google_protobuf//:protoc'
|
||||
- '@com_google_protobuf//:test_messages_proto2_cc_proto'
|
||||
- '@com_google_protobuf//:test_messages_proto3_cc_proto'
|
||||
- '@com_google_protobuf//:test_messages_proto3_cc_proto'
|
||||
# LINT.ThenChange(<ROOT_DIR>/.bazelci/presubmit.yml)
|
||||
|
1
third_party/protobuf/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
third_party/protobuf/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
@ -37,7 +37,7 @@ jobs:
|
||||
- { name: No-RTTI, flags: --cxxopt=-fno-rtti, continuous-only: true }
|
||||
include:
|
||||
# Set defaults
|
||||
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:7.1.2-2c05f44c25a209933743ddf0296ef0c1e583d2c3
|
||||
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:8.0.1-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
- targets: //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
|
||||
# Override cases with custom images
|
||||
- config: { name: "Bazel7", flags: --cxxopt="-Wno-self-assign-overloaded" }
|
||||
@ -48,14 +48,18 @@ jobs:
|
||||
cache_key: Bazel7nobzlmod
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
|
||||
targets: "//src/... //third_party/utf8_range/..."
|
||||
- config: { name: "Bazel8", flags: --cxxopt="-Wno-self-assign-overloaded" }
|
||||
cache_key: Bazel8
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3"
|
||||
targets: "//src/... //third_party/utf8_range/..."
|
||||
- config: { name: "TCMalloc" }
|
||||
cache_key: TcMalloc
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:8.0.1-b77fdae6d4771789dfc66a56bf8d806354e8011a"
|
||||
targets: "//src/... //third_party/utf8_range/..."
|
||||
- config: { name: "aarch64", flags: "--platforms=//build_defs:aarch64_linux" }
|
||||
cache_key: aarch64-bazel7
|
||||
cache_key: aarch64-bazel8
|
||||
targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..."
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8" #TODO: b/409557730 - upgrade to bazel 8
|
||||
name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.config.name }}
|
||||
runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }}
|
||||
steps:
|
||||
@ -79,17 +83,24 @@ jobs:
|
||||
fail-fast: false # Don't cancel all jobs if one fails.
|
||||
matrix:
|
||||
version: ['7.5', '9.1', '9.5', '13.1']
|
||||
name: Linux GCC ${{ matrix.version }}
|
||||
include:
|
||||
- version: 9.1
|
||||
continuous-only: true
|
||||
- version: 9.5
|
||||
continuous-only: true
|
||||
name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux GCC ${{ matrix.version }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout pending changes
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v4
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-${{ matrix.version }}-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.0.1-${{ matrix.version }}-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cpp_linux/gcc-${{ matrix.version }}
|
||||
bazel: test //pkg/... //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
|
||||
@ -98,9 +109,9 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false # Don't cancel all jobs if one fails.
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
arch: [x86_64, aarch64]
|
||||
name: Linux Release ${{ matrix.arch }}
|
||||
runs-on: ubuntu-20-4core
|
||||
runs-on: ubuntu-22-4core
|
||||
steps:
|
||||
- name: Checkout pending changes
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v4
|
||||
@ -110,7 +121,7 @@ jobs:
|
||||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 #TODO: b/409557730 - upgrade to bazel 8
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-${{ matrix.arch }}
|
||||
- name: Setup sccache
|
||||
@ -121,14 +132,14 @@ jobs:
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-${{ matrix.arch }}-2920199ab0090ed427413a8e422e62695c8392a8
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:8.0.1-${{ matrix.arch }}-168f9c9d015a0fa16611e1e9eede796fe9bfbb69
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
entrypoint: bash
|
||||
command: >
|
||||
-c "set -ex;
|
||||
sccache -z;
|
||||
cmake . -DWITH_PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }}
|
||||
-Dprotobuf_BUILD_LIBUPB=OFF -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=17
|
||||
-Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=17
|
||||
-Dprotobuf_WITH_ZLIB=OFF ${{ env.SCCACHE_CMAKE_FLAGS }};
|
||||
cmake --build . --parallel 20;
|
||||
ctest --parallel 20;
|
||||
@ -356,7 +367,7 @@ jobs:
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-12.2-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:8.0.1-12.2-168f9c9d015a0fa16611e1e9eede796fe9bfbb69
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
entrypoint: bash
|
||||
command: >-
|
||||
@ -405,7 +416,7 @@ jobs:
|
||||
include:
|
||||
- name: MacOS Bazel
|
||||
os: macos-13
|
||||
cache_key: macos-13-bazel7
|
||||
cache_key: macos-13-bazel8
|
||||
bazel: test //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests
|
||||
- name: MacOS Apple Silicon (build only) Bazel
|
||||
os: macos-13
|
||||
@ -436,7 +447,7 @@ jobs:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel: ${{ matrix.bazel }}
|
||||
bazel-cache: cpp_${{ matrix.cache_key }}
|
||||
version: ${{ matrix.bazel_version || '7.1.2' }}
|
||||
version: ${{ matrix.bazel_version || '8.0.1' }}
|
||||
|
||||
non-linux-cmake:
|
||||
strategy:
|
||||
@ -531,7 +542,7 @@ jobs:
|
||||
if: ${{ matrix.install-flags && (!matrix.continuous-only || inputs.continuous-run) }}
|
||||
uses: protocolbuffers/protobuf-ci/bash@v4
|
||||
with:
|
||||
bazel-version: 7.1.2
|
||||
bazel-version: 8.0.1
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
command: >-
|
||||
cmake . -DCMAKE_CXX_STANDARD=17 ${{ matrix.install-flags }}
|
||||
@ -558,7 +569,7 @@ jobs:
|
||||
uses: protocolbuffers/protobuf-ci/bash@v4
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-version: 7.1.2
|
||||
bazel-version: 8.0.1
|
||||
command: >-
|
||||
cmake . -DCMAKE_CXX_STANDARD=17 ${{ matrix.flags }}
|
||||
${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_ALLOW_CCACHE=ON
|
||||
|
@ -27,7 +27,7 @@ jobs:
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:7.1.2-3.1.415-6.0.100-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:8.0.1-3.1.415-6.0.100-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
entrypoint: /bin/bash
|
||||
command: >-
|
||||
@ -43,7 +43,7 @@ jobs:
|
||||
- name: Run conformance tests
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:7.1.2-3.1.415-6.0.100-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:8.0.1-3.1.415-6.0.100-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: csharp_linux
|
||||
bazel: test //csharp:conformance_test --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel
|
||||
@ -74,7 +74,7 @@ jobs:
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/bash@v4
|
||||
with:
|
||||
bazel-version: 7.1.2
|
||||
bazel-version: 8.0.1
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
command: |
|
||||
dotnet build csharp/src/Google.Protobuf.sln
|
||||
|
@ -30,19 +30,19 @@ jobs:
|
||||
include:
|
||||
- name: OpenJDK 8
|
||||
cache_key: '8'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-8-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8.0.1-8-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
# TODO: b/318555165 - enable the layering check. Currently it does
|
||||
# not work correctly with the toolchain in this Docker image.
|
||||
targets: //java/... //java/internal:java_version //compatibility/... --features=-layering_check
|
||||
targets: //java/... //java/internal:java_version --features=-layering_check
|
||||
flags: --java_language_version=8
|
||||
- name: OpenJDK 11
|
||||
cache_key: '11'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8.0.1-11-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
targets: //java/... //java/internal:java_version //compatibility/...
|
||||
continuous-only: true
|
||||
- name: OpenJDK 17
|
||||
cache_key: '17'
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-17-641278a52587c01f44525819b76499db35c2804d
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8.0.1-17-168f9c9d015a0fa16611e1e9eede796fe9bfbb69
|
||||
targets: //java/... //java/internal:java_version //compatibility/...
|
||||
- name: Bazel7
|
||||
cache_key: 'bazel7bzlmod'
|
||||
@ -106,7 +106,7 @@ jobs:
|
||||
- name: Generate maven artifacts with bazel and install using maven
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8.0.1-11-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: java_linux/11
|
||||
bash: |
|
||||
|
@ -69,6 +69,7 @@ jobs:
|
||||
CXX: ${{ github.workspace }}/ci/clang_wrapper++
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-version: 8.0.1
|
||||
command: |
|
||||
xcodebuild \
|
||||
-project "objectivec/${{ matrix.xc_project }}" \
|
||||
@ -111,7 +112,7 @@ jobs:
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v4
|
||||
with:
|
||||
version: 7.1.2 # Bazel version
|
||||
version: 8.0.1 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: cocoapods/${{ matrix.XCODE }}
|
||||
bash: |
|
||||
@ -159,7 +160,7 @@ jobs:
|
||||
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v4
|
||||
with:
|
||||
version: 7.1.2 # Bazel version
|
||||
version: 8.0.1 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }}
|
||||
bazel-cache: objc_${{ matrix.platform }}_${{ matrix.config.name }}
|
||||
|
@ -37,7 +37,6 @@ jobs:
|
||||
version: 8.1.14-dbg
|
||||
version-short: "8.1"
|
||||
command: composer test && composer test_c
|
||||
continuous-only: true
|
||||
- name: 8.1 Memory Leak
|
||||
version: 8.1.14-dbg
|
||||
version-short: "8.1"
|
||||
@ -72,7 +71,7 @@ jobs:
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:7.1.2-${{ matrix.version }}-90d207f4e749b54c8792bbe974dfc70323b6566e
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:8.0.1-${{ matrix.version }}-b77fdae6d4771789dfc66a56bf8d806354e8011a
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: php_linux/${{ matrix.version }}
|
||||
bash: |
|
||||
@ -122,7 +121,7 @@ jobs:
|
||||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-bec4e87effd62da1d4f9a13d377e37bcb80376c9
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 #TODO: b/409557730 - upgrade to bazel 8.0.1
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-i386
|
||||
|
||||
@ -148,6 +147,43 @@ jobs:
|
||||
composer update --ignore-platform-reqs;
|
||||
composer ${{ matrix.test }}'
|
||||
|
||||
linux-aarch64:
|
||||
name: Linux aarch64
|
||||
runs-on: ubuntu-22-4core
|
||||
steps:
|
||||
- name: Checkout pending changes
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
|
||||
- name: Cross compile protoc for aarch64
|
||||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 #TODO: b/409557730 - upgrade to bazel 8.0.1
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-aarch64
|
||||
|
||||
- name: Setup composer
|
||||
uses: protocolbuffers/protobuf-ci/composer-setup@v4
|
||||
with:
|
||||
cache-prefix: php-8.1
|
||||
directory: php
|
||||
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/docker@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php-aarch64@sha256:77ff9fdec867bbfb290ee0b10d8b7a3e5e434155daa5ec93de7341c7592b858d
|
||||
platform: linux/arm64
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
extra-flags: -e COMPOSER_HOME=/workspace/composer-cache -e PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }}
|
||||
command: >-
|
||||
-cex '
|
||||
cd php;
|
||||
composer update --ignore-platform-reqs;
|
||||
composer test;
|
||||
composer test_c'
|
||||
|
||||
macos:
|
||||
strategy:
|
||||
fail-fast: false # Don't cancel all jobs if one fails.
|
||||
@ -195,6 +231,7 @@ jobs:
|
||||
uses: protocolbuffers/protobuf-ci/bash@v4
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-version: 8.0.1
|
||||
command: |
|
||||
pushd php
|
||||
php -v
|
||||
@ -208,5 +245,6 @@ jobs:
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v4
|
||||
with:
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
version: 8.0.1 # Bazel version
|
||||
bazel-cache: php_macos/${{ matrix.version }}
|
||||
bazel: test //php:conformance_test //php:conformance_test_c --action_env=PATH --test_env=PATH
|
||||
|
@ -35,7 +35,7 @@ jobs:
|
||||
- name: Package extension
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v4
|
||||
with:
|
||||
version: 7.1.2 # Bazel version
|
||||
version: 8.0.1 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: php_ext/${{ matrix.version }}
|
||||
bash: >
|
||||
|
@ -13,7 +13,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
branch: [25.x, 29.x]
|
||||
branch: [25.x, 29.x, 30.x]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
|
@ -30,9 +30,8 @@ jobs:
|
||||
include:
|
||||
# Test both FFI and Native implementations on the highest and lowest
|
||||
# Ruby versions for CRuby and JRuby
|
||||
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82' }
|
||||
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, continuous-only: true, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82' }
|
||||
- { name: Ruby 3.1, ruby: ruby-3.1.6, continuous-only: true }
|
||||
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: NATIVE }
|
||||
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: FFI }
|
||||
- { name: Ruby 3.2, ruby: ruby-3.2.6, continuous-only: true }
|
||||
- { name: Ruby 3.3, ruby: ruby-3.3.6, continuous-only: true }
|
||||
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE }
|
||||
@ -52,7 +51,7 @@ jobs:
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
|
||||
with:
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-90d207f4e749b54c8792bbe974dfc70323b6566e', matrix.ruby) }}
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-{0}-b77fdae6d4771789dfc66a56bf8d806354e8011a', matrix.ruby) }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: ruby_linux/${{ matrix.ruby }}
|
||||
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,7 +66,7 @@ jobs:
|
||||
|
||||
linux-32bit:
|
||||
name: Linux 32-bit
|
||||
runs-on: ubuntu-20-4core
|
||||
runs-on: ubuntu-22-4core
|
||||
steps:
|
||||
- name: Checkout pending changes
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v4
|
||||
@ -78,18 +77,49 @@ jobs:
|
||||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 #TODO: b/409557730 - upgrade to bazel 8.0.1
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-i386
|
||||
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/docker@v4
|
||||
with:
|
||||
image: i386/ruby:3.0.2-buster
|
||||
image: i386/ruby:3.1.6-bullseye
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
command: >-
|
||||
/bin/bash -cex '
|
||||
gem install bundler -v 2.5.13;
|
||||
gem install bundler -v 2.6.6;
|
||||
cd /workspace/ruby;
|
||||
bundle;
|
||||
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
|
||||
rake clobber_package gem;
|
||||
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake test'
|
||||
|
||||
linux-aarch64:
|
||||
name: Linux aarch64
|
||||
runs-on: ubuntu-22-4core
|
||||
steps:
|
||||
- name: Checkout pending changes
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
|
||||
- name: Cross compile protoc for aarch64
|
||||
id: cross-compile
|
||||
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v4
|
||||
with:
|
||||
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 #TODO: b/409557730 - upgrade to bazel 8.0.1
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
architecture: linux-aarch64
|
||||
|
||||
- name: Run tests
|
||||
uses: protocolbuffers/protobuf-ci/docker@v4
|
||||
with:
|
||||
image: arm64v8/ruby:3.1.4-buster
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
command: >-
|
||||
/bin/bash -cex '
|
||||
gem install bundler -v 2.6.6;
|
||||
cd /workspace/ruby;
|
||||
bundle;
|
||||
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
|
||||
@ -104,9 +134,8 @@ jobs:
|
||||
# Test both FFI and Native implementations on the highest and lowest
|
||||
# Ruby versions for CRuby.
|
||||
# Quote versions numbers otherwise 3.0 will render as 3
|
||||
- { version: "3.0", ffi: NATIVE }
|
||||
- { version: "3.0", ffi: FFI, continuous-only: true }
|
||||
- { version: "3.1", continuous-only: true }
|
||||
- { version: "3.1", ffi: NATIVE }
|
||||
- { version: "3.1", ffi: FFI }
|
||||
- { version: "3.2", continuous-only: true }
|
||||
- { version: "3.3", continuous-only: true }
|
||||
- { version: "3.4", ffi: NATIVE }
|
||||
@ -135,7 +164,7 @@ jobs:
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel@v4
|
||||
with:
|
||||
version: 7.1.2 # Bazel version
|
||||
version: 8.0.1 # Bazel version
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: ruby_macos/${{ matrix.version }}
|
||||
bazel: test //ruby/... --test_env=KOKORO_RUBY_VERSION=${{ matrix.version }} --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
|
||||
@ -148,28 +177,27 @@ jobs:
|
||||
include:
|
||||
# Test both FFI and Native implementations on the highest and lowest
|
||||
# Ruby versions for CRuby and JRuby.
|
||||
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: NATIVE, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82'}
|
||||
- { name: Ruby 3.0, ruby: ruby-3.0.2, ffi: FFI, image: 'us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-ruby-3.0.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82'}
|
||||
- { name: Ruby 3.1, ruby: ruby-3.1.6}
|
||||
- { name: Ruby 3.2, ruby: ruby-3.2.6}
|
||||
- { name: Ruby 3.3, ruby: ruby-3.3.6}
|
||||
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: NATIVE }
|
||||
- { name: Ruby 3.1, ruby: ruby-3.1.6, ffi: FFI }
|
||||
- { name: Ruby 3.2, ruby: ruby-3.2.6, continuous-only: true}
|
||||
- { name: Ruby 3.3, ruby: ruby-3.3.6, continuous-only: true}
|
||||
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: NATIVE }
|
||||
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI }
|
||||
- { name: Ruby 3.4, ruby: ruby-3.4.1, ffi: FFI, continuous-only: true }
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: NATIVE }
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI }
|
||||
name: ${{ inputs.continuous-prefix }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
|
||||
- { name: JRuby 9.4, ruby: jruby-9.4.9.0, ffi: FFI, continuous-only: true }
|
||||
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout pending changes
|
||||
if: ${{ inputs.continuous-run }}
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
- name: Run tests
|
||||
if: ${{ inputs.continuous-run }}
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
|
||||
with:
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-90d207f4e749b54c8792bbe974dfc70323b6566e', matrix.ruby) }}
|
||||
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:8.0.1-{0}-b77fdae6d4771789dfc66a56bf8d806354e8011a', matrix.ruby) }}
|
||||
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
|
||||
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
|
||||
bash: >
|
||||
|
@ -18,20 +18,26 @@ jobs:
|
||||
fail-fast: false # Don't cancel all jobs if one fails.
|
||||
matrix:
|
||||
config:
|
||||
- { name: Fastbuild, flags: --noenable_bzlmod }
|
||||
- { name: Optimized, flags: --noenable_bzlmod --config=opt }
|
||||
- { name: ASAN, flags: --noenable_bzlmod --config=asan }
|
||||
- { name: "No bzlmod", flags: --noenable_bzlmod --enable_workspace }
|
||||
- { name: "Bzlmod and Workspace", flags: --enable_bzlmod --enable_workspace }
|
||||
- { name: Optimized, flags: --config=opt }
|
||||
- { name: ASAN, flags: --config=asan }
|
||||
|
||||
include:
|
||||
- targets: "//rust/... //src/google/protobuf/compiler/rust/..."
|
||||
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
|
||||
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3"
|
||||
- bazel_cmd: "test"
|
||||
|
||||
# Override cases with custom images
|
||||
- config: { name: Cargo, flags: --noenable_bzlmod }
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:7.1.2-1.74.0-d9624f2aa83cba3eaf906f751d75b36aacb9aa82"
|
||||
- config: { name: Cargo }
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:8.0.1-1.79.0-d271543f317955b5732ce19b2be672a195e96508"
|
||||
bazel_cmd: "run"
|
||||
targets: "//rust/release_crates:cargo_test"
|
||||
|
||||
# rules_rust does not support workspace + bazel 8, so we test workspace + bazel 7
|
||||
- name: "No bzlmod"
|
||||
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
|
||||
|
||||
name: Linux ${{ matrix.config.name }}
|
||||
runs-on: ubuntu-22-4core
|
||||
steps:
|
||||
|
@ -74,7 +74,7 @@ jobs:
|
||||
bazel-cache: "upb-bazel-gcc"
|
||||
bazel: >-
|
||||
test --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt
|
||||
--copt="-Wno-error=maybe-uninitialized" --copt="-Wno-error=attributes"
|
||||
--copt="-Wno-error=maybe-uninitialized" --java_runtime_version=remotejdk_11
|
||||
//bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
|
||||
|
||||
windows:
|
||||
|
124
third_party/protobuf/BUILD.bazel
vendored
124
third_party/protobuf/BUILD.bazel
vendored
@ -164,6 +164,118 @@ alias(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# upb targets for some of the well-known types
|
||||
|
||||
alias(
|
||||
name = "any_upb_proto",
|
||||
actual = "//src/google/protobuf:any_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "api_upb_proto",
|
||||
actual = "//src/google/protobuf:api_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "duration_upb_proto",
|
||||
actual = "//src/google/protobuf:duration_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "empty_upb_proto",
|
||||
actual = "//src/google/protobuf:empty_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "field_mask_upb_proto",
|
||||
actual = "//src/google/protobuf:field_mask_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "source_context_upb_proto",
|
||||
actual = "//src/google/protobuf:source_context_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "struct_upb_proto",
|
||||
actual = "//src/google/protobuf:struct_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "type_upb_proto",
|
||||
actual = "//src/google/protobuf:type_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "wrappers_upb_proto",
|
||||
actual = "//src/google/protobuf:wrappers_upb_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# upb reflection targets for some of the well-known types
|
||||
|
||||
alias(
|
||||
name = "any_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:any_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "api_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:api_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "duration_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:duration_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "empty_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:empty_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "field_mask_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:field_mask_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "source_context_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:source_context_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "struct_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:struct_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "type_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:type_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "wrappers_upb_reflection_proto",
|
||||
actual = "//src/google/protobuf:wrappers_upb_reflection_proto",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Source files: these are aliases to a filegroup, not a `proto_library`.
|
||||
#
|
||||
# (This is _probably_ not what you want.)
|
||||
@ -238,7 +350,15 @@ cc_binary(
|
||||
copts = COPTS,
|
||||
linkopts = LINK_OPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//src/google/protobuf/compiler:protoc_lib"],
|
||||
deps = ["//src/google/protobuf/compiler:protoc_lib_stage1"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "protoc_stage0",
|
||||
copts = COPTS,
|
||||
linkopts = LINK_OPTS,
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = ["//src/google/protobuf/compiler:protoc_lib_stage0"],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
@ -253,7 +373,7 @@ cc_binary(
|
||||
}),
|
||||
linkopts = LINK_OPTS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//src/google/protobuf/compiler:protoc_lib"],
|
||||
deps = ["//src/google/protobuf/compiler:protoc_lib_stage1"],
|
||||
)
|
||||
|
||||
################################################################################
|
||||
|
1
third_party/protobuf/BUILD.gn
vendored
1
third_party/protobuf/BUILD.gn
vendored
@ -310,7 +310,6 @@ source_set("utf8_range") {
|
||||
sources = [
|
||||
"third_party/utf8_range/utf8_range.c",
|
||||
"third_party/utf8_range/utf8_range.h",
|
||||
"third_party/utf8_range/utf8_validity.cc",
|
||||
"third_party/utf8_range/utf8_validity.h",
|
||||
]
|
||||
|
||||
|
4
third_party/protobuf/CMakeLists.txt
vendored
4
third_party/protobuf/CMakeLists.txt
vendored
@ -86,7 +86,7 @@ if (protobuf_BUILD_SHARED_LIBS)
|
||||
endif ()
|
||||
|
||||
# Version metadata
|
||||
set(protobuf_VERSION_STRING "6.30.2")
|
||||
set(protobuf_VERSION_STRING "6.31.0")
|
||||
set(protobuf_DESCRIPTION "Protocol Buffers")
|
||||
set(protobuf_CONTACT "protobuf@googlegroups.com")
|
||||
|
||||
@ -203,7 +203,7 @@ if (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "SHARED")
|
||||
else (protobuf_BUILD_SHARED_LIBS)
|
||||
set(protobuf_SHARED_OR_STATIC "STATIC")
|
||||
set(ABSL_MSVC_STATIC_RUNTIME ON)
|
||||
set(ABSL_MSVC_STATIC_RUNTIME ${protobuf_MSVC_STATIC_RUNTIME})
|
||||
if (protobuf_MSVC_STATIC_RUNTIME)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
|
||||
else()
|
||||
|
66
third_party/protobuf/Cargo.bazel.lock
vendored
66
third_party/protobuf/Cargo.bazel.lock
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"checksum": "422d164988d36886ae9aef8b60e233d67aac121356b66f1452c469f912cc0148",
|
||||
"checksum": "93ba4d30a8d1e92826afecc6c6d8c601bdc8b2447d8cf3238cbf26a85760165b",
|
||||
"crates": {
|
||||
"aho-corasick 1.1.2": {
|
||||
"name": "aho-corasick",
|
||||
@ -125,6 +125,14 @@
|
||||
{
|
||||
"id": "googletest 0.12.0",
|
||||
"target": "googletest"
|
||||
},
|
||||
{
|
||||
"id": "quote 1.0.33",
|
||||
"target": "quote"
|
||||
},
|
||||
{
|
||||
"id": "syn 2.0.43",
|
||||
"target": "syn"
|
||||
}
|
||||
],
|
||||
"selects": {}
|
||||
@ -919,13 +927,55 @@
|
||||
"clone-impls",
|
||||
"default",
|
||||
"derive",
|
||||
"full",
|
||||
"parsing",
|
||||
"printing",
|
||||
"proc-macro",
|
||||
"quote"
|
||||
],
|
||||
"selects": {}
|
||||
"selects": {
|
||||
"aarch64-apple-darwin": [
|
||||
"full"
|
||||
],
|
||||
"aarch64-pc-windows-msvc": [
|
||||
"full"
|
||||
],
|
||||
"aarch64-unknown-linux-gnu": [
|
||||
"full"
|
||||
],
|
||||
"aarch64-unknown-nixos-gnu": [
|
||||
"full"
|
||||
],
|
||||
"arm-unknown-linux-gnueabi": [
|
||||
"full"
|
||||
],
|
||||
"i686-pc-windows-msvc": [
|
||||
"full"
|
||||
],
|
||||
"i686-unknown-linux-gnu": [
|
||||
"full"
|
||||
],
|
||||
"powerpc-unknown-linux-gnu": [
|
||||
"full"
|
||||
],
|
||||
"s390x-unknown-linux-gnu": [
|
||||
"full"
|
||||
],
|
||||
"x86_64-apple-darwin": [
|
||||
"full"
|
||||
],
|
||||
"x86_64-pc-windows-msvc": [
|
||||
"full"
|
||||
],
|
||||
"x86_64-unknown-freebsd": [
|
||||
"full"
|
||||
],
|
||||
"x86_64-unknown-linux-gnu": [
|
||||
"full"
|
||||
],
|
||||
"x86_64-unknown-nixos-gnu": [
|
||||
"full"
|
||||
]
|
||||
}
|
||||
},
|
||||
"deps": {
|
||||
"common": [
|
||||
@ -1072,9 +1122,6 @@
|
||||
"wasm32-unknown-unknown": [
|
||||
"wasm32-unknown-unknown"
|
||||
],
|
||||
"wasm32-wasi": [
|
||||
"wasm32-wasi"
|
||||
],
|
||||
"wasm32-wasip1": [
|
||||
"wasm32-wasip1"
|
||||
],
|
||||
@ -1108,7 +1155,10 @@
|
||||
},
|
||||
"direct_deps": [
|
||||
"googletest 0.12.0",
|
||||
"paste 1.0.14"
|
||||
"paste 1.0.14",
|
||||
"quote 1.0.33",
|
||||
"syn 2.0.43"
|
||||
],
|
||||
"direct_dev_deps": []
|
||||
"direct_dev_deps": [],
|
||||
"unused_patches": []
|
||||
}
|
||||
|
4
third_party/protobuf/Cargo.lock
generated
vendored
4
third_party/protobuf/Cargo.lock
generated
vendored
@ -1,6 +1,6 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
@ -23,6 +23,8 @@ version = "0.0.1"
|
||||
dependencies = [
|
||||
"googletest",
|
||||
"paste",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
37
third_party/protobuf/Disable_bundle_install.patch
vendored
Normal file
37
third_party/protobuf/Disable_bundle_install.patch
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
Subject: [PATCH] Disable bundle install
|
||||
---
|
||||
Index: ruby/private/bundle_fetch.bzl
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/ruby/private/bundle_fetch.bzl b/ruby/private/bundle_fetch.bzl
|
||||
--- a/ruby/private/bundle_fetch.bzl (revision 075937d3f2e22d4657f5c4693e7405d8952ab209)
|
||||
+++ b/ruby/private/bundle_fetch.bzl (date 1740971614385)
|
||||
@@ -168,16 +168,16 @@
|
||||
)
|
||||
|
||||
# Fetch Bundler and define an `rb_gem_install()` target for it.
|
||||
- _download_gem(repository_ctx, gemfile_lock.bundler, cache_path, gemfile_lock.bundler.sha256)
|
||||
- gem_full_names.append(":%s" % gemfile_lock.bundler.full_name)
|
||||
- gem_install_fragments.append(
|
||||
- _GEM_INSTALL_BUILD_FRAGMENT.format(
|
||||
- name = gemfile_lock.bundler.full_name,
|
||||
- gem = gemfile_lock.bundler.filename,
|
||||
- cache_path = cache_path,
|
||||
- ruby = ruby_toolchain_attr,
|
||||
- ),
|
||||
- )
|
||||
+# _download_gem(repository_ctx, gemfile_lock.bundler, cache_path, gemfile_lock.bundler.sha256)
|
||||
+# gem_full_names.append(":%s" % gemfile_lock.bundler.full_name)
|
||||
+# gem_install_fragments.append(
|
||||
+# _GEM_INSTALL_BUILD_FRAGMENT.format(
|
||||
+# name = gemfile_lock.bundler.full_name,
|
||||
+# gem = gemfile_lock.bundler.filename,
|
||||
+# cache_path = cache_path,
|
||||
+# ruby = ruby_toolchain_attr,
|
||||
+# ),
|
||||
+# )
|
||||
|
||||
# Create `bin` package with shims for gem executables.
|
||||
# This allows targets to depend on `@bundle//bin:rake`
|
145
third_party/protobuf/MODULE.bazel
vendored
145
third_party/protobuf/MODULE.bazel
vendored
@ -3,7 +3,7 @@
|
||||
|
||||
module(
|
||||
name = "protobuf",
|
||||
version = "30.2", # Automatically updated on release
|
||||
version = "31.0", # Automatically updated on release
|
||||
compatibility_level = 1,
|
||||
repo_name = "com_google_protobuf",
|
||||
)
|
||||
@ -14,9 +14,16 @@ module(
|
||||
# Thus the highest version in their module graph is resolved.
|
||||
|
||||
# These dependencies must be declared before the other rules dependencies.
|
||||
bazel_dep(name = "rules_apple", version = "3.13.0", repo_name = "build_bazel_rules_apple")
|
||||
bazel_dep(name = "rules_apple", version = "3.16.0", repo_name = "build_bazel_rules_apple")
|
||||
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
|
||||
|
||||
# Keep apple_support on 1.15.1 for now to avoid this issue:
|
||||
# https://github.com/bazelbuild/apple_support/issues/316
|
||||
single_version_override(
|
||||
module_name = "apple_support",
|
||||
version = "1.15.1",
|
||||
)
|
||||
|
||||
#ifndef PROTO2_OPENSOURCE
|
||||
# LINT.IfChange
|
||||
#endif // PROTO2_OPENSOURCE
|
||||
@ -32,16 +39,72 @@ bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
|
||||
bazel_dep(name = "bazel_features", version = "1.23.0", repo_name = "proto_bazel_features")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.7.1")
|
||||
bazel_dep(name = "jsoncpp", version = "1.9.6")
|
||||
bazel_dep(name = "rules_fuzzing", version = "0.5.2")
|
||||
bazel_dep(name = "rules_java", version = "8.6.1")
|
||||
bazel_dep(name = "rules_jvm_external", version = "6.3")
|
||||
bazel_dep(name = "rules_jvm_external", version = "6.7")
|
||||
bazel_dep(name = "rules_kotlin", version = "1.9.6")
|
||||
bazel_dep(name = "rules_license", version = "1.0.0")
|
||||
bazel_dep(name = "rules_pkg", version = "1.0.1")
|
||||
bazel_dep(name = "rules_python", version = "1.0.0")
|
||||
bazel_dep(name = "rules_rust", version = "0.51.0")
|
||||
|
||||
bazel_dep(name = "rules_rust", version = "0.56.0", dev_dependency = True)
|
||||
bazel_dep(name = "rules_ruby", version = "0.17.3", dev_dependency = True)
|
||||
|
||||
# Workaround for https://github.com/bazelbuild/bazel-central-registry/issues/4230
|
||||
# rules_fuzzing 0.5.3 is not yet available in BCR.
|
||||
bazel_dep(name = "rules_fuzzing", version = "0.5.3", dev_dependency = True)
|
||||
archive_override(
|
||||
module_name = "rules_fuzzing",
|
||||
integrity = "sha256-CCdEIsQ4NBbfX5gpQ+QNWBQfdJwJAIu3gEQO7OaxE+Q=",
|
||||
strip_prefix = "rules_fuzzing-0.5.3",
|
||||
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.5.3.tar.gz"],
|
||||
)
|
||||
|
||||
# Workaround for https://github.com/bazel-contrib/rules_ruby/issues/216
|
||||
# Patch rules_ruby to disable automatic attempt to install bundler. When fixed,
|
||||
# delete Disable_bundle_install.patch and single_version_override() below.
|
||||
single_version_override(
|
||||
module_name = "rules_ruby",
|
||||
patch_strip = 1,
|
||||
patches = [
|
||||
"@com_google_protobuf//:Disable_bundle_install.patch",
|
||||
"@com_google_protobuf//:Neverlink_jruby_jars.patch",
|
||||
],
|
||||
version = "0.17.3",
|
||||
)
|
||||
|
||||
bazel_dep(name = "rules_shell", version = "0.2.0")
|
||||
bazel_dep(name = "platforms", version = "0.0.10")
|
||||
bazel_dep(name = "platforms", version = "0.0.11")
|
||||
|
||||
# Ruby toolchains
|
||||
ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby", dev_dependency = True)
|
||||
ruby.toolchain(
|
||||
name = "ruby",
|
||||
version = "system",
|
||||
)
|
||||
use_repo(ruby, "ruby")
|
||||
ruby.bundle_fetch(
|
||||
name = "protobuf_bundle",
|
||||
gem_checksums = {
|
||||
"bigdecimal-3.1.9": "2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc",
|
||||
"bigdecimal-3.1.9-java": "dd9b8f7c870664cd9538a1325ce385ba57a6627969177258c4f0e661a7be4456",
|
||||
"ffi-1.17.1": "26f6b0dbd1101e6ffc09d3ca640b2a21840cc52731ad8a7ded9fb89e5fb0fc39",
|
||||
"ffi-1.17.1-java": "2546e11f9592e2b9b6de49eb96d2a378da47b0bb8469d5cbc9881a55c0d55da7",
|
||||
"ffi-compiler-1.3.2": "a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0",
|
||||
"power_assert-2.0.5": "63b511b85bb8ea57336d25156864498644f5bbf028699ceda27949e0125bc323",
|
||||
"rake-13.2.1": "46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d",
|
||||
"rake-compiler-1.1.9": "51b5c95a1ff25cabaaf92e674a2bed847ab53d66302fc8843830df46ab1f51f5",
|
||||
"rake-compiler-dock-1.2.1": "3cc968d7ffc923c0e775b28d79a3389efb3d2b16ef52ed0298fbc97d347e5878",
|
||||
"test-unit-3.6.7": "c342bb9f7334ea84a361b43c20b063f405c0bf3c7dbe3ff38f61a91661d29221",
|
||||
},
|
||||
gemfile = "//ruby:Gemfile",
|
||||
gemfile_lock = "//ruby:Gemfile.lock",
|
||||
)
|
||||
use_repo(ruby, "protobuf_bundle", "ruby_toolchains")
|
||||
|
||||
register_toolchains(
|
||||
"@ruby_toolchains//:all",
|
||||
dev_dependency = True,
|
||||
)
|
||||
|
||||
# Proto toolchains
|
||||
register_toolchains("//bazel/private/toolchains:all")
|
||||
@ -85,6 +148,26 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen
|
||||
|
||||
use_repo(pip, "protobuf_pip_deps")
|
||||
|
||||
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True)
|
||||
crate.spec(
|
||||
package = "googletest",
|
||||
version = ">0.0.0",
|
||||
)
|
||||
crate.spec(
|
||||
package = "paste",
|
||||
version = ">=1",
|
||||
)
|
||||
crate.spec(
|
||||
package = "quote",
|
||||
version = ">=1",
|
||||
)
|
||||
crate.spec(
|
||||
package = "syn",
|
||||
version = ">=2",
|
||||
)
|
||||
crate.from_specs()
|
||||
use_repo(crate, crate_index = "crates")
|
||||
|
||||
PROTOBUF_MAVEN_ARTIFACTS = [
|
||||
"com.google.code.findbugs:jsr305:3.0.2",
|
||||
"com.google.code.gson:gson:2.8.9",
|
||||
@ -105,6 +188,9 @@ protobuf_maven.install(
|
||||
)
|
||||
use_repo(protobuf_maven, "protobuf_maven")
|
||||
|
||||
# Temporarily pin transitive dependency for https://github.com/bazelbuild/bazel/issues/24426
|
||||
bazel_dep(name = "re2", version = "2024-07-02.bcr.1")
|
||||
|
||||
# Development dependencies
|
||||
protobuf_maven_dev = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True)
|
||||
protobuf_maven_dev.install(
|
||||
@ -127,10 +213,9 @@ protobuf_maven_dev.install(
|
||||
)
|
||||
use_repo(protobuf_maven_dev, "protobuf_maven_dev")
|
||||
|
||||
# Development dependencies
|
||||
bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True)
|
||||
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
|
||||
bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True)
|
||||
bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)
|
||||
bazel_dep(name = "rules_testing", version = "0.8.0", dev_dependency = True)
|
||||
bazel_dep(
|
||||
name = "abseil-py",
|
||||
version = "2.1.0",
|
||||
@ -142,5 +227,43 @@ bazel_dep(
|
||||
cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension")
|
||||
use_repo(cc_configure, "local_config_cc")
|
||||
|
||||
# rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests
|
||||
bazel_dep(name = "rules_proto", version = "4.0.0", dev_dependency = True)
|
||||
# rules_proto are needed for @com_google_protobuf_v25 used in //compatibility/... tests
|
||||
bazel_dep(name = "rules_proto", version = "7.0.2", dev_dependency = True)
|
||||
|
||||
# For the Lua upb implementation
|
||||
bazel_dep(name = "lua", version = "5.4.6", dev_dependency = True)
|
||||
|
||||
# For benchmarks
|
||||
bazel_dep(name = "googleapis", version = "0.0.0-20240819-fe8ba054a", dev_dependency = True)
|
||||
bazel_dep(name = "google_benchmark", version = "1.9.2", dev_dependency = True)
|
||||
|
||||
# For testing runtime against old gencode from a previous major version.
|
||||
bazel_dep(name = "com_google_protobuf_v25", version = "25.0", dev_dependency = True)
|
||||
archive_override(
|
||||
module_name = "com_google_protobuf_v25",
|
||||
integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=",
|
||||
patch_strip = 1,
|
||||
patches = [
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0001-Add-MODULE.bazel.patch",
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0002-Examples-MODULE.bazel.patch",
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0003-relative-labels.patch",
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0004-Add-utf8_range-dependency.patch",
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0005-Make-rules_ruby-a-dev-only-dependency.patch",
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0006-Add-repo_name.patch",
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0007-Java-bazel8.patch",
|
||||
],
|
||||
strip_prefix = "protobuf-25.0",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz"],
|
||||
)
|
||||
|
||||
bazel_dep(name = "com_google_protobuf_previous_release", version = "29.0", dev_dependency = True)
|
||||
archive_override(
|
||||
module_name = "com_google_protobuf_previous_release",
|
||||
integrity = "sha256-EKDVjzmhqQnpXgDougtbHcZNApl/dBFRlTorNln254w=",
|
||||
patch_strip = 1,
|
||||
patches = [
|
||||
"@com_google_protobuf//:patches/protobuf_v29/0001-Update-module-name.patch",
|
||||
],
|
||||
strip_prefix = "protobuf-29.0",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz"],
|
||||
)
|
||||
|
16
third_party/protobuf/Neverlink_jruby_jars.patch
vendored
Normal file
16
third_party/protobuf/Neverlink_jruby_jars.patch
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
Index: ruby/private/download/BUILD.tpl
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/ruby/private/download/BUILD.tpl b/ruby/private/download/BUILD.tpl
|
||||
--- a/ruby/private/download/BUILD.tpl (revision 26e0ba621cb82933f28a59373cb6a7afe54fae95)
|
||||
+++ b/ruby/private/download/BUILD.tpl (date 1745340325192)
|
||||
@@ -33,6 +33,7 @@
|
||||
["dist/lib/**/*.jar"],
|
||||
allow_empty = True,
|
||||
),
|
||||
+ neverlink = True,
|
||||
)
|
||||
|
||||
rb_toolchain(
|
2
third_party/protobuf/Protobuf.podspec
vendored
2
third_party/protobuf/Protobuf.podspec
vendored
@ -5,7 +5,7 @@
|
||||
# dependent projects use the :git notation to refer to the library.
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Protobuf'
|
||||
s.version = '4.30.2'
|
||||
s.version = '4.31.0'
|
||||
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
|
||||
s.homepage = 'https://github.com/protocolbuffers/protobuf'
|
||||
s.license = 'BSD-3-Clause'
|
||||
|
60
third_party/protobuf/README.chromium
vendored
60
third_party/protobuf/README.chromium
vendored
@ -3,9 +3,9 @@ Short Name: protobuf
|
||||
URL: https://github.com/google/protobuf
|
||||
License: BSD-3-Clause
|
||||
License File: LICENSE
|
||||
Version: 30.2
|
||||
CPEPrefix: cpe:/a:google:protobuf:30.2
|
||||
Revision: 43e1626812c1b543e56a7bec59dc09eb18248bd2
|
||||
Version: 31.0
|
||||
CPEPrefix: cpe:/a:google:protobuf:31.0
|
||||
Revision: 3d4adad5c4c4e6a6f9f038769b8c90716065b0e4
|
||||
Security Critical: yes
|
||||
Shipped: yes
|
||||
|
||||
@ -19,10 +19,15 @@ Steps used to create the current version (or roll a newer one):
|
||||
code .tar.gz). Extract to `third_party/protobuf` (without version suffix),
|
||||
i.e. you may `$ mv protobuf-21.12 third_party/protobuf` or similar.
|
||||
|
||||
2. Add back chromium's non-upstream files (from this directory):
|
||||
2. Remove patches/ directory since Chromium has a different set of patches.
|
||||
|
||||
$ git checkout main BUILD.gn DEPS DIR_METADATA OWNERS README.chromium \
|
||||
gen_extra_chromium_files.py proto_library.gni proto_sources.gni patches/
|
||||
$ rm -r patches/
|
||||
|
||||
3. Add back chromium's on-upstream files (from this directory):
|
||||
|
||||
$ git checkout origin/main -- BUILD.gn DEPS DIR_METADATA OWNERS \
|
||||
README.chromium gen_extra_chromium_files.py proto_library.gni \
|
||||
proto_sources.gni patches/
|
||||
|
||||
Note: Ideally we wouldn't do this but instead have a
|
||||
`third_party/protobuf/src/` subdirectory where upstream code goes directly
|
||||
@ -35,9 +40,9 @@ Steps used to create the current version (or roll a newer one):
|
||||
Probably worth making a local `git commit` here before applying patches (next
|
||||
step).
|
||||
|
||||
3. Apply patches in patches/ (see the description below):
|
||||
4. Apply patches in patches/ (see the description below):
|
||||
|
||||
$ for patch in patches/*; do patch -s -p1 < $patch; done
|
||||
$ for patch in patches/*.patch; do patch -s -p1 < $patch; done
|
||||
|
||||
When a patch fails, it's probably best to check out previous state (from 3)
|
||||
for any changes not inside the patches/ folder, fix the patch and then try to
|
||||
@ -54,15 +59,26 @@ Steps used to create the current version (or roll a newer one):
|
||||
|
||||
Probably worth committing locally here too.
|
||||
|
||||
4. Generate descriptor_pb2.py using the script "gen_extra_chromium_files.py" in
|
||||
5. Generate descriptor_pb2.py using the script "gen_extra_chromium_files.py" in
|
||||
the same directory as this file.
|
||||
|
||||
$ ./gen_extra_chromium_files.py -C ../../out/Default
|
||||
|
||||
Add and commit `python/google/protobuf/descriptor_pb2.py` and
|
||||
`python/google/protobuf/compiler/plugin_pb2.py` as well.
|
||||
`python/google/protobuf/compiler/plugin_pb2.py` as well. Because *_pb2.py is
|
||||
in the .gitignore file for this directory, you need to add the files with
|
||||
`-f`.
|
||||
|
||||
5. Run:
|
||||
$ git add -f python/google/protobuf/descriptor_pb2.py \
|
||||
python/google/protobuf/compiler/plugin_pb2.py
|
||||
|
||||
6. This step requires `bazel`, and not the one from depot_tools, and it is not
|
||||
part of build/install-build-deps.sh in Chromium, so you need to manually
|
||||
install it:
|
||||
|
||||
$ apt install bazel
|
||||
|
||||
Run:
|
||||
|
||||
$ cd python/
|
||||
$ /usr/bin/bazel build embedded_python_edition_defaults_generate --enable_bzlmod
|
||||
@ -71,9 +87,9 @@ Steps used to create the current version (or roll a newer one):
|
||||
|
||||
TODO: generalize this and add it to gen_extra_chromium_files.py
|
||||
|
||||
6. Update Version, CPEPrefix and Revision in this file.
|
||||
7. Update Version, CPEPrefix and Revision in this file.
|
||||
|
||||
7. Address breakages.
|
||||
8. Address breakages.
|
||||
|
||||
The CQ will help you identify problems that need fixing.
|
||||
|
||||
@ -82,6 +98,13 @@ Steps used to create the current version (or roll a newer one):
|
||||
tweaks like modifying compiler flags or macro defines.
|
||||
|
||||
You may need to add new code modifications and diffs in patches/ as well.
|
||||
To do this, make the necessary changes in your current local branch, and then
|
||||
run the following command to create a patch file with the correct paths:
|
||||
|
||||
$ git diff --relative=third_party/protobuf > patches/your.patch
|
||||
|
||||
Remember to also update the patch description below.
|
||||
|
||||
|
||||
Notes (hints) for the next roll(er):
|
||||
|
||||
@ -199,10 +222,6 @@ Description of the patches:
|
||||
|
||||
Modify a compiler diagnostic pragma to work on Windows.
|
||||
|
||||
- 0050-remove-unreachable-code.patch
|
||||
|
||||
Remove some unreachable code.
|
||||
|
||||
- 0051-export-template-define.patch
|
||||
|
||||
Adds some missing export defines to fix Windows component build.
|
||||
@ -227,10 +246,3 @@ Description of the patches:
|
||||
of forward declarations to work around known issue with protobuf +
|
||||
newer abseil version,
|
||||
https://github.com/protocolbuffers/protobuf/issues/20331
|
||||
|
||||
- 0055-optimize-compile-time.patch
|
||||
|
||||
This backports clang compile speed optimization from upstream.
|
||||
https://github.com/protocolbuffers/protobuf/commit/d8964801b196a65cb9ab26f7c17872993c76b140
|
||||
It mitigates the build time regression https://crbug.com/397550708.
|
||||
It should be possible to remove this patch when rolling out v31.0.
|
||||
|
115
third_party/protobuf/WORKSPACE
vendored
115
third_party/protobuf/WORKSPACE
vendored
@ -137,39 +137,45 @@ load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
|
||||
|
||||
kt_register_toolchains()
|
||||
|
||||
# Workaround for https://github.com/bazel-contrib/rules_ruby/issues/216
|
||||
# Patch rules_ruby to disable automatic attempt to install bundler. When fixed,
|
||||
# delete Disable_bundle_install.patch and remove the patch related attributes
|
||||
http_archive(
|
||||
name = "rules_ruby",
|
||||
integrity = "sha256-Lh/xxR6WsKJnS92sYkpJDBtdS6DNrCbi0kuUxBffG6E=",
|
||||
strip_prefix = "rules_ruby-588d9dd40487277e2560ece09fe310d7c0ecb4a6",
|
||||
urls = [
|
||||
"https://github.com/protocolbuffers/rules_ruby/archive/588d9dd40487277e2560ece09fe310d7c0ecb4a6.zip",
|
||||
patch_args = ["-p1"],
|
||||
patches = [
|
||||
"@com_google_protobuf//:Disable_bundle_install.patch",
|
||||
],
|
||||
sha256 = "005da20827bee6b33d8ece7dc9973da293d7f8bb2ca07beaac43c31acaadbd31",
|
||||
strip_prefix = "rules_ruby-0.17.3",
|
||||
url = "https://github.com/bazel-contrib/rules_ruby/releases/download/v0.17.3/rules_ruby-v0.17.3.tar.gz",
|
||||
)
|
||||
|
||||
load("@rules_ruby//ruby:defs.bzl", "ruby_runtime")
|
||||
load("@rules_ruby//ruby:deps.bzl", "rb_bundle_fetch", "rb_register_toolchains")
|
||||
|
||||
ruby_runtime("system_ruby")
|
||||
rb_register_toolchains(
|
||||
version = "system",
|
||||
)
|
||||
|
||||
register_toolchains("@system_ruby//:toolchain")
|
||||
|
||||
# Uncomment pairs of ruby_runtime() + register_toolchain() calls below to enable
|
||||
# local JRuby testing. Do not submit the changes (due to impact on test duration
|
||||
# for non JRuby builds due to downloading JRuby SDKs).
|
||||
#ruby_runtime("jruby-9.2")
|
||||
#
|
||||
#register_toolchains("@jruby-9.2//:toolchain")
|
||||
#
|
||||
#ruby_runtime("jruby-9.3")
|
||||
#
|
||||
#register_toolchains("@jruby-9.3//:toolchain")
|
||||
|
||||
load("@system_ruby//:bundle.bzl", "ruby_bundle")
|
||||
|
||||
ruby_bundle(
|
||||
rb_bundle_fetch(
|
||||
name = "protobuf_bundle",
|
||||
srcs = ["//ruby:google-protobuf.gemspec"],
|
||||
bundler_version = "2.4.22",
|
||||
srcs = [
|
||||
"//ruby:google-protobuf.gemspec",
|
||||
],
|
||||
gem_checksums = {
|
||||
"bigdecimal-3.1.9": "2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc",
|
||||
"bigdecimal-3.1.9-java": "dd9b8f7c870664cd9538a1325ce385ba57a6627969177258c4f0e661a7be4456",
|
||||
"ffi-1.17.1": "26f6b0dbd1101e6ffc09d3ca640b2a21840cc52731ad8a7ded9fb89e5fb0fc39",
|
||||
"ffi-1.17.1-java": "2546e11f9592e2b9b6de49eb96d2a378da47b0bb8469d5cbc9881a55c0d55da7",
|
||||
"ffi-compiler-1.3.2": "a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0",
|
||||
"power_assert-2.0.5": "63b511b85bb8ea57336d25156864498644f5bbf028699ceda27949e0125bc323",
|
||||
"rake-13.2.1": "46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d",
|
||||
"rake-compiler-1.1.9": "51b5c95a1ff25cabaaf92e674a2bed847ab53d66302fc8843830df46ab1f51f5",
|
||||
"rake-compiler-dock-1.2.1": "3cc968d7ffc923c0e775b28d79a3389efb3d2b16ef52ed0298fbc97d347e5878",
|
||||
"test-unit-3.6.7": "c342bb9f7334ea84a361b43c20b063f405c0bf3c7dbe3ff38f61a91661d29221",
|
||||
},
|
||||
gemfile = "//ruby:Gemfile",
|
||||
gemfile_lock = "//ruby:Gemfile.lock",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
@ -184,19 +190,24 @@ http_archive(
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "com_github_google_benchmark",
|
||||
name = "google_benchmark",
|
||||
sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0",
|
||||
strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47",
|
||||
urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "com_google_googleapis",
|
||||
build_file = "//benchmarks:BUILD.googleapis",
|
||||
patch_cmds = ["find google -type f -name BUILD.bazel -delete"],
|
||||
sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4",
|
||||
strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57",
|
||||
urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"],
|
||||
name = "googleapis",
|
||||
integrity = "sha256-PopiL25y4WYMFq6EavbasLPraW+98BcuV7nN1nUjeOc=",
|
||||
strip_prefix = "googleapis-fe8ba054ad4f7eca946c2d14a63c3f07c0b586a0",
|
||||
urls = ["https://github.com/googleapis/googleapis/archive/fe8ba054ad4f7eca946c2d14a63c3f07c0b586a0.zip"],
|
||||
)
|
||||
|
||||
load("@googleapis//:repository_rules.bzl", "switched_rules_by_language")
|
||||
|
||||
switched_rules_by_language(
|
||||
name = "com_google_googleapis_imports",
|
||||
cc = True,
|
||||
)
|
||||
|
||||
load("@system_python//:pip.bzl", "pip_parse")
|
||||
@ -221,11 +232,9 @@ http_archive(
|
||||
|
||||
http_archive(
|
||||
name = "rules_fuzzing",
|
||||
patch_args = ["-p1"],
|
||||
patches = ["//third_party:rules_fuzzing.patch"],
|
||||
sha256 = "77206c54b71f4dd5335123a6ff2a8ea688eca5378d34b4838114dff71652cf26",
|
||||
strip_prefix = "rules_fuzzing-0.5.1",
|
||||
urls = ["https://github.com/bazelbuild/rules_fuzzing/releases/download/v0.5.1/rules_fuzzing-0.5.1.zip"],
|
||||
integrity = "sha256-CCdEIsQ4NBbfX5gpQ+QNWBQfdJwJAIu3gEQO7OaxE+Q=",
|
||||
strip_prefix = "rules_fuzzing-0.5.3",
|
||||
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.5.3.tar.gz"],
|
||||
)
|
||||
|
||||
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
|
||||
@ -242,8 +251,8 @@ fuzzing_py_deps_install_deps()
|
||||
|
||||
http_archive(
|
||||
name = "rules_rust",
|
||||
integrity = "sha256-r09Wyq5QqZpov845sUG1Cd1oVIyCBLmKt6HK/JTVuwI=",
|
||||
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.54.1/rules_rust-v0.54.1.tar.gz"],
|
||||
integrity = "sha256-8TBqrAsli3kN8BrZq8arsN8LZUFsdLTvJ/Sqsph4CmQ=",
|
||||
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.56.0/rules_rust-0.56.0.tar.gz"],
|
||||
)
|
||||
|
||||
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
|
||||
@ -267,6 +276,12 @@ crates_repository(
|
||||
"paste": crate.spec(
|
||||
version = ">=1",
|
||||
),
|
||||
"quote": crate.spec(
|
||||
version = ">=1",
|
||||
),
|
||||
"syn": crate.spec(
|
||||
version = ">=2",
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
@ -276,31 +291,35 @@ crate_repositories()
|
||||
|
||||
# For testing runtime against old gencode from a previous major version.
|
||||
http_archive(
|
||||
name = "com_google_protobuf_v25.0",
|
||||
name = "com_google_protobuf_v25",
|
||||
integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=",
|
||||
patch_args = ["-p1"],
|
||||
patches = [
|
||||
# There are other patches, but they are only needed for bzlmod.
|
||||
"@com_google_protobuf//:patches/protobuf_v25/0005-Make-rules_ruby-a-dev-only-dependency.patch",
|
||||
],
|
||||
strip_prefix = "protobuf-25.0",
|
||||
url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz",
|
||||
)
|
||||
|
||||
# Needed as a dependency of @com_google_protobuf_v25.0
|
||||
load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps = "protobuf_deps")
|
||||
# Needed as a dependency of @com_google_protobuf_v25
|
||||
load("@com_google_protobuf_v25//:protobuf_deps.bzl", protobuf_v25_deps = "protobuf_deps")
|
||||
|
||||
protobuf_v25_deps()
|
||||
|
||||
http_archive(
|
||||
name = "rules_testing",
|
||||
sha256 = "02c62574631876a4e3b02a1820cb51167bb9cdcdea2381b2fa9d9b8b11c407c4",
|
||||
strip_prefix = "rules_testing-0.6.0",
|
||||
url = "https://github.com/bazelbuild/rules_testing/releases/download/v0.6.0/rules_testing-v0.6.0.tar.gz",
|
||||
sha256 = "89feaf18d6e2fc07ed7e34510058fc8d48e45e6d2ff8a817a718e8c8e4bcda0e",
|
||||
strip_prefix = "rules_testing-0.8.0",
|
||||
url = "https://github.com/bazelbuild/rules_testing/releases/download/v0.8.0/rules_testing-v0.8.0.tar.gz",
|
||||
)
|
||||
|
||||
# For checking breaking changes to well-known types from the previous release version.
|
||||
load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE")
|
||||
|
||||
http_archive(
|
||||
name = "com_google_protobuf_previous_release",
|
||||
strip_prefix = "protobuf-" + PROTOBUF_PREVIOUS_RELEASE,
|
||||
url = "https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-{0}.tar.gz".format(PROTOBUF_PREVIOUS_RELEASE),
|
||||
integrity = "sha256-EKDVjzmhqQnpXgDougtbHcZNApl/dBFRlTorNln254w=",
|
||||
strip_prefix = "protobuf-29.0",
|
||||
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v29.0/protobuf-29.0.tar.gz"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
79
third_party/protobuf/WORKSPACE.bzlmod
vendored
79
third_party/protobuf/WORKSPACE.bzlmod
vendored
@ -1,82 +1,3 @@
|
||||
# This is a WORKSPACE file used by bzlmod in combination with MODULE.bazel.
|
||||
# It's used for a gradual migration and it should be empty.
|
||||
# Don't remove this file. If the file doesn't exist, bzlmod falls back to WORKSPACE file.
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
# TODO: either replace rules_ruby with a maintained version on BCR
|
||||
# or use bzlmod extensions to depend on this specific repo
|
||||
http_archive(
|
||||
name = "rules_ruby",
|
||||
urls = [
|
||||
"https://github.com/protocolbuffers/rules_ruby/archive/588d9dd40487277e2560ece09fe310d7c0ecb4a6.zip"
|
||||
],
|
||||
strip_prefix = "rules_ruby-588d9dd40487277e2560ece09fe310d7c0ecb4a6",
|
||||
integrity = "sha256-Lh/xxR6WsKJnS92sYkpJDBtdS6DNrCbi0kuUxBffG6E=",
|
||||
)
|
||||
|
||||
load("@rules_ruby//ruby:defs.bzl", "ruby_runtime")
|
||||
|
||||
ruby_runtime("system_ruby")
|
||||
|
||||
register_toolchains("@system_ruby//:toolchain")
|
||||
|
||||
load("@system_ruby//:bundle.bzl", "ruby_bundle")
|
||||
|
||||
ruby_bundle(
|
||||
name = "protobuf_bundle",
|
||||
srcs = ["//ruby:google-protobuf.gemspec"],
|
||||
bundler_version = "2.4.22",
|
||||
gemfile = "//ruby:Gemfile",
|
||||
)
|
||||
|
||||
# For testing UPB.
|
||||
http_archive(
|
||||
name = "lua",
|
||||
build_file = "//python/dist:lua.BUILD",
|
||||
sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b",
|
||||
strip_prefix = "lua-5.2.4",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz",
|
||||
"https://www.lua.org/ftp/lua-5.2.4.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "com_github_google_benchmark",
|
||||
sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0",
|
||||
strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47",
|
||||
urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "com_google_googleapis",
|
||||
build_file = "//benchmarks:BUILD.googleapis",
|
||||
patch_cmds = ["find google -type f -name BUILD.bazel -delete"],
|
||||
sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4",
|
||||
strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57",
|
||||
urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"],
|
||||
)
|
||||
|
||||
# Following are just needed to run conformance tests, not really needed to support them via MODULE.bazel
|
||||
|
||||
# For testing runtime against old gencode from a previous major version.
|
||||
http_archive(
|
||||
name = "com_google_protobuf_v25.0",
|
||||
integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=",
|
||||
strip_prefix = "protobuf-25.0",
|
||||
url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz",
|
||||
)
|
||||
|
||||
# Needed as a dependency of @com_google_protobuf_v25.0
|
||||
load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps="protobuf_deps")
|
||||
protobuf_v25_deps()
|
||||
|
||||
# Needed for checking breaking changes from the previous release version.
|
||||
load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE")
|
||||
|
||||
http_archive(
|
||||
name = "com_google_protobuf_previous_release",
|
||||
strip_prefix = "protobuf-" + PROTOBUF_PREVIOUS_RELEASE,
|
||||
url = "https://github.com/protocolbuffers/protobuf/releases/download/v{0}/protobuf-{0}.tar.gz".format(PROTOBUF_PREVIOUS_RELEASE),
|
||||
)
|
||||
|
2
third_party/protobuf/bazel/BUILD.bazel
vendored
2
third_party/protobuf/bazel/BUILD.bazel
vendored
@ -14,7 +14,7 @@ bzl_library(
|
||||
srcs = ["proto_library.bzl"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//bazel/private:bazel_proto_library_rule_bzl",
|
||||
"//bazel/private:proto_library_rule_bzl",
|
||||
"@proto_bazel_features//:features",
|
||||
],
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""ProtoInfo"""
|
||||
|
||||
load("@proto_bazel_features//:features.bzl", "bazel_features")
|
||||
load("//bazel/private:proto_info.bzl", _ProtoInfo = "ProtoInfo") # buildifier: disable=bzl-visibility
|
||||
load("//bazel/private:proto_info.bzl", _ProtoInfo = "ProtoInfo")
|
||||
|
||||
# This resolves to Starlark ProtoInfo in Bazel 8 or with --incompatible_enable_autoload flag
|
||||
ProtoInfo = getattr(bazel_features.globals, "ProtoInfo", None) or _ProtoInfo
|
||||
|
4
third_party/protobuf/bazel/private/BUILD
vendored
4
third_party/protobuf/bazel/private/BUILD
vendored
@ -59,9 +59,9 @@ bzl_library(
|
||||
)
|
||||
|
||||
bzl_library(
|
||||
name = "bazel_proto_library_rule_bzl",
|
||||
name = "proto_library_rule_bzl",
|
||||
srcs = [
|
||||
"bazel_proto_library_rule.bzl",
|
||||
"proto_library_rule.bzl",
|
||||
],
|
||||
visibility = ["//bazel:__subpackages__"],
|
||||
deps = [
|
||||
|
@ -36,7 +36,7 @@ def _bazel_java_proto_aspect_impl(target, ctx):
|
||||
version of`proto_library` and `JavaProtoAspectInfo` with all source and
|
||||
runtime jars.
|
||||
"""
|
||||
|
||||
_proto_library = ctx.rule.attr
|
||||
proto_toolchain_info = toolchains.find_toolchain(ctx, "_aspect_java_proto_toolchain", _JAVA_PROTO_TOOLCHAIN)
|
||||
source_jar = None
|
||||
if proto_common.experimental_should_generate_code(target[ProtoInfo], proto_toolchain_info, "java_proto_library", target.label):
|
||||
@ -51,8 +51,8 @@ def _bazel_java_proto_aspect_impl(target, ctx):
|
||||
)
|
||||
|
||||
# Compile Java sources (or just merge if there aren't any)
|
||||
deps = _filter_provider(JavaInfo, ctx.rule.attr.deps)
|
||||
exports = _filter_provider(JavaInfo, ctx.rule.attr.exports)
|
||||
deps = _filter_provider(JavaInfo, _proto_library.deps)
|
||||
exports = _filter_provider(JavaInfo, _proto_library.exports)
|
||||
if source_jar and proto_toolchain_info.runtime:
|
||||
deps.append(proto_toolchain_info.runtime[JavaInfo])
|
||||
java_info, jars = java_compile_for_protos(
|
||||
@ -63,7 +63,7 @@ def _bazel_java_proto_aspect_impl(target, ctx):
|
||||
exports,
|
||||
)
|
||||
|
||||
transitive_jars = [dep[JavaProtoAspectInfo].jars for dep in ctx.rule.attr.deps if JavaProtoAspectInfo in dep]
|
||||
transitive_jars = [dep[JavaProtoAspectInfo].jars for dep in _proto_library.deps if JavaProtoAspectInfo in dep]
|
||||
return [
|
||||
java_info,
|
||||
JavaProtoAspectInfo(jars = depset(jars, transitive = transitive_jars)),
|
||||
@ -71,11 +71,13 @@ def _bazel_java_proto_aspect_impl(target, ctx):
|
||||
|
||||
bazel_java_proto_aspect = aspect(
|
||||
implementation = _bazel_java_proto_aspect_impl,
|
||||
attrs = toolchains.if_legacy_toolchain({
|
||||
"_aspect_java_proto_toolchain": attr.label(
|
||||
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java"),
|
||||
),
|
||||
}),
|
||||
attrs = (
|
||||
toolchains.if_legacy_toolchain({
|
||||
"_aspect_java_proto_toolchain": attr.label(
|
||||
default = configuration_field(fragment = "proto", name = "proto_toolchain_for_java"),
|
||||
),
|
||||
})
|
||||
),
|
||||
toolchains = ["@bazel_tools//tools/jdk:toolchain_type"] + toolchains.use_toolchain(_JAVA_PROTO_TOOLCHAIN),
|
||||
attr_aspects = ["deps", "exports"],
|
||||
required_providers = [ProtoInfo],
|
||||
|
@ -231,14 +231,13 @@ def _write_descriptor_set(ctx, proto_info, deps, exports, descriptor_set):
|
||||
additional_args = args,
|
||||
)
|
||||
|
||||
_extra_doc = ""
|
||||
|
||||
proto_library = rule(
|
||||
_proto_library_impl,
|
||||
implementation = _proto_library_impl,
|
||||
# TODO: proto_common docs are missing
|
||||
# TODO: ProtoInfo link doesn't work and docs are missing
|
||||
doc = """
|
||||
<p>If using Bazel, please load the rule from <a href="https://github.com/bazelbuild/rules_proto">
|
||||
https://github.com/bazelbuild/rules_proto</a>.
|
||||
|
||||
<p>Use <code>proto_library</code> to define libraries of protocol buffers which
|
||||
may be used from multiple languages. A <code>proto_library</code> may be listed
|
||||
in the <code>deps</code> clause of supported rules, such as
|
||||
@ -265,7 +264,8 @@ See documentation in <code>proto_info.bzl</code>.
|
||||
<li>A <code>[language]_proto_library</code> that wraps a <code>proto_library</code>
|
||||
named <code>foo_proto</code> should be called <code>foo_[language]_proto</code>,
|
||||
and be located in the same package.
|
||||
</ul>""",
|
||||
</ul>
|
||||
""" + _extra_doc,
|
||||
attrs = {
|
||||
"srcs": attr.label_list(
|
||||
allow_files = [".proto", ".protodevel"],
|
||||
@ -350,7 +350,9 @@ lang_proto_library that is not in one of the listed packages.""",
|
||||
default = configuration_field("proto", "proto_compiler"),
|
||||
),
|
||||
}), # buildifier: disable=attr-licenses (attribute called licenses)
|
||||
fragments = ["proto"],
|
||||
fragments = [
|
||||
"proto",
|
||||
],
|
||||
provides = [ProtoInfo],
|
||||
toolchains = toolchains.use_toolchain(toolchains.PROTO_TOOLCHAIN),
|
||||
)
|
7
third_party/protobuf/bazel/proto_library.bzl
vendored
7
third_party/protobuf/bazel/proto_library.bzl
vendored
@ -4,12 +4,11 @@
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
"""
|
||||
Macro of proto_library rule.
|
||||
"""
|
||||
|
||||
"""Definition of proto_library rule."""
|
||||
|
||||
load("@proto_bazel_features//:features.bzl", "bazel_features")
|
||||
load("//bazel/private:bazel_proto_library_rule.bzl", _proto_library = "proto_library")
|
||||
load("//bazel/private:proto_library_rule.bzl", _proto_library = "proto_library")
|
||||
|
||||
def proto_library(**kwattrs):
|
||||
# This condition causes Starlark rules to be used only on Bazel >=7.0.0
|
||||
|
12
third_party/protobuf/bazel/tests/BUILD
vendored
12
third_party/protobuf/bazel/tests/BUILD
vendored
@ -1,5 +1,17 @@
|
||||
load(":java_proto_library_tests.bzl", "java_proto_library_test_suite")
|
||||
load(":proto_common_check_collocated_tests.bzl", "proto_common_check_collocated_test_suite")
|
||||
load(":proto_common_compile_tests.bzl", "proto_common_compile_test_suite")
|
||||
load(":proto_common_declare_generated_files_tests.bzl", "proto_common_declare_generated_files_test_suite")
|
||||
load(":proto_common_should_generate_tests.bzl", "proto_common_should_generate_test_suite")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
proto_common_compile_test_suite(name = "proto_common_compile_test_suite")
|
||||
|
||||
proto_common_should_generate_test_suite(name = "proto_common_should_generate_test_suite")
|
||||
|
||||
proto_common_declare_generated_files_test_suite(name = "proto_common_declare_generated_files_test_suite")
|
||||
|
||||
proto_common_check_collocated_test_suite(name = "proto_common_check_collocated_test_suite")
|
||||
|
||||
java_proto_library_test_suite(name = "java_proto_library_test_suite")
|
||||
|
102
third_party/protobuf/bazel/tests/java_proto_library_tests.bzl
vendored
Normal file
102
third_party/protobuf/bazel/tests/java_proto_library_tests.bzl
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2024 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
#
|
||||
"""Tests for `java_proto_library`."""
|
||||
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
|
||||
load("@rules_testing//lib:truth.bzl", "subjects")
|
||||
load("@rules_testing//lib:util.bzl", "util")
|
||||
load("//bazel:java_proto_library.bzl", "java_proto_library")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/private:bazel_java_proto_library_rule.bzl", java_proto_aspect = "bazel_java_proto_aspect")
|
||||
|
||||
def java_proto_library_test_suite(name):
|
||||
util.helper_target(
|
||||
java_proto_library,
|
||||
name = "simple_java_proto",
|
||||
deps = [":simple_proto"],
|
||||
)
|
||||
test_suite(
|
||||
name = name,
|
||||
tests = [
|
||||
_test_returned_java_info,
|
||||
_test_java_proto2_compiler_args,
|
||||
],
|
||||
)
|
||||
|
||||
# Verifies JavaInfo returned from java_proto_library contains library and source jar.
|
||||
def _test_returned_java_info(name):
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = ":simple_java_proto",
|
||||
impl = _test_returned_java_info_impl,
|
||||
provider_subject_factories = [java_info_subject_factory],
|
||||
)
|
||||
|
||||
def _test_returned_java_info_impl(env, target):
|
||||
java_info = env.expect.that_target(target).provider(JavaInfo)
|
||||
java_info.transitive_source_jars().contains("{package}/simple_proto-speed-src.jar")
|
||||
java_info.transitive_runtime_jars().contains("{package}/libsimple_proto-speed.jar")
|
||||
|
||||
_java_proto_aspect_testing_aspect = util.make_testing_aspect(aspects = [java_proto_aspect])
|
||||
|
||||
# Verifies arguments of action created by java_proto_aspect.
|
||||
def _test_java_proto2_compiler_args(name):
|
||||
# A nojp_simple_proto is defined to avoid conflict with native java_proto_library
|
||||
# aspect used in Bazel 6 and 7. Once Bazel 6,7 are not tested anymore it may be
|
||||
# replaced with simple_proto.
|
||||
util.helper_target(
|
||||
proto_library,
|
||||
name = "nojp_simple_proto",
|
||||
srcs = ["A.proto"],
|
||||
)
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = ":nojp_simple_proto",
|
||||
testing_aspect = _java_proto_aspect_testing_aspect,
|
||||
impl = _test_java_proto2_compiler_args_impl,
|
||||
)
|
||||
|
||||
def _test_java_proto2_compiler_args_impl(env, target):
|
||||
proto_library = env.expect.that_target(target)
|
||||
gen_proto = proto_library.action_named("GenProto")
|
||||
gen_proto.argv().contains("{package}/A.proto")
|
||||
gen_proto.argv().contains_at_least([
|
||||
"-I.",
|
||||
"{package}/A.proto",
|
||||
"--java_out={bindir}/{package}/nojp_simple_proto-speed-src.jar",
|
||||
])
|
||||
|
||||
def _java_info_subject(info, *, meta):
|
||||
"""Creates a new `JavaInfoSubject` for a JavaInfo provider instance.
|
||||
|
||||
Args:
|
||||
info: The JavaInfo object
|
||||
meta: ExpectMeta object.
|
||||
|
||||
Returns:
|
||||
A `JavaInfoSubject` struct
|
||||
"""
|
||||
self = struct(actual = info, meta = meta)
|
||||
public = struct(
|
||||
transitive_source_jars = lambda *a, **k: subjects.depset_file(
|
||||
self.actual.transitive_source_jars,
|
||||
meta = self.meta.derive("transitive_source_jars()"),
|
||||
),
|
||||
transitive_runtime_jars = lambda *a, **k: subjects.depset_file(
|
||||
self.actual.transitive_runtime_jars,
|
||||
meta = self.meta.derive("transitive_runtime_jars()"),
|
||||
),
|
||||
)
|
||||
return public
|
||||
|
||||
java_info_subject_factory = struct(
|
||||
type = JavaInfo,
|
||||
name = "JavaInfo",
|
||||
factory = _java_info_subject,
|
||||
)
|
147
third_party/protobuf/bazel/tests/proto_common_check_collocated_tests.bzl
vendored
Normal file
147
third_party/protobuf/bazel/tests/proto_common_check_collocated_tests.bzl
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2025 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
#
|
||||
"""Tests for `proto_common.check_collocated` function."""
|
||||
|
||||
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
|
||||
load("@rules_testing//lib:truth.bzl", "matching")
|
||||
load("@rules_testing//lib:util.bzl", "util")
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_info.bzl", "ProtoInfo")
|
||||
load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
|
||||
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
|
||||
|
||||
def proto_common_check_collocated_test_suite(name):
|
||||
test_suite(
|
||||
name = name,
|
||||
tests = [
|
||||
_test_allowed_in_different_package,
|
||||
_test_disallowed_in_different_package,
|
||||
_test_export_not_allowed,
|
||||
_test_export_allowed,
|
||||
],
|
||||
)
|
||||
|
||||
def _impl(ctx):
|
||||
proto_common.check_collocated(
|
||||
ctx.label,
|
||||
ctx.attr.proto_dep[ProtoInfo],
|
||||
ctx.attr.toolchain[ProtoLangToolchainInfo],
|
||||
)
|
||||
return None
|
||||
|
||||
check_collocated = rule(
|
||||
_impl,
|
||||
attrs = {
|
||||
"proto_dep": attr.label(),
|
||||
"toolchain": attr.label(default = "//bazel/tests/testdata:toolchain"),
|
||||
},
|
||||
)
|
||||
|
||||
# Verifies `proto_common.check_collocated` call.
|
||||
def _test_allowed_in_different_package(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_toolchain",
|
||||
allowlist_different_package = name + "_allowed",
|
||||
command_line = "",
|
||||
)
|
||||
native.package_group(
|
||||
name = name + "_allowed",
|
||||
packages = ["//..."],
|
||||
)
|
||||
util.helper_target(
|
||||
check_collocated,
|
||||
name = name + "_check_collocated",
|
||||
proto_dep = "//bazel/tests/testdata:simple_proto",
|
||||
toolchain = name + "_toolchain",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_check_collocated",
|
||||
impl = _test_allowed_in_different_package_impl,
|
||||
)
|
||||
|
||||
def _test_allowed_in_different_package_impl(env, target):
|
||||
env.expect.that_target(target).failures().has_size(0)
|
||||
|
||||
# Verifies `proto_common.check_collocated` call, when disallowed on toolchain.
|
||||
def _test_disallowed_in_different_package(name):
|
||||
util.helper_target(
|
||||
proto_lang_toolchain,
|
||||
name = name + "_toolchain",
|
||||
allowlist_different_package = name + "_disallowed",
|
||||
command_line = "",
|
||||
)
|
||||
native.package_group(
|
||||
name = name + "_disallowed",
|
||||
packages = [],
|
||||
)
|
||||
util.helper_target(
|
||||
check_collocated,
|
||||
name = name + "_check_collocated",
|
||||
proto_dep = "//bazel/tests/testdata:simple_proto",
|
||||
toolchain = name + "_toolchain",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_check_collocated",
|
||||
impl = _test_disallowed_in_different_package_impl,
|
||||
expect_failure = True,
|
||||
)
|
||||
|
||||
def _test_disallowed_in_different_package_impl(env, target):
|
||||
env.expect.that_target(target).failures().contains_predicate(
|
||||
matching.str_matches(
|
||||
"Error in fail: lang_proto_library '*_check_collocated'" +
|
||||
" may only be created in the same package as proto_library " +
|
||||
"'*/testdata:simple_proto'",
|
||||
),
|
||||
)
|
||||
|
||||
# Verifies `proto_common.check_collocated` call, when disallowed on proto.
|
||||
def _test_export_not_allowed(name):
|
||||
util.helper_target(
|
||||
check_collocated,
|
||||
name = name + "_check_collocated",
|
||||
proto_dep = "//bazel/tests/testdata:disallow_exports_proto",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_check_collocated",
|
||||
impl = _test_export_not_allowed_impl,
|
||||
expect_failure = True,
|
||||
)
|
||||
|
||||
def _test_export_not_allowed_impl(env, target):
|
||||
env.expect.that_target(target).failures().contains_predicate(
|
||||
matching.str_matches(
|
||||
"Error in fail: lang_proto_library '*_check_collocated'" +
|
||||
" may only be created in the same package as proto_library " +
|
||||
"'*/testdata:disallow_exports_proto'",
|
||||
),
|
||||
)
|
||||
|
||||
# Verifies `proto_common.check_collocated` call, when allowed on proto.
|
||||
def _test_export_allowed(name):
|
||||
util.helper_target(
|
||||
check_collocated,
|
||||
name = name + "_check_collocated",
|
||||
proto_dep = "//bazel/tests/testdata:allow_exports_proto",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_check_collocated",
|
||||
impl = _test_export_allowed_impl,
|
||||
)
|
||||
|
||||
def _test_export_allowed_impl(env, target):
|
||||
env.expect.that_target(target).failures().has_size(0)
|
@ -36,6 +36,7 @@ def proto_common_compile_test_suite(name):
|
||||
_test_compile_protoc_opts,
|
||||
_test_compile_direct_generated_protos,
|
||||
_test_compile_indirect_generated_protos,
|
||||
_test_compile_override_progress_message,
|
||||
],
|
||||
)
|
||||
|
||||
@ -366,3 +367,22 @@ def _test_compile_indirect_generated_protos_impl(env, target):
|
||||
matching.str_endswith("/A.proto"),
|
||||
],
|
||||
)
|
||||
|
||||
# Verifies usage of `proto_common.compile` with `experimental_progress_message` parameter
|
||||
def _test_compile_override_progress_message(name):
|
||||
util.helper_target(
|
||||
compile_rule,
|
||||
name = name + "_compile",
|
||||
progress_message = "My custom progress message %{label}",
|
||||
proto_dep = ":simple_proto",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_compile",
|
||||
impl = _test_compile_override_progress_message_impl,
|
||||
)
|
||||
|
||||
def _test_compile_override_progress_message_impl(env, target):
|
||||
action = env.expect.that_target(target).action_named("MyMnemonic")
|
||||
env.expect.that_str(repr(action.actual)).contains("My custom progress message //")
|
||||
|
95
third_party/protobuf/bazel/tests/proto_common_declare_generated_files_tests.bzl
vendored
Normal file
95
third_party/protobuf/bazel/tests/proto_common_declare_generated_files_tests.bzl
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2025 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
#
|
||||
"""Tests for `proto_common.declare_generated_files` function."""
|
||||
|
||||
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
|
||||
load("@rules_testing//lib:util.bzl", "util")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_info.bzl", "ProtoInfo")
|
||||
|
||||
def proto_common_declare_generated_files_test_suite(name):
|
||||
test_suite(
|
||||
name = name,
|
||||
tests = [
|
||||
_test_declare_generated_files_basic,
|
||||
_test_declare_generated_files_python,
|
||||
],
|
||||
)
|
||||
|
||||
def _impl(ctx):
|
||||
files = proto_common.declare_generated_files(
|
||||
ctx.actions,
|
||||
ctx.attr.proto_dep[ProtoInfo],
|
||||
ctx.attr.extension,
|
||||
(lambda s: s.replace("-", "_").replace(".", "/")) if ctx.attr.python_names else None,
|
||||
)
|
||||
for f in files:
|
||||
ctx.actions.write(f, "")
|
||||
return [DefaultInfo(files = depset(files))]
|
||||
|
||||
_declare_generated_files = rule(
|
||||
_impl,
|
||||
attrs = {
|
||||
"proto_dep": attr.label(),
|
||||
"extension": attr.string(),
|
||||
"python_names": attr.bool(default = False),
|
||||
},
|
||||
)
|
||||
|
||||
# Verifies `proto_common.declare_generated_files` call.
|
||||
def _test_declare_generated_files_basic(name):
|
||||
util.helper_target(
|
||||
proto_library,
|
||||
name = name + "_proto",
|
||||
srcs = ["A.proto", "b/B.proto"],
|
||||
)
|
||||
util.helper_target(
|
||||
_declare_generated_files,
|
||||
name = name + "_declare_generated_files",
|
||||
proto_dep = name + "_proto",
|
||||
extension = ".cc",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_declare_generated_files",
|
||||
impl = _test_declare_generated_files_basic_impl,
|
||||
)
|
||||
|
||||
def _test_declare_generated_files_basic_impl(env, target):
|
||||
env.expect.that_target(target).default_outputs().contains_exactly([
|
||||
"{package}/A.cc",
|
||||
"{package}/b/B.cc",
|
||||
])
|
||||
|
||||
# Verifies `proto_common.declare_generated_files` for Python.
|
||||
def _test_declare_generated_files_python(name):
|
||||
util.helper_target(
|
||||
proto_library,
|
||||
name = name + "_proto",
|
||||
srcs = ["my-proto.gen.proto"],
|
||||
)
|
||||
util.helper_target(
|
||||
_declare_generated_files,
|
||||
name = name + "_declare_generated_files_python",
|
||||
proto_dep = name + "_proto",
|
||||
extension = "_pb2.py",
|
||||
python_names = True,
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_declare_generated_files_python",
|
||||
impl = _test_declare_generated_files_python_impl,
|
||||
)
|
||||
|
||||
def _test_declare_generated_files_python_impl(env, target):
|
||||
env.expect.that_target(target).default_outputs().contains_exactly([
|
||||
"{package}/my_proto/gen_pb2.py",
|
||||
])
|
110
third_party/protobuf/bazel/tests/proto_common_should_generate_tests.bzl
vendored
Normal file
110
third_party/protobuf/bazel/tests/proto_common_should_generate_tests.bzl
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2024 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
#
|
||||
"""Tests for `proto_common.compile` function."""
|
||||
|
||||
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
|
||||
load("@rules_testing//lib:truth.bzl", "matching", "subjects", "truth")
|
||||
load("@rules_testing//lib:util.bzl", "util")
|
||||
load("//bazel:proto_library.bzl", "proto_library")
|
||||
load("//bazel/tests/testdata:should_generate.bzl", "BoolInfo", "should_generate_rule")
|
||||
|
||||
def proto_common_should_generate_test_suite(name):
|
||||
util.helper_target(
|
||||
proto_library,
|
||||
name = "test_proto",
|
||||
srcs = ["A.proto"],
|
||||
)
|
||||
test_suite(
|
||||
name = name,
|
||||
tests = [
|
||||
_test_should_generate_basic,
|
||||
_test_should_generate_dont_generate,
|
||||
_test_should_generate_mixed,
|
||||
],
|
||||
)
|
||||
|
||||
# Verifies `proto_common.should_generate_code` call.
|
||||
def _test_should_generate_basic(name):
|
||||
util.helper_target(
|
||||
should_generate_rule,
|
||||
name = name + "_should_generate",
|
||||
proto_dep = ":test_proto",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_should_generate",
|
||||
impl = _test_should_generate_basic_impl,
|
||||
)
|
||||
|
||||
def _test_should_generate_basic_impl(env, target):
|
||||
bool_info.from_target(env, target).value().equals(True)
|
||||
|
||||
# Verifies `proto_common.should_generate_code` call.
|
||||
def _test_should_generate_dont_generate(name):
|
||||
util.helper_target(
|
||||
should_generate_rule,
|
||||
name = name + "_should_generate",
|
||||
proto_dep = "//bazel/tests/testdata:denied",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_should_generate",
|
||||
impl = _test_should_generate_dont_generate_impl,
|
||||
)
|
||||
|
||||
def _test_should_generate_dont_generate_impl(env, target):
|
||||
bool_info.from_target(env, target).value().equals(False)
|
||||
|
||||
# Verifies `proto_common.should_generate_code` call.
|
||||
def _test_should_generate_mixed(name):
|
||||
util.helper_target(
|
||||
should_generate_rule,
|
||||
name = name + "_should_generate",
|
||||
proto_dep = "//bazel/tests/testdata:mixed",
|
||||
)
|
||||
|
||||
analysis_test(
|
||||
name = name,
|
||||
target = name + "_should_generate",
|
||||
impl = _test_should_generate_mixed_impl,
|
||||
expect_failure = True,
|
||||
)
|
||||
|
||||
def _test_should_generate_mixed_impl(env, target):
|
||||
failures = env.expect.that_target(target).failures()
|
||||
failures.contains_predicate(
|
||||
matching.str_matches(
|
||||
"The 'srcs' attribute of '*:mixed' contains protos for which 'MyRule' " +
|
||||
"shouldn't generate code (*/descriptor.proto, */metadata.proto)," +
|
||||
" in addition to protos for which it should (*/something.proto).\n" +
|
||||
"Separate '*:mixed' into 2 proto_library rules.",
|
||||
),
|
||||
)
|
||||
|
||||
# Utility functions
|
||||
|
||||
def _new_bool_info_subject(bool_info, meta):
|
||||
self = struct(actual = bool_info, meta = meta.derive("BoolInfo"))
|
||||
public = struct(
|
||||
value = lambda: subjects.bool(getattr(bool_info, "value", False), self.meta.derive("value")),
|
||||
)
|
||||
return public
|
||||
|
||||
def _bool_info_from_target(env, target):
|
||||
return _new_bool_info_subject(target[BoolInfo], meta = truth.expect(env).meta.derive(
|
||||
format_str_kwargs = {
|
||||
"name": target.label.name,
|
||||
"package": target.label.package,
|
||||
},
|
||||
))
|
||||
|
||||
bool_info = struct(
|
||||
from_target = _bool_info_from_target,
|
||||
)
|
48
third_party/protobuf/bazel/tests/testdata/BUILD
vendored
48
third_party/protobuf/bazel/tests/testdata/BUILD
vendored
@ -89,6 +89,54 @@ filegroup(
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "simple_proto",
|
||||
srcs = [
|
||||
"A.proto",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"nobuilder",
|
||||
"notap",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "allow_exports_proto",
|
||||
srcs = [
|
||||
"A.proto",
|
||||
],
|
||||
allow_exports = ":allow_everywhere",
|
||||
tags = [
|
||||
"manual",
|
||||
"nobuilder",
|
||||
"notap",
|
||||
],
|
||||
)
|
||||
|
||||
package_group(
|
||||
name = "allow_everywhere",
|
||||
packages = ["//..."],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "disallow_exports_proto",
|
||||
srcs = [
|
||||
"A.proto",
|
||||
],
|
||||
allow_exports = ":disallow_everywhere",
|
||||
tags = [
|
||||
"manual",
|
||||
"nobuilder",
|
||||
"notap",
|
||||
],
|
||||
)
|
||||
|
||||
package_group(
|
||||
name = "disallow_everywhere",
|
||||
packages = [],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "mixed",
|
||||
srcs = [
|
||||
|
34
third_party/protobuf/bazel/tests/testdata/collect_java_info_rule.bzl
vendored
Normal file
34
third_party/protobuf/bazel/tests/testdata/collect_java_info_rule.bzl
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"""An rule collecting JavaInfo from java_proto_library's aspect"""
|
||||
|
||||
load("@rules_java//java/common:java_common.bzl", "java_common")
|
||||
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
|
||||
|
||||
_Info = provider("Collects JavaInfos", fields = ["aspect_java_infos"])
|
||||
|
||||
def _collect_java_info_aspect_impl(target, ctx):
|
||||
aspect_java_infos = []
|
||||
for dep in ctx.rule.attr.deps:
|
||||
aspect_java_infos += dep[_Info].aspect_java_infos
|
||||
aspect_java_infos.append(target[JavaInfo])
|
||||
return _Info(aspect_java_infos = aspect_java_infos)
|
||||
|
||||
_collect_java_info_aspect = aspect(
|
||||
attr_aspects = ["deps"],
|
||||
fragments = ["java"],
|
||||
implementation = _collect_java_info_aspect_impl,
|
||||
required_aspect_providers = [[JavaInfo]],
|
||||
)
|
||||
|
||||
def _collect_java_info_impl(ctx):
|
||||
aspect_java_infos = []
|
||||
for dep in ctx.attr.deps:
|
||||
aspect_java_infos += dep[_Info].aspect_java_infos
|
||||
merged_java_info = java_common.merge(aspect_java_infos)
|
||||
return [merged_java_info]
|
||||
|
||||
collect_java_info_rule = rule(
|
||||
implementation = _collect_java_info_impl,
|
||||
attrs = {
|
||||
"deps": attr.label_list(aspects = [_collect_java_info_aspect]),
|
||||
},
|
||||
)
|
31
third_party/protobuf/bazel/tests/testdata/should_generate.bzl
vendored
Normal file
31
third_party/protobuf/bazel/tests/testdata/should_generate.bzl
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2024 Google Inc. All rights reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
#
|
||||
"""Testing function for proto_common module"""
|
||||
|
||||
load("//bazel/common:proto_common.bzl", "proto_common")
|
||||
load("//bazel/common:proto_info.bzl", "ProtoInfo")
|
||||
load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
|
||||
|
||||
BoolInfo = provider("Simple providers for testing", fields = ["value"])
|
||||
|
||||
def _impl(ctx):
|
||||
result = proto_common.experimental_should_generate_code(
|
||||
ctx.attr.proto_dep[ProtoInfo],
|
||||
ctx.attr.toolchain[ProtoLangToolchainInfo],
|
||||
"MyRule",
|
||||
ctx.attr.proto_dep.label,
|
||||
)
|
||||
return [BoolInfo(value = result)]
|
||||
|
||||
should_generate_rule = rule(
|
||||
_impl,
|
||||
attrs = {
|
||||
"proto_dep": attr.label(),
|
||||
"toolchain": attr.label(default = ":toolchain"),
|
||||
},
|
||||
)
|
7
third_party/protobuf/benchmarks/BUILD
vendored
7
third_party/protobuf/benchmarks/BUILD
vendored
@ -41,7 +41,7 @@ upb_proto_reflection_library(
|
||||
|
||||
upb_proto_reflection_library(
|
||||
name = "ads_upb_proto_reflection",
|
||||
deps = ["@com_google_googleapis//:ads_proto"],
|
||||
deps = ["@googleapis//google/ads/googleads/v17/services:services_proto"],
|
||||
)
|
||||
|
||||
cc_proto_library(
|
||||
@ -78,7 +78,7 @@ cc_test(
|
||||
"//upb:wire",
|
||||
"@abseil-cpp//absl/container:flat_hash_set",
|
||||
"@abseil-cpp//absl/log:absl_check",
|
||||
"@com_github_google_benchmark//:benchmark_main",
|
||||
"@google_benchmark//:benchmark_main",
|
||||
"@googletest//:gtest",
|
||||
"@googletest//:gtest_main",
|
||||
],
|
||||
@ -98,19 +98,16 @@ SIZE_BENCHMARKS = {
|
||||
py_binary(
|
||||
name = "gen_synthetic_protos",
|
||||
srcs = ["gen_synthetic_protos.py"],
|
||||
python_version = "PY3",
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "gen_upb_binary_c",
|
||||
srcs = ["gen_upb_binary_c.py"],
|
||||
python_version = "PY3",
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "gen_protobuf_binary_cc",
|
||||
srcs = ["gen_protobuf_binary_cc.py"],
|
||||
python_version = "PY3",
|
||||
)
|
||||
|
||||
genrule(
|
||||
|
59
third_party/protobuf/benchmarks/BUILD.googleapis
vendored
59
third_party/protobuf/benchmarks/BUILD.googleapis
vendored
@ -1,59 +0,0 @@
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2023 Google LLC. All rights reserved.
|
||||
# https://developers.google.com/protocol-buffers/
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google LLC nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
load(
|
||||
"@com_google_protobuf//bazel:proto_library.bzl",
|
||||
"proto_library",
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "ads_proto",
|
||||
srcs = glob([
|
||||
"google/ads/googleads/v16/**/*.proto",
|
||||
"google/api/**/*.proto",
|
||||
"google/rpc/**/*.proto",
|
||||
"google/longrunning/**/*.proto",
|
||||
"google/logging/**/*.proto",
|
||||
]),
|
||||
#srcs = ["google/ads/googleads/v5/services/google_ads_service.proto"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@com_google_protobuf//:any_proto",
|
||||
"@com_google_protobuf//:api_proto",
|
||||
"@com_google_protobuf//:descriptor_proto",
|
||||
"@com_google_protobuf//:duration_proto",
|
||||
"@com_google_protobuf//:empty_proto",
|
||||
"@com_google_protobuf//:field_mask_proto",
|
||||
"@com_google_protobuf//:struct_proto",
|
||||
"@com_google_protobuf//:timestamp_proto",
|
||||
"@com_google_protobuf//:type_proto",
|
||||
"@com_google_protobuf//:wrappers_proto",
|
||||
],
|
||||
)
|
12
third_party/protobuf/benchmarks/benchmark.cc
vendored
12
third_party/protobuf/benchmarks/benchmark.cc
vendored
@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "google/ads/googleads/v16/services/google_ads_service.upbdefs.h"
|
||||
#include "google/ads/googleads/v17/services/google_ads_service.upbdefs.h"
|
||||
#include "google/protobuf/descriptor.pb.h"
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/log/absl_check.h"
|
||||
@ -181,14 +181,14 @@ static void BM_LoadAdsDescriptor_Upb(benchmark::State& state) {
|
||||
for (auto _ : state) {
|
||||
upb::DefPool defpool;
|
||||
if (Mode == NoLayout) {
|
||||
google_ads_googleads_v16_services_SearchGoogleAdsRequest_getmsgdef(
|
||||
google_ads_googleads_v17_services_SearchGoogleAdsRequest_getmsgdef(
|
||||
defpool.ptr());
|
||||
bytes_per_iter = _upb_DefPool_BytesLoaded(defpool.ptr());
|
||||
} else {
|
||||
bytes_per_iter = 0;
|
||||
LoadDefInit_BuildLayout(
|
||||
defpool.ptr(),
|
||||
&google_ads_googleads_v16_services_google_ads_service_proto_upbdefinit,
|
||||
&google_ads_googleads_v17_services_google_ads_service_proto_upbdefinit,
|
||||
&bytes_per_iter);
|
||||
}
|
||||
}
|
||||
@ -200,11 +200,11 @@ BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Upb, WithLayout);
|
||||
template <LoadDescriptorMode Mode>
|
||||
static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) {
|
||||
extern _upb_DefPool_Init
|
||||
google_ads_googleads_v16_services_google_ads_service_proto_upbdefinit;
|
||||
google_ads_googleads_v17_services_google_ads_service_proto_upbdefinit;
|
||||
std::vector<upb_StringView> serialized_files;
|
||||
absl::flat_hash_set<const _upb_DefPool_Init*> seen_files;
|
||||
CollectFileDescriptors(
|
||||
&google_ads_googleads_v16_services_google_ads_service_proto_upbdefinit,
|
||||
&google_ads_googleads_v17_services_google_ads_service_proto_upbdefinit,
|
||||
serialized_files, seen_files);
|
||||
size_t bytes_per_iter = 0;
|
||||
for (auto _ : state) {
|
||||
@ -227,7 +227,7 @@ static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) {
|
||||
if (Mode == WithLayout) {
|
||||
protobuf::DynamicMessageFactory factory;
|
||||
const protobuf::Descriptor* d = pool.FindMessageTypeByName(
|
||||
"google.ads.googleads.v16.services.SearchGoogleAdsResponse");
|
||||
"google.ads.googleads.v17.services.SearchGoogleAdsResponse");
|
||||
if (!d) {
|
||||
printf("Failed to find descriptor.\n");
|
||||
exit(1);
|
||||
|
6
third_party/protobuf/build_defs/cpp_opts.bzl
vendored
6
third_party/protobuf/build_defs/cpp_opts.bzl
vendored
@ -23,6 +23,7 @@ COPTS = select({
|
||||
|
||||
# Android and MSVC builds do not need to link in a separate pthread library.
|
||||
LINK_OPTS = select({
|
||||
"@platforms//os:android": [],
|
||||
"//build_defs:config_android": [],
|
||||
"//build_defs:config_android-legacy-default-crosstool": [],
|
||||
"//build_defs:config_android-stlport": [],
|
||||
@ -39,6 +40,11 @@ LINK_OPTS = select({
|
||||
"-lm",
|
||||
"-framework CoreFoundation",
|
||||
],
|
||||
"@platforms//os:windows": [
|
||||
"-ldbghelp",
|
||||
"-lpthread",
|
||||
"-lm",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-lpthread",
|
||||
"-lm",
|
||||
|
3
third_party/protobuf/ci/common.bazelrc
vendored
3
third_party/protobuf/ci/common.bazelrc
vendored
@ -52,13 +52,10 @@ build --incompatible_dont_use_javasourceinfoprovider
|
||||
build --incompatible_enable_android_toolchain_resolution
|
||||
build --incompatible_enable_apple_toolchain_resolution
|
||||
build --incompatible_exclusive_test_sandboxed
|
||||
build --incompatible_remote_output_paths_relative_to_input_root
|
||||
build --incompatible_remote_use_new_exit_code_for_lost_inputs
|
||||
build --incompatible_sandbox_hermetic_tmp
|
||||
build --incompatible_struct_has_no_methods
|
||||
build --incompatible_top_level_aspects_require_providers
|
||||
build --incompatible_use_cc_configure_from_rules_cc
|
||||
build --incompatible_use_host_features
|
||||
|
||||
# We cannot yet build successfully with the following flags:
|
||||
# --incompatible_check_testonly_for_output_files
|
||||
|
1
third_party/protobuf/cmake/abseil-cpp.cmake
vendored
1
third_party/protobuf/cmake/abseil-cpp.cmake
vendored
@ -90,7 +90,6 @@ else()
|
||||
absl::time
|
||||
absl::type_traits
|
||||
absl::utility
|
||||
absl::variant
|
||||
)
|
||||
set(protobuf_ABSL_USED_TEST_TARGETS
|
||||
absl::scoped_mock_log
|
||||
|
23
third_party/protobuf/cmake/dependencies.cmake
vendored
23
third_party/protobuf/cmake/dependencies.cmake
vendored
@ -10,7 +10,7 @@ if(${CMAKE_VERSION} VERSION_GREATER 3.16 OR ${CMAKE_VERSION} VERSION_EQUAL 3.16)
|
||||
include_guard()
|
||||
endif()
|
||||
|
||||
set(rules_apple-version "3.13.0")
|
||||
set(rules_apple-version "3.16.0")
|
||||
set(apple_support-version "1.15.1")
|
||||
set(abseil-cpp-version "20250127.0")
|
||||
set(rules_cc-version "0.0.17")
|
||||
@ -18,20 +18,27 @@ set(zlib-version "1.3.1.bcr.5")
|
||||
set(bazel_features-version "1.23.0")
|
||||
set(bazel_skylib-version "1.7.1")
|
||||
set(jsoncpp-version "1.9.6")
|
||||
set(rules_fuzzing-version "0.5.2")
|
||||
set(rules_java-version "8.6.1")
|
||||
set(rules_jvm_external-version "6.3")
|
||||
set(rules_jvm_external-version "6.7")
|
||||
set(rules_kotlin-version "1.9.6")
|
||||
set(rules_license-version "1.0.0")
|
||||
set(rules_pkg-version "1.0.1")
|
||||
set(rules_python-version "1.0.0")
|
||||
set(rules_rust-version "0.51.0")
|
||||
set(rules_rust-version "0.56.0")
|
||||
set(rules_ruby-version "0.17.3")
|
||||
set(rules_fuzzing-version "0.5.3")
|
||||
set(rules_shell-version "0.2.0")
|
||||
set(platforms-version "0.0.10")
|
||||
set(googletest-version "1.14.0")
|
||||
set(platforms-version "0.0.11")
|
||||
set(re2-version "2024-07-02.bcr.1")
|
||||
set(googletest-version "1.15.2")
|
||||
set(rules_buf-version "0.3.0")
|
||||
set(rules_testing-version "0.6.0")
|
||||
set(rules_testing-version "0.8.0")
|
||||
set(abseil-py-version "2.1.0")
|
||||
set(rules_proto-version "4.0.0")
|
||||
set(rules_proto-version "7.0.2")
|
||||
set(lua-version "5.4.6")
|
||||
set(googleapis-version "0.0.0-20240819-fe8ba054a")
|
||||
set(google_benchmark-version "1.9.2")
|
||||
set(com_google_protobuf_v25-version "25.0")
|
||||
set(com_google_protobuf_previous_release-version "29.0")
|
||||
|
||||
|
||||
|
@ -63,6 +63,9 @@ class ExtensionFunctions(object):
|
||||
def install(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def bundle_fetch(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class ModuleFileFunctions(object):
|
||||
"""A fake MODULE file that we can exec() to get the functions we need."""
|
||||
@ -84,12 +87,15 @@ class ModuleFileFunctions(object):
|
||||
}
|
||||
)
|
||||
|
||||
def register_toolchains(self, *args):
|
||||
def register_toolchains(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def use_repo(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def single_version_override(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def use_extension(self, *args, **kwargs):
|
||||
return ExtensionFunctions()
|
||||
|
||||
@ -99,6 +105,9 @@ class ModuleFileFunctions(object):
|
||||
def git_override(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def archive_override(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class Converter(object):
|
||||
|
||||
|
2
third_party/protobuf/cmake/install.cmake
vendored
2
third_party/protobuf/cmake/install.cmake
vendored
@ -61,7 +61,7 @@ if (protobuf_BUILD_PROTOC_BINARIES)
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc
|
||||
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
|
||||
if (protobuf_BUILD_LIBUPB)
|
||||
foreach (generator upb upbdefs upb_minitable)
|
||||
foreach (generator upb upbdefs)
|
||||
list(APPEND _protobuf_binaries protoc-gen-${generator})
|
||||
install(TARGETS protoc-gen-${generator} EXPORT protobuf-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT upb-generators
|
||||
|
@ -1,4 +1,3 @@
|
||||
protoc
|
||||
protoc-gen-upb
|
||||
protoc-gen-upb_minitable
|
||||
protoc-gen-upbdefs
|
||||
|
@ -99,13 +99,13 @@ google/protobuf/json/json.h
|
||||
google/protobuf/map.h
|
||||
google/protobuf/map_entry.h
|
||||
google/protobuf/map_field.h
|
||||
google/protobuf/map_field_inl.h
|
||||
google/protobuf/map_field_lite.h
|
||||
google/protobuf/map_type_handler.h
|
||||
google/protobuf/message.h
|
||||
google/protobuf/message_lite.h
|
||||
google/protobuf/metadata.h
|
||||
google/protobuf/metadata_lite.h
|
||||
google/protobuf/micro_string.h
|
||||
google/protobuf/parse_context.h
|
||||
google/protobuf/port.h
|
||||
google/protobuf/port_def.inc
|
||||
|
2
third_party/protobuf/cmake/libprotoc.cmake
vendored
2
third_party/protobuf/cmake/libprotoc.cmake
vendored
@ -17,7 +17,7 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map)
|
||||
endif()
|
||||
target_link_libraries(libprotoc PRIVATE libprotobuf)
|
||||
target_link_libraries(libprotoc PUBLIC ${protobuf_ABSL_USED_TARGETS})
|
||||
target_link_libraries(libprotoc PUBLIC libupb ${protobuf_ABSL_USED_TARGETS})
|
||||
protobuf_configure_target(libprotoc)
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotoc
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
# Refactors configuration options set on all Protobuf targets
|
||||
function(protobuf_configure_target target)
|
||||
target_compile_features("${target}" PUBLIC cxx_std_14)
|
||||
target_compile_features("${target}" PUBLIC cxx_std_17)
|
||||
if (MSVC)
|
||||
# Build with multiple processes
|
||||
target_compile_options("${target}" PRIVATE /MP)
|
||||
|
34
third_party/protobuf/cmake/tests.cmake
vendored
34
third_party/protobuf/cmake/tests.cmake
vendored
@ -175,10 +175,30 @@ add_test(NAME full-test
|
||||
COMMAND tests ${protobuf_GTEST_ARGS}
|
||||
WORKING_DIRECTORY ${protobuf_SOURCE_DIR})
|
||||
|
||||
# This test involves observing and modifying the internal state of the global
|
||||
# descriptor pool, so it needs to be in its own binary to avoid conflicting
|
||||
# with other tests.
|
||||
add_executable(lazily-build-dependencies-test
|
||||
${lazily_build_dependencies_test_files}
|
||||
)
|
||||
|
||||
target_link_libraries(lazily-build-dependencies-test
|
||||
libtest_common
|
||||
libtest_common_lite
|
||||
${protobuf_LIB_PROTOBUF}
|
||||
${protobuf_ABSL_USED_TARGETS}
|
||||
${protobuf_ABSL_USED_TEST_TARGETS}
|
||||
GTest::gmock_main
|
||||
)
|
||||
|
||||
add_test(NAME lazily-build-dependencies-test
|
||||
COMMAND lazily-build-dependencies-test ${protobuf_GTEST_ARGS}
|
||||
WORKING_DIRECTORY ${protobuf_SOURCE_DIR})
|
||||
|
||||
if (protobuf_BUILD_LIBUPB)
|
||||
set(upb_test_proto_genfiles)
|
||||
foreach(proto_file ${upb_test_protos_files} ${descriptor_proto_proto_srcs})
|
||||
foreach(generator upb upbdefs upb_minitable)
|
||||
foreach(generator upb upbdefs)
|
||||
protobuf_generate(
|
||||
PROTOS ${proto_file}
|
||||
LANGUAGE ${generator}
|
||||
@ -191,6 +211,18 @@ if (protobuf_BUILD_LIBUPB)
|
||||
)
|
||||
set(upb_test_proto_genfiles ${upb_test_proto_genfiles} ${pb_generated_files})
|
||||
endforeach()
|
||||
|
||||
# The minitable generator has a slightly different setup from the other upb
|
||||
# generators, since it is built into protoc.
|
||||
protobuf_generate(
|
||||
PROTOS ${proto_file}
|
||||
LANGUAGE upb_minitable
|
||||
GENERATE_EXTENSIONS .upb_minitable.h .upb_minitable.c
|
||||
OUT_VAR pb_generated_files
|
||||
IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
|
||||
IMPORT_DIRS ${protobuf_SOURCE_DIR}
|
||||
)
|
||||
set(upb_test_proto_genfiles ${upb_test_proto_genfiles} ${pb_generated_files})
|
||||
endforeach(proto_file)
|
||||
|
||||
add_executable(upb-test
|
||||
|
@ -7,7 +7,7 @@ set(bootstrap_sources
|
||||
${bootstrap_cmake_dir}/google/protobuf/compiler/plugin.upb_minitable.c
|
||||
)
|
||||
|
||||
foreach(generator upb upbdefs upb_minitable)
|
||||
foreach(generator upb upbdefs)
|
||||
add_executable(protoc-gen-${generator}
|
||||
${protoc-gen-${generator}_srcs}
|
||||
${protoc-gen-${generator}_hdrs}
|
||||
|
6
third_party/protobuf/conformance/BUILD.bazel
vendored
6
third_party/protobuf/conformance/BUILD.bazel
vendored
@ -15,7 +15,8 @@ load(
|
||||
"pkg_files",
|
||||
"strip_prefix",
|
||||
)
|
||||
load("@rules_ruby//ruby:defs.bzl", "ruby_binary")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("@rules_ruby//ruby:defs.bzl", "rb_binary")
|
||||
load("//:protobuf.bzl", "internal_csharp_proto_library", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library", "internal_ruby_proto_library")
|
||||
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
|
||||
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
|
||||
@ -424,10 +425,11 @@ cc_binary(
|
||||
deps = [":conformance_objc_lib"],
|
||||
)
|
||||
|
||||
ruby_binary(
|
||||
rb_binary(
|
||||
name = "conformance_ruby",
|
||||
testonly = True,
|
||||
srcs = ["conformance_ruby.rb"],
|
||||
main = "conformance_ruby.rb",
|
||||
visibility = ["//ruby:__subpackages__"],
|
||||
deps = [
|
||||
":conformance_ruby_proto",
|
||||
|
@ -46,15 +46,15 @@ while [[ -n "$@" ]]; do
|
||||
done
|
||||
|
||||
conformance_test_runner=$(rlocation com_google_protobuf/conformance/conformance_test_runner)
|
||||
conformance_testee=$(rlocation $TESTEE)
|
||||
conformance_testee=$TESTEE
|
||||
args=(--enforce_recommended)
|
||||
|
||||
failure_list=$(rlocation $FAILURE_LIST) || unset
|
||||
failure_list=$FAILURE_LIST || unset
|
||||
if [ -n "$failure_list" ] ; then
|
||||
args+=(--failure_list $failure_list)
|
||||
fi
|
||||
|
||||
text_format_failure_list=$(rlocation $TEXT_FORMAT_FAILURE_LIST) || unset
|
||||
text_format_failure_list=$TEXT_FORMAT_FAILURE_LIST || unset
|
||||
if [ -n "$text_format_failure_list" ]; then
|
||||
args+=(--text_format_failure_list $text_format_failure_list)
|
||||
fi
|
||||
|
@ -363,6 +363,9 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
|
||||
this, /*run_proto3_tests=*/true);
|
||||
BinaryAndJsonConformanceSuiteImpl<TestAllTypesProto2>(
|
||||
this, /*run_proto3_tests=*/false);
|
||||
if (!this->performance_) {
|
||||
RunMessageSetTests();
|
||||
}
|
||||
if (maximum_edition_ >= Edition::EDITION_2023) {
|
||||
BinaryAndJsonConformanceSuiteImpl<TestAllTypesProto3Editions>(
|
||||
this, /*run_proto3_tests=*/true);
|
||||
@ -426,6 +429,92 @@ void BinaryAndJsonConformanceSuite::RunDelimitedFieldTests() {
|
||||
R"pb([protobuf_test_messages.editions.delimited_ext] { c: 99 })pb");
|
||||
}
|
||||
|
||||
void BinaryAndJsonConformanceSuite::RunMessageSetTests() {
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding"), REQUIRED,
|
||||
len(500,
|
||||
group(1, absl::StrCat(field(2, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(4135312)),
|
||||
len(3, field(9, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(99)))))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.MessageSetCorrectExtension2]: { i: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding.OutOfOrderGroupsEntries"), REQUIRED,
|
||||
len(500,
|
||||
group(1, absl::StrCat(len(3, field(9, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(99))),
|
||||
field(2, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(4135312))))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.MessageSetCorrectExtension2]: { i: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
|
||||
// Test that an unknown message set extension always goes to unknown fields.
|
||||
// This is done by poisoning the extension payload with an entry for field 0.
|
||||
RunValidRoundtripProtobufTest<TestAllTypesProto2>(
|
||||
"MessageSetEncoding.UnknownExtension", REQUIRED,
|
||||
len(500,
|
||||
group(1, absl::StrCat(field(2, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(4135300)),
|
||||
len(3, field(0, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(99)))))));
|
||||
|
||||
// If an encoder is unaware of the message_set_wire_format option it will be
|
||||
// encoded like any other extension submessage. Decoders should be able to
|
||||
// tolerate this format as well.
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding.SubmessageEncoding"), RECOMMENDED,
|
||||
len(500,
|
||||
len(4135312, field(9, WireFormatLite::WIRETYPE_VARINT, varint(99)))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.MessageSetCorrectExtension2]: { i: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
|
||||
// Test again, but this time we'll try to detect if the implementation put the
|
||||
// submessage encoded entry into the unknown field set. We'll do this by using
|
||||
// conflicting oneof entries where order matters when the messages are merged.
|
||||
//
|
||||
// In a non-compliant implementation submessage encoded messageset entry will
|
||||
// be moved to unknown fields and then tacked onto the end of the payload.
|
||||
// Thus we'll see field b set first, and then field a.
|
||||
//
|
||||
// In a compliant implementation we expect the submessage encoded messageset
|
||||
// to be read first with field a set, and then the normal message set entry
|
||||
// will be read with field b will be set -- thus field b will win.
|
||||
RunValidBinaryProtobufTest<TestAllTypesProto2>(
|
||||
absl::StrCat("ValidMessageSetEncoding.SubmessageEncoding.NotUnknown"),
|
||||
RECOMMENDED,
|
||||
len(500, absl::StrCat(
|
||||
len(123456789,
|
||||
field(1, WireFormatLite::WIRETYPE_VARINT, varint(42))),
|
||||
group(1, absl::StrCat(
|
||||
field(2, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(123456789)),
|
||||
len(3, field(2, WireFormatLite::WIRETYPE_VARINT,
|
||||
varint(99))))))),
|
||||
// clang-format off
|
||||
R"pb(message_set_correct: {
|
||||
[protobuf_test_messages.proto2
|
||||
.TestAllTypesProto2.ExtensionWithOneof]: { b: 99 }
|
||||
})pb"
|
||||
// clang-format on
|
||||
);
|
||||
}
|
||||
|
||||
template <typename MessageType>
|
||||
void BinaryAndJsonConformanceSuiteImpl<MessageType>::
|
||||
ExpectParseFailureForProtoWithProtoVersion(const std::string& proto,
|
||||
@ -545,6 +634,18 @@ void BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest(
|
||||
RunValidInputTest(binary_to_binary, equivalent_text_format);
|
||||
}
|
||||
|
||||
template <typename MessageType>
|
||||
void BinaryAndJsonConformanceSuite::RunValidRoundtripProtobufTest(
|
||||
const std::string& test_name, ConformanceLevel level,
|
||||
const std::string& input_protobuf) {
|
||||
MessageType prototype;
|
||||
|
||||
ConformanceRequestSetting binary_to_binary(
|
||||
level, conformance::PROTOBUF, conformance::PROTOBUF,
|
||||
conformance::BINARY_TEST, prototype, test_name, input_protobuf);
|
||||
RunValidBinaryInputTest(binary_to_binary, input_protobuf);
|
||||
}
|
||||
|
||||
template <typename MessageType>
|
||||
void BinaryAndJsonConformanceSuite::RunValidProtobufTest(
|
||||
const std::string& test_name, ConformanceLevel level,
|
||||
|
@ -5,8 +5,8 @@
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
#ifndef CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
|
||||
#define CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
|
||||
#ifndef GOOGLE_PROTOBUF_CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H__
|
||||
#define GOOGLE_PROTOBUF_CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H__
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@ -44,6 +44,11 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite {
|
||||
const std::string& input_protobuf,
|
||||
const std::string& equivalent_text_format);
|
||||
|
||||
template <typename MessageType>
|
||||
void RunValidRoundtripProtobufTest(const std::string& test_name,
|
||||
ConformanceLevel level,
|
||||
const std::string& input_protobuf);
|
||||
|
||||
template <typename MessageType>
|
||||
void RunValidProtobufTest(const std::string& test_name,
|
||||
ConformanceLevel level,
|
||||
@ -52,6 +57,8 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite {
|
||||
|
||||
void RunDelimitedFieldTests();
|
||||
|
||||
void RunMessageSetTests();
|
||||
|
||||
template <typename MessageType>
|
||||
friend class BinaryAndJsonConformanceSuiteImpl;
|
||||
|
||||
@ -186,4 +193,4 @@ class BinaryAndJsonConformanceSuiteImpl {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
#endif // CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
|
||||
#endif // GOOGLE_PROTOBUF_CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H__
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
static void Die(NSString *format, ...) __dead2;
|
||||
|
||||
static BOOL verbose = NO;
|
||||
static int32_t testCount = 0;
|
||||
static BOOL gVerbose = NO;
|
||||
static int32_t gTestCount = 0;
|
||||
|
||||
static void Die(NSString *format, ...) {
|
||||
va_list args;
|
||||
@ -52,28 +52,43 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
|
||||
break;
|
||||
|
||||
case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: {
|
||||
NSDictionary *mappings = @{
|
||||
@"protobuf_test_messages.proto2.TestAllTypesProto2" : [Proto2TestAllTypesProto2 class],
|
||||
@"protobuf_test_messages.proto3.TestAllTypesProto3" : [Proto3TestAllTypesProto3 class],
|
||||
@"protobuf_test_messages.editions.TestAllTypesEdition2023" :
|
||||
[EditionsTestAllTypesEdition2023 class],
|
||||
@"protobuf_test_messages.editions.proto2.TestAllTypesProto2" :
|
||||
[EditionsProto2TestAllTypesProto2 class],
|
||||
@"protobuf_test_messages.editions.proto3.TestAllTypesProto3" :
|
||||
[EditionsProto3TestAllTypesProto3 class],
|
||||
};
|
||||
Class msgClass = mappings[request.messageType];
|
||||
if (msgClass) {
|
||||
NSError *error = nil;
|
||||
testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
|
||||
if (!testMessage) {
|
||||
response.parseError = [NSString stringWithFormat:@"Parse error: %@", error];
|
||||
}
|
||||
Class msgClass;
|
||||
GPBExtensionRegistry *registry;
|
||||
if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
|
||||
msgClass = [Proto2TestAllTypesProto2 class];
|
||||
registry = [Proto2TestMessagesProto2Root extensionRegistry];
|
||||
} else if ([request.messageType
|
||||
isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) {
|
||||
msgClass = [Proto3TestAllTypesProto3 class];
|
||||
registry = [Proto3TestMessagesProto3Root extensionRegistry];
|
||||
} else if ([request.messageType
|
||||
isEqual:@"protobuf_test_messages.editions.TestAllTypesEdition2023"]) {
|
||||
msgClass = [EditionsTestAllTypesEdition2023 class];
|
||||
registry = [EditionsTestMessagesEdition2023Root extensionRegistry];
|
||||
} else if ([request.messageType
|
||||
isEqual:@"protobuf_test_messages.editions.proto2.TestAllTypesProto2"]) {
|
||||
msgClass = [EditionsProto2TestAllTypesProto2 class];
|
||||
registry = [EditionsProto2TestMessagesProto2EditionsRoot extensionRegistry];
|
||||
} else if ([request.messageType
|
||||
isEqual:@"protobuf_test_messages.editions.proto3.TestAllTypesProto3"]) {
|
||||
msgClass = [EditionsProto3TestAllTypesProto3 class];
|
||||
registry = [EditionsProto3TestMessagesProto3EditionsRoot extensionRegistry];
|
||||
} else {
|
||||
msgClass = nil;
|
||||
registry = nil;
|
||||
response.runtimeError =
|
||||
[NSString stringWithFormat:@"Protobuf request had an unknown message_type: %@",
|
||||
request.messageType];
|
||||
}
|
||||
if (msgClass) {
|
||||
NSError *error = nil;
|
||||
testMessage = [msgClass parseFromData:request.protobufPayload
|
||||
extensionRegistry:registry
|
||||
error:&error];
|
||||
if (!testMessage) {
|
||||
response.parseError = [NSString stringWithFormat:@"Parse error: %@", error];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -167,15 +182,15 @@ static BOOL DoTestIo(NSFileHandle *input, NSFileHandle *output) {
|
||||
}
|
||||
|
||||
data = response.data;
|
||||
[output writeData:UInt32ToLittleEndianData((int32_t)data.length)];
|
||||
[output writeData:UInt32ToLittleEndianData((uint32_t)data.length)];
|
||||
[output writeData:data];
|
||||
|
||||
if (verbose) {
|
||||
if (gVerbose) {
|
||||
NSLog(@"Request: %@", request);
|
||||
NSLog(@"Response: %@", response);
|
||||
}
|
||||
|
||||
++testCount;
|
||||
++gTestCount;
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -191,7 +206,7 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
NSLog(@"Received EOF from test runner after %d tests, exiting.", testCount);
|
||||
NSLog(@"Received EOF from test runner after %d tests, exiting.", gTestCount);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# Protocol Buffers - Google's data interchange format
|
||||
# Copyright 2008 Google Inc. All rights reserved.
|
||||
#
|
||||
@ -7,6 +5,13 @@
|
||||
# license that can be found in the LICENSE file or at
|
||||
# https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
# TODO - When rules_ruby supports prefix stripping, use it to obviate the need
|
||||
# for manual load path manipulation
|
||||
# https://github.com/bazel-contrib/rules_ruby/issues/219
|
||||
$LOAD_PATH.unshift ENV['PWD']
|
||||
$LOAD_PATH.unshift File.join(ENV['PWD'], 'ruby', 'lib')
|
||||
$LOAD_PATH.unshift File.join(ENV['PWD'], 'ruby')
|
||||
|
||||
require 'conformance/conformance_pb'
|
||||
require 'conformance/test_protos/test_messages_edition2023_pb'
|
||||
require 'google/protobuf'
|
||||
|
@ -11,8 +11,8 @@
|
||||
//
|
||||
// For pros and cons of this approach, please see conformance.proto.
|
||||
|
||||
#ifndef CONFORMANCE_CONFORMANCE_TEST_H
|
||||
#define CONFORMANCE_CONFORMANCE_TEST_H
|
||||
#ifndef GOOGLE_PROTOBUF_CONFORMANCE_CONFORMANCE_TEST_H__
|
||||
#define GOOGLE_PROTOBUF_CONFORMANCE_CONFORMANCE_TEST_H__
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -370,4 +370,4 @@ class ConformanceTestSuite {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
#endif // CONFORMANCE_CONFORMANCE_TEST_H
|
||||
#endif // GOOGLE_PROTOBUF_CONFORMANCE_CONFORMANCE_TEST_H__
|
||||
|
11
third_party/protobuf/conformance/defs.bzl
vendored
11
third_party/protobuf/conformance/defs.bzl
vendored
@ -22,13 +22,13 @@ def conformance_test(
|
||||
for the text format conformance suite.
|
||||
**kwargs: common arguments to pass to sh_test.
|
||||
"""
|
||||
args = ["--testee %s" % _strip_bazel(testee)]
|
||||
args = ["--testee $(location %s)" % testee]
|
||||
failure_lists = []
|
||||
if failure_list:
|
||||
args = args + ["--failure_list %s" % _strip_bazel(failure_list)]
|
||||
args = args + ["--failure_list $(location %s)" % failure_list]
|
||||
failure_lists = failure_lists + [failure_list]
|
||||
if text_format_failure_list:
|
||||
args = args + ["--text_format_failure_list %s" % _strip_bazel(text_format_failure_list)]
|
||||
args = args + ["--text_format_failure_list $(location %s)" % text_format_failure_list]
|
||||
failure_lists = failure_lists + [text_format_failure_list]
|
||||
if maximum_edition:
|
||||
args = args + ["--maximum_edition %s" % maximum_edition]
|
||||
@ -46,8 +46,3 @@ def conformance_test(
|
||||
tags = ["conformance"],
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def _strip_bazel(testee):
|
||||
if testee.startswith("//"):
|
||||
testee = testee.replace("//", "com_google_protobuf/")
|
||||
return testee.replace(":", "/")
|
||||
|
@ -0,0 +1 @@
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
Required.*.JsonInput.Int32FieldQuotedExponentialValue.* # Failed to parse input or produce output.
|
||||
Required.*.JsonInput.AnyWithNoType.*
|
||||
Required.*.JsonInput.AnyWithNoType.*
|
||||
|
@ -5,8 +5,8 @@
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
#ifndef TEXT_FORMAT_CONFORMANCE_SUITE_H_
|
||||
#define TEXT_FORMAT_CONFORMANCE_SUITE_H_
|
||||
#ifndef GOOGLE_PROTOBUF_CONFORMANCE_TEXT_FORMAT_CONFORMANCE_SUITE_H__
|
||||
#define GOOGLE_PROTOBUF_CONFORMANCE_TEXT_FORMAT_CONFORMANCE_SUITE_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -79,4 +79,4 @@ class TextFormatConformanceTestSuiteImpl {
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
#endif // TEXT_FORMAT_CONFORMANCE_SUITE_H_
|
||||
#endif // GOOGLE_PROTOBUF_CONFORMANCE_TEXT_FORMAT_CONFORMANCE_SUITE_H__
|
||||
|
1
third_party/protobuf/csharp/BUILD.bazel
vendored
1
third_party/protobuf/csharp/BUILD.bazel
vendored
@ -3,6 +3,7 @@
|
||||
# See also code generation logic under /src/google/protobuf/compiler/csharp.
|
||||
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
|
||||
load("//build_defs:internal_shell.bzl", "inline_sh_test")
|
||||
load("//conformance:defs.bzl", "conformance_test")
|
||||
load("//editions:defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
|
||||
|
@ -5,7 +5,7 @@
|
||||
<title>Google Protocol Buffers tools</title>
|
||||
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
|
||||
<description>See project site for more info.</description>
|
||||
<version>3.30.2</version>
|
||||
<version>3.31.0</version>
|
||||
<authors>Google Inc.</authors>
|
||||
<owners>protobuf-packages</owners>
|
||||
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl>
|
||||
|
811
third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs
vendored
811
third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs
vendored
File diff suppressed because it is too large
Load Diff
844
third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs
vendored
844
third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2Editions.pb.cs
vendored
File diff suppressed because it is too large
Load Diff
@ -488,6 +488,7 @@ namespace ProtobufTestMessages.Proto3 {
|
||||
private int optionalInt32_;
|
||||
/// <summary>
|
||||
/// Singular
|
||||
/// test [kotlin] comment
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
|
1
third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3Editions.pb.cs
vendored
1
third_party/protobuf/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3Editions.pb.cs
vendored
@ -496,6 +496,7 @@ namespace ProtobufTestMessages.Editions.Proto3 {
|
||||
private int optionalInt32_;
|
||||
/// <summary>
|
||||
/// Singular
|
||||
/// test [kotlin] comment
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
|
Binary file not shown.
@ -8,11 +8,13 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
#if NET5_0_OR_GREATER
|
||||
using System.Runtime.CompilerServices;
|
||||
@ -116,12 +118,24 @@ namespace Google.Protobuf.Collections
|
||||
{
|
||||
EnsureSize(count + (length / codec.FixedSize));
|
||||
|
||||
while (!SegmentedBufferHelper.IsReachedLimit(ref ctx.state))
|
||||
// if littleEndian treat array as bytes and directly copy from buffer for improved performance
|
||||
if(TryGetArrayAsSpanPinnedUnsafe(codec, out Span<byte> span, out GCHandle handle))
|
||||
{
|
||||
// Only FieldCodecs with a fixed size can reach here, and they are all known
|
||||
// types that don't allow the user to specify a custom reader action.
|
||||
// reader action will never return null.
|
||||
array[count++] = reader(ref ctx);
|
||||
span = span.Slice(count * codec.FixedSize);
|
||||
Debug.Assert(span.Length >= length);
|
||||
ParsingPrimitives.ReadPackedFieldLittleEndian(ref ctx.buffer, ref ctx.state, length, span);
|
||||
count += length / codec.FixedSize;
|
||||
handle.Free();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!SegmentedBufferHelper.IsReachedLimit(ref ctx.state))
|
||||
{
|
||||
// Only FieldCodecs with a fixed size can reach here, and they are all known
|
||||
// types that don't allow the user to specify a custom reader action.
|
||||
// reader action will never return null.
|
||||
array[count++] = reader(ref ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -241,9 +255,21 @@ namespace Google.Protobuf.Collections
|
||||
int size = CalculatePackedDataSize(codec);
|
||||
ctx.WriteTag(tag);
|
||||
ctx.WriteLength(size);
|
||||
for (int i = 0; i < count; i++)
|
||||
|
||||
// if littleEndian and elements has fixed size, treat array as bytes (and write it as bytes to buffer) for improved performance
|
||||
if(TryGetArrayAsSpanPinnedUnsafe(codec, out Span<byte> span, out GCHandle handle))
|
||||
{
|
||||
writer(ref ctx, array[i]);
|
||||
span = span.Slice(0, Count * codec.FixedSize);
|
||||
|
||||
WritingPrimitives.WriteRawBytes(ref ctx.buffer, ref ctx.state, span);
|
||||
handle.Free();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
writer(ref ctx, array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -679,6 +705,24 @@ namespace Google.Protobuf.Collections
|
||||
count = targetCount;
|
||||
}
|
||||
|
||||
[SecuritySafeCritical]
|
||||
private unsafe bool TryGetArrayAsSpanPinnedUnsafe(FieldCodec<T> codec, out Span<byte> span, out GCHandle handle)
|
||||
{
|
||||
// 1. protobuf wire bytes is LittleEndian only
|
||||
// 2. validate that size of csharp element T is matching the size of protobuf wire size
|
||||
// NOTE: cannot use bool with this span because csharp marshal it as 4 bytes
|
||||
if (BitConverter.IsLittleEndian && (codec.FixedSize > 0 && Marshal.SizeOf(typeof(T)) == codec.FixedSize))
|
||||
{
|
||||
handle = GCHandle.Alloc(array, GCHandleType.Pinned);
|
||||
span = new Span<byte>(handle.AddrOfPinnedObject().ToPointer(), array.Length * codec.FixedSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
span = default;
|
||||
handle = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Explicit interface implementation for IList and ICollection.
|
||||
bool IList.IsFixedSize => false;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright notice and license
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
//
|
||||
@ -12,8 +12,12 @@ using System;
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a non-generic extension definition. This API is experimental and subject to change.
|
||||
/// Represents a non-generic extension definition.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Most users will not use this abstract class directly, instead using the generated instances
|
||||
/// of the concrete subclasses.
|
||||
/// </remarks>
|
||||
public abstract class Extension
|
||||
{
|
||||
internal abstract Type TargetType { get; }
|
||||
@ -37,8 +41,7 @@ namespace Google.Protobuf
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a type-safe extension identifier used for getting and setting single extension values in <see cref="IExtendableMessage{T}"/> instances.
|
||||
/// This API is experimental and subject to change.
|
||||
/// Represents a type-safe extension identifier used for getting and setting single extension values in <see cref="IExtendableMessage{T}"/> instances.
|
||||
/// </summary>
|
||||
/// <typeparam name="TTarget">The message type this field applies to</typeparam>
|
||||
/// <typeparam name="TValue">The field value type of this extension</typeparam>
|
||||
@ -68,7 +71,6 @@ namespace Google.Protobuf
|
||||
|
||||
/// <summary>
|
||||
/// Represents a type-safe extension identifier used for getting repeated extension values in <see cref="IExtendableMessage{T}"/> instances.
|
||||
/// This API is experimental and subject to change.
|
||||
/// </summary>
|
||||
/// <typeparam name="TTarget">The message type this field applies to</typeparam>
|
||||
/// <typeparam name="TValue">The repeated field value type of this extension</typeparam>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright notice and license
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
//
|
||||
@ -15,7 +15,7 @@ using System.Linq;
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides extensions to messages while parsing. This API is experimental and subject to change.
|
||||
/// Provides extensions to messages while parsing.
|
||||
/// </summary>
|
||||
public sealed class ExtensionRegistry : ICollection<Extension>, IDeepCloneable<ExtensionRegistry>
|
||||
{
|
||||
|
@ -18,9 +18,14 @@ namespace Google.Protobuf
|
||||
{
|
||||
/// <summary>
|
||||
/// Methods for managing <see cref="ExtensionSet{TTarget}"/>s with null checking.
|
||||
///
|
||||
/// Most users will not use this class directly and its API is experimental and subject to change.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Most users will not use this class directly. Accessing extensions for a given message
|
||||
/// is usually performed by obtaining the generated instance of
|
||||
/// <see cref="Extension{TTarget,TValue}"/> or <see cref="RepeatedExtension{TTarget,TValue}"/>
|
||||
/// and then calling methods on <see cref="IExtendableMessage{T}"/> (which is implemented by
|
||||
/// all generated messages).
|
||||
/// </remarks>
|
||||
public static class ExtensionSet
|
||||
{
|
||||
private static bool TryGetValue<TTarget>(ref ExtensionSet<TTarget> set, Extension extension, out IExtensionValue value) where TTarget : IExtendableMessage<TTarget>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
|
||||
<Copyright>Copyright 2015, Google Inc.</Copyright>
|
||||
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
|
||||
<VersionPrefix>3.30.2</VersionPrefix>
|
||||
<VersionPrefix>3.31.0</VersionPrefix>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Authors>Google Inc.</Authors>
|
||||
<TargetFrameworks>netstandard1.1;netstandard2.0;net45;net50</TargetFrameworks>
|
||||
|
@ -11,6 +11,7 @@ using System;
|
||||
using System.Buffers;
|
||||
using System.Buffers.Binary;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
@ -45,7 +46,7 @@ namespace Google.Protobuf
|
||||
|
||||
/// <summary>
|
||||
/// Parses the next tag.
|
||||
/// If the end of logical stream was reached, an invalid tag of 0 is returned.
|
||||
/// If the end of logical stream was reached, an invalid tag of 0 is returned.
|
||||
/// </summary>
|
||||
public static uint ParseTag(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)
|
||||
{
|
||||
@ -382,7 +383,7 @@ namespace Google.Protobuf
|
||||
// ReadUnaligned uses processor architecture for endianness.
|
||||
float result = Unsafe.ReadUnaligned<float>(ref MemoryMarshal.GetReference(buffer.Slice(state.bufferPos, length)));
|
||||
state.bufferPos += length;
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static unsafe float ParseFloatSlow(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state)
|
||||
@ -737,7 +738,7 @@ namespace Google.Protobuf
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ZigZag encodes signed integers into values that can be efficiently
|
||||
/// encoded with varint. (Otherwise, negative values must be
|
||||
/// encoded with varint. (Otherwise, negative values must be
|
||||
/// sign-extended to 32 bits to be varint encoded, thus always taking
|
||||
/// 5 bytes on the wire.)
|
||||
/// </remarks>
|
||||
@ -751,7 +752,7 @@ namespace Google.Protobuf
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ZigZag encodes signed integers into values that can be efficiently
|
||||
/// encoded with varint. (Otherwise, negative values must be
|
||||
/// encoded with varint. (Otherwise, negative values must be
|
||||
/// sign-extended to 64 bits to be varint encoded, thus always taking
|
||||
/// 10 bytes on the wire.)
|
||||
/// </remarks>
|
||||
@ -810,5 +811,25 @@ namespace Google.Protobuf
|
||||
state.bufferPos += unreadSpan.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read LittleEndian packed field from buffer of specified length into a span.
|
||||
/// The amount of data available and the current limit should be checked before calling this method.
|
||||
/// </summary>
|
||||
internal static void ReadPackedFieldLittleEndian(ref ReadOnlySpan<byte> buffer, ref ParserInternalState state, int length, Span<byte> outBuffer)
|
||||
{
|
||||
Debug.Assert(BitConverter.IsLittleEndian);
|
||||
|
||||
if (length <= state.bufferSize - state.bufferPos)
|
||||
{
|
||||
buffer.Slice(state.bufferPos, length).CopyTo(outBuffer);
|
||||
state.bufferPos += length;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadRawBytesIntoSpan(ref buffer, ref state, length, outBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,5 +13,5 @@ internal sealed partial class FeatureSetDescriptor
|
||||
{
|
||||
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
|
||||
private const string DefaultsBase64 =
|
||||
"ChUYhAciACoOCAEQAhgCIAMoATACOAIKFRjnByIAKg4IAhABGAEgAigBMAE4AgoVGOgHIgwIARABGAEgAigBMAEqAjgCIOYHKOgH";
|
||||
"ChcYhAciACoQCAEQAhgCIAMoATACOAJAAQoXGOcHIgAqEAgCEAEYASACKAEwATgCQAEKFxjoByIMCAEQARgBIAIoATABKgQ4AkABIOYHKOgH";
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#region Copyright notice and license
|
||||
#region Copyright notice and license
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
//
|
||||
@ -48,7 +48,6 @@ namespace Google.Protobuf
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="ByteString" /> from the given bytes. The bytes are not copied,
|
||||
/// and must not be modified while the <see cref="ByteString" /> is in use.
|
||||
/// This API is experimental and subject to change.
|
||||
/// </summary>
|
||||
public static ByteString UnsafeWrap(ReadOnlyMemory<byte> bytes)
|
||||
{
|
||||
|
7
third_party/protobuf/docs/options.md
vendored
7
third_party/protobuf/docs/options.md
vendored
@ -255,7 +255,7 @@ with info about your project (name and website) so we can add an entry for you.
|
||||
* Website: https://github.com/bufbuild/protoc-gen-validate
|
||||
* Extensions: 1071
|
||||
|
||||
1. Protokt
|
||||
1. Protokt (pre 1.0.0)
|
||||
|
||||
* Website: https://github.com/open-toast/protokt
|
||||
* Extensions: 1072
|
||||
@ -531,3 +531,8 @@ with info about your project (name and website) so we can add an entry for you.
|
||||
|
||||
* Website: https://github.com/jaiarobotics/jaiabot
|
||||
* Extensions: 1252
|
||||
|
||||
1. Protokt (1.0.0 and up)
|
||||
|
||||
* Website: https://github.com/open-toast/protokt
|
||||
* Extensions: 1253-1263
|
||||
|
@ -147,6 +147,7 @@ TEST(Generated, EditionDefaults2023InternalFeatures) {
|
||||
message_encoding: LENGTH_PREFIXED
|
||||
json_format: ALLOW
|
||||
enforce_naming_style: STYLE_LEGACY
|
||||
default_symbol_visibility: EXPORT_ALL
|
||||
[pb.cpp] {
|
||||
legacy_closed_enum: false
|
||||
string_type: STRING
|
||||
|
@ -2,7 +2,7 @@
|
||||
<testsuites tests="1" name="AllTests">
|
||||
<testsuite name="EditionsCodegenTests">
|
||||
<testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.cc" status="run" result="completed" classname="DiffTest">
|
||||
<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.
, with the difference:
@@ @@
 ::_pbi::TcParser::GetTable<::protobuf_editions_test::golden::SimpleProto3>(), // to_prefetch
 #endif // PROTOBUF_PREFETCH_PARSE_TABLE
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0, PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0,
 (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if ((cached_has_bits & 0x00000001u) != 0) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 (void)cached_has_bits;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if ((cached_has_bits & 0x00000001u) != 0) {
 total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(" type=""></failure>
|
||||
<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.cc
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#include "third_party/protobuf/editions/golden/simple_proto3.pb.h"

#include <algorithm>
#include <type_traits>
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/generated_message_tctable_impl.h"
#include "third_party/protobuf/extension_set.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/wire_format_lite.h"
#include "third_party/protobuf/io/zero_copy_stream_impl_lite.h"
#include "third_party/protobuf/v2/generated_message_table_impl.h"
// @@protoc_insertion_point(includes)

// Must be included last.
, with the difference:
@@ @@
 ::_pbi::TcParser::GetTable<::protobuf_editions_test::golden::SimpleProto3>(), // to_prefetch
 #endif // PROTOBUF_PREFETCH_PARSE_TABLE
 }, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {::_pbi::TcParser::FastV32S1,
 {8, 0, 0, PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_)}},
 }}, {{
 65535, 65535
 }}, {{
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 {PROTOBUF_FIELD_OFFSET(SimpleProto3, _impl_.int32_field_), _Internal::kHasBitsOffset + 0, 0,
 (0 | ::_fl::kFcOptional | ::_fl::kInt32)},
 }},
@@ @@
 (void)cached_has_bits;
 
 cached_has_bits = this_._impl_._has_bits_[0];
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 if ((cached_has_bits & 0x00000001u) != 0) {
 target =
 ::proto2::internal::WireFormatLite::WriteInt32ToArrayWithField<1>(
@@ @@
 (void)cached_has_bits;
 
 {
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 cached_has_bits = this_._impl_._has_bits_[0];
 if ((cached_has_bits & 0x00000001u) != 0) {
 total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(" type=""></failure>
|
||||
</testcase>
|
||||
<testcase name="third_party/protobuf/editions/golden/simple_proto3.pb.h" status="run" result="completed" classname="DiffTest">
|
||||
<failure message="Value of: third_party/protobuf/editions/golden/simple_proto3.pb.h
Expected: 
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: third_party/protobuf/editions/golden/simple_proto3.proto

#ifndef third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
#define third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh

#include <limits>
#include <string>
#include <type_traits>
#include <utility>

#include "third_party/protobuf/runtime_version.h"
#include "third_party/protobuf/io/coded_stream.h"
#include "third_party/protobuf/arena.h"
#include "third_party/protobuf/arenastring.h"
#include "third_party/protobuf/generated_message_tctable_decl.h"
#include "third_party/protobuf/v2/generated_message_table.h"
#include "third_party/protobuf/v2/generated_message_table_impl.h"
#include "third_party/protobuf/generated_message_util.h"
#include "third_party/protobuf/metadata_lite.h"
#include "third_party/protobuf/message_lite.h"
// @@protoc_insertion_point(includes)

// Must be included last.

#endif // third_5fparty_2fprotobuf_2feditions_2fgolden_2fsimple_5fproto3_2eproto_2epb_2eh
, with the difference:
@@ @@
 enum : int {
 kInt32FieldFieldNumber = 1,
 };
- // optional int32 int32_field = 1;
+ // int32 int32_field = 1;
 bool has_int32_field() const;
 void clear_int32_field() ;
 ::int32_t int32_field() const;
@@ @@
 
 // SimpleProto3
 
-// optional int32 int32_field = 1;
+// int32 int32_field = 1;
 inline bool SimpleProto3::has_int32_field() const {
 bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0;
 return value;" type=""></failure>
|
||||
|
8
third_party/protobuf/editions/golden/editions_transform_noop.proto
vendored
Normal file
8
third_party/protobuf/editions/golden/editions_transform_noop.proto
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// clang-format off
|
||||
edition = "2023";
|
||||
|
||||
package third_party_protobuf_editions_proto;
|
||||
|
||||
message EditionsTransformNoop {
|
||||
string string_field = 1;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
//
|
||||
@ -38,28 +39,6 @@ service BasicService {
|
||||
rpc BasicMethod(EmptyMessage) returns (EmptyMessage) {}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
message UnformattedMessage {
|
||||
int32 a = 1;
|
||||
|
||||
message Foo {
|
||||
int32 a = 1;
|
||||
}
|
||||
|
||||
Foo foo = 2 [
|
||||
features.message_encoding = DELIMITED
|
||||
];
|
||||
|
||||
string string_piece_with_zero = 3 [
|
||||
ctype = STRING_PIECE,
|
||||
default = "ab\000c"
|
||||
];
|
||||
|
||||
float long_float_name_wrapped = 4;
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
||||
message ParentMessage {
|
||||
message ExtendedMessage {
|
||||
extensions 536860000 to 536869999 [
|
||||
@ -128,3 +107,25 @@ message TestOpenEnumMessage {
|
||||
|
||||
TestEnum closed_enum_field = 2;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
message UnformattedMessage {
|
||||
int32 a = 1;
|
||||
|
||||
message Foo {
|
||||
int32 a = 1;
|
||||
}
|
||||
|
||||
Foo foo = 2 [
|
||||
features.message_encoding = DELIMITED
|
||||
];
|
||||
|
||||
string string_piece_with_zero = 3 [
|
||||
ctype = STRING_PIECE,
|
||||
default = "ab\000c"
|
||||
];
|
||||
|
||||
float long_float_name_wrapped = 4;
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
//
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
//
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
//
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
//
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2008 Google Inc. All rights reserved.
|
||||
//
|
||||
@ -187,8 +188,10 @@ message TestAllTypesProto2 {
|
||||
map<fixed64, fixed64> map_fixed64_fixed64 = 63;
|
||||
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 64;
|
||||
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 65;
|
||||
map<int32, bool> map_int32_bool = 104;
|
||||
map<int32, float> map_int32_float = 66;
|
||||
map<int32, double> map_int32_double = 67;
|
||||
map<int32, NestedMessage> map_int32_nested_message = 103;
|
||||
map<bool, bool> map_bool_bool = 68;
|
||||
map<string, string> map_string_string = 69;
|
||||
map<string, bytes> map_string_bytes = 70;
|
||||
@ -316,6 +319,8 @@ message TestAllTypesProto2 {
|
||||
// Reserved for unknown fields test.
|
||||
reserved 1000 to 9999;
|
||||
|
||||
MessageSetCorrect message_set_correct = 500;
|
||||
|
||||
// message_set test case.
|
||||
message MessageSetCorrect {
|
||||
option message_set_wire_format = true;
|
||||
@ -338,6 +343,17 @@ message TestAllTypesProto2 {
|
||||
|
||||
int32 i = 9;
|
||||
}
|
||||
|
||||
message ExtensionWithOneof {
|
||||
oneof oneof_field {
|
||||
int32 a = 1;
|
||||
int32 b = 2;
|
||||
}
|
||||
|
||||
extend MessageSetCorrect {
|
||||
ExtensionWithOneof extension_with_oneof = 123456789;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message ForeignMessageProto2 {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user