From fc8b8abc05a8fd749be90d62784956b07ba0f9d1 Mon Sep 17 00:00:00 2001 From: hw-wLiu Date: Mon, 3 Mar 2025 16:03:39 +0800 Subject: [PATCH] revert Signed-off-by: hw-wLiu --- .bazelignore | 4 + .bazelrc | 32 + .gitattributes | 15 - .gitignore | 108 +- .gitmodules | 10 +- .readthedocs.yml | 22 + BUILD.bazel | 609 + BUILD.gn | 513 +- CHANGES.txt | 2465 -- CMakeLists.txt | 362 + CODE_OF_CONDUCT.md | 3 + CONTRIBUTING.md | 38 +- CONTRIBUTORS.txt | 5 + Cargo.bazel.lock | 772 + Cargo.lock | 133 + MODULE.bazel | 2 + Makefile.am | 1415 - Protobuf-C++.podspec | 40 + Protobuf.podspec | 50 + README.OpenSource | 2 +- README.md | 72 +- SECURITY.md | 4 + WORKSPACE | 218 +- appveyor.bat | 4 +- appveyor.yml | 10 +- bazel/BUILD | 59 + bazel/amalgamate.py | 136 + bazel/amalgamation.bzl | 67 + bazel/build_defs.bzl | 82 + bazel/lua.BUILD | 109 + bazel/py_proto_library.bzl | 139 + bazel/python_downloads.bzl | 84 + bazel/system_python.bzl | 275 + bazel/upb_c_proto_library.bzl | 70 + bazel/upb_minitable_proto_library.bzl | 78 + bazel/upb_proto_library.bzl | 35 + bazel/upb_proto_library_internal/aspect.bzl | 239 + .../cc_library_func.bzl | 71 + bazel/upb_proto_library_internal/copts.bzl | 16 + bazel/upb_proto_library_internal/rule.bzl | 39 + bazel/upb_proto_reflection_library.bzl | 68 + benchmarks/BUILD | 245 + benchmarks/BUILD.googleapis | 59 + benchmarks/Makefile.am | 664 - benchmarks/README.md | 243 - benchmarks/benchmark.cc | 390 + benchmarks/benchmarks.proto | 63 - benchmarks/build_defs.bzl | 70 + benchmarks/compare.py | 123 + benchmarks/cpp/cpp_benchmark.cc | 254 - .../proto2/benchmark_message1_proto2.proto | 108 - .../proto2/dataset.google_message1_proto2.pb | Bin 289 -> 0 bytes .../proto3/benchmark_message1_proto3.proto | 108 - .../proto3/dataset.google_message1_proto3.pb | Bin 289 -> 0 bytes .../google_message2/benchmark_message2.proto | 108 - .../dataset.google_message2.pb | Bin 84625 -> 0 bytes .../google_message3/benchmark_message3.proto | 566 - .../benchmark_message3_1.proto | 1298 - .../benchmark_message3_2.proto | 528 - .../benchmark_message3_3.proto | 496 - .../benchmark_message3_4.proto | 514 - .../benchmark_message3_5.proto | 496 - .../benchmark_message3_6.proto | 483 - .../benchmark_message3_7.proto | 81 - .../benchmark_message3_8.proto | 1925 -- .../google_message4/benchmark_message4.proto | 484 - .../benchmark_message4_1.proto | 500 - .../benchmark_message4_2.proto | 316 - .../benchmark_message4_3.proto | 779 - benchmarks/descriptor.proto | 865 + benchmarks/descriptor_sv.proto | 867 + benchmarks/download_data.sh | 5 - benchmarks/empty.proto | 35 + benchmarks/gen_protobuf_binary_cc.py | 69 + benchmarks/gen_synthetic_protos.py | 123 + benchmarks/gen_upb_binary_c.py | 70 + benchmarks/go/go_benchmark_test.go | 124 - benchmarks/google_size.proto | 138 - benchmarks/java/pom.xml | 98 - .../protobuf/ProtoCaliperBenchmark.java | 214 - benchmarks/js/benchmark_suite.js | 33 - benchmarks/js/js_benchmark.js | 82 - benchmarks/php/PhpBenchmark.php | 170 - benchmarks/php/autoload.php | 25 - benchmarks/protobuf.js/generate_pbjs_files.js | 25 - .../protobuf.js/protobufjs_benchmark.js | 66 - benchmarks/python/py_benchmark.py | 161 - .../python/python_benchmark_messages.cc | 29 - benchmarks/util/big_query_utils.py | 189 - benchmarks/util/data_proto2_to_proto3_util.h | 64 - benchmarks/util/gogo_data_scrubber.cc | 74 - benchmarks/util/proto3_data_stripper.cc | 74 - benchmarks/util/protoc-gen-gogoproto.cc | 103 - .../util/protoc-gen-proto2_to_proto3.cc | 115 - benchmarks/util/result_parser.py | 300 - benchmarks/util/result_uploader.py | 107 - .../util/schema_proto2_to_proto3_util.h | 194 - build_defs/BUILD.bazel | 210 + build_defs/arch_tests.bzl | 55 + .../cc_proto_blacklist_test.bzl | 6 +- .../compiler_config_setting.bzl | 0 build_defs/cpp_opts.bzl | 49 + build_defs/internal_shell.bzl | 94 + build_defs/java_opts.bzl | 77 + bundle.json | 3 +- ci/Linux.bazelrc | 3 + ci/README.md | 17 + ci/Windows.bazelrc | 2 + ci/clang_wrapper | 3 + ci/clang_wrapper++ | 3 + ci/common.bazelrc | 36 + ci/macOS.bazelrc | 3 + ci/push_auto_update.sh | 45 + cmake/CMakeLists.txt | 293 - cmake/README.md | 270 +- cmake/abseil-cpp.cmake | 95 + cmake/conformance.cmake | 129 +- cmake/examples.cmake | 6 +- cmake/extract_includes.bat.in | 131 - cmake/gtest.cmake | 48 + cmake/install.cmake | 173 +- cmake/libprotobuf-lite.cmake | 99 +- cmake/libprotobuf.cmake | 152 +- cmake/libprotoc.cmake | 195 +- cmake/protobuf-config.cmake.in | 138 +- cmake/protobuf-configure-target.cmake | 55 + cmake/protobuf-generate.cmake | 161 + cmake/protobuf-lite.pc.cmake | 3 +- cmake/protobuf-module.cmake.in | 46 +- cmake/protobuf-options.cmake | 4 +- cmake/protobuf.pc.cmake | 3 +- cmake/protoc.cmake | 14 +- cmake/tests.cmake | 378 +- cmake/utf8_range.cmake | 15 + composer.json | 23 - configure.ac | 234 - conformance/BUILD.bazel | 373 + conformance/ConformanceJava.java | 344 +- conformance/ConformanceJavaLite.java | 288 +- conformance/Makefile.am | 375 - conformance/README.md | 79 +- conformance/autoload.php | 2 +- conformance/bazel_conformance_test_runner.sh | 60 + conformance/binary_json_conformance_suite.cc | 2797 +- conformance/binary_json_conformance_suite.h | 75 +- conformance/conformance.proto | 61 +- conformance/conformance_cpp.cc | 329 +- conformance/conformance_dart.dart | 106 + conformance/conformance_nodejs.js | 186 - conformance/conformance_objc.m | 64 +- conformance/conformance_php.php | 4 +- conformance/conformance_python.py | 59 +- conformance/conformance_ruby.rb | 86 +- conformance/conformance_rust.rs | 104 + conformance/conformance_test.cc | 356 +- conformance/conformance_test.h | 105 +- conformance/conformance_test_main.cc | 29 +- conformance/conformance_test_runner.cc | 198 +- conformance/defs.bzl | 48 + conformance/failure_list_cpp.txt | 5 +- conformance/failure_list_csharp.txt | 8 +- .../failure_list_dart_upb.txt | 0 conformance/failure_list_java.txt | 4 - conformance/failure_list_java_lite.txt | 10 + conformance/failure_list_jruby.txt | 38 + conformance/failure_list_jruby_ffi.txt | 2 + conformance/failure_list_js.txt | 115 - conformance/failure_list_php.txt | 6 + conformance/failure_list_php_c.txt | 2 + conformance/failure_list_php_c_32.txt | 2 - conformance/failure_list_python.txt | 3 + conformance/failure_list_python_cpp.txt | 5 +- conformance/failure_list_ruby.txt | 113 +- .../failure_list_rust_cc.txt | 0 .../failure_list_rust_upb.txt | 0 conformance/text_format_conformance_suite.cc | 587 +- conformance/text_format_conformance_suite.h | 47 +- conformance/text_format_failure_list_cpp.txt | 20 + .../text_format_failure_list_dart_upb.txt | 0 conformance/text_format_failure_list_java.txt | 3 + .../text_format_failure_list_java_lite.txt | 5 + .../text_format_failure_list_jruby.txt | 8 + .../text_format_failure_list_python.txt | 29 + .../text_format_failure_list_python_cpp.txt | 28 + .../text_format_failure_list_rust_cc.txt | 0 .../text_format_failure_list_rust_upb.txt | 0 conformance/third_party/jsoncpp/json.h | 2075 -- conformance/third_party/jsoncpp/jsoncpp.cpp | 5192 ---- conformance/update_failure_list.py | 29 +- csharp/src/AddressBook/Addressbook.cs | 758 - .../Conformance.cs | 1503 - .../Collections/ReadOnlyDictionary.cs | 147 - .../Compatibility/MethodInfoExtensions.cs | 47 - .../Compatibility/StreamExtensions.cs | 66 - .../Google.Protobuf/Reflection/Descriptor.cs | 10296 ------- .../src/Google.Protobuf/WellKnownTypes/Any.cs | 366 - .../src/Google.Protobuf/WellKnownTypes/Api.cs | 1172 - .../WellKnownTypes/Duration.cs | 328 - .../Google.Protobuf/WellKnownTypes/Empty.cs | 193 - .../WellKnownTypes/FieldMask.cs | 411 - .../WellKnownTypes/SourceContext.cs | 227 - .../Google.Protobuf/WellKnownTypes/Struct.cs | 866 - .../WellKnownTypes/Timestamp.cs | 349 - .../Google.Protobuf/WellKnownTypes/Type.cs | 1877 -- .../WellKnownTypes/Wrappers.cs | 1679 -- docs/cmake_protobuf_generate.md | 135 + docs/cpp_build_systems.md | 338 + docs/csharp/proto2.md | 2 +- docs/design/editions/README.md | 36 + .../editions/cpp-apis-for-edition-zero.md | 79 + docs/design/editions/edition-evolution.md | 95 + docs/design/editions/edition-naming.md | 265 + .../edition-zero-converged-semantics.md | 248 + ...tion-zero-feature-enum-field-closedness.md | 305 + docs/design/editions/edition-zero-features.md | 626 + .../editions/edition-zero-json-handling.md | 148 + .../editions/editions-feature-visibility.md | 203 + .../editions/editions-life-of-a-featureset.md | 635 + ...editions-life-of-a-featureset-image-01.png | Bin 0 -> 20510 bytes ...editions-life-of-a-featureset-image-03.png | Bin 0 -> 32658 bytes ...editions-life-of-a-featureset-image-04.png | Bin 0 -> 57321 bytes .../design/editions/java-lite-for-editions.md | 368 + docs/design/editions/life-of-an-edition.md | 403 + .../protobuf-design-options-attributes.md | 247 + .../protobuf-editions-design-features.md | 317 + .../protobuf-editions-for-schema-producers.md | 127 + .../stricter-schemas-with-editions.md | 245 + .../editions/what-are-protobuf-editions.md | 332 + docs/design/prototiller/README.md | 22 + docs/design/prototiller/editions-tooling.md | 165 + .../prototiller-reqs-for-edition-zero.md | 536 + docs/field_presence.md | 88 +- docs/implementing_proto3_presence.md | 21 +- docs/jvm_aot.md | 20 + docs/options.md | 590 +- docs/performance.md | 304 - docs/third_party.md | 317 +- docs/upb/design.md | 429 + docs/upb/render.py | 73 + docs/upb/style-guide.md | 65 + docs/upb/vs-cpp-protos.md | 262 + docs/upb/wrapping-upb.md | 444 + editors/proto.vim | 8 +- editors/protobuf-mode.el | 22 +- examples/.bazelrc | 1 + examples/AddPerson.java | 6 +- examples/BUILD | 105 - examples/BUILD.bazel | 143 + examples/CMakeLists.txt | 2 +- examples/ListPeople.java | 6 +- examples/Makefile | 109 + examples/README.md | 28 +- examples/WORKSPACE | 6 +- examples/add_person.cc | 2 +- examples/add_person.py | 2 +- examples/add_person.rb | 77 + examples/addressbook.proto | 9 +- .../{ => go/cmd/add_person}/add_person.go | 4 +- .../cmd/add_person}/add_person_test.go | 6 +- .../{ => go/cmd/list_people}/list_people.go | 4 +- .../cmd/list_people}/list_people_test.go | 2 +- examples/go/go.mod | 5 + examples/go/go.sum | 6 + examples/list_people.cc | 2 +- examples/list_people.py | 2 +- examples/list_people.rb | 42 + generate_changelog.py | 65 - generate_descriptor_proto.sh | 7 +- global.json | 2 +- google3_export_generated_files.sh | 31 + java/BUILD.bazel | 84 + java/README.md | 20 +- java/bom/pom.xml | 19 +- java/compatibility_tests/README.md | 50 - java/compatibility_tests/v2.5.0/deps/pom.xml | 43 - .../v2.5.0/more_protos/pom.xml | 69 - .../google/protobuf/multiple_files_test.proto | 71 - .../protobuf/nested_builders_test.proto | 53 - .../google/protobuf/nested_extension.proto | 45 - .../protobuf/nested_extension_lite.proto | 48 - .../protobuf/non_nested_extension.proto | 48 - .../protobuf/non_nested_extension_lite.proto | 50 - .../protobuf/test_bad_identifiers.proto | 108 - .../proto/google/protobuf/descriptor.proto | 620 - .../src/proto/google/protobuf/unittest.proto | 719 - .../protobuf/unittest_custom_options.proto | 387 - .../unittest_embed_optimize_for.proto | 50 - .../google/protobuf/unittest_empty.proto | 37 - .../unittest_enormous_descriptor.proto | 1046 - .../google/protobuf/unittest_import.proto | 64 - .../protobuf/unittest_import_lite.proto | 51 - .../protobuf/unittest_import_public.proto | 40 - .../unittest_import_public_lite.proto | 42 - .../proto/google/protobuf/unittest_lite.proto | 360 - .../unittest_lite_imports_nonlite.proto | 43 - .../proto/google/protobuf/unittest_mset.proto | 72 - .../unittest_no_generic_services.proto | 52 - .../protobuf/unittest_optimize_for.proto | 61 - java/compatibility_tests/v2.5.0/pom.xml | 30 - .../compatibility_tests/v2.5.0/protos/pom.xml | 71 - .../google/protobuf/multiple_files_test.proto | 71 - .../protobuf/nested_builders_test.proto | 53 - .../google/protobuf/nested_extension.proto | 45 - .../protobuf/nested_extension_lite.proto | 48 - .../protobuf/non_nested_extension.proto | 48 - .../protobuf/non_nested_extension_lite.proto | 50 - .../protobuf/test_bad_identifiers.proto | 108 - .../proto/google/protobuf/descriptor.proto | 620 - .../src/proto/google/protobuf/unittest.proto | 719 - .../protobuf/unittest_custom_options.proto | 387 - .../unittest_embed_optimize_for.proto | 50 - .../google/protobuf/unittest_empty.proto | 37 - .../unittest_enormous_descriptor.proto | 1046 - .../google/protobuf/unittest_import.proto | 64 - .../protobuf/unittest_import_lite.proto | 51 - .../protobuf/unittest_import_public.proto | 40 - .../unittest_import_public_lite.proto | 42 - .../proto/google/protobuf/unittest_lite.proto | 360 - .../unittest_lite_imports_nonlite.proto | 43 - .../proto/google/protobuf/unittest_mset.proto | 72 - .../unittest_no_generic_services.proto | 52 - .../protobuf/unittest_optimize_for.proto | 61 - java/compatibility_tests/v2.5.0/test.sh | 115 - java/compatibility_tests/v2.5.0/tests/pom.xml | 73 - .../protobuf/test/AbstractMessageTest.java | 510 - .../protobuf/test/BoundedByteStringTest.java | 56 - .../google/protobuf/test/ByteStringTest.java | 590 - .../protobuf/test/CodedInputStreamTest.java | 469 - .../protobuf/test/CodedOutputStreamTest.java | 318 - .../protobuf/test/DeprecatedFieldTest.java | 81 - .../google/protobuf/test/DescriptorsTest.java | 649 - .../protobuf/test/DynamicMessageTest.java | 265 - .../test/ForceFieldBuildersPreRun.java | 49 - .../protobuf/test/GeneratedMessageTest.java | 961 - .../test/LazyStringArrayListTest.java | 163 - .../protobuf/test/LazyStringEndToEndTest.java | 108 - .../protobuf/test/LiteralByteStringTest.java | 344 - .../com/google/protobuf/test/MessageTest.java | 354 - .../protobuf/test/NestedBuildersTest.java | 186 - .../com/google/protobuf/test/ParserTest.java | 278 - .../test/RopeByteStringSubstringTest.java | 62 - .../protobuf/test/RopeByteStringTest.java | 84 - .../com/google/protobuf/test/ServiceTest.java | 321 - .../protobuf/test/TestBadIdentifiers.java | 64 - .../com/google/protobuf/test/TestUtil.java | 3068 -- .../google/protobuf/test/TextFormatTest.java | 536 - .../protobuf/test/UnknownFieldSetTest.java | 438 - .../test/UnmodifiableLazyStringListTest.java | 153 - .../google/protobuf/test/WireFormatTest.java | 465 - java/core/BUILD | 127 - .../com/google/protobuf/ProtobufLists.java | 94 - .../protobuf/ForceFieldBuildersPreRun.java | 47 - .../protobuf/Proto2MessageInfoFactory.java | 892 - .../protobuf/Proto3MessageInfoFactory.java | 506 - .../Proto3MessageLiteInfoFactory.java | 816 - .../java/com/google/protobuf/Utf8Utils.java | 193 - .../message_lite_extension_util_test.proto | 48 - .../protobuf/test_extra_interfaces.proto | 56 - java/internal/BUILD.bazel | 24 + java/internal/JavaVersionTest.java | 31 + java/internal/testing.bzl | 72 + java/kotlin-lite/BUILD.bazel | 236 + java/kotlin-lite/generate-sources-build.xml | 19 + .../generate-test-sources-build.xml | 34 + java/kotlin-lite/lite.awk | 25 + java/kotlin-lite/pom.xml | 237 + java/kotlin-lite/pom_template.xml | 35 + .../process-lite-sources-build.xml | 7 + .../ExtendableMessageLiteExtensions.kt | 55 + .../ExtendableMessageLiteExtensionsTest.kt | 86 + .../com/google/protobuf/Proto2LiteTest.kt | 1008 + java/linkage_monitor.sh | 43 + java/lite.md | 37 +- java/lite/BUILD | 14 - java/lite/BUILD.bazel | 97 + java/lite/generate-test-sources-build.xml | 3 +- java/lite/pom.xml | 20 +- java/lite/pom_template.xml | 41 + java/lite/proguard.pgcfg | 5 + .../java/com/google/protobuf/LiteTest.java | 2105 +- .../Proto2MessageLiteInfoFactory.java | 1331 - java/pom.xml | 86 +- java/test/linkage-monitor-check-bom/pom.xml | 75 + java/util/BUILD | 20 - java/util/BUILD.bazel | 112 + java/util/pom.xml | 47 +- java/util/pom_template.xml | 43 + .../com/google/protobuf/util/Durations.java | 127 +- .../google/protobuf/util/FieldMaskTree.java | 149 +- .../google/protobuf/util/FieldMaskUtil.java | 65 +- .../com/google/protobuf/util/JsonFormat.java | 264 +- .../com/google/protobuf/util/Structs.java | 29 +- .../com/google/protobuf/util/TimeUtil.java | 401 - .../com/google/protobuf/util/Timestamps.java | 216 +- .../java/com/google/protobuf/util/Values.java | 34 +- .../google/protobuf/util/DurationsTest.java | 613 + .../protobuf/util/FieldMaskTreeTest.java | 164 +- .../protobuf/util/FieldMaskUtilTest.java | 215 +- .../google/protobuf/util/JsonFormatTest.java | 1741 +- .../com/google/protobuf/util/StructsTest.java | 40 +- .../google/protobuf/util/TimeUtilTest.java | 498 - .../google/protobuf/util/TimestampsTest.java | 864 + .../com/google/protobuf/util/ValuesTest.java | 43 +- .../com/google/protobuf/util/json_test.proto | 29 +- js/README.md | 167 - js/binary/arith.js | 413 - js/binary/arith_test.js | 354 - js/binary/constants.js | 376 - js/binary/decoder.js | 950 - js/binary/decoder_test.js | 478 - js/binary/encoder.js | 510 - js/binary/message_test.js | 60 - js/binary/proto_test.js | 665 - js/binary/reader.js | 1286 - js/binary/reader_test.js | 967 - js/binary/utils.js | 1066 - js/binary/utils_test.js | 739 - js/binary/writer.js | 1832 -- js/binary/writer_test.js | 369 - js/commonjs/export.js | 31 - js/commonjs/export_asserts.js | 41 - js/commonjs/export_testdeps.js | 24 - js/commonjs/import_test.js | 52 - js/commonjs/jasmine.json | 9 - js/commonjs/rewrite_tests_for_commonjs.js | 97 - js/commonjs/strict_test.js | 67 - js/commonjs/test6/test6.proto | 40 - js/commonjs/test7/test7.proto | 42 - .../v3.0.0/binary/arith_test.js | 355 - .../v3.0.0/binary/decoder_test.js | 317 - .../v3.0.0/binary/proto_test.js | 628 - .../v3.0.0/binary/reader_test.js | 922 - .../v3.0.0/binary/utils_test.js | 668 - .../v3.0.0/binary/writer_test.js | 122 - .../v3.0.0/commonjs/export_asserts.js | 37 - .../v3.0.0/commonjs/export_testdeps.js | 18 - .../v3.0.0/commonjs/import_test.js | 52 - .../v3.0.0/commonjs/jasmine.json | 9 - .../commonjs/rewrite_tests_for_commonjs.js | 97 - .../v3.0.0/commonjs/test6/test6.proto | 40 - .../v3.0.0/commonjs/test7/test7.proto | 42 - js/compatibility_tests/v3.0.0/data.proto | 51 - js/compatibility_tests/v3.0.0/debug_test.js | 105 - js/compatibility_tests/v3.0.0/jasmine1.json | 17 - js/compatibility_tests/v3.0.0/jasmine2.json | 17 - js/compatibility_tests/v3.0.0/jasmine3.json | 17 - js/compatibility_tests/v3.0.0/message_test.js | 1081 - js/compatibility_tests/v3.0.0/proto3_test.js | 329 - .../v3.0.0/proto3_test.proto | 89 - js/compatibility_tests/v3.0.0/test.proto | 236 - js/compatibility_tests/v3.0.0/test.sh | 92 - js/compatibility_tests/v3.0.0/test2.proto | 54 - js/compatibility_tests/v3.0.0/test3.proto | 53 - js/compatibility_tests/v3.0.0/test4.proto | 42 - js/compatibility_tests/v3.0.0/test5.proto | 44 - .../v3.0.0/testbinary.proto | 212 - js/compatibility_tests/v3.0.0/testempty.proto | 34 - .../v3.1.0/binary/arith_test.js | 355 - .../v3.1.0/binary/decoder_test.js | 328 - .../v3.1.0/binary/proto_test.js | 628 - .../v3.1.0/binary/reader_test.js | 922 - .../v3.1.0/binary/utils_test.js | 668 - .../v3.1.0/binary/writer_test.js | 122 - .../v3.1.0/commonjs/test6/test6.proto | 40 - .../v3.1.0/commonjs/test7/test7.proto | 42 - js/compatibility_tests/v3.1.0/data.proto | 51 - js/compatibility_tests/v3.1.0/debug_test.js | 105 - js/compatibility_tests/v3.1.0/maps_test.js | 301 - js/compatibility_tests/v3.1.0/message_test.js | 1033 - js/compatibility_tests/v3.1.0/proto3_test.js | 329 - .../v3.1.0/proto3_test.proto | 89 - js/compatibility_tests/v3.1.0/test.proto | 262 - js/compatibility_tests/v3.1.0/test2.proto | 54 - js/compatibility_tests/v3.1.0/test3.proto | 53 - js/compatibility_tests/v3.1.0/test4.proto | 42 - js/compatibility_tests/v3.1.0/test5.proto | 44 - .../v3.1.0/testbinary.proto | 212 - js/compatibility_tests/v3.1.0/testempty.proto | 34 - js/data.proto | 50 - js/debug.js | 159 - js/debug_test.js | 188 - .../code_size/apps_jspb/all_types_proto2.js | 314 - .../code_size/apps_jspb/all_types_proto3.js | 314 - .../apps_jspb/popular_types_proto2.js | 53 - .../apps_jspb/popular_types_proto3.js | 53 - .../benchmarks/code_size/code_size_base.js | 57 - .../benchmarks/code_size/kernel/all_types.js | 227 - .../code_size/kernel/popular_types.js | 68 - js/experimental/runtime/bytestring.js | 183 - .../runtime/bytestring_internal.js | 33 - js/experimental/runtime/bytestring_test.js | 277 - js/experimental/runtime/int64.js | 403 - js/experimental/runtime/int64_test.js | 213 - js/experimental/runtime/internal/checks.js | 708 - .../runtime/internal/checks_test.js | 58 - .../runtime/kernel/binary_storage.js | 130 - .../runtime/kernel/binary_storage_test.js | 165 - .../runtime/kernel/bool_test_pairs.js | 79 - .../runtime/kernel/buffer_decoder.js | 343 - .../runtime/kernel/buffer_decoder_helper.js | 18 - .../runtime/kernel/buffer_decoder_test.js | 242 - .../kernel/conformance/conformance_request.js | 91 - .../conformance/conformance_response.js | 76 - .../kernel/conformance/conformance_testee.js | 103 - .../conformance_testee_runner_node.js | 62 - .../conformance/test_all_types_proto2.js | 309 - .../conformance/test_all_types_proto3.js | 310 - .../runtime/kernel/conformance/wire_format.js | 16 - .../runtime/kernel/double_test_pairs.js | 89 - js/experimental/runtime/kernel/field.js | 196 - .../runtime/kernel/fixed32_test_pairs.js | 36 - .../runtime/kernel/float_test_pairs.js | 78 - js/experimental/runtime/kernel/indexer.js | 55 - .../runtime/kernel/indexer_test.js | 334 - .../runtime/kernel/int32_test_pairs.js | 71 - .../runtime/kernel/int64_test_pairs.js | 59 - .../runtime/kernel/internal_message.js | 24 - js/experimental/runtime/kernel/kernel.js | 4122 --- .../kernel/kernel_compatibility_test.js | 266 - .../runtime/kernel/kernel_repeated_test.js | 7807 ------ js/experimental/runtime/kernel/kernel_test.js | 2329 -- js/experimental/runtime/kernel/message_set.js | 285 - .../runtime/kernel/message_set_test.js | 262 - .../runtime/kernel/packed_bool_test_pairs.js | 59 - .../kernel/packed_double_test_pairs.js | 52 - .../kernel/packed_fixed32_test_pairs.js | 34 - .../runtime/kernel/packed_float_test_pairs.js | 34 - .../runtime/kernel/packed_int32_test_pairs.js | 33 - .../runtime/kernel/packed_int64_test_pairs.js | 34 - .../kernel/packed_sfixed32_test_pairs.js | 34 - .../kernel/packed_sfixed64_test_pairs.js | 53 - .../kernel/packed_sint32_test_pairs.js | 33 - .../kernel/packed_sint64_test_pairs.js | 34 - .../kernel/packed_uint32_test_pairs.js | 33 - js/experimental/runtime/kernel/reader.js | 366 - js/experimental/runtime/kernel/reader_test.js | 425 - .../runtime/kernel/sfixed32_test_pairs.js | 46 - .../runtime/kernel/sfixed64_test_pairs.js | 52 - .../runtime/kernel/sint32_test_pairs.js | 57 - .../runtime/kernel/sint64_test_pairs.js | 60 - js/experimental/runtime/kernel/storage.js | 67 - js/experimental/runtime/kernel/tag.js | 144 - js/experimental/runtime/kernel/tag_test.js | 221 - .../runtime/kernel/textencoding.js | 116 - .../runtime/kernel/textencoding_test.js | 113 - .../runtime/kernel/typed_arrays.js | 116 - .../runtime/kernel/typed_arrays_test.js | 191 - .../runtime/kernel/uint32_test_pairs.js | 68 - js/experimental/runtime/kernel/uint8arrays.js | 28 - .../runtime/kernel/uint8arrays_test.js | 47 - js/experimental/runtime/kernel/wire_type.js | 17 - js/experimental/runtime/kernel/writer.js | 743 - js/experimental/runtime/kernel/writer_test.js | 927 - .../runtime/testing/binary/test_message.js | 1769 -- .../testing/ensure_custom_equality_test.js | 44 - .../runtime/testing/jasmine_protobuf.js | 88 - js/gulpfile.js | 262 - js/jasmine.json | 17 - js/map.js | 552 - js/maps_test.js | 482 - js/message.js | 1889 -- js/message_test.js | 1112 - js/node_loader.js | 49 - js/package.json | 26 - js/proto3_test.js | 477 - js/proto3_test.proto | 109 - js/test.proto | 322 - js/test10.proto | 39 - js/test11.proto | 52 - js/test12.proto | 119 - js/test13.proto | 70 - js/test14.proto | 43 - js/test15.proto | 39 - js/test2.proto | 60 - js/test3.proto | 53 - js/test4.proto | 42 - js/test5.proto | 44 - js/test8.proto | 50 - js/test9.proto | 39 - js/test_bootstrap.js | 41 - js/testbinary.proto | 294 - js/testempty.proto | 33 - js/testlargenumbers.proto | 40 - kokoro/README.md | 6 - kokoro/docs/common.cfg | 44 - kokoro/docs/publish-python.sh | 51 - kokoro/docs/python.cfg | 7 - kokoro/docs/trampoline.sh | 11 - kokoro/linux/32-bit/Dockerfile | 143 - kokoro/linux/32-bit/build.sh | 18 - kokoro/linux/32-bit/continuous.cfg | 11 - kokoro/linux/32-bit/presubmit.cfg | 11 - kokoro/linux/bazel/build.sh | 37 - kokoro/linux/bazel/continuous.cfg | 5 - kokoro/linux/bazel/presubmit.cfg | 5 - kokoro/linux/benchmark/build.sh | 26 - kokoro/linux/benchmark/continuous.cfg | 11 - kokoro/linux/benchmark/run.sh | 105 - kokoro/linux/build_and_run_docker.sh | 64 - kokoro/linux/cpp_distcheck/build.sh | 21 - kokoro/linux/cpp_distcheck/continuous.cfg | 5 - kokoro/linux/cpp_distcheck/presubmit.cfg | 5 - kokoro/linux/cpp_tcmalloc/build.sh | 13 - kokoro/linux/cpp_tcmalloc/continuous.cfg | 5 - kokoro/linux/cpp_tcmalloc/presubmit.cfg | 5 - kokoro/linux/csharp/build.sh | 18 - kokoro/linux/csharp/continuous.cfg | 5 - kokoro/linux/csharp/presubmit.cfg | 5 - kokoro/linux/dist_install/build.sh | 15 - kokoro/linux/dist_install/continuous.cfg | 5 - kokoro/linux/dist_install/presubmit.cfg | 5 - .../linux/dockerfile/push_testing_images.sh | 29 - .../dockerfile/test/cpp_tcmalloc/Dockerfile | 29 - .../linux/dockerfile/test/csharp/Dockerfile | 37 - .../dockerfile/test/java_stretch/Dockerfile | 31 - .../dockerfile/test/javascript/Dockerfile | 33 - kokoro/linux/dockerfile/test/php/Dockerfile | 283 - kokoro/linux/dockerfile/test/php80/Dockerfile | 96 - .../dockerfile/test/php_32bit/Dockerfile | 267 - .../linux/dockerfile/test/python27/Dockerfile | 23 - .../linux/dockerfile/test/python35/Dockerfile | 23 - .../linux/dockerfile/test/python36/Dockerfile | 23 - .../linux/dockerfile/test/python37/Dockerfile | 23 - .../linux/dockerfile/test/python38/Dockerfile | 23 - kokoro/linux/dockerfile/test/ruby/Dockerfile | 38 - kokoro/linux/golang/build.sh | 17 - kokoro/linux/golang/continuous.cfg | 11 - kokoro/linux/golang/presubmit.cfg | 11 - kokoro/linux/java_compatibility/build.sh | 17 - .../linux/java_compatibility/continuous.cfg | 5 - kokoro/linux/java_compatibility/presubmit.cfg | 5 - kokoro/linux/java_jdk7/build.sh | 17 - kokoro/linux/java_jdk7/continuous.cfg | 11 - kokoro/linux/java_jdk7/presubmit.cfg | 11 - kokoro/linux/java_linkage_monitor/build.sh | 19 - .../linux/java_linkage_monitor/continuous.cfg | 11 - .../linux/java_linkage_monitor/presubmit.cfg | 12 - kokoro/linux/java_oracle7/build.sh | 17 - kokoro/linux/java_oracle7/continuous.cfg | 11 - kokoro/linux/java_oracle7/presubmit.cfg | 11 - kokoro/linux/javascript/build.sh | 18 - kokoro/linux/javascript/continuous.cfg | 11 - kokoro/linux/javascript/presubmit.cfg | 11 - kokoro/linux/make_test_output.py | 94 - kokoro/linux/php80/build.sh | 18 - kokoro/linux/php80/continuous.cfg | 11 - kokoro/linux/php80/presubmit.cfg | 11 - kokoro/linux/php_all/build.sh | 18 - kokoro/linux/php_all/continuous.cfg | 11 - kokoro/linux/php_all/presubmit.cfg | 11 - kokoro/linux/pull_request_in_docker.sh | 25 - kokoro/linux/python/build.sh | 17 - kokoro/linux/python/continuous.cfg | 11 - kokoro/linux/python/presubmit.cfg | 11 - kokoro/linux/python27/build.sh | 18 - kokoro/linux/python27/continuous.cfg | 11 - kokoro/linux/python27/presubmit.cfg | 11 - kokoro/linux/python27_cpp/build.sh | 18 - kokoro/linux/python27_cpp/continuous.cfg | 11 - kokoro/linux/python27_cpp/presubmit.cfg | 11 - kokoro/linux/python35/build.sh | 18 - kokoro/linux/python35/continuous.cfg | 11 - kokoro/linux/python35/presubmit.cfg | 11 - kokoro/linux/python35_cpp/build.sh | 18 - kokoro/linux/python35_cpp/continuous.cfg | 11 - kokoro/linux/python35_cpp/presubmit.cfg | 11 - kokoro/linux/python36/build.sh | 18 - kokoro/linux/python36/continuous.cfg | 11 - kokoro/linux/python36/presubmit.cfg | 11 - kokoro/linux/python36_cpp/build.sh | 18 - kokoro/linux/python36_cpp/continuous.cfg | 11 - kokoro/linux/python36_cpp/presubmit.cfg | 11 - kokoro/linux/python37/build.sh | 18 - kokoro/linux/python37/continuous.cfg | 11 - kokoro/linux/python37/presubmit.cfg | 11 - kokoro/linux/python37_cpp/build.sh | 18 - kokoro/linux/python37_cpp/continuous.cfg | 11 - kokoro/linux/python37_cpp/presubmit.cfg | 11 - kokoro/linux/python38/build.sh | 18 - kokoro/linux/python38/continuous.cfg | 11 - kokoro/linux/python38/presubmit.cfg | 11 - kokoro/linux/python38_cpp/build.sh | 18 - kokoro/linux/python38_cpp/continuous.cfg | 11 - kokoro/linux/python38_cpp/presubmit.cfg | 11 - kokoro/linux/python_compatibility/build.sh | 17 - .../linux/python_compatibility/continuous.cfg | 5 - .../linux/python_compatibility/presubmit.cfg | 5 - kokoro/linux/python_cpp/build.sh | 17 - kokoro/linux/python_cpp/continuous.cfg | 11 - kokoro/linux/python_cpp/presubmit.cfg | 11 - kokoro/linux/ruby23/build.sh | 18 - kokoro/linux/ruby23/continuous.cfg | 11 - kokoro/linux/ruby23/presubmit.cfg | 11 - kokoro/linux/ruby24/build.sh | 18 - kokoro/linux/ruby24/continuous.cfg | 11 - kokoro/linux/ruby24/presubmit.cfg | 11 - kokoro/linux/ruby25/build.sh | 18 - kokoro/linux/ruby25/continuous.cfg | 11 - kokoro/linux/ruby25/presubmit.cfg | 11 - kokoro/linux/ruby26/build.sh | 18 - kokoro/linux/ruby26/continuous.cfg | 11 - kokoro/linux/ruby26/presubmit.cfg | 11 - kokoro/linux/ruby27/build.sh | 18 - kokoro/linux/ruby27/continuous.cfg | 11 - kokoro/linux/ruby27/presubmit.cfg | 11 - kokoro/macos/cpp/build.sh | 11 - kokoro/macos/cpp/continuous.cfg | 5 - kokoro/macos/cpp/presubmit.cfg | 5 - kokoro/macos/cpp_distcheck/build.sh | 11 - kokoro/macos/cpp_distcheck/continuous.cfg | 5 - kokoro/macos/cpp_distcheck/presubmit.cfg | 5 - kokoro/macos/javascript/build.sh | 11 - kokoro/macos/javascript/continuous.cfg | 5 - kokoro/macos/javascript/presubmit.cfg | 5 - .../objectivec_cocoapods_integration/build.sh | 12 - .../continuous.cfg | 5 - .../presubmit.cfg | 5 - kokoro/macos/objectivec_ios_debug/build.sh | 11 - .../macos/objectivec_ios_debug/continuous.cfg | 5 - .../macos/objectivec_ios_debug/presubmit.cfg | 5 - kokoro/macos/objectivec_ios_release/build.sh | 11 - .../objectivec_ios_release/continuous.cfg | 5 - .../objectivec_ios_release/presubmit.cfg | 5 - kokoro/macos/objectivec_osx/build.sh | 11 - kokoro/macos/objectivec_osx/continuous.cfg | 5 - kokoro/macos/objectivec_osx/presubmit.cfg | 5 - kokoro/macos/php5.6_mac/build.sh | 11 - kokoro/macos/php5.6_mac/continuous.cfg | 5 - kokoro/macos/php5.6_mac/presubmit.cfg | 5 - kokoro/macos/php7.0_mac/build.sh | 11 - kokoro/macos/php7.0_mac/continuous.cfg | 5 - kokoro/macos/php7.0_mac/presubmit.cfg | 5 - kokoro/macos/php7.3_mac/build.sh | 11 - kokoro/macos/php7.3_mac/continuous.cfg | 5 - kokoro/macos/php7.3_mac/presubmit.cfg | 5 - kokoro/macos/prepare_build_macos_rc | 80 - kokoro/macos/python/build.sh | 12 - kokoro/macos/python/continuous.cfg | 5 - kokoro/macos/python/presubmit.cfg | 5 - kokoro/macos/python_cpp/build.sh | 13 - kokoro/macos/python_cpp/continuous.cfg | 5 - kokoro/macos/python_cpp/presubmit.cfg | 5 - kokoro/macos/ruby23/build.sh | 13 - kokoro/macos/ruby23/continuous.cfg | 5 - kokoro/macos/ruby23/presubmit.cfg | 5 - kokoro/macos/ruby24/build.sh | 13 - kokoro/macos/ruby24/continuous.cfg | 5 - kokoro/macos/ruby24/presubmit.cfg | 5 - kokoro/macos/ruby25/build.sh | 13 - kokoro/macos/ruby25/continuous.cfg | 5 - kokoro/macos/ruby25/presubmit.cfg | 5 - kokoro/macos/ruby26/build.sh | 13 - kokoro/macos/ruby26/continuous.cfg | 5 - kokoro/macos/ruby26/presubmit.cfg | 5 - kokoro/macos/ruby27/build.sh | 13 - kokoro/macos/ruby27/continuous.cfg | 5 - kokoro/macos/ruby27/presubmit.cfg | 5 - kokoro/release/collect_all_artifacts.cfg | 7 - kokoro/release/collect_all_artifacts.sh | 60 - kokoro/release/csharp/windows/build_nuget.bat | 14 - kokoro/release/csharp/windows/continuous.cfg | 11 - kokoro/release/csharp/windows/presubmit.cfg | 11 - kokoro/release/csharp/windows/release.cfg | 11 - kokoro/release/protoc/linux/build.sh | 44 - kokoro/release/protoc/linux/release.cfg | 7 - kokoro/release/protoc/macos/build.sh | 15 - kokoro/release/protoc/macos/release.cfg | 8 - kokoro/release/protoc/windows/build.bat | 27 - kokoro/release/protoc/windows/release.cfg | 8 - .../release/python/linux/build_artifacts.sh | 56 - kokoro/release/python/linux/config.sh | 50 - kokoro/release/python/linux/continuous.cfg | 8 - kokoro/release/python/linux/presubmit.cfg | 8 - kokoro/release/python/linux/release.cfg | 8 - .../release/python/macos/build_artifacts.sh | 62 - kokoro/release/python/macos/config.sh | 67 - kokoro/release/python/macos/continuous.cfg | 8 - kokoro/release/python/macos/presubmit.cfg | 8 - kokoro/release/python/macos/release.cfg | 8 - .../python/windows/build_artifacts.bat | 78 - .../python/windows/build_single_artifact.bat | 78 - kokoro/release/python/windows/continuous.cfg | 8 - kokoro/release/python/windows/presubmit.cfg | 8 - kokoro/release/python/windows/release.cfg | 8 - kokoro/release/ruby/linux/build_artifacts.sh | 14 - kokoro/release/ruby/linux/continuous.cfg | 8 - kokoro/release/ruby/linux/prepare_build.sh | 12 - kokoro/release/ruby/linux/presubmit.cfg | 8 - kokoro/release/ruby/linux/release.cfg | 8 - kokoro/release/ruby/linux/ruby/ruby_build.sh | 18 - .../ruby/linux/ruby/ruby_build_environment.sh | 9 - kokoro/release/ruby/macos/build_artifacts.sh | 19 - kokoro/release/ruby/macos/continuous.cfg | 8 - kokoro/release/ruby/macos/presubmit.cfg | 8 - kokoro/release/ruby/macos/release.cfg | 8 - kokoro/release/ruby/macos/ruby/ruby_build.sh | 17 - .../ruby/macos/ruby/ruby_build_environment.sh | 75 - kokoro/windows/csharp/build.bat | 14 - kokoro/windows/csharp/continuous.cfg | 5 - kokoro/windows/csharp/presubmit.cfg | 5 - lua/BUILD.bazel | 112 + lua/README.md | 8 + lua/def.c | 943 + lua/lua_proto_library.bzl | 136 + lua/main.c | 96 + lua/msg.c | 1118 + lua/test.proto | 98 + lua/test_upb.lua | 852 + lua/upb.c | 261 + lua/upb.h | 135 + lua/upb.lua | 58 + lua/upbc.cc | 139 + maven_install.json | 967 + objectivec/.clang-format | 6 - objectivec/BUILD.bazel | 239 + objectivec/DevTools/check_version_stamps.sh | 23 +- objectivec/DevTools/compile_testing_protos.sh | 93 +- objectivec/DevTools/full_mac_build.sh | 176 +- objectivec/DevTools/pddm.py | 45 +- objectivec/DevTools/pddm_tests.py | 203 +- .../DevTools/sources_pddm_expansion_test.sh | 9 + objectivec/GPBAny.pbobjc.h | 40 +- objectivec/GPBAny.pbobjc.m | 71 +- objectivec/GPBApi.pbobjc.h | 42 +- objectivec/GPBApi.pbobjc.m | 91 +- objectivec/GPBArray.h | 112 +- objectivec/GPBArray.m | 153 +- objectivec/GPBArray_PackagePrivate.h | 31 +- objectivec/GPBBootstrap.h | 42 +- objectivec/GPBCodedInputStream.h | 37 +- objectivec/GPBCodedInputStream.m | 144 +- .../GPBCodedInputStream_PackagePrivate.h | 49 +- objectivec/GPBCodedOutputStream.h | 51 +- objectivec/GPBCodedOutputStream.m | 397 +- .../GPBCodedOutputStream_PackagePrivate.h | 97 +- objectivec/GPBDescriptor.h | 90 +- objectivec/GPBDescriptor.m | 734 +- objectivec/GPBDescriptor_PackagePrivate.h | 258 +- objectivec/GPBDictionary.h | 91 +- objectivec/GPBDictionary.m | 514 +- objectivec/GPBDictionary_PackagePrivate.h | 67 +- objectivec/GPBDuration.pbobjc.h | 25 +- objectivec/GPBDuration.pbobjc.m | 63 +- objectivec/GPBEmpty.pbobjc.h | 27 +- objectivec/GPBEmpty.pbobjc.m | 63 +- objectivec/GPBExtensionInternals.h | 43 +- objectivec/GPBExtensionInternals.m | 201 +- objectivec/GPBExtensionRegistry.h | 62 +- objectivec/GPBExtensionRegistry.m | 90 +- objectivec/GPBFieldMask.pbobjc.h | 27 +- objectivec/GPBFieldMask.pbobjc.m | 63 +- objectivec/GPBMessage.h | 118 +- objectivec/GPBMessage.m | 1492 +- objectivec/GPBMessage_PackagePrivate.h | 48 +- objectivec/GPBProtocolBuffers.h | 70 +- objectivec/GPBProtocolBuffers.m | 30 +- .../GPBProtocolBuffers_RuntimeSupport.h | 34 +- objectivec/GPBRootObject.h | 29 +- objectivec/GPBRootObject.m | 99 +- objectivec/GPBRootObject_PackagePrivate.h | 29 +- objectivec/GPBRuntimeTypes.h | 29 +- objectivec/GPBSourceContext.pbobjc.h | 25 +- objectivec/GPBSourceContext.pbobjc.m | 63 +- objectivec/GPBStruct.pbobjc.h | 35 +- objectivec/GPBStruct.pbobjc.m | 82 +- objectivec/GPBTimestamp.pbobjc.h | 36 +- objectivec/GPBTimestamp.pbobjc.m | 63 +- objectivec/GPBType.pbobjc.h | 54 +- objectivec/GPBType.pbobjc.m | 373 +- objectivec/GPBUnknownField.h | 34 +- objectivec/GPBUnknownField.m | 98 +- objectivec/GPBUnknownFieldSet.h | 34 +- objectivec/GPBUnknownFieldSet.m | 123 +- .../GPBUnknownFieldSet_PackagePrivate.h | 30 +- objectivec/GPBUnknownField_PackagePrivate.h | 29 +- objectivec/GPBUtilities.h | 47 +- objectivec/GPBUtilities.m | 549 +- objectivec/GPBUtilities_PackagePrivate.h | 109 +- objectivec/GPBWellKnownTypes.h | 59 +- objectivec/GPBWellKnownTypes.m | 108 +- objectivec/GPBWireFormat.h | 40 +- objectivec/GPBWireFormat.m | 29 +- objectivec/GPBWrappers.pbobjc.h | 25 +- objectivec/GPBWrappers.pbobjc.m | 143 +- .../project.pbxproj | 154 +- .../xcschemes/PerformanceTests.xcscheme | 6 +- .../xcschemes/ProtocolBuffers.xcscheme | 28 +- .../project.pbxproj | 148 +- .../xcschemes/PerformanceTests.xcscheme | 15 +- .../xcschemes/ProtocolBuffers.xcscheme | 19 +- .../project.pbxproj | 142 +- .../xcschemes/PerformanceTests.xcscheme | 24 +- .../xcschemes/ProtocolBuffers.xcscheme | 28 +- objectivec/README.md | 98 +- .../project.pbxproj | 290 - .../contents.xcworkspacedata | 7 - .../xcschemes/OSXCocoaPodsTester.xcscheme | 91 - .../OSXCocoaPodsTester/AppDelegate.h | 37 - .../OSXCocoaPodsTester/AppDelegate.m | 48 - .../AppIcon.appiconset/Contents.json | 58 - .../Base.lproj/MainMenu.xib | 680 - .../OSXCocoaPodsTester/Info.plist | 34 - .../OSXCocoaPodsTester/main.m | 35 - .../OSXCocoaPodsTester/Podfile-framework | 10 - .../OSXCocoaPodsTester/Podfile-static | 8 - objectivec/Tests/CocoaPods/README.md | 9 - .../iOSCocoaPodsTester/Podfile-framework | 10 - .../iOSCocoaPodsTester/Podfile-static | 8 - .../project.pbxproj | 309 - .../contents.xcworkspacedata | 7 - .../xcschemes/iOSCocoaPodsTester.xcscheme | 91 - .../iOSCocoaPodsTester/AppDelegate.h | 39 - .../iOSCocoaPodsTester/AppDelegate.m | 67 - .../AppIcon.appiconset/Contents.json | 68 - .../Base.lproj/LaunchScreen.storyboard | 27 - .../Base.lproj/Main.storyboard | 26 - .../iOSCocoaPodsTester/Info.plist | 47 - .../iOSCocoaPodsTester/ViewController.h | 37 - .../iOSCocoaPodsTester/ViewController.m | 49 - .../iOSCocoaPodsTester/main.m | 39 - objectivec/Tests/CocoaPods/run_tests.sh | 150 - objectivec/Tests/GPBARCUnittestProtos.m | 69 +- objectivec/Tests/GPBArrayTests.m | 320 +- objectivec/Tests/GPBCodedInputStreamTests.m | 155 +- objectivec/Tests/GPBCodedOuputStreamTests.m | 444 - objectivec/Tests/GPBCodedOutputStreamTests.m | 396 + objectivec/Tests/GPBCompileTest01.m | 31 +- objectivec/Tests/GPBCompileTest02.m | 31 +- objectivec/Tests/GPBCompileTest03.m | 31 +- objectivec/Tests/GPBCompileTest04.m | 31 +- objectivec/Tests/GPBCompileTest05.m | 31 +- objectivec/Tests/GPBCompileTest06.m | 31 +- objectivec/Tests/GPBCompileTest07.m | 31 +- objectivec/Tests/GPBCompileTest08.m | 31 +- objectivec/Tests/GPBCompileTest09.m | 31 +- objectivec/Tests/GPBCompileTest10.m | 31 +- objectivec/Tests/GPBCompileTest11.m | 31 +- objectivec/Tests/GPBCompileTest12.m | 31 +- objectivec/Tests/GPBCompileTest13.m | 31 +- objectivec/Tests/GPBCompileTest14.m | 31 +- objectivec/Tests/GPBCompileTest15.m | 31 +- objectivec/Tests/GPBCompileTest16.m | 31 +- objectivec/Tests/GPBCompileTest17.m | 31 +- objectivec/Tests/GPBCompileTest18.m | 31 +- objectivec/Tests/GPBCompileTest19.m | 31 +- objectivec/Tests/GPBCompileTest20.m | 31 +- objectivec/Tests/GPBCompileTest21.m | 31 +- objectivec/Tests/GPBCompileTest22.m | 31 +- objectivec/Tests/GPBCompileTest23.m | 31 +- objectivec/Tests/GPBCompileTest24.m | 42 - objectivec/Tests/GPBCompileTest25.m | 42 - objectivec/Tests/GPBConcurrencyTests.m | 68 +- objectivec/Tests/GPBDescriptorTests.m | 135 +- objectivec/Tests/GPBDictionaryTests+Bool.m | 98 +- objectivec/Tests/GPBDictionaryTests+Int32.m | 93 +- objectivec/Tests/GPBDictionaryTests+Int64.m | 93 +- objectivec/Tests/GPBDictionaryTests+String.m | 92 +- objectivec/Tests/GPBDictionaryTests+UInt32.m | 93 +- objectivec/Tests/GPBDictionaryTests+UInt64.m | 93 +- objectivec/Tests/GPBDictionaryTests.m | 65 +- objectivec/Tests/GPBDictionaryTests.pddm | 46 +- objectivec/Tests/GPBExtensionRegistryTest.m | 70 +- objectivec/Tests/GPBMessageTests+ClassNames.m | 89 +- objectivec/Tests/GPBMessageTests+Merge.m | 133 +- objectivec/Tests/GPBMessageTests+Runtime.m | 430 +- .../Tests/GPBMessageTests+Serialization.m | 212 +- objectivec/Tests/GPBMessageTests.m | 690 +- objectivec/Tests/GPBObjectiveCPlusPlusTest.mm | 46 +- objectivec/Tests/GPBPerfTests.m | 66 +- objectivec/Tests/GPBSwiftTests.swift | 29 +- objectivec/Tests/GPBTestUtilities.h | 66 +- objectivec/Tests/GPBTestUtilities.m | 945 +- objectivec/Tests/GPBUnittestProtos.m | 89 +- objectivec/Tests/GPBUnittestProtos2.m | 31 +- objectivec/Tests/GPBUnknownFieldSetTest.m | 93 +- objectivec/Tests/GPBUtilitiesTests.m | 99 +- objectivec/Tests/GPBWellKnownTypesTest.m | 132 +- objectivec/Tests/GPBWireFormatTests.m | 135 +- objectivec/Tests/UnitTests-Bridging-Header.h | 14 +- objectivec/Tests/any_test.proto | 21 + objectivec/Tests/expected_prefixes.txt | 12 + objectivec/Tests/map_proto2_unittest.proto | 67 + objectivec/Tests/map_unittest.proto | 100 + objectivec/Tests/unittest.proto | 1517 + objectivec/Tests/unittest_cycle.proto | 56 +- objectivec/Tests/unittest_deprecated.proto | 30 +- .../Tests/unittest_deprecated_file.proto | 30 +- .../Tests/unittest_extension_chain_a.proto | 50 +- .../Tests/unittest_extension_chain_b.proto | 42 +- .../Tests/unittest_extension_chain_c.proto | 38 +- .../Tests/unittest_extension_chain_d.proto | 46 +- .../Tests/unittest_extension_chain_e.proto | 36 +- .../Tests/unittest_extension_chain_f.proto | 38 +- .../Tests/unittest_extension_chain_g.proto | 38 +- objectivec/Tests/unittest_import.proto | 35 + objectivec/Tests/unittest_import_public.proto | 18 + objectivec/Tests/unittest_mset.proto | 42 + objectivec/Tests/unittest_objc.proto | 38 +- objectivec/Tests/unittest_objc_options.proto | 38 +- objectivec/Tests/unittest_objc_startup.proto | 40 +- .../unittest_preserve_unknown_enum.proto | 46 + .../Tests/unittest_runtime_proto2.proto | 33 +- .../Tests/unittest_runtime_proto3.proto | 33 +- objectivec/defs.bzl | 68 + objectivec/generate_well_known_types.sh | 26 +- php/BUILD.bazel | 212 + php/README.md | 30 +- php/REFCOUNTING.md | 112 + php/composer.json | 23 +- php/composer.json.dist | 23 + php/ext/google/protobuf/arena.c | 53 +- php/ext/google/protobuf/arena.h | 37 +- php/ext/google/protobuf/array.c | 354 +- php/ext/google/protobuf/array.h | 53 +- php/ext/google/protobuf/bundled_php.h | 46 - php/ext/google/protobuf/config.m4 | 5 +- php/ext/google/protobuf/config.w32 | 14 + php/ext/google/protobuf/convert.c | 253 +- php/ext/google/protobuf/convert.h | 57 +- php/ext/google/protobuf/def.c | 784 +- php/ext/google/protobuf/def.h | 89 +- .../google/protobuf/generate_package_xml.sh | 41 + php/ext/google/protobuf/make-preload.php | 62 - php/ext/google/protobuf/map.c | 399 +- php/ext/google/protobuf/map.h | 55 +- php/ext/google/protobuf/message.c | 970 +- php/ext/google/protobuf/message.h | 54 +- php/ext/google/protobuf/names.c | 188 +- php/ext/google/protobuf/names.h | 33 +- php/ext/google/protobuf/package.xml | 679 - php/ext/google/protobuf/php-upb.c | 19227 ++++++++----- php/ext/google/protobuf/php-upb.h | 15744 ++++++++--- php/ext/google/protobuf/php_protobuf.h | 23 + php/ext/google/protobuf/protobuf.c | 247 +- php/ext/google/protobuf/protobuf.h | 110 +- php/ext/google/protobuf/template_package.xml | 42 + .../protobuf/tests/unnecessary_zval.phpt | 9 + php/ext/google/protobuf/wkt.inc | 3250 +++ php/generate_descriptor_protos.sh | 23 +- php/generate_test_protos.sh | 35 + php/phpunit.xml | 18 - php/release.sh | 31 +- php/src/GPBMetadata/Google/Protobuf/Any.php | 18 +- php/src/GPBMetadata/Google/Protobuf/Api.php | 51 +- .../GPBMetadata/Google/Protobuf/Duration.php | 19 +- .../GPBMetadata/Google/Protobuf/FieldMask.php | 18 +- .../GPBMetadata/Google/Protobuf/GPBEmpty.php | 17 +- .../Google/Protobuf/Internal/Descriptor.php | 4 + .../Google/Protobuf/SourceContext.php | 19 +- .../GPBMetadata/Google/Protobuf/Struct.php | Bin 1818 -> 1162 bytes .../GPBMetadata/Google/Protobuf/Timestamp.php | 19 +- php/src/GPBMetadata/Google/Protobuf/Type.php | Bin 4662 -> 2205 bytes .../GPBMetadata/Google/Protobuf/Wrappers.php | 45 +- php/src/Google/Protobuf/Any.php | 110 +- php/src/Google/Protobuf/Api.php | 32 +- php/src/Google/Protobuf/BoolValue.php | 2 +- php/src/Google/Protobuf/BytesValue.php | 2 +- php/src/Google/Protobuf/Descriptor.php | 29 +- php/src/Google/Protobuf/DescriptorPool.php | 29 +- php/src/Google/Protobuf/DoubleValue.php | 2 +- php/src/Google/Protobuf/Duration.php | 6 +- php/src/Google/Protobuf/Enum.php | 26 +- php/src/Google/Protobuf/EnumDescriptor.php | 29 +- php/src/Google/Protobuf/EnumValue.php | 8 +- .../Google/Protobuf/EnumValueDescriptor.php | 29 +- php/src/Google/Protobuf/Field.php | 26 +- php/src/Google/Protobuf/Field/Cardinality.php | 1 + php/src/Google/Protobuf/Field/Kind.php | 1 + php/src/Google/Protobuf/FieldDescriptor.php | 64 +- php/src/Google/Protobuf/FieldMask.php | 46 +- php/src/Google/Protobuf/FloatValue.php | 2 +- php/src/Google/Protobuf/GPBEmpty.php | 1 - php/src/Google/Protobuf/Int32Value.php | 2 +- php/src/Google/Protobuf/Int64Value.php | 2 +- php/src/Google/Protobuf/Internal/AnyBase.php | 86 + .../Protobuf/Internal/CodedInputStream.php | 40 +- .../Protobuf/Internal/CodedOutputStream.php | 29 +- .../Google/Protobuf/Internal/Descriptor.php | 45 +- .../Protobuf/Internal/DescriptorPool.php | 32 +- .../Protobuf/Internal/DescriptorProto.php | 36 +- .../DescriptorProto/ExtensionRange.php | 4 +- .../Protobuf/Internal/EnumBuilderContext.php | 29 +- .../Protobuf/Internal/EnumDescriptor.php | 3 +- .../Protobuf/Internal/EnumDescriptorProto.php | 16 +- .../Google/Protobuf/Internal/EnumOptions.php | 75 +- .../Internal/EnumValueDescriptorProto.php | 4 +- .../Protobuf/Internal/EnumValueOptions.php | 4 +- .../Internal/ExtensionRangeOptions.php | 4 +- .../Protobuf/Internal/FieldDescriptor.php | 67 +- .../Internal/FieldDescriptorProto.php | 8 +- .../Google/Protobuf/Internal/FieldOptions.php | 64 +- .../Protobuf/Internal/FileDescriptor.php | 29 +- .../Protobuf/Internal/FileDescriptorProto.php | 92 +- .../Protobuf/Internal/FileDescriptorSet.php | 4 +- .../Google/Protobuf/Internal/FileOptions.php | 75 +- .../Protobuf/Internal/GPBDecodeException.php | 29 +- .../Google/Protobuf/Internal/GPBJsonWire.php | 29 +- php/src/Google/Protobuf/Internal/GPBLabel.php | 29 +- php/src/Google/Protobuf/Internal/GPBType.php | 29 +- php/src/Google/Protobuf/Internal/GPBUtil.php | 99 +- php/src/Google/Protobuf/Internal/GPBWire.php | 43 +- .../Google/Protobuf/Internal/GPBWireType.php | 29 +- .../Protobuf/Internal/GeneratedCodeInfo.php | 4 +- .../Internal/GeneratedCodeInfo/Annotation.php | 49 +- .../Internal/GetPublicDescriptorTrait.php | 29 +- .../Internal/HasPublicDescriptorTrait.php | 29 +- php/src/Google/Protobuf/Internal/MapEntry.php | 29 +- php/src/Google/Protobuf/Internal/MapField.php | 51 +- .../Google/Protobuf/Internal/MapFieldIter.php | 53 +- php/src/Google/Protobuf/Internal/Message.php | 87 +- .../Internal/MessageBuilderContext.php | 29 +- .../Protobuf/Internal/MessageOptions.php | 107 +- .../Internal/MethodDescriptorProto.php | 4 +- .../Protobuf/Internal/MethodOptions.php | 4 +- .../Protobuf/Internal/OneofDescriptor.php | 38 +- .../Internal/OneofDescriptorProto.php | 4 +- .../Google/Protobuf/Internal/OneofField.php | 29 +- .../Google/Protobuf/Internal/OneofOptions.php | 4 +- .../Protobuf/Internal/RawInputStream.php | 29 +- .../Protobuf/Internal/RepeatedField.php | 63 +- .../Protobuf/Internal/RepeatedFieldIter.php | 42 +- .../Internal/ServiceDescriptorProto.php | 8 +- .../Protobuf/Internal/ServiceOptions.php | 4 +- .../Protobuf/Internal/SourceCodeInfo.php | 4 +- .../Internal/SourceCodeInfo/Location.php | 60 +- .../Protobuf/Internal/TimestampBase.php | 32 + .../Protobuf/Internal/UninterpretedOption.php | 4 +- .../Internal/UninterpretedOption/NamePart.php | 4 +- php/src/Google/Protobuf/ListValue.php | 4 +- php/src/Google/Protobuf/Method.php | 16 +- php/src/Google/Protobuf/Mixin.php | 6 +- php/src/Google/Protobuf/OneofDescriptor.php | 38 +- php/src/Google/Protobuf/Option.php | 16 +- php/src/Google/Protobuf/SourceContext.php | 2 +- php/src/Google/Protobuf/StringValue.php | 2 +- php/src/Google/Protobuf/Syntax.php | 1 + php/src/Google/Protobuf/Timestamp.php | 68 +- php/src/Google/Protobuf/Type.php | 30 +- php/src/Google/Protobuf/UInt32Value.php | 2 +- php/src/Google/Protobuf/UInt64Value.php | 2 +- php/src/Google/Protobuf/Value.php | 8 +- php/tests/ArrayTest.php | 126 +- php/tests/DescriptorsTest.php | 34 +- php/tests/EncodeDecodeTest.php | 181 +- php/tests/GeneratedClassTest.php | 382 +- php/tests/GeneratedPhpdocTest.php | 33 +- php/tests/GeneratedServiceTest.php | 53 +- php/tests/MapFieldTest.php | 70 +- php/tests/PhpImplementationTest.php | 33 +- php/tests/PreviouslyGeneratedClassTest.php | 24 + php/tests/WellKnownTest.php | 17 +- php/tests/WrapperTypeSettersTest.php | 6 +- php/tests/autoload.php | 27 - php/tests/bootstrap_phpunit.php | 5 - php/tests/compatibility_test.sh | 152 - php/tests/compile_extension.sh | 48 +- php/tests/force_c_ext.php | 14 + php/tests/gdb_test.sh | 0 php/tests/generate_protos.sh | 16 - .../TestPreviouslyUnreservedMessage.php | 28 + .../generated_previous/Previous/readonly.php | 31 + php/tests/memory_leak_test.php | 67 +- php/tests/memory_leak_test.sh | 40 + php/tests/multirequest.sh | 74 +- php/tests/proto/test.proto | 46 + php/tests/proto/test_descriptors.proto | 1 + php/tests/proto/test_php_namespace.proto | 2 + .../proto/test_reserved_enum_lower.proto | 93 +- .../proto/test_reserved_enum_upper.proto | 93 +- .../test_reserved_enum_value_lower.proto | 93 +- .../test_reserved_enum_value_upper.proto | 93 +- .../proto/test_reserved_message_lower.proto | 7 + .../proto/test_reserved_message_upper.proto | 7 + .../test_previously_unreserved_message.proto | 5 + php/tests/test.sh | 70 - php/tests/test_base.php | 24 + php/tests/undefined_test.php | 920 - php/tests/valgrind.supp | 21 + pkg/BUILD.bazel | 245 + pkg/README.md | 31 + pkg/build_systems.bzl | 336 + pkg/cc_dist_library.bzl | 434 + pkg/test/BUILD.bazel | 40 + pkg/test/file_lists.cmake.golden | 20 + pkg/test/gen_file_lists_golden_test.sh | 14 + pkg/test/test_lib.cc | 8 + pkg/test/test_lib.h | 8 + protobuf.bzl | 673 +- protobuf_deps.bzl | 169 +- protobuf_release.bzl | 50 + protobuf_version.bzl | 6 + protoc-artifacts/README.md | 161 - protoc-artifacts/build-protoc.sh | 294 - protoc-artifacts/build-zip.sh | 118 - protoc-artifacts/pom.xml | 139 - protoc-artifacts/scl-enable-devtoolset.sh | 13 - python/BUILD.bazel | 208 + python/MANIFEST.in | 2 + python/README.md | 236 +- python/build_targets.bzl | 474 + .../protobuf/internal/factory_test1.proto | 55 - .../protobuf/internal/factory_test2.proto | 77 - .../protobuf/internal/more_extensions.proto | 58 - .../internal/more_extensions_dynamic.proto | 49 - .../protobuf/internal/more_messages.proto | 51 - .../internal/test_bad_identifiers.proto | 52 - .../proto/google/protobuf/descriptor.proto | 620 - .../src/proto/google/protobuf/unittest.proto | 719 - .../protobuf/unittest_custom_options.proto | 387 - .../google/protobuf/unittest_import.proto | 64 - .../protobuf/unittest_import_public.proto | 40 - .../proto/google/protobuf/unittest_mset.proto | 72 - .../unittest_no_generic_services.proto | 52 - python/compatibility_tests/v2.5.0/setup.py | 87 - python/compatibility_tests/v2.5.0/test.sh | 76 - .../v2.5.0/tests/__init__.py | 4 - .../v2.5.0/tests/google/__init__.py | 4 - .../v2.5.0/tests/google/protobuf/__init__.py | 4 - .../google/protobuf/internal/__init__.py | 37 - .../protobuf/internal/descriptor_test.py | 613 - .../protobuf/internal/generator_test.py | 269 - .../google/protobuf/internal/golden_message | Bin 509 -> 0 bytes .../internal/golden_packed_fields_message | Bin 142 -> 0 bytes .../google/protobuf/internal/message_test.py | 499 - .../internal/service_reflection_test.py | 136 - .../google/protobuf/internal/test_util.py | 651 - .../protobuf/internal/text_format_test.py | 622 - .../internal/text_format_unittest_data.txt | 128 - .../text_format_unittest_extensions_data.txt | 128 - .../protobuf/internal/wire_format_test.py | 253 - python/convert.c | 454 + python/convert.h | 66 + python/descriptor.c | 1796 ++ python/descriptor.h | 85 + python/descriptor_containers.c | 816 + python/descriptor_containers.h | 117 + python/descriptor_pool.c | 652 + python/descriptor_pool.h | 51 + python/dist/BUILD.bazel | 450 + python/dist/MANIFEST.in | 2 + python/dist/dist.bzl | 193 + python/dist/setup.py | 78 + python/docs/Makefile | 19 + python/docs/generate_docs.py | 2 +- python/docs/google/protobuf.rst | 2 +- python/docs/google/protobuf/any_pb2.rst | 2 +- python/docs/google/protobuf/descriptor.rst | 2 +- .../google/protobuf/descriptor_database.rst | 2 +- .../docs/google/protobuf/descriptor_pb2.rst | 2 +- .../docs/google/protobuf/descriptor_pool.rst | 2 +- python/docs/google/protobuf/duration_pb2.rst | 2 +- python/docs/google/protobuf/empty_pb2.rst | 2 +- .../docs/google/protobuf/field_mask_pb2.rst | 2 +- .../google/protobuf/internal/containers.rst | 2 +- python/docs/google/protobuf/json_format.rst | 2 +- python/docs/google/protobuf/message.rst | 2 +- .../docs/google/protobuf/message_factory.rst | 2 +- python/docs/google/protobuf/proto_builder.rst | 2 +- python/docs/google/protobuf/reflection.rst | 2 +- python/docs/google/protobuf/service.rst | 2 +- .../google/protobuf/service_reflection.rst | 2 +- python/docs/google/protobuf/struct_pb2.rst | 2 +- .../docs/google/protobuf/symbol_database.rst | 2 +- python/docs/google/protobuf/text_encoding.rst | 2 +- python/docs/google/protobuf/text_format.rst | 2 +- python/docs/google/protobuf/timestamp_pb2.rst | 2 +- python/docs/google/protobuf/type_pb2.rst | 2 +- .../docs/google/protobuf/unknown_fields.rst | 21 + python/docs/google/protobuf/wrappers_pb2.rst | 2 +- python/docs/index.rst | 1 + python/docs/make.bat | 70 +- python/docs/requirements.txt | 4 +- python/extension_dict.c | 256 + python/extension_dict.h | 42 + python/google/protobuf/__init__.py | 37 +- python/google/protobuf/descriptor.py | 335 +- python/google/protobuf/descriptor_database.py | 35 +- python/google/protobuf/descriptor_pool.py | 138 +- python/google/protobuf/internal/__init__.py | 29 +- .../protobuf/internal/_parameterized.py | 71 +- .../google/protobuf/internal/any_test.proto | 31 +- .../protobuf/internal/api_implementation.cc | 97 +- .../protobuf/internal/api_implementation.py | 153 +- python/google/protobuf/internal/builder.py | 118 + python/google/protobuf/internal/containers.py | 464 +- python/google/protobuf/internal/decoder.py | 125 +- .../internal/descriptor_database_test.py | 46 +- .../protobuf/internal/descriptor_pool_test.py | 264 +- .../internal/descriptor_pool_test1.proto | 33 +- .../internal/descriptor_pool_test2.proto | 33 +- .../protobuf/internal/descriptor_test.py | 297 +- python/google/protobuf/internal/encoder.py | 40 +- .../protobuf/internal/enum_type_wrapper.py | 46 +- .../protobuf/internal/extension_dict.py | 53 +- .../protobuf/internal/factory_test1.proto | 34 +- .../protobuf/internal/factory_test2.proto | 34 +- python/google/protobuf/internal/field_mask.py | 310 + .../protobuf/internal/field_mask_test.py | 377 + .../protobuf/internal/file_options_test.proto | 33 +- .../protobuf/internal/generator_test.py | 140 +- .../google/protobuf/internal/import_test.py | 26 + .../internal/import_test_package/__init__.py | 29 +- .../import_test_package/import_public.proto | 17 + .../import_public_nested.proto | 17 + .../internal/import_test_package/inner.proto | 32 +- .../internal/import_test_package/outer.proto | 30 +- .../protobuf/internal/json_format_test.py | 384 +- .../google/protobuf/internal/keywords_test.py | 31 +- .../protobuf/internal/message_factory_test.py | 257 +- .../protobuf/internal/message_listener.py | 29 +- .../internal/message_set_extensions.proto | 32 +- .../google/protobuf/internal/message_test.py | 873 +- .../internal/missing_enum_values.proto | 32 +- .../protobuf/internal/more_extensions.proto | 38 +- .../internal/more_extensions_dynamic.proto | 33 +- .../protobuf/internal/more_messages.proto | 78 +- .../google/protobuf/internal/no_package.proto | 31 +- .../protobuf/internal/numpy/BUILD.bazel | 23 + .../protobuf/internal/numpy/__init__.py | 7 + .../protobuf/internal/numpy/numpy_test.py | 192 + .../protobuf/internal/packed_field_test.proto | 80 +- .../protobuf/internal/proto_builder_test.py | 63 +- .../protobuf/internal/python_message.py | 299 +- .../protobuf/internal/python_protobuf.cc | 39 +- .../protobuf/internal/reflection_test.py | 238 +- .../internal/service_reflection_test.py | 38 +- .../protobuf/internal/symbol_database_test.py | 38 +- .../internal/test_bad_identifiers.proto | 29 +- .../internal/test_proto3_optional.proto | 29 +- python/google/protobuf/internal/test_util.py | 57 +- .../protobuf/internal/testing_refleaks.py | 60 +- .../protobuf/internal/text_encoding_test.py | 36 +- .../protobuf/internal/text_format_test.py | 440 +- .../protobuf/internal/thread_safe_test.py | 55 + .../google/protobuf/internal/type_checkers.py | 149 +- .../protobuf/internal/unknown_fields_test.py | 205 +- .../protobuf/internal/well_known_types.py | 418 +- .../internal/well_known_types_test.py | 701 +- .../google/protobuf/internal/wire_format.py | 31 +- .../protobuf/internal/wire_format_test.py | 36 +- python/google/protobuf/json_format.py | 404 +- python/google/protobuf/link_error_fast_cpp.cc | 23 + .../google/protobuf/link_error_pure_python.cc | 23 + python/google/protobuf/link_error_upb.cc | 24 + python/google/protobuf/message.py | 78 +- python/google/protobuf/message_factory.py | 233 +- python/google/protobuf/proto_api.h | 84 +- python/google/protobuf/proto_builder.py | 61 +- python/google/protobuf/pyext/__init__.py | 4 - python/google/protobuf/pyext/cpp_message.py | 38 +- python/google/protobuf/pyext/descriptor.cc | 1297 +- python/google/protobuf/pyext/descriptor.h | 35 +- .../protobuf/pyext/descriptor_containers.cc | 904 +- .../protobuf/pyext/descriptor_containers.h | 30 +- .../protobuf/pyext/descriptor_database.cc | 71 +- .../protobuf/pyext/descriptor_database.h | 46 +- .../google/protobuf/pyext/descriptor_pool.cc | 477 +- .../google/protobuf/pyext/descriptor_pool.h | 54 +- .../google/protobuf/pyext/extension_dict.cc | 268 +- python/google/protobuf/pyext/extension_dict.h | 34 +- python/google/protobuf/pyext/field.cc | 144 +- python/google/protobuf/pyext/field.h | 30 +- python/google/protobuf/pyext/map_container.cc | 478 +- python/google/protobuf/pyext/map_container.h | 40 +- python/google/protobuf/pyext/message.cc | 1668 +- python/google/protobuf/pyext/message.h | 126 +- .../google/protobuf/pyext/message_factory.cc | 176 +- .../google/protobuf/pyext/message_factory.h | 34 +- .../google/protobuf/pyext/message_module.cc | 97 +- .../protobuf/pyext/proto2_api_test.proto | 40 - python/google/protobuf/pyext/python.proto | 29 +- .../pyext/repeated_composite_container.cc | 381 +- .../pyext/repeated_composite_container.h | 36 +- .../pyext/repeated_scalar_container.cc | 519 +- .../pyext/repeated_scalar_container.h | 36 +- python/google/protobuf/pyext/safe_numerics.h | 34 +- .../protobuf/pyext/scoped_pyobject_ptr.h | 44 +- .../protobuf/pyext/unknown_field_set.cc | 332 + .../google/protobuf/pyext/unknown_field_set.h | 55 + .../google/protobuf/pyext/unknown_fields.cc | 280 +- python/google/protobuf/pyext/unknown_fields.h | 32 +- python/google/protobuf/python_protobuf.h | 30 +- python/google/protobuf/reflection.py | 31 +- python/google/protobuf/service.py | 29 +- python/google/protobuf/service_reflection.py | 76 +- python/google/protobuf/symbol_database.py | 59 +- python/google/protobuf/testdata/__init__.py | 0 python/google/protobuf/text_encoding.py | 54 +- python/google/protobuf/text_format.py | 383 +- python/google/protobuf/unknown_fields.py | 97 + python/google/protobuf/use_fast_cpp_protos.cc | 40 + python/google/protobuf/use_pure_python.cc | 40 + python/google/protobuf/use_upb_protos.cc | 40 + python/internal.bzl | 134 + python/map.c | 527 + python/map.h | 69 + python/message.c | 2019 ++ python/message.h | 110 + python/minimal_test.py | 187 + python/mox.py | 1401 - python/pb_unit_tests/BUILD | 84 + python/pb_unit_tests/README.md | 11 + .../descriptor_database_test_wrapper.py | 35 + .../descriptor_pool_test_wrapper.py | 45 + .../pb_unit_tests/descriptor_test_wrapper.py | 46 + .../pb_unit_tests/generator_test_wrapper.py | 35 + .../pb_unit_tests/json_format_test_wrapper.py | 35 + python/pb_unit_tests/keywords_test_wrapper.py | 35 + .../message_factory_test_wrapper.py | 37 + python/pb_unit_tests/message_test_wrapper.py | 55 + python/pb_unit_tests/numpy_test_wrapper.py | 36 + .../proto_builder_test_wrapper.py | 37 + python/pb_unit_tests/pyproto_test_wrapper.bzl | 46 + .../pb_unit_tests/reflection_test_wrapper.py | 53 + .../service_reflection_test_wrapper.py | 35 + .../symbol_database_test_wrapper.py | 35 + .../text_encoding_test_wrapper.py | 35 + .../pb_unit_tests/text_format_test_wrapper.py | 35 + .../unknown_fields_test_wrapper.py | 35 + .../well_known_types_test_wrapper.py | 36 + .../pb_unit_tests/wire_format_test_wrapper.py | 35 + python/protobuf.c | 431 + python/protobuf.h | 240 + python/protobuf_distutils/README.md | 121 + .../protobuf_distutils/__init__.py | 0 .../generate_py_protobufs.py | 137 + python/protobuf_distutils/setup.py | 54 + python/py_extension.bzl | 58 + python/python_api.h | 64 + python/python_version_test.py | 29 + python/release.sh | 124 - python/release/wheel/Dockerfile | 6 - python/release/wheel/README.md | 17 - python/release/wheel/build_wheel_manylinux.sh | 27 - .../release/wheel/protobuf_optimized_pip.sh | 66 - python/repeated.c | 800 + python/repeated.h | 72 + python/requirements.txt | 1 + python/setup.py | 432 +- python/stubout.py | 143 - python/tox.ini | 15 +- python/unknown_fields.c | 358 + python/unknown_fields.h | 42 + python/version_script.lds | 6 + regenerate_stale_files.sh | 30 + ruby/.gitignore | 8 +- ruby/BUILD.bazel | 273 + ruby/README.md | 46 +- ruby/Rakefile | 155 +- ruby/compatibility_tests/v3.0.0/BUILD.bazel | 34 + ruby/compatibility_tests/v3.0.0/Rakefile | 1 + ruby/compatibility_tests/v3.0.0/test.sh | 2 +- .../v3.0.0/tests/BUILD.bazel | 64 + .../compatibility_tests/v3.0.0/tests/basic.rb | 777 +- .../v3.0.0/tests/generated_code_test.rb | 0 .../v3.0.0/tests/repeated_field_test.rb | 41 +- .../v3.0.0/tests/stress.rb | 4 +- ruby/ext/google/protobuf_c/BUILD.bazel | 178 + ruby/ext/google/protobuf_c/Rakefile | 3 + ruby/ext/google/protobuf_c/convert.c | 314 + ruby/ext/google/protobuf_c/convert.h | 50 + ruby/ext/google/protobuf_c/defs.c | 2449 +- ruby/ext/google/protobuf_c/defs.h | 82 + ruby/ext/google/protobuf_c/encode_decode.c | 1795 -- ruby/ext/google/protobuf_c/extconf.rb | 23 +- ruby/ext/google/protobuf_c/glue.c | 56 + ruby/ext/google/protobuf_c/map.c | 822 +- ruby/ext/google/protobuf_c/map.h | 44 + ruby/ext/google/protobuf_c/message.c | 1603 +- ruby/ext/google/protobuf_c/message.h | 86 + ruby/ext/google/protobuf_c/protobuf.c | 395 +- ruby/ext/google/protobuf_c/protobuf.h | 687 +- ruby/ext/google/protobuf_c/repeated_field.c | 676 +- ruby/ext/google/protobuf_c/repeated_field.h | 41 + ruby/ext/google/protobuf_c/ruby-upb.c | 14414 ++++++++++ ruby/ext/google/protobuf_c/ruby-upb.h | 13044 +++++++++ ruby/ext/google/protobuf_c/shared_convert.c | 64 + ruby/ext/google/protobuf_c/shared_convert.h | 26 + ruby/ext/google/protobuf_c/shared_message.c | 65 + ruby/ext/google/protobuf_c/shared_message.h | 25 + ruby/ext/google/protobuf_c/storage.c | 1198 - ruby/ext/google/protobuf_c/upb.c | 13817 --------- ruby/ext/google/protobuf_c/upb.h | 6777 ----- ruby/ext/google/protobuf_c/wrap_memcpy.c | 36 +- ruby/google-protobuf.gemspec | 40 + ruby/lib/google/BUILD.bazel | 98 + ruby/lib/google/protobuf.rb | 61 + ruby/lib/google/protobuf/descriptor_dsl.rb | 465 + ruby/lib/google/protobuf/ffi/descriptor.rb | 165 + .../google/protobuf/ffi/descriptor_pool.rb | 75 + .../google/protobuf/ffi/enum_descriptor.rb | 171 + ruby/lib/google/protobuf/ffi/ffi.rb | 213 + .../google/protobuf/ffi/field_descriptor.rb | 319 + .../google/protobuf/ffi/file_descriptor.rb | 59 + .../lib/google/protobuf/ffi/internal/arena.rb | 66 + .../google/protobuf/ffi/internal/convert.rb | 305 + .../protobuf/ffi/internal/pointer_helper.rb | 35 + .../protobuf/ffi/internal/type_safety.rb | 25 + ruby/lib/google/protobuf/ffi/map.rb | 407 + ruby/lib/google/protobuf/ffi/message.rb | 662 + ruby/lib/google/protobuf/ffi/object_cache.rb | 30 + .../google/protobuf/ffi/oneof_descriptor.rb | 95 + .../lib/google/protobuf/ffi/repeated_field.rb | 383 + ruby/lib/google/protobuf/message_exts.rb | 35 + ruby/lib/google/protobuf/object_cache.rb | 97 + ruby/lib/google/protobuf/repeated_field.rb | 178 + ruby/lib/google/protobuf/well_known_types.rb | 211 + ruby/lib/google/protobuf_ffi.rb | 50 + ruby/lib/google/protobuf_native.rb | 20 + ruby/lib/google/tasks/ffi.rake | 102 + ruby/pom.xml | 28 +- ruby/src/main/java/BUILD.bazel | 42 + .../google/protobuf/jruby/RubyBuilder.java | 167 - .../google/protobuf/jruby/RubyDescriptor.java | 421 +- .../protobuf/jruby/RubyDescriptorPool.java | 290 +- .../com/google/protobuf/jruby/RubyEnum.java | 78 +- .../jruby/RubyEnumBuilderContext.java | 82 - .../protobuf/jruby/RubyEnumDescriptor.java | 301 +- .../protobuf/jruby/RubyFieldDescriptor.java | 442 +- .../protobuf/jruby/RubyFileDescriptor.java | 129 + .../com/google/protobuf/jruby/RubyMap.java | 749 +- .../google/protobuf/jruby/RubyMessage.java | 2067 +- .../jruby/RubyMessageBuilderContext.java | 217 - .../jruby/RubyOneofBuilderContext.java | 84 - .../protobuf/jruby/RubyOneofDescriptor.java | 175 +- .../google/protobuf/jruby/RubyProtobuf.java | 57 +- .../protobuf/jruby/RubyRepeatedField.java | 700 +- .../protobuf/jruby/SentinelOuterClass.java | 467 +- .../java/com/google/protobuf/jruby/Utils.java | 561 +- .../main/java/google/ProtobufJavaService.java | 41 +- ruby/src/main/java/sentinel.proto | 24 + ruby/src/main/sentinel.proto | 15 - ruby/tests/BUILD.bazel | 158 + ruby/tests/basic.rb | 445 +- ruby/tests/basic_proto2.rb | 223 +- ruby/tests/basic_test.proto | 89 +- ruby/tests/basic_test_proto2.proto | 48 +- ruby/tests/common_tests.rb | 1091 +- ruby/tests/encode_decode_test.rb | 105 +- ruby/tests/gc_test.rb | 13 +- ruby/tests/generated_code.proto | 6 + ruby/tests/generated_code_proto2.proto | 2 + ruby/tests/generated_code_proto2_test.rb | 0 ruby/tests/generated_code_test.rb | 0 ruby/tests/implementation.rb | 37 + ruby/tests/multi_level_nesting_test.proto | 19 + ruby/tests/multi_level_nesting_test.rb | 20 + ruby/tests/object_cache_test.rb | 65 + ruby/tests/repeated_field_test.rb | 141 +- ruby/tests/ruby_version.rb | 33 + ruby/tests/stress.rb | 4 +- ruby/tests/type_errors.rb | 9 +- ruby/tests/well_known_types_test.rb | 104 +- ruby/travis-test.sh | 46 - rust/BUILD | 142 + rust/aspects.bzl | 336 + rust/cpp.rs | 204 + rust/cpp_kernel/BUILD | 24 + rust/cpp_kernel/cpp_api.h | 65 + rust/cpp_kernel/rust_alloc_for_cpp_api.rs | 14 + rust/defs.bzl | 90 + rust/internal.rs | 105 + rust/macros.rs | 47 + rust/optional.rs | 727 + rust/primitive.rs | 111 + rust/protobuf.rs | 21 + rust/proxied.rs | 538 + rust/shared.rs | 60 + rust/string.rs | 1009 + rust/test/BUILD | 332 + rust/test/child.proto | 14 + rust/test/cpp/BUILD | 11 + rust/test/cpp/interop/BUILD | 27 + rust/test/cpp/interop/main.rs | 94 + rust/test/cpp/interop/test_utils.cc | 42 + rust/test/dots_in_package.proto | 12 + rust/test/nested.proto | 18 + rust/test/no_package.proto | 14 + rust/test/no_package_import.proto | 12 + rust/test/no_package_other.proto | 12 + rust/test/package.proto | 14 + rust/test/package_import.proto | 12 + rust/test/package_other.proto | 12 + rust/test/package_other_different.proto | 12 + rust/test/parent.proto | 12 + rust/test/reserved.proto | 17 + rust/test/rust_proto_library_unit_test/BUILD | 3 + .../rust_proto_library_unit_test/child.proto | 10 + .../rust_proto_library_unit_test/defs.bzl | 58 + .../rust_proto_library_unit_test/empty.cc | 10 + .../rust_proto_library_unit_test/empty.rs | 10 + .../rust_proto_library_unit_test/parent.proto | 10 + .../rust_proto_library_unit_test.bzl | 130 + .../some_proto.proto | 16 + rust/test/shared/BUILD | 255 + rust/test/shared/accessors_proto3_test.rs | 206 + rust/test/shared/accessors_test.rs | 400 + rust/test/shared/child_parent_test.rs | 28 + rust/test/shared/matchers.rs | 58 + rust/test/shared/nested_messages_test.rs | 16 + rust/test/shared/package_test.rs | 27 + rust/test/shared/reserved_test.rs | 23 + rust/test/shared/serialization_test.rs | 39 + rust/test/shared/simple_nested_test.rs | 15 + rust/test/upb/BUILD | 11 + rust/upb.rs | 312 + rust/upb_kernel/BUILD | 13 + rust/upb_kernel/upb_api.c | 11 + rust/utf8.rs | 305 + rust/vtable.rs | 400 + src/BUILD.bazel | 65 + src/Makefile.am | 898 - src/README.md | 170 +- src/file_lists.cmake | 843 + src/google/protobuf/BUILD.bazel | 1611 ++ src/google/protobuf/any.cc | 66 +- src/google/protobuf/any.h | 96 +- src/google/protobuf/any.pb.cc | 522 +- src/google/protobuf/any.pb.h | 481 +- src/google/protobuf/any.proto | 19 +- src/google/protobuf/any_lite.cc | 104 +- src/google/protobuf/any_test.cc | 69 +- src/google/protobuf/any_test.proto | 32 +- src/google/protobuf/api.pb.cc | 1840 +- src/google/protobuf/api.pb.h | 1890 +- src/google/protobuf/api.proto | 7 +- src/google/protobuf/arena.cc | 1073 +- src/google/protobuf/arena.h | 638 +- src/google/protobuf/arena_align.cc | 22 + src/google/protobuf/arena_align.h | 198 + src/google/protobuf/arena_align_test.cc | 214 + src/google/protobuf/arena_allocation_policy.h | 102 + src/google/protobuf/arena_cleanup.h | 208 + src/google/protobuf/arena_impl.h | 389 - src/google/protobuf/arena_test_util.cc | 37 +- src/google/protobuf/arena_test_util.h | 100 +- src/google/protobuf/arena_unittest.cc | 675 +- src/google/protobuf/arenastring.cc | 285 + src/google/protobuf/arenastring.h | 748 +- src/google/protobuf/arenastring_unittest.cc | 283 +- src/google/protobuf/arenaz_sampler.cc | 223 + src/google/protobuf/arenaz_sampler.h | 238 + src/google/protobuf/arenaz_sampler_test.cc | 599 + src/google/protobuf/bridge/BUILD.bazel | 11 + src/google/protobuf/bridge/message_set.proto | 76 + src/google/protobuf/compiler/BUILD.bazel | 511 + .../protobuf/compiler/allowlists/BUILD.bazel | 60 + .../protobuf/compiler/allowlists/allowlist.h | 141 + .../compiler/allowlists/allowlist_test.cc | 97 + .../protobuf/compiler/allowlists/allowlists.h | 39 + .../protobuf/compiler/allowlists/editions.cc | 31 + .../compiler/allowlists/empty_package.cc | 38 + .../protobuf/compiler/allowlists/open_enum.cc | 36 + .../compiler/allowlists/unused_imports.cc | 28 + .../compiler/allowlists/weak_imports.cc | 29 + .../protobuf/compiler/annotation_test_util.cc | 95 +- .../protobuf/compiler/annotation_test_util.h | 53 +- .../protobuf/compiler/code_generator.cc | 109 +- src/google/protobuf/compiler/code_generator.h | 134 +- .../compiler/code_generator_unittest.cc | 309 + .../compiler/command_line_interface.cc | 1709 +- .../compiler/command_line_interface.h | 144 +- .../compiler/command_line_interface_tester.cc | 177 + .../compiler/command_line_interface_tester.h | 155 + .../command_line_interface_unittest.cc | 2235 +- src/google/protobuf/compiler/cpp/BUILD.bazel | 321 + .../cpp/arena_ctor_visibility_test.cc | 41 + .../compiler/cpp/bootstrap_unittest.cc | 181 + .../protobuf/compiler/cpp/copy_unittest.cc | 66 + .../compiler/cpp/cpp_bootstrap_unittest.cc | 199 - src/google/protobuf/compiler/cpp/cpp_enum.cc | 434 - src/google/protobuf/compiler/cpp/cpp_enum.h | 105 - .../protobuf/compiler/cpp/cpp_enum_field.cc | 490 - .../protobuf/compiler/cpp/cpp_enum_field.h | 113 - .../protobuf/compiler/cpp/cpp_extension.cc | 187 - .../protobuf/compiler/cpp/cpp_extension.h | 91 - src/google/protobuf/compiler/cpp/cpp_field.cc | 195 - src/google/protobuf/compiler/cpp/cpp_field.h | 231 - src/google/protobuf/compiler/cpp/cpp_file.cc | 1524 - src/google/protobuf/compiler/cpp/cpp_file.h | 206 - .../protobuf/compiler/cpp/cpp_generator.cc | 219 - .../protobuf/compiler/cpp/cpp_generator.h | 107 +- .../protobuf/compiler/cpp/cpp_helpers.cc | 2014 -- .../protobuf/compiler/cpp/cpp_helpers.h | 912 - .../protobuf/compiler/cpp/cpp_map_field.cc | 303 - .../protobuf/compiler/cpp/cpp_map_field.h | 70 - .../protobuf/compiler/cpp/cpp_message.cc | 4080 --- .../protobuf/compiler/cpp/cpp_message.h | 225 - .../compiler/cpp/cpp_message_field.cc | 867 - .../protobuf/compiler/cpp/cpp_message_field.h | 132 - .../compiler/cpp/cpp_message_layout_helper.h | 61 - .../compiler/cpp/cpp_move_unittest.cc | 169 - .../protobuf/compiler/cpp/cpp_options.h | 79 - .../compiler/cpp/cpp_padding_optimizer.cc | 227 - .../compiler/cpp/cpp_padding_optimizer.h | 64 - .../compiler/cpp/cpp_plugin_unittest.cc | 245 - .../compiler/cpp/cpp_primitive_field.cc | 476 - .../compiler/cpp/cpp_primitive_field.h | 112 - .../protobuf/compiler/cpp/cpp_service.cc | 327 - .../protobuf/compiler/cpp/cpp_service.h | 122 - .../protobuf/compiler/cpp/cpp_string_field.cc | 1114 - .../protobuf/compiler/cpp/cpp_string_field.h | 130 - .../cpp/cpp_test_bad_identifiers.proto | 184 - .../cpp/cpp_test_large_enum_value.proto | 43 - .../protobuf/compiler/cpp/cpp_unittest.cc | 134 - .../protobuf/compiler/cpp/cpp_unittest.h | 51 - .../protobuf/compiler/cpp/cpp_unittest.inc | 2231 -- src/google/protobuf/compiler/cpp/enum.cc | 587 + src/google/protobuf/compiler/cpp/enum.h | 81 + src/google/protobuf/compiler/cpp/extension.cc | 176 + src/google/protobuf/compiler/cpp/extension.h | 77 + src/google/protobuf/compiler/cpp/field.cc | 356 + src/google/protobuf/compiler/cpp/field.h | 528 + .../cpp/field_generators/cord_field.cc | 462 + .../cpp/field_generators/enum_field.cc | 574 + .../cpp/field_generators/generators.h | 84 + .../cpp/field_generators/map_field.cc | 327 + .../cpp/field_generators/message_field.cc | 1038 + .../cpp/field_generators/primitive_field.cc | 661 + .../cpp/field_generators/string_field.cc | 1029 + src/google/protobuf/compiler/cpp/file.cc | 1778 ++ src/google/protobuf/compiler/cpp/file.h | 199 + .../protobuf/compiler/cpp/file_unittest.cc | 219 + src/google/protobuf/compiler/cpp/generator.cc | 383 + src/google/protobuf/compiler/cpp/generator.h | 96 + .../compiler/cpp/generator_unittest.cc | 189 + src/google/protobuf/compiler/cpp/helpers.cc | 1716 ++ src/google/protobuf/compiler/cpp/helpers.h | 1075 + src/google/protobuf/compiler/cpp/main.cc | 18 + src/google/protobuf/compiler/cpp/message.cc | 5035 ++++ src/google/protobuf/compiler/cpp/message.h | 220 + .../compiler/cpp/message_layout_helper.h | 41 + .../compiler/cpp/message_size_unittest.cc | 273 + .../protobuf/compiler/cpp/metadata_test.cc | 560 +- .../protobuf/compiler/cpp/move_unittest.cc | 146 + src/google/protobuf/compiler/cpp/names.h | 90 + src/google/protobuf/compiler/cpp/options.h | 72 + .../compiler/cpp/padding_optimizer.cc | 232 + .../protobuf/compiler/cpp/padding_optimizer.h | 42 + .../compiler/cpp/parse_function_generator.cc | 831 + .../compiler/cpp/parse_function_generator.h | 80 + .../protobuf/compiler/cpp/plugin_unittest.cc | 214 + src/google/protobuf/compiler/cpp/service.cc | 291 + src/google/protobuf/compiler/cpp/service.h | 90 + .../compiler/cpp/test_bad_identifiers.proto | 168 + .../compiler/cpp/test_large_enum_value.proto | 20 + src/google/protobuf/compiler/cpp/tracker.cc | 317 + src/google/protobuf/compiler/cpp/tracker.h | 35 + src/google/protobuf/compiler/cpp/unittest.cc | 110 + src/google/protobuf/compiler/cpp/unittest.h | 28 + src/google/protobuf/compiler/cpp/unittest.inc | 2207 ++ .../protobuf/compiler/csharp/BUILD.bazel | 137 + .../csharp/csharp_bootstrap_unittest.cc | 102 +- .../compiler/csharp/csharp_doc_comment.cc | 69 +- .../compiler/csharp/csharp_doc_comment.h | 33 +- .../protobuf/compiler/csharp/csharp_enum.cc | 81 +- .../protobuf/compiler/csharp/csharp_enum.h | 37 +- .../compiler/csharp/csharp_enum_field.cc | 53 +- .../compiler/csharp/csharp_enum_field.h | 53 +- .../compiler/csharp/csharp_field_base.cc | 194 +- .../compiler/csharp/csharp_field_base.h | 52 +- .../compiler/csharp/csharp_generator.cc | 70 +- .../compiler/csharp/csharp_generator.h | 39 +- .../csharp/csharp_generator_unittest.cc | 69 +- .../compiler/csharp/csharp_helpers.cc | 312 +- .../protobuf/compiler/csharp/csharp_helpers.h | 117 +- .../compiler/csharp/csharp_map_field.cc | 56 +- .../compiler/csharp/csharp_map_field.h | 61 +- .../compiler/csharp/csharp_message.cc | 597 +- .../protobuf/compiler/csharp/csharp_message.h | 35 +- .../compiler/csharp/csharp_message_field.cc | 61 +- .../compiler/csharp/csharp_message_field.h | 69 +- .../protobuf/compiler/csharp/csharp_names.h | 107 - .../protobuf/compiler/csharp/csharp_options.h | 29 +- .../compiler/csharp/csharp_primitive_field.cc | 87 +- .../compiler/csharp/csharp_primitive_field.h | 67 +- .../csharp/csharp_reflection_class.cc | 78 +- .../compiler/csharp/csharp_reflection_class.h | 37 +- .../csharp/csharp_repeated_enum_field.cc | 49 +- .../csharp/csharp_repeated_enum_field.h | 65 +- .../csharp/csharp_repeated_message_field.cc | 51 +- .../csharp/csharp_repeated_message_field.h | 63 +- .../csharp/csharp_repeated_primitive_field.cc | 49 +- .../csharp/csharp_repeated_primitive_field.h | 63 +- .../csharp/csharp_source_generator_base.cc | 58 +- .../csharp/csharp_source_generator_base.h | 36 +- .../compiler/csharp/csharp_wrapper_field.cc | 57 +- .../compiler/csharp/csharp_wrapper_field.h | 75 +- src/google/protobuf/compiler/csharp/names.cc | 200 + src/google/protobuf/compiler/csharp/names.h | 124 + src/google/protobuf/compiler/fake_plugin.cc | 45 + src/google/protobuf/compiler/importer.cc | 223 +- src/google/protobuf/compiler/importer.h | 133 +- .../protobuf/compiler/importer_unittest.cc | 196 +- src/google/protobuf/compiler/java/BUILD.bazel | 182 + src/google/protobuf/compiler/java/context.cc | 190 + src/google/protobuf/compiler/java/context.h | 106 + .../protobuf/compiler/java/doc_comment.cc | 498 + .../protobuf/compiler/java/doc_comment.h | 89 + .../compiler/java/doc_comment_unittest.cc | 33 + src/google/protobuf/compiler/java/enum.cc | 387 + src/google/protobuf/compiler/java/enum.h | 78 + .../protobuf/compiler/java/enum_field.cc | 1191 + .../protobuf/compiler/java/enum_field.h | 142 + .../protobuf/compiler/java/enum_field_lite.cc | 1005 + .../protobuf/compiler/java/enum_field_lite.h | 121 + .../protobuf/compiler/java/enum_lite.cc | 250 + src/google/protobuf/compiler/java/enum_lite.h | 76 + .../protobuf/compiler/java/extension.cc | 159 + src/google/protobuf/compiler/java/extension.h | 93 + .../protobuf/compiler/java/extension_lite.cc | 101 + .../protobuf/compiler/java/extension_lite.h | 54 + src/google/protobuf/compiler/java/field.cc | 294 + src/google/protobuf/compiler/java/field.h | 169 + src/google/protobuf/compiler/java/file.cc | 755 + src/google/protobuf/compiler/java/file.h | 104 + .../protobuf/compiler/java/generator.cc | 183 + src/google/protobuf/compiler/java/generator.h | 61 + .../compiler/java/generator_factory.cc | 63 + .../compiler/java/generator_factory.h | 81 + src/google/protobuf/compiler/java/helpers.cc | 987 + src/google/protobuf/compiler/java/helpers.h | 422 + .../protobuf/compiler/java/java_context.cc | 201 - .../protobuf/compiler/java/java_context.h | 113 - .../compiler/java/java_doc_comment.cc | 416 - .../protobuf/compiler/java/java_doc_comment.h | 101 - .../java/java_doc_comment_unittest.cc | 67 - .../protobuf/compiler/java/java_enum.cc | 390 - src/google/protobuf/compiler/java/java_enum.h | 100 - .../protobuf/compiler/java/java_enum_field.cc | 1047 - .../protobuf/compiler/java/java_enum_field.h | 157 - .../compiler/java/java_enum_field_lite.cc | 784 - .../compiler/java/java_enum_field_lite.h | 136 - .../protobuf/compiler/java/java_enum_lite.cc | 234 - .../protobuf/compiler/java/java_enum_lite.h | 98 - .../protobuf/compiler/java/java_extension.cc | 172 - .../protobuf/compiler/java/java_extension.h | 115 - .../compiler/java/java_extension_lite.cc | 115 - .../compiler/java/java_extension_lite.h | 75 - .../compiler/java/java_features.pb.cc | 383 + .../protobuf/compiler/java/java_features.pb.h | 420 + .../protobuf/compiler/java/java_field.cc | 293 - .../protobuf/compiler/java/java_field.h | 188 - .../protobuf/compiler/java/java_file.cc | 689 - src/google/protobuf/compiler/java/java_file.h | 119 - .../protobuf/compiler/java/java_generator.cc | 211 - .../protobuf/compiler/java/java_generator.h | 77 +- .../compiler/java/java_generator_factory.cc | 86 - .../compiler/java/java_generator_factory.h | 103 - .../protobuf/compiler/java/java_helpers.cc | 1030 - .../protobuf/compiler/java/java_helpers.h | 458 - .../protobuf/compiler/java/java_map_field.cc | 773 - .../protobuf/compiler/java/java_map_field.h | 80 - .../compiler/java/java_map_field_lite.cc | 803 - .../compiler/java/java_map_field_lite.h | 71 - .../protobuf/compiler/java/java_message.cc | 1436 - .../protobuf/compiler/java/java_message.h | 145 - .../compiler/java/java_message_builder.cc | 712 - .../compiler/java/java_message_builder.h | 89 - .../java/java_message_builder_lite.cc | 151 - .../compiler/java/java_message_builder_lite.h | 86 - .../compiler/java/java_message_field.cc | 1366 - .../compiler/java/java_message_field.h | 175 - .../compiler/java/java_message_field_lite.cc | 755 - .../compiler/java/java_message_field_lite.h | 136 - .../compiler/java/java_message_lite.cc | 729 - .../compiler/java/java_message_lite.h | 82 - .../compiler/java/java_name_resolver.cc | 286 - .../compiler/java/java_name_resolver.h | 127 - .../protobuf/compiler/java/java_names.h | 112 - .../protobuf/compiler/java/java_options.h | 73 - .../compiler/java/java_plugin_unittest.cc | 120 - .../compiler/java/java_primitive_field.cc | 973 - .../compiler/java/java_primitive_field.h | 158 - .../java/java_primitive_field_lite.cc | 640 - .../compiler/java/java_primitive_field_lite.h | 137 - .../protobuf/compiler/java/java_service.cc | 474 - .../protobuf/compiler/java/java_service.h | 139 - .../java/java_shared_code_generator.cc | 197 - .../java/java_shared_code_generator.h | 90 - .../compiler/java/java_string_field.cc | 1055 - .../compiler/java/java_string_field.h | 156 - .../compiler/java/java_string_field_lite.cc | 729 - .../compiler/java/java_string_field_lite.h | 135 - .../compiler/java/kotlin_generator.cc | 136 + .../protobuf/compiler/java/kotlin_generator.h | 50 + .../protobuf/compiler/java/map_field.cc | 1184 + src/google/protobuf/compiler/java/map_field.h | 66 + .../protobuf/compiler/java/map_field_lite.cc | 938 + .../protobuf/compiler/java/map_field_lite.h | 51 + src/google/protobuf/compiler/java/message.cc | 1612 ++ src/google/protobuf/compiler/java/message.h | 128 + .../protobuf/compiler/java/message_builder.cc | 913 + .../protobuf/compiler/java/message_builder.h | 77 + .../compiler/java/message_builder_lite.cc | 145 + .../compiler/java/message_builder_lite.h | 65 + .../protobuf/compiler/java/message_field.cc | 1468 + .../protobuf/compiler/java/message_field.h | 166 + .../compiler/java/message_field_lite.cc | 905 + .../compiler/java/message_field_lite.h | 125 + .../protobuf/compiler/java/message_lite.cc | 1035 + .../protobuf/compiler/java/message_lite.h | 63 + .../compiler/java/message_serialization.cc | 28 + .../compiler/java/message_serialization.h | 80 + .../java/message_serialization_unittest.cc | 101 + .../java/message_serialization_unittest.proto | 33 + .../protobuf/compiler/java/name_resolver.cc | 395 + .../protobuf/compiler/java/name_resolver.h | 143 + src/google/protobuf/compiler/java/names.cc | 172 + src/google/protobuf/compiler/java/names.h | 112 + src/google/protobuf/compiler/java/options.h | 54 + .../protobuf/compiler/java/plugin_unittest.cc | 115 + .../protobuf/compiler/java/primitive_field.cc | 1103 + .../protobuf/compiler/java/primitive_field.h | 143 + .../compiler/java/primitive_field_lite.cc | 820 + .../compiler/java/primitive_field_lite.h | 122 + src/google/protobuf/compiler/java/service.cc | 461 + src/google/protobuf/compiler/java/service.h | 116 + .../compiler/java/shared_code_generator.cc | 184 + .../compiler/java/shared_code_generator.h | 68 + .../protobuf/compiler/java/string_field.cc | 1202 + .../protobuf/compiler/java/string_field.h | 141 + .../compiler/java/string_field_lite.cc | 933 + .../compiler/java/string_field_lite.h | 122 + .../protobuf/compiler/js/js_generator.cc | 3951 --- .../protobuf/compiler/js/js_generator.h | 339 - .../compiler/js/well_known_types_embed.cc | 270 - .../compiler/js/well_known_types_embed.h | 43 - src/google/protobuf/compiler/main.cc | 87 +- .../protobuf/compiler/mock_code_generator.cc | 318 +- .../protobuf/compiler/mock_code_generator.h | 115 +- .../protobuf/compiler/objectivec/BUILD.bazel | 166 + .../protobuf/compiler/objectivec/enum.cc | 265 + .../protobuf/compiler/objectivec/enum.h | 51 + .../compiler/objectivec/enum_field.cc | 161 + .../protobuf/compiler/objectivec/enum_field.h | 66 + .../protobuf/compiler/objectivec/extension.cc | 146 + .../protobuf/compiler/objectivec/extension.h | 54 + .../protobuf/compiler/objectivec/field.cc | 481 + .../protobuf/compiler/objectivec/field.h | 180 + .../protobuf/compiler/objectivec/file.cc | 811 + .../protobuf/compiler/objectivec/file.h | 138 + .../protobuf/compiler/objectivec/generator.cc | 427 + .../protobuf/compiler/objectivec/generator.h | 63 + .../protobuf/compiler/objectivec/helpers.cc | 399 + .../protobuf/compiler/objectivec/helpers.h | 156 + .../compiler/objectivec/import_writer.cc | 271 + .../compiler/objectivec/import_writer.h | 61 + .../compiler/objectivec/line_consumer.cc | 183 + .../compiler/objectivec/line_consumer.h | 51 + .../objectivec/line_consumer_unittest.cc | 164 + .../protobuf/compiler/objectivec/map_field.cc | 153 + .../protobuf/compiler/objectivec/map_field.h | 57 + .../protobuf/compiler/objectivec/message.cc | 644 + .../protobuf/compiler/objectivec/message.h | 73 + .../compiler/objectivec/message_field.cc | 114 + .../compiler/objectivec/message_field.h | 74 + .../compiler/objectivec/method_dump.sh | 16 +- .../protobuf/compiler/objectivec/names.cc | 1442 + .../protobuf/compiler/objectivec/names.h | 178 + .../compiler/objectivec/names_unittest.cc | 116 + .../compiler/objectivec/nsobject_methods.h | 204 + .../compiler/objectivec/objectivec_enum.cc | 261 - .../compiler/objectivec/objectivec_enum.h | 71 - .../objectivec/objectivec_enum_field.cc | 149 - .../objectivec/objectivec_enum_field.h | 77 - .../objectivec/objectivec_extension.cc | 156 - .../objectivec/objectivec_extension.h | 67 - .../compiler/objectivec/objectivec_field.cc | 475 - .../compiler/objectivec/objectivec_field.h | 191 - .../compiler/objectivec/objectivec_file.cc | 609 - .../compiler/objectivec/objectivec_file.h | 83 - .../objectivec/objectivec_generator.cc | 179 - .../objectivec/objectivec_generator.h | 82 - .../compiler/objectivec/objectivec_helpers.cc | 1776 -- .../compiler/objectivec/objectivec_helpers.h | 328 - .../objectivec/objectivec_helpers_unittest.cc | 257 - .../objectivec/objectivec_map_field.cc | 189 - .../objectivec/objectivec_map_field.h | 69 - .../compiler/objectivec/objectivec_message.cc | 635 - .../compiler/objectivec/objectivec_message.h | 100 - .../objectivec/objectivec_message_field.cc | 106 - .../objectivec/objectivec_message_field.h | 83 - .../objectivec/objectivec_nsobject_methods.h | 197 - .../compiler/objectivec/objectivec_oneof.cc | 140 - .../compiler/objectivec/objectivec_oneof.h | 76 - .../objectivec/objectivec_primitive_field.cc | 190 - .../objectivec/objectivec_primitive_field.h | 95 - .../protobuf/compiler/objectivec/oneof.cc | 118 + .../protobuf/compiler/objectivec/oneof.h | 56 + .../protobuf/compiler/objectivec/options.h | 39 + .../compiler/objectivec/primitive_field.cc | 71 + .../compiler/objectivec/primitive_field.h | 75 + .../objectivec/text_format_decode_data.cc | 231 + .../objectivec/text_format_decode_data.h | 58 + .../text_format_decode_data_unittest.cc | 233 + src/google/protobuf/compiler/package_info.h | 29 +- src/google/protobuf/compiler/parser.cc | 940 +- src/google/protobuf/compiler/parser.h | 145 +- .../protobuf/compiler/parser_unittest.cc | 1063 +- src/google/protobuf/compiler/php/BUILD.bazel | 64 + src/google/protobuf/compiler/php/names.cc | 121 + src/google/protobuf/compiler/php/names.h | 50 + .../protobuf/compiler/php/php_generator.cc | 1513 +- .../protobuf/compiler/php/php_generator.h | 57 +- src/google/protobuf/compiler/plugin.cc | 96 +- src/google/protobuf/compiler/plugin.h | 35 +- src/google/protobuf/compiler/plugin.pb.cc | 2175 +- src/google/protobuf/compiler/plugin.pb.h | 2491 +- src/google/protobuf/compiler/plugin.proto | 52 +- .../protobuf/compiler/python/BUILD.bazel | 75 + .../protobuf/compiler/python/generator.cc | 1416 + .../protobuf/compiler/python/generator.h | 175 + .../protobuf/compiler/python/helpers.cc | 121 + src/google/protobuf/compiler/python/helpers.h | 42 + .../compiler/python/plugin_unittest.cc | 108 + .../protobuf/compiler/python/pyi_generator.cc | 629 + .../protobuf/compiler/python/pyi_generator.h | 98 + .../compiler/python/python_generator.cc | 1474 - .../compiler/python/python_generator.h | 183 +- .../compiler/python/python_plugin_unittest.cc | 162 - src/google/protobuf/compiler/retention.cc | 327 + src/google/protobuf/compiler/retention.h | 70 + .../protobuf/compiler/retention_unittest.cc | 582 + src/google/protobuf/compiler/ruby/BUILD.bazel | 75 + .../compiler/ruby/ruby_generated_code.proto | 10 + .../compiler/ruby/ruby_generated_code_pb.rb | 85 +- .../ruby/ruby_generated_code_proto2.proto | 10 + .../ruby_generated_code_proto2_import.proto | 12 + .../ruby/ruby_generated_code_proto2_pb.rb | 86 +- .../ruby/ruby_generated_pkg_explicit.proto | 7 + .../ruby_generated_pkg_explicit_legacy.proto | 7 + .../ruby_generated_pkg_explicit_legacy_pb.rb | 28 +- .../ruby/ruby_generated_pkg_explicit_pb.rb | 28 +- .../ruby/ruby_generated_pkg_implicit.proto | 7 + .../ruby/ruby_generated_pkg_implicit_pb.rb | 28 +- .../protobuf/compiler/ruby/ruby_generator.cc | 550 +- .../protobuf/compiler/ruby/ruby_generator.h | 40 +- .../compiler/ruby/ruby_generator_unittest.cc | 105 +- src/google/protobuf/compiler/rust/BUILD.bazel | 142 + .../rust/accessors/accessor_generator.h | 100 + .../compiler/rust/accessors/accessors.cc | 79 + .../compiler/rust/accessors/accessors.h | 28 + .../rust/accessors/singular_message.cc | 98 + .../rust/accessors/singular_scalar.cc | 158 + .../rust/accessors/singular_string.cc | 213 + .../rust/accessors/unsupported_field.cc | 28 + src/google/protobuf/compiler/rust/context.cc | 73 + src/google/protobuf/compiler/rust/context.h | 107 + .../protobuf/compiler/rust/generator.cc | 295 + src/google/protobuf/compiler/rust/generator.h | 49 + src/google/protobuf/compiler/rust/message.cc | 498 + src/google/protobuf/compiler/rust/message.h | 34 + src/google/protobuf/compiler/rust/naming.cc | 188 + src/google/protobuf/compiler/rust/naming.h | 47 + src/google/protobuf/compiler/rust/oneof.cc | 308 + src/google/protobuf/compiler/rust/oneof.h | 29 + .../protobuf/compiler/rust/relative_path.cc | 80 + .../protobuf/compiler/rust/relative_path.h | 54 + .../compiler/rust/relative_path_test.cc | 44 + src/google/protobuf/compiler/scc.h | 81 +- src/google/protobuf/compiler/subprocess.cc | 220 +- src/google/protobuf/compiler/subprocess.h | 38 +- src/google/protobuf/compiler/test_plugin.cc | 35 +- .../compiler/test_plugin_injection.bzl | 65 + src/google/protobuf/compiler/versions.h | 53 + .../protobuf/compiler/versions_suffix.h | 26 + .../protobuf/compiler/zip_output_unittest.sh | 29 +- src/google/protobuf/compiler/zip_writer.cc | 68 +- src/google/protobuf/compiler/zip_writer.h | 45 +- src/google/protobuf/cpp_edition_defaults.h | 12 + src/google/protobuf/cpp_features.pb.cc | 307 + src/google/protobuf/cpp_features.pb.h | 313 + src/google/protobuf/cpp_features.proto | 30 + src/google/protobuf/descriptor.cc | 6369 +++-- src/google/protobuf/descriptor.h | 1197 +- src/google/protobuf/descriptor.pb.cc | 18318 ++++++------ src/google/protobuf/descriptor.pb.h | 23029 ++++++++++------ src/google/protobuf/descriptor.proto | 391 +- src/google/protobuf/descriptor_database.cc | 343 +- src/google/protobuf/descriptor_database.h | 88 +- .../protobuf/descriptor_database_unittest.cc | 73 +- src/google/protobuf/descriptor_legacy.h | 97 + src/google/protobuf/descriptor_unittest.cc | 5795 +++- src/google/protobuf/descriptor_visitor.h | 187 + .../protobuf/descriptor_visitor_test.cc | 143 + .../protobuf/drop_unknown_fields_test.cc | 45 +- src/google/protobuf/duration.pb.cc | 465 +- src/google/protobuf/duration.pb.h | 333 +- src/google/protobuf/duration.proto | 5 +- src/google/protobuf/dynamic_message.cc | 571 +- src/google/protobuf/dynamic_message.h | 104 +- .../protobuf/dynamic_message_unittest.cc | 82 +- src/google/protobuf/editions/BUILD | 70 + .../protobuf/editions/codegen_tests/BUILD | 134 + .../editions/codegen_tests/proto2_enum.proto | 20 + .../editions/codegen_tests/proto2_group.proto | 18 + .../codegen_tests/proto2_import.proto | 16 + .../codegen_tests/proto2_optional.proto | 19 + .../codegen_tests/proto2_packed.proto | 14 + .../codegen_tests/proto2_proto3_enum.proto | 18 + .../codegen_tests/proto2_required.proto | 19 + .../codegen_tests/proto2_unpacked.proto | 19 + .../codegen_tests/proto2_utf8_disabled.proto | 16 + .../codegen_tests/proto2_utf8_lite.proto | 17 + .../codegen_tests/proto2_utf8_verify.proto | 14 + .../editions/codegen_tests/proto3_enum.proto | 20 + .../codegen_tests/proto3_implicit.proto | 19 + .../codegen_tests/proto3_import.proto | 16 + .../codegen_tests/proto3_optional.proto | 19 + .../codegen_tests/proto3_packed.proto | 19 + .../codegen_tests/proto3_unpacked.proto | 19 + .../codegen_tests/proto3_utf8_strict.proto | 15 + .../defaults_test_embedded.h.template | 6 + .../protobuf/editions/generated_files_test.cc | 155 + .../editions/generated_reflection_test.cc | 30 + .../golden/compare_cpp_codegen_failure.txt | 58 + .../golden/compare_cpp_codegen_failure.xml | 13 + .../golden/compare_cpp_codegen_multiple.txt | 12 + .../golden/compare_cpp_codegen_multiple.xml | 17 + .../golden/compare_cpp_codegen_success.txt | 6 + .../golden/compare_cpp_codegen_success.xml | 11 + .../golden/editions_transform_proto2.proto | 128 + .../editions_transform_proto2_lite.proto | 22 + ...tions_transform_proto2_utf8_disabled.proto | 21 + .../golden/editions_transform_proto3.proto | 27 + ...tions_transform_proto3_utf8_disabled.proto | 18 + .../editions/golden/simple_proto2.proto | 14 + .../golden/simple_proto2_import.proto | 16 + .../editions/golden/simple_proto3.proto | 14 + .../golden/test_messages_proto2.proto | 623 + .../golden/test_messages_proto3.proto | 307 + .../proto/editions_transform_proto2.proto | 91 + .../editions_transform_proto2_lite.proto | 20 + ...tions_transform_proto2_utf8_disabled.proto | 19 + .../proto/editions_transform_proto3.proto | 25 + ...tions_transform_proto3_utf8_disabled.proto | 19 + .../test_editions_default_features.proto | 30 + src/google/protobuf/empty.pb.cc | 326 +- src/google/protobuf/empty.pb.h | 245 +- src/google/protobuf/empty.proto | 5 +- src/google/protobuf/endian.h | 175 + src/google/protobuf/explicitly_constructed.h | 72 + src/google/protobuf/extension_set.cc | 1396 +- src/google/protobuf/extension_set.h | 1051 +- src/google/protobuf/extension_set_heavy.cc | 314 +- src/google/protobuf/extension_set_inl.h | 94 +- src/google/protobuf/extension_set_unittest.cc | 421 +- src/google/protobuf/feature_resolver.cc | 317 + src/google/protobuf/feature_resolver.h | 70 + src/google/protobuf/feature_resolver_test.cc | 1041 + src/google/protobuf/field_access_listener.h | 155 + src/google/protobuf/field_mask.pb.cc | 438 +- src/google/protobuf/field_mask.pb.h | 370 +- src/google/protobuf/field_mask.proto | 4 +- .../protobuf/generated_enum_reflection.h | 44 +- src/google/protobuf/generated_enum_util.cc | 190 +- src/google/protobuf/generated_enum_util.h | 95 +- .../protobuf/generated_enum_util_test.cc | 357 + .../protobuf/generated_message_bases.cc | 106 + src/google/protobuf/generated_message_bases.h | 67 + .../protobuf/generated_message_reflection.cc | 2599 +- .../protobuf/generated_message_reflection.h | 264 +- .../generated_message_reflection_unittest.cc | 964 +- .../generated_message_table_driven.cc | 103 - .../protobuf/generated_message_table_driven.h | 339 - .../generated_message_table_driven_lite.cc | 106 - .../generated_message_table_driven_lite.h | 876 - .../protobuf/generated_message_tctable_decl.h | 519 + .../generated_message_tctable_full.cc | 96 + .../protobuf/generated_message_tctable_gen.cc | 912 + .../protobuf/generated_message_tctable_gen.h | 165 + .../protobuf/generated_message_tctable_impl.h | 952 + .../generated_message_tctable_lite.cc | 2808 ++ .../generated_message_tctable_lite_test.cc | 904 + src/google/protobuf/generated_message_util.cc | 603 +- src/google/protobuf/generated_message_util.h | 323 +- src/google/protobuf/has_bits.h | 79 +- src/google/protobuf/has_bits_test.cc | 108 + src/google/protobuf/implicit_weak_message.cc | 68 +- src/google/protobuf/implicit_weak_message.h | 137 +- src/google/protobuf/inlined_string_field.cc | 118 + src/google/protobuf/inlined_string_field.h | 563 +- .../protobuf/inlined_string_field_unittest.cc | 36 + src/google/protobuf/internal_message_util.cc | 96 + src/google/protobuf/internal_message_util.h | 27 + .../internal_message_util_unittest.cc | 22 + src/google/protobuf/internal_visibility.h | 42 + .../internal_visibility_for_testing.h | 27 + src/google/protobuf/io/BUILD.bazel | 225 + src/google/protobuf/io/coded_stream.cc | 394 +- src/google/protobuf/io/coded_stream.h | 752 +- .../protobuf/io/coded_stream_unittest.cc | 455 +- src/google/protobuf/io/gzip_stream.cc | 53 +- src/google/protobuf/io/gzip_stream.h | 75 +- .../protobuf/io/gzip_stream_unittest.sh | 44 - src/google/protobuf/io/io_win32.cc | 36 +- src/google/protobuf/io/io_win32.h | 37 +- src/google/protobuf/io/io_win32_unittest.cc | 37 +- src/google/protobuf/io/package_info.h | 29 +- src/google/protobuf/io/printer.cc | 1049 +- src/google/protobuf/io/printer.h | 1160 +- src/google/protobuf/io/printer_death_test.cc | 152 + src/google/protobuf/io/printer_unittest.cc | 1290 +- src/google/protobuf/io/strtod.cc | 248 +- src/google/protobuf/io/strtod.h | 54 +- .../protobuf/io/test_zero_copy_stream.h | 119 + .../protobuf/io/test_zero_copy_stream_test.cc | 196 + src/google/protobuf/io/tokenizer.cc | 318 +- src/google/protobuf/io/tokenizer.h | 120 +- src/google/protobuf/io/tokenizer_unittest.cc | 413 +- src/google/protobuf/io/zero_copy_sink.cc | 45 + src/google/protobuf/io/zero_copy_sink.h | 57 + src/google/protobuf/io/zero_copy_sink_test.cc | 204 + src/google/protobuf/io/zero_copy_stream.cc | 130 +- src/google/protobuf/io/zero_copy_stream.h | 99 +- .../protobuf/io/zero_copy_stream_impl.cc | 90 +- .../protobuf/io/zero_copy_stream_impl.h | 117 +- .../protobuf/io/zero_copy_stream_impl_lite.cc | 395 +- .../protobuf/io/zero_copy_stream_impl_lite.h | 255 +- .../protobuf/io/zero_copy_stream_unittest.cc | 881 +- src/google/protobuf/json/BUILD.bazel | 262 + .../json/internal/descriptor_traits.h | 507 + src/google/protobuf/json/internal/lexer.cc | 517 + src/google/protobuf/json/internal/lexer.h | 336 + .../protobuf/json/internal/lexer_test.cc | 722 + .../protobuf/json/internal/message_path.cc | 44 + .../protobuf/json/internal/message_path.h | 61 + src/google/protobuf/json/internal/parser.cc | 1369 + src/google/protobuf/json/internal/parser.h | 36 + .../protobuf/json/internal/parser_traits.h | 400 + src/google/protobuf/json/internal/unparser.cc | 911 + src/google/protobuf/json/internal/unparser.h | 36 + .../protobuf/json/internal/unparser_traits.h | 415 + .../protobuf/json/internal/untyped_message.cc | 567 + .../protobuf/json/internal/untyped_message.h | 237 + src/google/protobuf/json/internal/writer.cc | 305 + src/google/protobuf/json/internal/writer.h | 218 + .../internal/zero_copy_buffered_stream.cc | 133 + .../json/internal/zero_copy_buffered_stream.h | 332 + .../zero_copy_buffered_stream_test.cc | 156 + src/google/protobuf/json/json.cc | 112 + src/google/protobuf/json/json.h | 161 + src/google/protobuf/json/json_test.cc | 1357 + src/google/protobuf/lite_arena_unittest.cc | 35 +- src/google/protobuf/lite_unittest.cc | 592 +- src/google/protobuf/map.cc | 222 + src/google/protobuf/map.h | 2105 +- src/google/protobuf/map_entry.h | 238 +- src/google/protobuf/map_entry_lite.h | 671 - src/google/protobuf/map_field.cc | 766 +- src/google/protobuf/map_field.h | 937 +- src/google/protobuf/map_field_inl.h | 375 +- src/google/protobuf/map_field_lite.h | 174 +- src/google/protobuf/map_field_test.cc | 361 +- src/google/protobuf/map_lite_test_util.cc | 36 +- src/google/protobuf/map_lite_test_util.h | 31 +- src/google/protobuf/map_lite_unittest.proto | 33 +- src/google/protobuf/map_probe_benchmark.cc | 308 + src/google/protobuf/map_proto2_unittest.proto | 77 +- src/google/protobuf/map_proto3_unittest.proto | 23 + src/google/protobuf/map_test.cc | 3719 +-- src/google/protobuf/map_test.inc | 4286 +++ src/google/protobuf/map_test_util.h | 1564 +- src/google/protobuf/map_test_util.inc | 38 +- src/google/protobuf/map_test_util_impl.h | 84 +- src/google/protobuf/map_type_handler.h | 620 +- src/google/protobuf/map_unittest.proto | 34 +- src/google/protobuf/message.cc | 345 +- src/google/protobuf/message.h | 635 +- src/google/protobuf/message_lite.cc | 380 +- src/google/protobuf/message_lite.h | 343 +- src/google/protobuf/message_unittest.cc | 38 +- src/google/protobuf/message_unittest.inc | 1597 +- src/google/protobuf/metadata.h | 31 +- src/google/protobuf/metadata_lite.h | 175 +- src/google/protobuf/no_field_presence_test.cc | 45 +- src/google/protobuf/package_info.h | 31 +- src/google/protobuf/parse_context.cc | 396 +- src/google/protobuf/parse_context.h | 1117 +- src/google/protobuf/port.cc | 29 + src/google/protobuf/port.h | 221 +- src/google/protobuf/port_def.inc | 1311 +- src/google/protobuf/port_test.cc | 33 + src/google/protobuf/port_undef.inc | 177 +- .../protobuf/preserve_unknown_enum_test.cc | 53 +- .../protobuf/proto3_arena_lite_unittest.cc | 34 +- src/google/protobuf/proto3_arena_unittest.cc | 197 +- src/google/protobuf/proto3_lite_unittest.cc | 33 +- src/google/protobuf/proto3_lite_unittest.inc | 47 +- src/google/protobuf/raw_ptr.cc | 25 + src/google/protobuf/raw_ptr.h | 64 + src/google/protobuf/raw_ptr_test.cc | 101 + src/google/protobuf/redaction_metric_test.cc | 40 + src/google/protobuf/reflection.h | 156 +- src/google/protobuf/reflection_internal.h | 70 +- src/google/protobuf/reflection_mode.cc | 34 + src/google/protobuf/reflection_mode.h | 144 + src/google/protobuf/reflection_mode_test.cc | 92 + src/google/protobuf/reflection_ops.cc | 159 +- src/google/protobuf/reflection_ops.h | 44 +- .../protobuf/reflection_ops_unittest.cc | 60 +- src/google/protobuf/reflection_tester.cc | 1660 ++ src/google/protobuf/reflection_tester.h | 106 + src/google/protobuf/repeated_field.cc | 131 +- src/google/protobuf/repeated_field.h | 3280 +-- .../repeated_field_reflection_unittest.cc | 147 +- .../protobuf/repeated_field_unittest.cc | 985 +- src/google/protobuf/repeated_ptr_field.cc | 290 + src/google/protobuf/repeated_ptr_field.h | 2186 ++ src/google/protobuf/retention_test.cc | 416 + src/google/protobuf/serial_arena.h | 467 + src/google/protobuf/service.cc | 31 +- src/google/protobuf/service.h | 55 +- src/google/protobuf/source_context.pb.cc | 445 +- src/google/protobuf/source_context.pb.h | 348 +- src/google/protobuf/source_context.proto | 4 +- src/google/protobuf/string_block.h | 179 + src/google/protobuf/string_block_test.cc | 152 + src/google/protobuf/string_member_robber.h | 17 + src/google/protobuf/struct.pb.cc | 1454 +- src/google/protobuf/struct.pb.h | 1408 +- src/google/protobuf/struct.proto | 10 +- src/google/protobuf/stubs/BUILD.bazel | 103 + src/google/protobuf/stubs/bytestream.cc | 198 - src/google/protobuf/stubs/bytestream.h | 351 - .../protobuf/stubs/bytestream_unittest.cc | 146 - src/google/protobuf/stubs/callback.h | 41 +- src/google/protobuf/stubs/casts.h | 139 - src/google/protobuf/stubs/common.cc | 272 +- src/google/protobuf/stubs/common.h | 142 +- src/google/protobuf/stubs/common_unittest.cc | 150 +- src/google/protobuf/stubs/fastmem.h | 157 - src/google/protobuf/stubs/hash.h | 122 - src/google/protobuf/stubs/int128.cc | 192 - src/google/protobuf/stubs/int128.h | 387 - src/google/protobuf/stubs/int128_unittest.cc | 517 - src/google/protobuf/stubs/logging.h | 241 - src/google/protobuf/stubs/macros.h | 120 - src/google/protobuf/stubs/map_util.h | 769 - src/google/protobuf/stubs/mathutil.h | 162 - src/google/protobuf/stubs/mutex.h | 186 - src/google/protobuf/stubs/once.h | 55 - src/google/protobuf/stubs/platform_macros.h | 37 +- src/google/protobuf/stubs/port.h | 291 +- src/google/protobuf/stubs/status.cc | 134 - src/google/protobuf/stubs/status.h | 125 - src/google/protobuf/stubs/status_macros.h | 54 +- src/google/protobuf/stubs/status_test.cc | 138 - src/google/protobuf/stubs/statusor.cc | 48 - src/google/protobuf/stubs/statusor.h | 272 - src/google/protobuf/stubs/statusor_test.cc | 274 - src/google/protobuf/stubs/stl_util.h | 71 - src/google/protobuf/stubs/stringpiece.cc | 270 - src/google/protobuf/stubs/stringpiece.h | 489 - .../protobuf/stubs/stringpiece_unittest.cc | 796 - src/google/protobuf/stubs/stringprintf.cc | 176 - src/google/protobuf/stubs/stringprintf.h | 83 - .../protobuf/stubs/stringprintf_unittest.cc | 152 - .../protobuf/stubs/structurally_valid.cc | 615 - .../stubs/structurally_valid_unittest.cc | 70 - src/google/protobuf/stubs/strutil.cc | 2483 -- src/google/protobuf/stubs/strutil.h | 947 - src/google/protobuf/stubs/strutil_unittest.cc | 895 - src/google/protobuf/stubs/substitute.cc | 138 - src/google/protobuf/stubs/substitute.h | 174 - src/google/protobuf/stubs/template_util.h | 138 - .../protobuf/stubs/template_util_unittest.cc | 130 - src/google/protobuf/stubs/time.cc | 365 - src/google/protobuf/stubs/time.h | 80 - src/google/protobuf/stubs/time_test.cc | 261 - .../protobuf/test_messages_proto2.proto | 160 +- .../protobuf/test_messages_proto3.proto | 44 +- src/google/protobuf/test_textproto.h | 54 + src/google/protobuf/test_util.cc | 31 +- src/google/protobuf/test_util.h | 135 +- src/google/protobuf/test_util.inc | 86 +- src/google/protobuf/test_util2.h | 84 +- src/google/protobuf/test_util_lite.cc | 77 +- src/google/protobuf/test_util_lite.h | 36 +- src/google/protobuf/testdata/__init__.py | 0 src/google/protobuf/testdata/golden_message | Bin 531 -> 537 bytes .../testdata/golden_message_oneof_implemented | Bin 515 -> 521 bytes .../protobuf/testdata/map_test_data.txt | 12 +- ...format_unittest_data_oneof_implemented.txt | 3 + .../text_format_unittest_data_pointy.txt | 3 + ...text_format_unittest_data_pointy_oneof.txt | 3 + .../text_format_unittest_extensions_data.txt | 3 + ...format_unittest_extensions_data_pointy.txt | 3 + src/google/protobuf/testing/BUILD.bazel | 48 + src/google/protobuf/testing/file.cc | 132 +- src/google/protobuf/testing/file.h | 80 +- src/google/protobuf/testing/googletest.cc | 147 +- src/google/protobuf/testing/googletest.h | 84 +- src/google/protobuf/testing/zcgunzip.cc | 84 - src/google/protobuf/testing/zcgzip.cc | 87 - src/google/protobuf/text_format.cc | 1142 +- src/google/protobuf/text_format.h | 385 +- src/google/protobuf/text_format_unittest.cc | 949 +- src/google/protobuf/thread_safe_arena.h | 276 + src/google/protobuf/timestamp.pb.cc | 465 +- src/google/protobuf/timestamp.pb.h | 333 +- src/google/protobuf/timestamp.proto | 16 +- src/google/protobuf/type.pb.cc | 3181 ++- src/google/protobuf/type.pb.h | 3487 +-- src/google/protobuf/type.proto | 12 +- src/google/protobuf/unittest.proto | 798 +- src/google/protobuf/unittest_arena.proto | 35 +- .../protobuf/unittest_custom_options.proto | 63 +- .../unittest_drop_unknown_fields.proto | 37 +- .../unittest_embed_optimize_for.proto | 32 +- src/google/protobuf/unittest_empty.proto | 32 +- .../unittest_enormous_descriptor.proto | 32 +- .../protobuf/unittest_extension_set.proto | 28 + src/google/protobuf/unittest_features.proto | 183 + src/google/protobuf/unittest_import.proto | 30 +- .../protobuf/unittest_import_lite.proto | 35 +- .../protobuf/unittest_import_public.proto | 29 +- .../unittest_import_public_lite.proto | 30 +- .../protobuf/unittest_invalid_features.proto | 24 + .../protobuf/unittest_lazy_dependencies.proto | 42 +- ...test_lazy_dependencies_custom_option.proto | 43 +- .../unittest_lazy_dependencies_enum.proto | 40 +- src/google/protobuf/unittest_lite.proto | 80 +- .../unittest_lite_imports_nonlite.proto | 30 +- src/google/protobuf/unittest_mset.proto | 49 +- .../protobuf/unittest_mset_wire_format.proto | 40 +- .../protobuf/unittest_no_field_presence.proto | 131 +- .../unittest_no_generic_services.proto | 32 +- .../protobuf/unittest_optimize_for.proto | 32 +- .../unittest_preserve_unknown_enum.proto | 41 +- .../unittest_preserve_unknown_enum2.proto | 41 +- src/google/protobuf/unittest_proto3.proto | 32 +- .../protobuf/unittest_proto3_arena.proto | 48 +- .../protobuf/unittest_proto3_arena_lite.proto | 29 +- .../protobuf/unittest_proto3_bad_macros.proto | 75 + .../protobuf/unittest_proto3_lite.proto | 29 +- .../protobuf/unittest_proto3_optional.proto | 51 +- src/google/protobuf/unittest_retention.proto | 185 + .../protobuf/unittest_well_known_types.proto | 7 + src/google/protobuf/unknown_field_set.cc | 146 +- src/google/protobuf/unknown_field_set.h | 116 +- .../protobuf/unknown_field_set_unittest.cc | 243 +- src/google/protobuf/util/BUILD.bazel | 296 + .../protobuf/util/delimited_message_util.cc | 55 +- .../protobuf/util/delimited_message_util.h | 43 +- .../util/delimited_message_util_test.cc | 66 +- src/google/protobuf/util/field_comparator.cc | 156 +- src/google/protobuf/util/field_comparator.h | 120 +- .../protobuf/util/field_comparator_test.cc | 380 +- src/google/protobuf/util/field_mask_util.cc | 291 +- src/google/protobuf/util/field_mask_util.h | 73 +- .../protobuf/util/field_mask_util_test.cc | 48 +- src/google/protobuf/util/internal/constants.h | 99 - .../protobuf/util/internal/datapiece.cc | 424 - src/google/protobuf/util/internal/datapiece.h | 220 - .../internal/default_value_objectwriter.cc | 629 - .../internal/default_value_objectwriter.h | 331 - .../default_value_objectwriter_test.cc | 191 - .../protobuf/util/internal/error_listener.cc | 42 - .../protobuf/util/internal/error_listener.h | 109 - .../util/internal/expecting_objectwriter.h | 247 - .../util/internal/field_mask_utility.cc | 226 - .../util/internal/field_mask_utility.h | 73 - .../protobuf/util/internal/json_escaping.cc | 369 - .../protobuf/util/internal/json_escaping.h | 96 - .../util/internal/json_objectwriter.cc | 189 - .../util/internal/json_objectwriter.h | 275 - .../util/internal/json_objectwriter_test.cc | 313 - .../util/internal/json_stream_parser.cc | 950 - .../util/internal/json_stream_parser.h | 302 - .../util/internal/json_stream_parser_test.cc | 917 - .../protobuf/util/internal/location_tracker.h | 69 - .../util/internal/mock_error_listener.h | 68 - .../util/internal/object_location_tracker.h | 64 - .../protobuf/util/internal/object_source.h | 84 - .../protobuf/util/internal/object_writer.cc | 93 - .../protobuf/util/internal/object_writer.h | 147 - .../protobuf/util/internal/proto_writer.cc | 837 - .../protobuf/util/internal/proto_writer.h | 378 - .../util/internal/protostream_objectsource.cc | 1156 - .../util/internal/protostream_objectsource.h | 342 - .../internal/protostream_objectsource_test.cc | 1164 - .../util/internal/protostream_objectwriter.cc | 1361 - .../util/internal/protostream_objectwriter.h | 424 - .../internal/protostream_objectwriter_test.cc | 2980 -- .../util/internal/structured_objectwriter.h | 119 - .../util/internal/testdata/anys.proto | 114 - .../util/internal/testdata/books.proto | 251 - .../internal/testdata/default_value.proto | 170 - .../testdata/default_value_test.proto | 53 - .../util/internal/testdata/field_mask.proto | 71 - .../util/internal/testdata/maps.proto | 148 - .../util/internal/testdata/oneofs.proto | 77 - .../util/internal/testdata/proto3.proto | 42 - .../util/internal/testdata/struct.proto | 117 - .../testdata/timestamp_duration.proto | 80 - .../util/internal/testdata/wrappers.proto | 100 - .../protobuf/util/internal/type_info.cc | 181 - src/google/protobuf/util/internal/type_info.h | 97 - .../util/internal/type_info_test_helper.cc | 131 - .../util/internal/type_info_test_helper.h | 95 - src/google/protobuf/util/internal/utility.cc | 415 - src/google/protobuf/util/internal/utility.h | 203 - src/google/protobuf/util/json_format.proto | 40 +- .../protobuf/util/json_format_proto3.proto | 148 +- src/google/protobuf/util/json_util.cc | 281 - src/google/protobuf/util/json_util.h | 196 +- src/google/protobuf/util/json_util_test.cc | 649 - .../protobuf/util/message_differencer.cc | 1001 +- .../protobuf/util/message_differencer.h | 330 +- .../util/message_differencer_unittest.cc | 491 +- .../util/message_differencer_unittest.proto | 32 +- .../message_differencer_unittest_proto3.proto | 21 + src/google/protobuf/util/package_info.h | 29 +- src/google/protobuf/util/time_util.cc | 348 +- src/google/protobuf/util/time_util.h | 132 +- src/google/protobuf/util/time_util_test.cc | 234 +- src/google/protobuf/util/type_resolver.h | 52 +- .../protobuf/util/type_resolver_util.cc | 602 +- src/google/protobuf/util/type_resolver_util.h | 50 +- .../protobuf/util/type_resolver_util_test.cc | 479 +- src/google/protobuf/varint_shuffle.h | 163 + src/google/protobuf/varint_shuffle_test.cc | 308 + .../protobuf/well_known_types_unittest.cc | 38 +- src/google/protobuf/wire_format.cc | 513 +- src/google/protobuf/wire_format.h | 144 +- src/google/protobuf/wire_format_lite.cc | 267 +- src/google/protobuf/wire_format_lite.h | 1217 +- src/google/protobuf/wire_format_unittest.cc | 1612 +- src/google/protobuf/wire_format_unittest.inc | 1732 ++ src/google/protobuf/wrappers.pb.cc | 2863 +- src/google/protobuf/wrappers.pb.h | 2119 +- src/google/protobuf/wrappers.proto | 6 +- src/libprotobuf-lite.map | 3 + src/libprotobuf.map | 3 + src/libprotoc.map | 3 + tests.sh | 823 - third_party/BUILD | 1 - third_party/BUILD.bazel | 4 + .../abseil-cpp/absl/algorithm/algorithm.h | 159 + .../abseil-cpp/absl/algorithm/container.h | 1774 ++ third_party/abseil-cpp/absl/base/attributes.h | 835 + third_party/abseil-cpp/absl/base/call_once.h | 219 + third_party/abseil-cpp/absl/base/casts.h | 180 + third_party/abseil-cpp/absl/base/config.h | 937 + third_party/abseil-cpp/absl/base/const_init.h | 76 + .../absl/base/dynamic_annotations.h | 496 + .../absl/base/internal/atomic_hook.h | 200 + .../base/internal/atomic_hook_test_helper.h | 34 + .../absl/base/internal/cycleclock.h | 144 + .../absl/base/internal/cycleclock_config.h | 55 + .../absl/base/internal/direct_mmap.h | 175 + .../absl/base/internal/dynamic_annotations.h | 398 + .../abseil-cpp/absl/base/internal/endian.h | 282 + .../absl/base/internal/errno_saver.h | 43 + .../base/internal/exception_safety_testing.h | 1109 + .../absl/base/internal/exception_testing.h | 42 + .../absl/base/internal/fast_type_id.h | 50 + .../abseil-cpp/absl/base/internal/hide_ptr.h | 51 + .../abseil-cpp/absl/base/internal/identity.h | 37 + .../absl/base/internal/inline_variable.h | 107 + .../base/internal/inline_variable_testing.h | 46 + .../abseil-cpp/absl/base/internal/invoke.h | 241 + .../absl/base/internal/low_level_alloc.h | 127 + .../absl/base/internal/low_level_scheduling.h | 134 + .../absl/base/internal/nullability_impl.h | 106 + .../absl/base/internal/per_thread_tls.h | 52 + .../abseil-cpp/absl/base/internal/prefetch.h | 137 + .../absl/base/internal/pretty_function.h | 33 + .../absl/base/internal/raw_logging.h | 215 + .../absl/base/internal/scheduling_mode.h | 58 + .../absl/base/internal/scoped_set_env.h | 45 + .../abseil-cpp/absl/base/internal/spinlock.h | 252 + .../absl/base/internal/spinlock_wait.h | 95 + .../abseil-cpp/absl/base/internal/strerror.h | 39 + .../abseil-cpp/absl/base/internal/sysinfo.h | 74 + .../absl/base/internal/thread_annotations.h | 280 + .../absl/base/internal/thread_identity.h | 269 + .../absl/base/internal/throw_delegate.h | 75 + .../absl/base/internal/tsan_mutex_interface.h | 68 + .../absl/base/internal/unaligned_access.h | 82 + .../absl/base/internal/unscaledcycleclock.h | 96 + .../base/internal/unscaledcycleclock_config.h | 62 + .../abseil-cpp/absl/base/log_severity.h | 172 + third_party/abseil-cpp/absl/base/macros.h | 141 + .../abseil-cpp/absl/base/nullability.h | 224 + .../abseil-cpp/absl/base/optimization.h | 304 + third_party/abseil-cpp/absl/base/options.h | 232 + .../abseil-cpp/absl/base/policy_checks.h | 113 + third_party/abseil-cpp/absl/base/port.h | 25 + third_party/abseil-cpp/absl/base/prefetch.h | 198 + .../abseil-cpp/absl/base/thread_annotations.h | 335 + third_party/abseil-cpp/absl/cleanup/cleanup.h | 140 + .../absl/cleanup/internal/cleanup.h | 100 + .../abseil-cpp/absl/container/btree_map.h | 885 + .../abseil-cpp/absl/container/btree_set.h | 821 + .../abseil-cpp/absl/container/btree_test.h | 166 + .../abseil-cpp/absl/container/fixed_array.h | 556 + .../abseil-cpp/absl/container/flat_hash_map.h | 617 + .../abseil-cpp/absl/container/flat_hash_set.h | 507 + .../absl/container/inlined_vector.h | 1002 + .../absl/container/internal/btree.h | 3058 ++ .../absl/container/internal/btree_container.h | 763 + .../absl/container/internal/common.h | 207 + .../container/internal/common_policy_traits.h | 132 + .../container/internal/compressed_tuple.h | 272 + .../container/internal/container_memory.h | 454 + .../container/internal/counting_allocator.h | 122 + .../internal/hash_function_defaults.h | 209 + .../internal/hash_generator_testing.h | 182 + .../container/internal/hash_policy_testing.h | 184 + .../container/internal/hash_policy_traits.h | 157 + .../absl/container/internal/hashtable_debug.h | 110 + .../internal/hashtable_debug_hooks.h | 85 + .../container/internal/hashtablez_sampler.h | 267 + .../absl/container/internal/inlined_vector.h | 1090 + .../absl/container/internal/layout.h | 743 + .../container/internal/node_slot_policy.h | 92 + .../absl/container/internal/raw_hash_map.h | 215 + .../absl/container/internal/raw_hash_set.h | 2886 ++ .../internal/test_instance_tracker.h | 274 + .../absl/container/internal/tracked.h | 83 + .../internal/unordered_map_constructor_test.h | 494 + .../internal/unordered_map_lookup_test.h | 117 + .../internal/unordered_map_members_test.h | 87 + .../internal/unordered_map_modifiers_test.h | 352 + .../internal/unordered_set_constructor_test.h | 496 + .../internal/unordered_set_lookup_test.h | 91 + .../internal/unordered_set_members_test.h | 86 + .../internal/unordered_set_modifiers_test.h | 221 + .../abseil-cpp/absl/container/node_hash_map.h | 608 + .../abseil-cpp/absl/container/node_hash_set.h | 504 + third_party/abseil-cpp/absl/crc/crc32c.h | 190 + .../abseil-cpp/absl/crc/internal/cpu_detect.h | 57 + .../abseil-cpp/absl/crc/internal/crc.h | 83 + .../internal/crc32_x86_arm_combined_simd.h | 269 + .../abseil-cpp/absl/crc/internal/crc32c.h | 39 + .../absl/crc/internal/crc32c_inline.h | 72 + .../absl/crc/internal/crc_cord_state.h | 159 + .../absl/crc/internal/crc_internal.h | 177 + .../abseil-cpp/absl/crc/internal/crc_memcpy.h | 119 + .../internal/non_temporal_arm_intrinsics.h | 79 + .../absl/crc/internal/non_temporal_memcpy.h | 180 + .../absl/debugging/failure_signal_handler.h | 121 + .../debugging/internal/address_is_readable.h | 32 + .../absl/debugging/internal/demangle.h | 71 + .../absl/debugging/internal/elf_mem_image.h | 140 + .../absl/debugging/internal/examine_stack.h | 64 + .../debugging/internal/stack_consumption.h | 50 + .../debugging/internal/stacktrace_config.h | 88 + .../absl/debugging/internal/symbolize.h | 153 + .../absl/debugging/internal/vdso_support.h | 158 + .../abseil-cpp/absl/debugging/leak_check.h | 150 + .../abseil-cpp/absl/debugging/stacktrace.h | 231 + .../abseil-cpp/absl/debugging/symbolize.h | 99 + .../abseil-cpp/absl/flags/commandlineflag.h | 200 + third_party/abseil-cpp/absl/flags/config.h | 68 + third_party/abseil-cpp/absl/flags/declare.h | 73 + third_party/abseil-cpp/absl/flags/flag.h | 310 + .../absl/flags/internal/commandlineflag.h | 68 + .../abseil-cpp/absl/flags/internal/flag.h | 801 + .../abseil-cpp/absl/flags/internal/parse.h | 70 + .../absl/flags/internal/path_util.h | 62 + .../flags/internal/private_handle_accessor.h | 61 + .../absl/flags/internal/program_name.h | 50 + .../abseil-cpp/absl/flags/internal/registry.h | 97 + .../absl/flags/internal/sequence_lock.h | 187 + .../abseil-cpp/absl/flags/internal/usage.h | 106 + .../abseil-cpp/absl/flags/marshalling.h | 361 + third_party/abseil-cpp/absl/flags/parse.h | 130 + .../abseil-cpp/absl/flags/reflection.h | 90 + third_party/abseil-cpp/absl/flags/usage.h | 43 + .../abseil-cpp/absl/flags/usage_config.h | 135 + .../absl/functional/any_invocable.h | 324 + .../abseil-cpp/absl/functional/bind_front.h | 193 + .../abseil-cpp/absl/functional/function_ref.h | 143 + .../absl/functional/internal/any_invocable.h | 891 + .../absl/functional/internal/front_binder.h | 95 + .../absl/functional/internal/function_ref.h | 116 + third_party/abseil-cpp/absl/hash/hash.h | 424 + .../abseil-cpp/absl/hash/hash_testing.h | 378 + .../abseil-cpp/absl/hash/internal/city.h | 78 + .../abseil-cpp/absl/hash/internal/hash.h | 1328 + .../abseil-cpp/absl/hash/internal/hash_test.h | 87 + .../absl/hash/internal/low_level_hash.h | 50 + .../absl/hash/internal/spy_hash_state.h | 266 + third_party/abseil-cpp/absl/log/absl_check.h | 117 + third_party/abseil-cpp/absl/log/absl_log.h | 103 + third_party/abseil-cpp/absl/log/check.h | 209 + third_party/abseil-cpp/absl/log/die_if_null.h | 76 + third_party/abseil-cpp/absl/log/flags.h | 43 + third_party/abseil-cpp/absl/log/globals.h | 195 + third_party/abseil-cpp/absl/log/initialize.h | 45 + .../absl/log/internal/append_truncated.h | 47 + .../abseil-cpp/absl/log/internal/check_impl.h | 150 + .../abseil-cpp/absl/log/internal/check_op.h | 394 + .../abseil-cpp/absl/log/internal/conditions.h | 228 + .../abseil-cpp/absl/log/internal/config.h | 45 + .../abseil-cpp/absl/log/internal/flags.h | 53 + .../abseil-cpp/absl/log/internal/globals.h | 101 + .../abseil-cpp/absl/log/internal/log_format.h | 78 + .../abseil-cpp/absl/log/internal/log_impl.h | 216 + .../absl/log/internal/log_message.h | 377 + .../absl/log/internal/log_sink_set.h | 54 + .../abseil-cpp/absl/log/internal/nullguard.h | 88 + .../abseil-cpp/absl/log/internal/nullstream.h | 136 + .../abseil-cpp/absl/log/internal/proto.h | 288 + .../abseil-cpp/absl/log/internal/strip.h | 71 + .../abseil-cpp/absl/log/internal/structured.h | 58 + .../absl/log/internal/test_actions.h | 90 + .../absl/log/internal/test_helpers.h | 71 + .../absl/log/internal/test_matchers.h | 94 + .../abseil-cpp/absl/log/internal/voidify.h | 44 + third_party/abseil-cpp/absl/log/log.h | 320 + third_party/abseil-cpp/absl/log/log_entry.h | 220 + third_party/abseil-cpp/absl/log/log_sink.h | 64 + .../abseil-cpp/absl/log/log_sink_registry.h | 61 + .../abseil-cpp/absl/log/log_streamer.h | 171 + .../abseil-cpp/absl/log/scoped_mock_log.h | 197 + third_party/abseil-cpp/absl/log/structured.h | 70 + third_party/abseil-cpp/absl/memory/memory.h | 278 + .../abseil-cpp/absl/meta/type_traits.h | 564 + third_party/abseil-cpp/absl/numeric/bits.h | 177 + third_party/abseil-cpp/absl/numeric/int128.h | 1162 + .../absl/numeric/int128_have_intrinsic.inc | 293 + .../absl/numeric/int128_no_intrinsic.inc | 328 + .../abseil-cpp/absl/numeric/internal/bits.h | 358 + .../absl/numeric/internal/representation.h | 55 + .../profiling/internal/exponential_biased.h | 130 + .../profiling/internal/periodic_sampler.h | 211 + .../absl/profiling/internal/sample_recorder.h | 253 + .../absl/random/bernoulli_distribution.h | 200 + .../absl/random/beta_distribution.h | 427 + .../abseil-cpp/absl/random/bit_gen_ref.h | 185 + .../absl/random/discrete_distribution.h | 247 + .../abseil-cpp/absl/random/distributions.h | 452 + .../absl/random/exponential_distribution.h | 165 + .../absl/random/gaussian_distribution.h | 275 + .../absl/random/internal/chi_square.h | 89 + .../random/internal/distribution_caller.h | 95 + .../random/internal/distribution_test_util.h | 113 + .../absl/random/internal/explicit_seed_seq.h | 92 + .../absl/random/internal/fast_uniform_bits.h | 271 + .../absl/random/internal/fastmath.h | 57 + .../absl/random/internal/generate_real.h | 144 + .../random/internal/iostream_state_saver.h | 245 + .../absl/random/internal/mock_helpers.h | 135 + .../absl/random/internal/mock_overload_set.h | 100 + .../absl/random/internal/nanobenchmark.h | 172 + .../absl/random/internal/nonsecure_base.h | 161 + .../absl/random/internal/pcg_engine.h | 287 + .../absl/random/internal/platform.h | 171 + .../absl/random/internal/pool_urbg.h | 131 + .../abseil-cpp/absl/random/internal/randen.h | 96 + .../absl/random/internal/randen_detect.h | 33 + .../absl/random/internal/randen_engine.h | 264 + .../absl/random/internal/randen_hwaes.h | 50 + .../absl/random/internal/randen_slow.h | 40 + .../absl/random/internal/randen_traits.h | 88 + .../absl/random/internal/salted_seed_seq.h | 165 + .../absl/random/internal/seed_material.h | 104 + .../absl/random/internal/sequence_urbg.h | 60 + .../abseil-cpp/absl/random/internal/traits.h | 149 + .../absl/random/internal/uniform_helper.h | 244 + .../absl/random/internal/wide_multiply.h | 96 + .../random/log_uniform_int_distribution.h | 256 + .../absl/random/mock_distributions.h | 266 + .../abseil-cpp/absl/random/mocking_bit_gen.h | 240 + .../absl/random/poisson_distribution.h | 261 + third_party/abseil-cpp/absl/random/random.h | 189 + .../absl/random/seed_gen_exception.h | 55 + .../abseil-cpp/absl/random/seed_sequences.h | 111 + .../absl/random/uniform_int_distribution.h | 275 + .../absl/random/uniform_real_distribution.h | 202 + .../absl/random/zipf_distribution.h | 272 + .../absl/status/internal/status_internal.h | 91 + .../absl/status/internal/statusor_internal.h | 384 + third_party/abseil-cpp/absl/status/status.h | 901 + .../absl/status/status_payload_printer.h | 51 + third_party/abseil-cpp/absl/status/statusor.h | 790 + third_party/abseil-cpp/absl/strings/ascii.h | 242 + .../abseil-cpp/absl/strings/charconv.h | 120 + third_party/abseil-cpp/absl/strings/cord.h | 1660 ++ .../abseil-cpp/absl/strings/cord_analysis.h | 62 + .../abseil-cpp/absl/strings/cord_buffer.h | 572 + .../absl/strings/cord_test_helpers.h | 122 + .../absl/strings/cordz_test_helpers.h | 151 + .../abseil-cpp/absl/strings/escaping.h | 169 + .../absl/strings/internal/char_map.h | 158 + .../absl/strings/internal/charconv_bigint.h | 423 + .../absl/strings/internal/charconv_parse.h | 99 + .../absl/strings/internal/cord_data_edge.h | 63 + .../absl/strings/internal/cord_internal.h | 917 + .../absl/strings/internal/cord_rep_btree.h | 944 + .../internal/cord_rep_btree_navigator.h | 267 + .../strings/internal/cord_rep_btree_reader.h | 212 + .../absl/strings/internal/cord_rep_consume.h | 47 + .../absl/strings/internal/cord_rep_crc.h | 103 + .../absl/strings/internal/cord_rep_flat.h | 195 + .../absl/strings/internal/cord_rep_ring.h | 607 + .../strings/internal/cord_rep_ring_reader.h | 118 + .../strings/internal/cord_rep_test_util.h | 205 + .../absl/strings/internal/cordz_functions.h | 77 + .../absl/strings/internal/cordz_handle.h | 98 + .../absl/strings/internal/cordz_info.h | 298 + .../strings/internal/cordz_sample_token.h | 97 + .../absl/strings/internal/cordz_statistics.h | 88 + .../strings/internal/cordz_update_scope.h | 71 + .../strings/internal/cordz_update_tracker.h | 123 + .../internal/damerau_levenshtein_distance.h | 34 + .../absl/strings/internal/escaping.h | 57 + .../strings/internal/escaping_test_common.h | 133 + .../strings/internal/has_absl_stringify.h | 55 + .../absl/strings/internal/memutil.h | 40 + .../strings/internal/numbers_test_common.h | 184 + .../absl/strings/internal/ostringstream.h | 114 + .../absl/strings/internal/pow10_helper.h | 40 + .../strings/internal/resize_uninitialized.h | 119 + .../absl/strings/internal/stl_type_traits.h | 248 + .../absl/strings/internal/str_format/arg.h | 623 + .../absl/strings/internal/str_format/bind.h | 234 + .../strings/internal/str_format/checker.h | 100 + .../internal/str_format/constexpr_parser.h | 352 + .../strings/internal/str_format/extension.h | 450 + .../internal/str_format/float_conversion.h | 37 + .../absl/strings/internal/str_format/output.h | 97 + .../absl/strings/internal/str_format/parser.h | 268 + .../absl/strings/internal/str_join_internal.h | 317 + .../strings/internal/str_split_internal.h | 481 + .../absl/strings/internal/string_constant.h | 72 + .../absl/strings/internal/stringify_sink.h | 57 + .../abseil-cpp/absl/strings/internal/utf8.h | 50 + third_party/abseil-cpp/absl/strings/match.h | 119 + third_party/abseil-cpp/absl/strings/numbers.h | 298 + third_party/abseil-cpp/absl/strings/str_cat.h | 530 + .../abseil-cpp/absl/strings/str_format.h | 877 + .../abseil-cpp/absl/strings/str_join.h | 287 + .../abseil-cpp/absl/strings/str_replace.h | 219 + .../abseil-cpp/absl/strings/str_split.h | 547 + .../abseil-cpp/absl/strings/string_view.h | 704 + third_party/abseil-cpp/absl/strings/strip.h | 93 + .../abseil-cpp/absl/strings/substitute.h | 755 + .../abseil-cpp/absl/synchronization/barrier.h | 79 + .../absl/synchronization/blocking_counter.h | 101 + .../internal/create_thread_identity.h | 56 + .../absl/synchronization/internal/futex.h | 177 + .../synchronization/internal/futex_waiter.h | 63 + .../synchronization/internal/graphcycles.h | 141 + .../synchronization/internal/kernel_timeout.h | 178 + .../synchronization/internal/per_thread_sem.h | 119 + .../synchronization/internal/pthread_waiter.h | 60 + .../synchronization/internal/sem_waiter.h | 65 + .../synchronization/internal/stdcpp_waiter.h | 56 + .../synchronization/internal/thread_pool.h | 96 + .../absl/synchronization/internal/waiter.h | 69 + .../synchronization/internal/waiter_base.h | 90 + .../synchronization/internal/win32_waiter.h | 71 + .../abseil-cpp/absl/synchronization/mutex.h | 1163 + .../absl/synchronization/notification.h | 123 + third_party/abseil-cpp/absl/time/civil_time.h | 563 + third_party/abseil-cpp/absl/time/clock.h | 74 + .../internal/cctz/include/cctz/civil_time.h | 332 + .../cctz/include/cctz/civil_time_detail.h | 632 + .../internal/cctz/include/cctz/time_zone.h | 460 + .../cctz/include/cctz/zone_info_source.h | 102 + .../time/internal/cctz/src/time_zone_fixed.h | 52 + .../time/internal/cctz/src/time_zone_if.h | 80 + .../time/internal/cctz/src/time_zone_impl.h | 97 + .../time/internal/cctz/src/time_zone_info.h | 128 + .../time/internal/cctz/src/time_zone_libc.h | 60 + .../time/internal/cctz/src/time_zone_posix.h | 132 + .../absl/time/internal/cctz/src/tzfile.h | 126 + .../abseil-cpp/absl/time/internal/test_util.h | 33 + third_party/abseil-cpp/absl/time/time.h | 1815 ++ third_party/abseil-cpp/absl/types/any.h | 519 + .../abseil-cpp/absl/types/bad_any_cast.h | 75 + .../absl/types/bad_optional_access.h | 78 + .../absl/types/bad_variant_access.h | 82 + third_party/abseil-cpp/absl/types/compare.h | 609 + .../absl/types/internal/conformance_aliases.h | 447 + .../types/internal/conformance_archetype.h | 978 + .../absl/types/internal/conformance_profile.h | 933 + .../absl/types/internal/conformance_testing.h | 1386 + .../internal/conformance_testing_helpers.h | 391 + .../abseil-cpp/absl/types/internal/optional.h | 352 + .../absl/types/internal/parentheses.h | 34 + .../abseil-cpp/absl/types/internal/span.h | 139 + .../absl/types/internal/transform_args.h | 246 + .../abseil-cpp/absl/types/internal/variant.h | 1634 ++ third_party/abseil-cpp/absl/types/optional.h | 781 + third_party/abseil-cpp/absl/types/span.h | 748 + third_party/abseil-cpp/absl/types/variant.h | 866 + .../absl/utility/internal/if_constexpr.h | 70 + third_party/abseil-cpp/absl/utility/utility.h | 350 + third_party/jsoncpp.BUILD | 37 + third_party/lunit/BUILD.bazel | 10 + third_party/lunit/LICENSE | 32 + third_party/lunit/README.google | 9 + third_party/lunit/console.lua | 156 + third_party/lunit/lunit.lua | 725 + third_party/six.BUILD | 19 - third_party/utf8_range/.bazelrc | 11 + .../.github/workflows/bazel_tests.yml | 43 + .../.github/workflows/cmake_tests.yml | 61 + third_party/utf8_range/.gitignore | 2 + third_party/utf8_range/BUILD.bazel | 61 + third_party/utf8_range/CMakeLists.txt | 86 + third_party/utf8_range/CONTRIBUTING.md | 31 + third_party/utf8_range/LICENSE | 22 + third_party/utf8_range/README.md | 264 + third_party/utf8_range/UTF-8-demo.txt | 212 + third_party/utf8_range/WORKSPACE | 31 + third_party/utf8_range/ascii.cpp | 222 + third_party/utf8_range/boost.cpp | 15 + .../cmake/utf8_range-config.cmake.in | 7 + .../utf8_range/cmake/utf8_range.pc.cmake | 11 + third_party/utf8_range/fuzz/BUILD.bazel | 9 + third_party/utf8_range/fuzz/utf8_fuzzer.dict | 7 + .../utf8_range/fuzz/utf8_validity_fuzzer.cc | 15 + third_party/utf8_range/lemire-avx2.c | 233 + third_party/utf8_range/lemire-neon.c | 215 + third_party/utf8_range/lemire-sse.c | 206 + third_party/utf8_range/lookup.c | 41 + third_party/utf8_range/main.c | 405 + third_party/utf8_range/naive.c | 92 + third_party/utf8_range/range-avx2.c | 277 + third_party/utf8_range/range-neon.c | 228 + third_party/utf8_range/range-sse.c | 255 + third_party/utf8_range/range2-neon.c | 157 + third_party/utf8_range/range2-sse.c | 170 + .../utf8_corpus_dir/utf8_corpus_durst.txt | 213 + .../utf8_corpus_dir/utf8_corpus_kuhn.txt | Bin 0 -> 23349 bytes third_party/utf8_range/utf8_range.h | 21 + third_party/utf8_range/utf8_to_utf16/Makefile | 11 + third_party/utf8_range/utf8_to_utf16/iconv.c | 51 + third_party/utf8_range/utf8_to_utf16/main.c | 424 + third_party/utf8_range/utf8_to_utf16/naive.c | 133 + third_party/utf8_range/utf8_validity.cc | 460 + third_party/utf8_range/utf8_validity.h | 23 + third_party/utf8_range/utf8_validity_test.cc | 76 + third_party/utf8_range/workspace_deps.bzl | 11 + third_party/zlib.BUILD | 70 + toolchain/BUILD.bazel | 165 + toolchain/cc_toolchain_config.bzl | 234 + toolchain/toolchains.bazelrc | 16 + upb/BUILD | 736 + upb/README.md | 84 + upb/base/BUILD | 53 + upb/base/descriptor_constants.h | 84 + upb/base/internal/log2.h | 38 + upb/base/status.c | 61 + upb/base/status.h | 46 + upb/base/status.hpp | 50 + upb/base/string_view.h | 58 + upb/cmake/BUILD.bazel | 108 + upb/cmake/CMakeLists.txt | 126 + upb/cmake/README.md | 23 + upb/cmake/build_defs.bzl | 59 + upb/cmake/google/protobuf/descriptor.upb.c | 1351 + upb/cmake/google/protobuf/descriptor.upb.h | 6397 +++++ .../protobuf/descriptor.upb_minitable.c | 1357 + .../protobuf/descriptor.upb_minitable.h | 78 + upb/cmake/make_cmakelists.py | 346 + upb/cmake/push_auto_update.sh | 73 + upb/cmake/staleness_test.py | 60 + upb/cmake/staleness_test_lib.py | 194 + upb/collections/BUILD | 36 + upb/collections/array.h | 17 + upb/collections/map.h | 17 + upb/conformance/BUILD | 155 + upb/conformance/conformance_upb.c | 327 + upb/conformance/conformance_upb_failures.txt | 2 + upb/generated_code_support.h | 33 + upb/hash/BUILD | 56 + upb/hash/common.c | 836 + upb/hash/common.h | 174 + upb/hash/int_table.h | 82 + upb/hash/str_table.h | 142 + upb/hash/test.cc | 240 + upb/io/BUILD | 103 + upb/io/README.md | 4 + upb/io/chunked_input_stream.c | 90 + upb/io/chunked_input_stream.h | 33 + upb/io/chunked_output_stream.c | 74 + upb/io/chunked_output_stream.h | 33 + upb/io/string.h | 147 + upb/io/string_test.cc | 107 + upb/io/tokenizer.c | 1000 + upb/io/tokenizer.h | 133 + upb/io/tokenizer_test.cc | 1235 + upb/io/zero_copy_input_stream.h | 109 + upb/io/zero_copy_output_stream.h | 110 + upb/io/zero_copy_stream_test.cc | 271 + upb/json/BUILD | 84 + upb/json/decode.c | 1480 + upb/json/decode.h | 55 + upb/json/decode_test.cc | 102 + upb/json/encode.c | 807 + upb/json/encode.h | 73 + upb/json/encode_test.cc | 120 + upb/json/test.proto | 54 + upb/lex/BUILD | 53 + upb/lex/atoi.c | 48 + upb/lex/atoi.h | 35 + upb/lex/atoi_test.cc | 91 + upb/lex/round_trip.c | 47 + upb/lex/round_trip.h | 35 + upb/lex/strtod.c | 77 + upb/lex/strtod.h | 26 + upb/lex/unicode.c | 37 + upb/lex/unicode.h | 59 + upb/mem/BUILD | 73 + upb/mem/alloc.c | 27 + upb/mem/alloc.h | 78 + upb/mem/arena.c | 368 + upb/mem/arena.h | 132 + upb/mem/arena.hpp | 54 + upb/mem/arena_test.cc | 218 + upb/mem/internal/arena.h | 94 + upb/message/BUILD | 413 + upb/message/accessors.c | 71 + upb/message/accessors.h | 380 + upb/message/accessors_split64.h | 66 + upb/message/accessors_test.cc | 416 + upb/message/array.c | 154 + upb/message/array.h | 98 + upb/message/array_split64.h | 93 + upb/message/array_test.cc | 66 + upb/message/copy.c | 299 + upb/message/copy.h | 48 + upb/message/copy_test.cc | 324 + upb/message/internal/accessors.h | 367 + upb/message/internal/array.h | 138 + upb/message/internal/extension.h | 63 + upb/message/internal/map.h | 173 + upb/message/internal/map_entry.h | 66 + upb/message/internal/map_sorter.h | 112 + upb/message/internal/message.h | 106 + upb/message/internal/types.h | 23 + upb/message/map.c | 145 + upb/message/map.h | 147 + upb/message/map_gencode_util.h | 81 + upb/message/map_sorter.c | 170 + upb/message/map_test.cc | 56 + upb/message/message.c | 154 + upb/message/message.h | 52 + upb/message/promote.c | 355 + upb/message/promote.h | 161 + upb/message/promote_test.cc | 851 + upb/message/tagged_ptr.h | 69 + upb/message/test.cc | 676 + upb/message/test.proto | 180 + upb/message/types.h | 15 + upb/message/utf8_test.cc | 150 + upb/message/utf8_test.proto | 71 + upb/message/value.h | 46 + upb/mini_descriptor/BUILD | 86 + upb/mini_descriptor/build_enum.c | 130 + upb/mini_descriptor/build_enum.h | 42 + upb/mini_descriptor/decode.c | 870 + upb/mini_descriptor/decode.h | 120 + upb/mini_descriptor/internal/base92.c | 26 + upb/mini_descriptor/internal/base92.h | 63 + upb/mini_descriptor/internal/decoder.h | 53 + upb/mini_descriptor/internal/encode.c | 323 + upb/mini_descriptor/internal/encode.h | 92 + upb/mini_descriptor/internal/encode.hpp | 118 + upb/mini_descriptor/internal/encode_test.cc | 297 + upb/mini_descriptor/internal/modifiers.h | 32 + upb/mini_descriptor/internal/wire_constants.h | 72 + upb/mini_descriptor/link.c | 122 + upb/mini_descriptor/link.h | 84 + upb/mini_table/BUILD | 106 + upb/mini_table/compat.c | 109 + upb/mini_table/compat.h | 45 + upb/mini_table/compat_test.cc | 34 + upb/mini_table/enum.h | 38 + upb/mini_table/extension.h | 15 + upb/mini_table/extension_registry.c | 76 + upb/mini_table/extension_registry.h | 85 + upb/mini_table/field.h | 98 + upb/mini_table/file.h | 15 + upb/mini_table/internal/enum.h | 58 + upb/mini_table/internal/extension.h | 27 + upb/mini_table/internal/field.h | 114 + upb/mini_table/internal/file.h | 29 + upb/mini_table/internal/message.c | 19 + upb/mini_table/internal/message.h | 88 + upb/mini_table/internal/sub.h | 18 + upb/mini_table/message.c | 77 + upb/mini_table/message.h | 85 + upb/mini_table/sub.h | 15 + upb/port/BUILD | 52 + upb/port/atomic.h | 83 + upb/port/def.inc | 328 + upb/port/undef.inc | 55 + upb/port/vsnprintf_compat.h | 30 + upb/reflection/common.h | 51 + upb/reflection/def.h | 24 + upb/reflection/def.hpp | 605 + upb/reflection/def_pool.c | 443 + upb/reflection/def_pool.h | 87 + upb/reflection/def_type.c | 30 + upb/reflection/def_type.h | 60 + upb/reflection/desc_state.c | 33 + upb/reflection/enum_def.c | 292 + upb/reflection/enum_def.h | 60 + upb/reflection/enum_reserved_range.c | 63 + upb/reflection/enum_reserved_range.h | 31 + upb/reflection/enum_value_def.c | 125 + upb/reflection/enum_value_def.h | 37 + upb/reflection/extension_range.c | 74 + upb/reflection/extension_range.h | 35 + upb/reflection/field_def.c | 948 + upb/reflection/field_def.h | 74 + upb/reflection/file_def.c | 345 + upb/reflection/file_def.h | 57 + upb/reflection/internal/def_builder.c | 339 + upb/reflection/internal/def_builder.h | 137 + upb/reflection/internal/def_builder_test.cc | 84 + upb/reflection/internal/def_pool.h | 57 + upb/reflection/internal/desc_state.h | 44 + upb/reflection/internal/enum_def.h | 36 + upb/reflection/internal/enum_reserved_range.h | 35 + upb/reflection/internal/enum_value_def.h | 37 + upb/reflection/internal/extension_range.h | 34 + upb/reflection/internal/field_def.h | 56 + upb/reflection/internal/file_def.h | 37 + upb/reflection/internal/message_def.h | 43 + .../internal/message_reserved_range.h | 35 + upb/reflection/internal/method_def.h | 33 + upb/reflection/internal/oneof_def.h | 37 + upb/reflection/internal/service_def.h | 33 + upb/reflection/internal/strdup2.c | 33 + upb/reflection/internal/strdup2.h | 32 + upb/reflection/message.c | 213 + upb/reflection/message.h | 89 + upb/reflection/message.hpp | 19 + upb/reflection/message_def.c | 736 + upb/reflection/message_def.h | 156 + upb/reflection/message_reserved_range.c | 61 + upb/reflection/message_reserved_range.h | 31 + upb/reflection/method_def.c | 105 + upb/reflection/method_def.h | 39 + upb/reflection/oneof_def.c | 208 + upb/reflection/oneof_def.h | 47 + upb/reflection/service_def.c | 109 + upb/reflection/service_def.h | 40 + .../stage0/google/protobuf/descriptor.upb.c | 571 + .../stage0/google/protobuf/descriptor.upb.h | 6445 +++++ upb/test/BUILD | 268 + upb/test/empty.proto | 10 + upb/test/fuzz_util.cc | 168 + upb/test/fuzz_util.h | 61 + upb/test/parse_text_proto.h | 44 + upb/test/proto3_test.cc | 17 + upb/test/proto3_test.proto | 29 + upb/test/test.proto | 102 + upb/test/test_cpp.cc | 108 + upb/test/test_cpp.proto | 19 + upb/test/test_generated_code.cc | 910 + upb/test/test_import_empty_srcs.cc | 14 + upb/test/test_import_empty_srcs.proto | 18 + upb/test/test_mini_table_oneof.cc | 42 + upb/text/BUILD | 47 + upb/text/encode.c | 457 + upb/text/encode.h | 49 + upb/upb.hpp | 18 + upb/upb_so.c | 16 + upb/util/BUILD | 180 + upb/util/README.md | 7 + upb/util/compare.c | 288 + upb/util/compare.h | 46 + upb/util/compare_test.cc | 174 + upb/util/def_to_proto.c | 666 + upb/util/def_to_proto.h | 42 + upb/util/def_to_proto_fuzz_test.cc | 32 + .../def_to_proto_public_import_test.proto | 12 + .../def_to_proto_regular_import_test.proto | 16 + upb/util/def_to_proto_test.cc | 309 + upb/util/def_to_proto_test.h | 125 + upb/util/def_to_proto_test.proto | 110 + upb/util/def_to_proto_weak_import_test.proto | 8 + upb/util/def_to_proto_wweak_import_test.proto | 8 + upb/util/required_fields.c | 302 + upb/util/required_fields.h | 76 + upb/util/required_fields_test.cc | 187 + upb/util/required_fields_test.proto | 28 + upb/wire/BUILD | 123 + upb/wire/decode.c | 1381 + upb/wire/decode.h | 132 + upb/wire/decode_fast.c | 996 + upb/wire/decode_fast.h | 147 + upb/wire/encode.c | 638 + upb/wire/encode.h | 76 + upb/wire/eps_copy_input_stream.c | 19 + upb/wire/eps_copy_input_stream.h | 405 + upb/wire/eps_copy_input_stream_test.cc | 342 + upb/wire/internal/constants.h | 27 + upb/wire/internal/decode.h | 143 + upb/wire/internal/swap.h | 45 + upb/wire/reader.c | 47 + upb/wire/reader.h | 207 + upb/wire/types.h | 21 + update_compatibility_version.py | 56 - update_file_lists.sh | 196 - update_subtrees.sh | 8 + update_version.py | 352 - util/python/BUILD | 20 - version.json | 17 + 3211 files changed, 502311 insertions(+), 371905 deletions(-) create mode 100644 .bazelignore create mode 100644 .bazelrc delete mode 100644 .gitattributes create mode 100644 .readthedocs.yml create mode 100644 BUILD.bazel delete mode 100644 CHANGES.txt create mode 100644 CMakeLists.txt create mode 100644 CODE_OF_CONDUCT.md create mode 100644 Cargo.bazel.lock create mode 100644 Cargo.lock create mode 100644 MODULE.bazel delete mode 100644 Makefile.am create mode 100644 Protobuf-C++.podspec create mode 100644 Protobuf.podspec mode change 100755 => 100644 README.OpenSource create mode 100644 SECURITY.md create mode 100644 bazel/BUILD create mode 100644 bazel/amalgamate.py create mode 100644 bazel/amalgamation.bzl create mode 100644 bazel/build_defs.bzl create mode 100644 bazel/lua.BUILD create mode 100644 bazel/py_proto_library.bzl create mode 100644 bazel/python_downloads.bzl create mode 100644 bazel/system_python.bzl create mode 100644 bazel/upb_c_proto_library.bzl create mode 100644 bazel/upb_minitable_proto_library.bzl create mode 100644 bazel/upb_proto_library.bzl create mode 100644 bazel/upb_proto_library_internal/aspect.bzl create mode 100644 bazel/upb_proto_library_internal/cc_library_func.bzl create mode 100644 bazel/upb_proto_library_internal/copts.bzl create mode 100644 bazel/upb_proto_library_internal/rule.bzl create mode 100644 bazel/upb_proto_reflection_library.bzl create mode 100644 benchmarks/BUILD create mode 100644 benchmarks/BUILD.googleapis delete mode 100644 benchmarks/Makefile.am delete mode 100644 benchmarks/README.md create mode 100644 benchmarks/benchmark.cc delete mode 100644 benchmarks/benchmarks.proto create mode 100644 benchmarks/build_defs.bzl create mode 100644 benchmarks/compare.py delete mode 100644 benchmarks/cpp/cpp_benchmark.cc delete mode 100644 benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto delete mode 100644 benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb delete mode 100644 benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto delete mode 100644 benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb delete mode 100644 benchmarks/datasets/google_message2/benchmark_message2.proto delete mode 100644 benchmarks/datasets/google_message2/dataset.google_message2.pb delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_1.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_2.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_3.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_4.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_5.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_6.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_7.proto delete mode 100644 benchmarks/datasets/google_message3/benchmark_message3_8.proto delete mode 100644 benchmarks/datasets/google_message4/benchmark_message4.proto delete mode 100644 benchmarks/datasets/google_message4/benchmark_message4_1.proto delete mode 100644 benchmarks/datasets/google_message4/benchmark_message4_2.proto delete mode 100644 benchmarks/datasets/google_message4/benchmark_message4_3.proto create mode 100644 benchmarks/descriptor.proto create mode 100644 benchmarks/descriptor_sv.proto delete mode 100755 benchmarks/download_data.sh create mode 100644 benchmarks/empty.proto create mode 100644 benchmarks/gen_protobuf_binary_cc.py create mode 100644 benchmarks/gen_synthetic_protos.py create mode 100644 benchmarks/gen_upb_binary_c.py delete mode 100644 benchmarks/go/go_benchmark_test.go delete mode 100644 benchmarks/google_size.proto delete mode 100644 benchmarks/java/pom.xml delete mode 100644 benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java delete mode 100644 benchmarks/js/benchmark_suite.js delete mode 100644 benchmarks/js/js_benchmark.js delete mode 100644 benchmarks/php/PhpBenchmark.php delete mode 100644 benchmarks/php/autoload.php delete mode 100644 benchmarks/protobuf.js/generate_pbjs_files.js delete mode 100644 benchmarks/protobuf.js/protobufjs_benchmark.js delete mode 100644 benchmarks/python/py_benchmark.py delete mode 100644 benchmarks/python/python_benchmark_messages.cc delete mode 100755 benchmarks/util/big_query_utils.py delete mode 100644 benchmarks/util/data_proto2_to_proto3_util.h delete mode 100644 benchmarks/util/gogo_data_scrubber.cc delete mode 100644 benchmarks/util/proto3_data_stripper.cc delete mode 100644 benchmarks/util/protoc-gen-gogoproto.cc delete mode 100644 benchmarks/util/protoc-gen-proto2_to_proto3.cc delete mode 100644 benchmarks/util/result_parser.py delete mode 100644 benchmarks/util/result_uploader.py delete mode 100644 benchmarks/util/schema_proto2_to_proto3_util.h create mode 100644 build_defs/BUILD.bazel create mode 100644 build_defs/arch_tests.bzl rename cc_proto_blacklist_test.bzl => build_defs/cc_proto_blacklist_test.bzl (92%) rename compiler_config_setting.bzl => build_defs/compiler_config_setting.bzl (100%) create mode 100644 build_defs/cpp_opts.bzl create mode 100644 build_defs/internal_shell.bzl create mode 100644 build_defs/java_opts.bzl create mode 100644 ci/Linux.bazelrc create mode 100644 ci/README.md create mode 100644 ci/Windows.bazelrc create mode 100644 ci/clang_wrapper create mode 100644 ci/clang_wrapper++ create mode 100644 ci/common.bazelrc create mode 100644 ci/macOS.bazelrc create mode 100644 ci/push_auto_update.sh delete mode 100644 cmake/CMakeLists.txt create mode 100644 cmake/abseil-cpp.cmake delete mode 100644 cmake/extract_includes.bat.in create mode 100644 cmake/gtest.cmake create mode 100644 cmake/protobuf-configure-target.cmake create mode 100644 cmake/protobuf-generate.cmake create mode 100644 cmake/utf8_range.cmake delete mode 100644 composer.json delete mode 100644 configure.ac create mode 100644 conformance/BUILD.bazel delete mode 100644 conformance/Makefile.am create mode 100644 conformance/bazel_conformance_test_runner.sh create mode 100644 conformance/conformance_dart.dart delete mode 100755 conformance/conformance_nodejs.js create mode 100644 conformance/conformance_rust.rs create mode 100644 conformance/defs.bzl rename benchmarks/__init__.py => conformance/failure_list_dart_upb.txt (100%) create mode 100644 conformance/failure_list_java_lite.txt create mode 100644 conformance/failure_list_jruby.txt create mode 100644 conformance/failure_list_jruby_ffi.txt delete mode 100644 conformance/failure_list_js.txt delete mode 100644 conformance/failure_list_php_c_32.txt rename benchmarks/python/__init__.py => conformance/failure_list_rust_cc.txt (100%) rename benchmarks/util/__init__.py => conformance/failure_list_rust_upb.txt (100%) create mode 100644 conformance/text_format_failure_list_cpp.txt create mode 100644 conformance/text_format_failure_list_dart_upb.txt create mode 100644 conformance/text_format_failure_list_java_lite.txt create mode 100644 conformance/text_format_failure_list_jruby.txt create mode 100644 conformance/text_format_failure_list_python_cpp.txt create mode 100644 conformance/text_format_failure_list_rust_cc.txt create mode 100644 conformance/text_format_failure_list_rust_upb.txt delete mode 100644 conformance/third_party/jsoncpp/json.h delete mode 100644 conformance/third_party/jsoncpp/jsoncpp.cpp delete mode 100644 csharp/src/AddressBook/Addressbook.cs delete mode 100644 csharp/src/Google.Protobuf.Conformance/Conformance.cs delete mode 100644 csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs delete mode 100644 csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs delete mode 100644 csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs delete mode 100644 csharp/src/Google.Protobuf/Reflection/Descriptor.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Any.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Api.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Type.cs delete mode 100644 csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs create mode 100644 docs/cmake_protobuf_generate.md create mode 100644 docs/cpp_build_systems.md create mode 100644 docs/design/editions/README.md create mode 100644 docs/design/editions/cpp-apis-for-edition-zero.md create mode 100644 docs/design/editions/edition-evolution.md create mode 100644 docs/design/editions/edition-naming.md create mode 100644 docs/design/editions/edition-zero-converged-semantics.md create mode 100644 docs/design/editions/edition-zero-feature-enum-field-closedness.md create mode 100644 docs/design/editions/edition-zero-features.md create mode 100644 docs/design/editions/edition-zero-json-handling.md create mode 100644 docs/design/editions/editions-feature-visibility.md create mode 100644 docs/design/editions/editions-life-of-a-featureset.md create mode 100644 docs/design/editions/images/editions-life-of-a-featureset-image-01.png create mode 100644 docs/design/editions/images/editions-life-of-a-featureset-image-03.png create mode 100644 docs/design/editions/images/editions-life-of-a-featureset-image-04.png create mode 100644 docs/design/editions/java-lite-for-editions.md create mode 100644 docs/design/editions/life-of-an-edition.md create mode 100644 docs/design/editions/protobuf-design-options-attributes.md create mode 100644 docs/design/editions/protobuf-editions-design-features.md create mode 100644 docs/design/editions/protobuf-editions-for-schema-producers.md create mode 100644 docs/design/editions/stricter-schemas-with-editions.md create mode 100644 docs/design/editions/what-are-protobuf-editions.md create mode 100644 docs/design/prototiller/README.md create mode 100644 docs/design/prototiller/editions-tooling.md create mode 100644 docs/design/prototiller/prototiller-reqs-for-edition-zero.md create mode 100644 docs/jvm_aot.md delete mode 100644 docs/performance.md create mode 100644 docs/upb/design.md create mode 100644 docs/upb/render.py create mode 100644 docs/upb/style-guide.md create mode 100644 docs/upb/vs-cpp-protos.md create mode 100644 docs/upb/wrapping-upb.md create mode 100644 examples/.bazelrc delete mode 100644 examples/BUILD create mode 100644 examples/BUILD.bazel create mode 100644 examples/Makefile create mode 100644 examples/add_person.rb rename examples/{ => go/cmd/add_person}/add_person.go (96%) rename examples/{ => go/cmd/add_person}/add_person_test.go (88%) rename examples/{ => go/cmd/list_people}/list_people.go (92%) rename examples/{ => go/cmd/list_people}/list_people_test.go (97%) create mode 100644 examples/go/go.mod create mode 100644 examples/go/go.sum create mode 100644 examples/list_people.rb delete mode 100755 generate_changelog.py create mode 100644 google3_export_generated_files.sh create mode 100644 java/BUILD.bazel delete mode 100644 java/compatibility_tests/README.md delete mode 100644 java/compatibility_tests/v2.5.0/deps/pom.xml delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/pom.xml delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto delete mode 100644 java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto delete mode 100644 java/compatibility_tests/v2.5.0/pom.xml delete mode 100644 java/compatibility_tests/v2.5.0/protos/pom.xml delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto delete mode 100644 java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto delete mode 100755 java/compatibility_tests/v2.5.0/test.sh delete mode 100644 java/compatibility_tests/v2.5.0/tests/pom.xml delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java delete mode 100644 java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java delete mode 100644 java/core/BUILD delete mode 100644 java/core/src/main/java/com/google/protobuf/ProtobufLists.java delete mode 100644 java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java delete mode 100644 java/core/src/test/java/com/google/protobuf/Proto2MessageInfoFactory.java delete mode 100644 java/core/src/test/java/com/google/protobuf/Proto3MessageInfoFactory.java delete mode 100644 java/core/src/test/java/com/google/protobuf/Proto3MessageLiteInfoFactory.java delete mode 100644 java/core/src/test/java/com/google/protobuf/Utf8Utils.java delete mode 100644 java/core/src/test/proto/com/google/protobuf/message_lite_extension_util_test.proto delete mode 100644 java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto create mode 100644 java/internal/BUILD.bazel create mode 100644 java/internal/JavaVersionTest.java create mode 100644 java/internal/testing.bzl create mode 100644 java/kotlin-lite/BUILD.bazel create mode 100644 java/kotlin-lite/generate-sources-build.xml create mode 100644 java/kotlin-lite/generate-test-sources-build.xml create mode 100644 java/kotlin-lite/lite.awk create mode 100644 java/kotlin-lite/pom.xml create mode 100644 java/kotlin-lite/pom_template.xml create mode 100644 java/kotlin-lite/process-lite-sources-build.xml create mode 100644 java/kotlin-lite/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt create mode 100644 java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt create mode 100644 java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt create mode 100644 java/linkage_monitor.sh delete mode 100644 java/lite/BUILD create mode 100644 java/lite/BUILD.bazel create mode 100644 java/lite/pom_template.xml delete mode 100644 java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java create mode 100644 java/test/linkage-monitor-check-bom/pom.xml delete mode 100644 java/util/BUILD create mode 100644 java/util/BUILD.bazel create mode 100644 java/util/pom_template.xml delete mode 100644 java/util/src/main/java/com/google/protobuf/util/TimeUtil.java create mode 100644 java/util/src/test/java/com/google/protobuf/util/DurationsTest.java delete mode 100644 java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java create mode 100644 java/util/src/test/java/com/google/protobuf/util/TimestampsTest.java delete mode 100644 js/README.md delete mode 100644 js/binary/arith.js delete mode 100644 js/binary/arith_test.js delete mode 100644 js/binary/constants.js delete mode 100644 js/binary/decoder.js delete mode 100644 js/binary/decoder_test.js delete mode 100644 js/binary/encoder.js delete mode 100644 js/binary/message_test.js delete mode 100644 js/binary/proto_test.js delete mode 100644 js/binary/reader.js delete mode 100644 js/binary/reader_test.js delete mode 100644 js/binary/utils.js delete mode 100644 js/binary/utils_test.js delete mode 100644 js/binary/writer.js delete mode 100644 js/binary/writer_test.js delete mode 100644 js/commonjs/export.js delete mode 100644 js/commonjs/export_asserts.js delete mode 100644 js/commonjs/export_testdeps.js delete mode 100644 js/commonjs/import_test.js delete mode 100644 js/commonjs/jasmine.json delete mode 100644 js/commonjs/rewrite_tests_for_commonjs.js delete mode 100644 js/commonjs/strict_test.js delete mode 100644 js/commonjs/test6/test6.proto delete mode 100644 js/commonjs/test7/test7.proto delete mode 100644 js/compatibility_tests/v3.0.0/binary/arith_test.js delete mode 100644 js/compatibility_tests/v3.0.0/binary/decoder_test.js delete mode 100644 js/compatibility_tests/v3.0.0/binary/proto_test.js delete mode 100644 js/compatibility_tests/v3.0.0/binary/reader_test.js delete mode 100644 js/compatibility_tests/v3.0.0/binary/utils_test.js delete mode 100644 js/compatibility_tests/v3.0.0/binary/writer_test.js delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/export_asserts.js delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/import_test.js delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/jasmine.json delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto delete mode 100644 js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto delete mode 100644 js/compatibility_tests/v3.0.0/data.proto delete mode 100644 js/compatibility_tests/v3.0.0/debug_test.js delete mode 100644 js/compatibility_tests/v3.0.0/jasmine1.json delete mode 100644 js/compatibility_tests/v3.0.0/jasmine2.json delete mode 100644 js/compatibility_tests/v3.0.0/jasmine3.json delete mode 100644 js/compatibility_tests/v3.0.0/message_test.js delete mode 100644 js/compatibility_tests/v3.0.0/proto3_test.js delete mode 100644 js/compatibility_tests/v3.0.0/proto3_test.proto delete mode 100644 js/compatibility_tests/v3.0.0/test.proto delete mode 100755 js/compatibility_tests/v3.0.0/test.sh delete mode 100644 js/compatibility_tests/v3.0.0/test2.proto delete mode 100644 js/compatibility_tests/v3.0.0/test3.proto delete mode 100644 js/compatibility_tests/v3.0.0/test4.proto delete mode 100644 js/compatibility_tests/v3.0.0/test5.proto delete mode 100644 js/compatibility_tests/v3.0.0/testbinary.proto delete mode 100644 js/compatibility_tests/v3.0.0/testempty.proto delete mode 100644 js/compatibility_tests/v3.1.0/binary/arith_test.js delete mode 100644 js/compatibility_tests/v3.1.0/binary/decoder_test.js delete mode 100644 js/compatibility_tests/v3.1.0/binary/proto_test.js delete mode 100644 js/compatibility_tests/v3.1.0/binary/reader_test.js delete mode 100644 js/compatibility_tests/v3.1.0/binary/utils_test.js delete mode 100644 js/compatibility_tests/v3.1.0/binary/writer_test.js delete mode 100644 js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto delete mode 100644 js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto delete mode 100644 js/compatibility_tests/v3.1.0/data.proto delete mode 100644 js/compatibility_tests/v3.1.0/debug_test.js delete mode 100644 js/compatibility_tests/v3.1.0/maps_test.js delete mode 100644 js/compatibility_tests/v3.1.0/message_test.js delete mode 100644 js/compatibility_tests/v3.1.0/proto3_test.js delete mode 100644 js/compatibility_tests/v3.1.0/proto3_test.proto delete mode 100644 js/compatibility_tests/v3.1.0/test.proto delete mode 100644 js/compatibility_tests/v3.1.0/test2.proto delete mode 100644 js/compatibility_tests/v3.1.0/test3.proto delete mode 100644 js/compatibility_tests/v3.1.0/test4.proto delete mode 100644 js/compatibility_tests/v3.1.0/test5.proto delete mode 100644 js/compatibility_tests/v3.1.0/testbinary.proto delete mode 100644 js/compatibility_tests/v3.1.0/testempty.proto delete mode 100644 js/data.proto delete mode 100644 js/debug.js delete mode 100644 js/debug_test.js delete mode 100644 js/experimental/benchmarks/code_size/apps_jspb/all_types_proto2.js delete mode 100644 js/experimental/benchmarks/code_size/apps_jspb/all_types_proto3.js delete mode 100644 js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto2.js delete mode 100644 js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto3.js delete mode 100644 js/experimental/benchmarks/code_size/code_size_base.js delete mode 100644 js/experimental/benchmarks/code_size/kernel/all_types.js delete mode 100644 js/experimental/benchmarks/code_size/kernel/popular_types.js delete mode 100644 js/experimental/runtime/bytestring.js delete mode 100644 js/experimental/runtime/bytestring_internal.js delete mode 100644 js/experimental/runtime/bytestring_test.js delete mode 100644 js/experimental/runtime/int64.js delete mode 100644 js/experimental/runtime/int64_test.js delete mode 100644 js/experimental/runtime/internal/checks.js delete mode 100644 js/experimental/runtime/internal/checks_test.js delete mode 100644 js/experimental/runtime/kernel/binary_storage.js delete mode 100644 js/experimental/runtime/kernel/binary_storage_test.js delete mode 100644 js/experimental/runtime/kernel/bool_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/buffer_decoder.js delete mode 100644 js/experimental/runtime/kernel/buffer_decoder_helper.js delete mode 100644 js/experimental/runtime/kernel/buffer_decoder_test.js delete mode 100644 js/experimental/runtime/kernel/conformance/conformance_request.js delete mode 100644 js/experimental/runtime/kernel/conformance/conformance_response.js delete mode 100755 js/experimental/runtime/kernel/conformance/conformance_testee.js delete mode 100755 js/experimental/runtime/kernel/conformance/conformance_testee_runner_node.js delete mode 100644 js/experimental/runtime/kernel/conformance/test_all_types_proto2.js delete mode 100644 js/experimental/runtime/kernel/conformance/test_all_types_proto3.js delete mode 100644 js/experimental/runtime/kernel/conformance/wire_format.js delete mode 100644 js/experimental/runtime/kernel/double_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/field.js delete mode 100644 js/experimental/runtime/kernel/fixed32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/float_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/indexer.js delete mode 100644 js/experimental/runtime/kernel/indexer_test.js delete mode 100644 js/experimental/runtime/kernel/int32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/int64_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/internal_message.js delete mode 100644 js/experimental/runtime/kernel/kernel.js delete mode 100644 js/experimental/runtime/kernel/kernel_compatibility_test.js delete mode 100644 js/experimental/runtime/kernel/kernel_repeated_test.js delete mode 100644 js/experimental/runtime/kernel/kernel_test.js delete mode 100644 js/experimental/runtime/kernel/message_set.js delete mode 100644 js/experimental/runtime/kernel/message_set_test.js delete mode 100644 js/experimental/runtime/kernel/packed_bool_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_double_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_fixed32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_float_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_int32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_int64_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_sfixed32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_sfixed64_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_sint32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_sint64_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/packed_uint32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/reader.js delete mode 100644 js/experimental/runtime/kernel/reader_test.js delete mode 100644 js/experimental/runtime/kernel/sfixed32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/sfixed64_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/sint32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/sint64_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/storage.js delete mode 100644 js/experimental/runtime/kernel/tag.js delete mode 100644 js/experimental/runtime/kernel/tag_test.js delete mode 100644 js/experimental/runtime/kernel/textencoding.js delete mode 100644 js/experimental/runtime/kernel/textencoding_test.js delete mode 100644 js/experimental/runtime/kernel/typed_arrays.js delete mode 100644 js/experimental/runtime/kernel/typed_arrays_test.js delete mode 100644 js/experimental/runtime/kernel/uint32_test_pairs.js delete mode 100644 js/experimental/runtime/kernel/uint8arrays.js delete mode 100644 js/experimental/runtime/kernel/uint8arrays_test.js delete mode 100644 js/experimental/runtime/kernel/wire_type.js delete mode 100644 js/experimental/runtime/kernel/writer.js delete mode 100644 js/experimental/runtime/kernel/writer_test.js delete mode 100644 js/experimental/runtime/testing/binary/test_message.js delete mode 100644 js/experimental/runtime/testing/ensure_custom_equality_test.js delete mode 100644 js/experimental/runtime/testing/jasmine_protobuf.js delete mode 100644 js/gulpfile.js delete mode 100644 js/jasmine.json delete mode 100644 js/map.js delete mode 100644 js/maps_test.js delete mode 100644 js/message.js delete mode 100644 js/message_test.js delete mode 100644 js/node_loader.js delete mode 100644 js/package.json delete mode 100644 js/proto3_test.js delete mode 100644 js/proto3_test.proto delete mode 100644 js/test.proto delete mode 100644 js/test10.proto delete mode 100644 js/test11.proto delete mode 100644 js/test12.proto delete mode 100644 js/test13.proto delete mode 100644 js/test14.proto delete mode 100644 js/test15.proto delete mode 100644 js/test2.proto delete mode 100644 js/test3.proto delete mode 100644 js/test4.proto delete mode 100644 js/test5.proto delete mode 100644 js/test8.proto delete mode 100644 js/test9.proto delete mode 100644 js/test_bootstrap.js delete mode 100644 js/testbinary.proto delete mode 100644 js/testempty.proto delete mode 100644 js/testlargenumbers.proto delete mode 100644 kokoro/README.md delete mode 100644 kokoro/docs/common.cfg delete mode 100755 kokoro/docs/publish-python.sh delete mode 100644 kokoro/docs/python.cfg delete mode 100755 kokoro/docs/trampoline.sh delete mode 100644 kokoro/linux/32-bit/Dockerfile delete mode 100755 kokoro/linux/32-bit/build.sh delete mode 100644 kokoro/linux/32-bit/continuous.cfg delete mode 100644 kokoro/linux/32-bit/presubmit.cfg delete mode 100755 kokoro/linux/bazel/build.sh delete mode 100644 kokoro/linux/bazel/continuous.cfg delete mode 100644 kokoro/linux/bazel/presubmit.cfg delete mode 100755 kokoro/linux/benchmark/build.sh delete mode 100644 kokoro/linux/benchmark/continuous.cfg delete mode 100755 kokoro/linux/benchmark/run.sh delete mode 100755 kokoro/linux/build_and_run_docker.sh delete mode 100755 kokoro/linux/cpp_distcheck/build.sh delete mode 100644 kokoro/linux/cpp_distcheck/continuous.cfg delete mode 100644 kokoro/linux/cpp_distcheck/presubmit.cfg delete mode 100755 kokoro/linux/cpp_tcmalloc/build.sh delete mode 100644 kokoro/linux/cpp_tcmalloc/continuous.cfg delete mode 100644 kokoro/linux/cpp_tcmalloc/presubmit.cfg delete mode 100755 kokoro/linux/csharp/build.sh delete mode 100644 kokoro/linux/csharp/continuous.cfg delete mode 100644 kokoro/linux/csharp/presubmit.cfg delete mode 100755 kokoro/linux/dist_install/build.sh delete mode 100644 kokoro/linux/dist_install/continuous.cfg delete mode 100644 kokoro/linux/dist_install/presubmit.cfg delete mode 100755 kokoro/linux/dockerfile/push_testing_images.sh delete mode 100644 kokoro/linux/dockerfile/test/cpp_tcmalloc/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/csharp/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/java_stretch/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/javascript/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/php/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/php80/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/php_32bit/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/python27/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/python35/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/python36/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/python37/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/python38/Dockerfile delete mode 100644 kokoro/linux/dockerfile/test/ruby/Dockerfile delete mode 100755 kokoro/linux/golang/build.sh delete mode 100644 kokoro/linux/golang/continuous.cfg delete mode 100644 kokoro/linux/golang/presubmit.cfg delete mode 100755 kokoro/linux/java_compatibility/build.sh delete mode 100644 kokoro/linux/java_compatibility/continuous.cfg delete mode 100644 kokoro/linux/java_compatibility/presubmit.cfg delete mode 100755 kokoro/linux/java_jdk7/build.sh delete mode 100644 kokoro/linux/java_jdk7/continuous.cfg delete mode 100644 kokoro/linux/java_jdk7/presubmit.cfg delete mode 100755 kokoro/linux/java_linkage_monitor/build.sh delete mode 100644 kokoro/linux/java_linkage_monitor/continuous.cfg delete mode 100644 kokoro/linux/java_linkage_monitor/presubmit.cfg delete mode 100755 kokoro/linux/java_oracle7/build.sh delete mode 100644 kokoro/linux/java_oracle7/continuous.cfg delete mode 100644 kokoro/linux/java_oracle7/presubmit.cfg delete mode 100755 kokoro/linux/javascript/build.sh delete mode 100644 kokoro/linux/javascript/continuous.cfg delete mode 100644 kokoro/linux/javascript/presubmit.cfg delete mode 100644 kokoro/linux/make_test_output.py delete mode 100755 kokoro/linux/php80/build.sh delete mode 100644 kokoro/linux/php80/continuous.cfg delete mode 100644 kokoro/linux/php80/presubmit.cfg delete mode 100755 kokoro/linux/php_all/build.sh delete mode 100644 kokoro/linux/php_all/continuous.cfg delete mode 100644 kokoro/linux/php_all/presubmit.cfg delete mode 100755 kokoro/linux/pull_request_in_docker.sh delete mode 100755 kokoro/linux/python/build.sh delete mode 100644 kokoro/linux/python/continuous.cfg delete mode 100644 kokoro/linux/python/presubmit.cfg delete mode 100755 kokoro/linux/python27/build.sh delete mode 100644 kokoro/linux/python27/continuous.cfg delete mode 100644 kokoro/linux/python27/presubmit.cfg delete mode 100755 kokoro/linux/python27_cpp/build.sh delete mode 100644 kokoro/linux/python27_cpp/continuous.cfg delete mode 100644 kokoro/linux/python27_cpp/presubmit.cfg delete mode 100755 kokoro/linux/python35/build.sh delete mode 100644 kokoro/linux/python35/continuous.cfg delete mode 100644 kokoro/linux/python35/presubmit.cfg delete mode 100755 kokoro/linux/python35_cpp/build.sh delete mode 100644 kokoro/linux/python35_cpp/continuous.cfg delete mode 100644 kokoro/linux/python35_cpp/presubmit.cfg delete mode 100755 kokoro/linux/python36/build.sh delete mode 100644 kokoro/linux/python36/continuous.cfg delete mode 100644 kokoro/linux/python36/presubmit.cfg delete mode 100755 kokoro/linux/python36_cpp/build.sh delete mode 100644 kokoro/linux/python36_cpp/continuous.cfg delete mode 100644 kokoro/linux/python36_cpp/presubmit.cfg delete mode 100755 kokoro/linux/python37/build.sh delete mode 100644 kokoro/linux/python37/continuous.cfg delete mode 100644 kokoro/linux/python37/presubmit.cfg delete mode 100755 kokoro/linux/python37_cpp/build.sh delete mode 100644 kokoro/linux/python37_cpp/continuous.cfg delete mode 100644 kokoro/linux/python37_cpp/presubmit.cfg delete mode 100755 kokoro/linux/python38/build.sh delete mode 100644 kokoro/linux/python38/continuous.cfg delete mode 100644 kokoro/linux/python38/presubmit.cfg delete mode 100755 kokoro/linux/python38_cpp/build.sh delete mode 100644 kokoro/linux/python38_cpp/continuous.cfg delete mode 100644 kokoro/linux/python38_cpp/presubmit.cfg delete mode 100755 kokoro/linux/python_compatibility/build.sh delete mode 100644 kokoro/linux/python_compatibility/continuous.cfg delete mode 100644 kokoro/linux/python_compatibility/presubmit.cfg delete mode 100755 kokoro/linux/python_cpp/build.sh delete mode 100644 kokoro/linux/python_cpp/continuous.cfg delete mode 100644 kokoro/linux/python_cpp/presubmit.cfg delete mode 100755 kokoro/linux/ruby23/build.sh delete mode 100644 kokoro/linux/ruby23/continuous.cfg delete mode 100644 kokoro/linux/ruby23/presubmit.cfg delete mode 100755 kokoro/linux/ruby24/build.sh delete mode 100644 kokoro/linux/ruby24/continuous.cfg delete mode 100644 kokoro/linux/ruby24/presubmit.cfg delete mode 100755 kokoro/linux/ruby25/build.sh delete mode 100644 kokoro/linux/ruby25/continuous.cfg delete mode 100644 kokoro/linux/ruby25/presubmit.cfg delete mode 100755 kokoro/linux/ruby26/build.sh delete mode 100644 kokoro/linux/ruby26/continuous.cfg delete mode 100644 kokoro/linux/ruby26/presubmit.cfg delete mode 100755 kokoro/linux/ruby27/build.sh delete mode 100644 kokoro/linux/ruby27/continuous.cfg delete mode 100644 kokoro/linux/ruby27/presubmit.cfg delete mode 100755 kokoro/macos/cpp/build.sh delete mode 100644 kokoro/macos/cpp/continuous.cfg delete mode 100644 kokoro/macos/cpp/presubmit.cfg delete mode 100755 kokoro/macos/cpp_distcheck/build.sh delete mode 100644 kokoro/macos/cpp_distcheck/continuous.cfg delete mode 100644 kokoro/macos/cpp_distcheck/presubmit.cfg delete mode 100755 kokoro/macos/javascript/build.sh delete mode 100644 kokoro/macos/javascript/continuous.cfg delete mode 100644 kokoro/macos/javascript/presubmit.cfg delete mode 100755 kokoro/macos/objectivec_cocoapods_integration/build.sh delete mode 100644 kokoro/macos/objectivec_cocoapods_integration/continuous.cfg delete mode 100644 kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg delete mode 100755 kokoro/macos/objectivec_ios_debug/build.sh delete mode 100644 kokoro/macos/objectivec_ios_debug/continuous.cfg delete mode 100644 kokoro/macos/objectivec_ios_debug/presubmit.cfg delete mode 100755 kokoro/macos/objectivec_ios_release/build.sh delete mode 100644 kokoro/macos/objectivec_ios_release/continuous.cfg delete mode 100644 kokoro/macos/objectivec_ios_release/presubmit.cfg delete mode 100755 kokoro/macos/objectivec_osx/build.sh delete mode 100644 kokoro/macos/objectivec_osx/continuous.cfg delete mode 100644 kokoro/macos/objectivec_osx/presubmit.cfg delete mode 100755 kokoro/macos/php5.6_mac/build.sh delete mode 100644 kokoro/macos/php5.6_mac/continuous.cfg delete mode 100644 kokoro/macos/php5.6_mac/presubmit.cfg delete mode 100755 kokoro/macos/php7.0_mac/build.sh delete mode 100644 kokoro/macos/php7.0_mac/continuous.cfg delete mode 100644 kokoro/macos/php7.0_mac/presubmit.cfg delete mode 100755 kokoro/macos/php7.3_mac/build.sh delete mode 100644 kokoro/macos/php7.3_mac/continuous.cfg delete mode 100644 kokoro/macos/php7.3_mac/presubmit.cfg delete mode 100755 kokoro/macos/prepare_build_macos_rc delete mode 100755 kokoro/macos/python/build.sh delete mode 100644 kokoro/macos/python/continuous.cfg delete mode 100644 kokoro/macos/python/presubmit.cfg delete mode 100755 kokoro/macos/python_cpp/build.sh delete mode 100644 kokoro/macos/python_cpp/continuous.cfg delete mode 100644 kokoro/macos/python_cpp/presubmit.cfg delete mode 100755 kokoro/macos/ruby23/build.sh delete mode 100644 kokoro/macos/ruby23/continuous.cfg delete mode 100644 kokoro/macos/ruby23/presubmit.cfg delete mode 100755 kokoro/macos/ruby24/build.sh delete mode 100644 kokoro/macos/ruby24/continuous.cfg delete mode 100644 kokoro/macos/ruby24/presubmit.cfg delete mode 100755 kokoro/macos/ruby25/build.sh delete mode 100644 kokoro/macos/ruby25/continuous.cfg delete mode 100644 kokoro/macos/ruby25/presubmit.cfg delete mode 100755 kokoro/macos/ruby26/build.sh delete mode 100644 kokoro/macos/ruby26/continuous.cfg delete mode 100644 kokoro/macos/ruby26/presubmit.cfg delete mode 100755 kokoro/macos/ruby27/build.sh delete mode 100644 kokoro/macos/ruby27/continuous.cfg delete mode 100644 kokoro/macos/ruby27/presubmit.cfg delete mode 100644 kokoro/release/collect_all_artifacts.cfg delete mode 100755 kokoro/release/collect_all_artifacts.sh delete mode 100644 kokoro/release/csharp/windows/build_nuget.bat delete mode 100644 kokoro/release/csharp/windows/continuous.cfg delete mode 100644 kokoro/release/csharp/windows/presubmit.cfg delete mode 100644 kokoro/release/csharp/windows/release.cfg delete mode 100755 kokoro/release/protoc/linux/build.sh delete mode 100644 kokoro/release/protoc/linux/release.cfg delete mode 100755 kokoro/release/protoc/macos/build.sh delete mode 100644 kokoro/release/protoc/macos/release.cfg delete mode 100644 kokoro/release/protoc/windows/build.bat delete mode 100644 kokoro/release/protoc/windows/release.cfg delete mode 100755 kokoro/release/python/linux/build_artifacts.sh delete mode 100644 kokoro/release/python/linux/config.sh delete mode 100644 kokoro/release/python/linux/continuous.cfg delete mode 100644 kokoro/release/python/linux/presubmit.cfg delete mode 100644 kokoro/release/python/linux/release.cfg delete mode 100755 kokoro/release/python/macos/build_artifacts.sh delete mode 100644 kokoro/release/python/macos/config.sh delete mode 100644 kokoro/release/python/macos/continuous.cfg delete mode 100644 kokoro/release/python/macos/presubmit.cfg delete mode 100644 kokoro/release/python/macos/release.cfg delete mode 100644 kokoro/release/python/windows/build_artifacts.bat delete mode 100644 kokoro/release/python/windows/build_single_artifact.bat delete mode 100644 kokoro/release/python/windows/continuous.cfg delete mode 100644 kokoro/release/python/windows/presubmit.cfg delete mode 100644 kokoro/release/python/windows/release.cfg delete mode 100755 kokoro/release/ruby/linux/build_artifacts.sh delete mode 100644 kokoro/release/ruby/linux/continuous.cfg delete mode 100755 kokoro/release/ruby/linux/prepare_build.sh delete mode 100644 kokoro/release/ruby/linux/presubmit.cfg delete mode 100644 kokoro/release/ruby/linux/release.cfg delete mode 100755 kokoro/release/ruby/linux/ruby/ruby_build.sh delete mode 100755 kokoro/release/ruby/linux/ruby/ruby_build_environment.sh delete mode 100755 kokoro/release/ruby/macos/build_artifacts.sh delete mode 100644 kokoro/release/ruby/macos/continuous.cfg delete mode 100644 kokoro/release/ruby/macos/presubmit.cfg delete mode 100644 kokoro/release/ruby/macos/release.cfg delete mode 100755 kokoro/release/ruby/macos/ruby/ruby_build.sh delete mode 100755 kokoro/release/ruby/macos/ruby/ruby_build_environment.sh delete mode 100644 kokoro/windows/csharp/build.bat delete mode 100644 kokoro/windows/csharp/continuous.cfg delete mode 100644 kokoro/windows/csharp/presubmit.cfg create mode 100644 lua/BUILD.bazel create mode 100644 lua/README.md create mode 100644 lua/def.c create mode 100644 lua/lua_proto_library.bzl create mode 100644 lua/main.c create mode 100644 lua/msg.c create mode 100644 lua/test.proto create mode 100644 lua/test_upb.lua create mode 100644 lua/upb.c create mode 100644 lua/upb.h create mode 100644 lua/upb.lua create mode 100644 lua/upbc.cc create mode 100644 maven_install.json create mode 100644 objectivec/BUILD.bazel mode change 100755 => 100644 objectivec/DevTools/check_version_stamps.sh mode change 100755 => 100644 objectivec/DevTools/compile_testing_protos.sh mode change 100755 => 100644 objectivec/DevTools/full_mac_build.sh mode change 100755 => 100644 objectivec/DevTools/pddm.py mode change 100755 => 100644 objectivec/DevTools/pddm_tests.py create mode 100644 objectivec/DevTools/sources_pddm_expansion_test.sh delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static delete mode 100644 objectivec/Tests/CocoaPods/README.md delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m delete mode 100755 objectivec/Tests/CocoaPods/run_tests.sh delete mode 100644 objectivec/Tests/GPBCodedOuputStreamTests.m create mode 100644 objectivec/Tests/GPBCodedOutputStreamTests.m delete mode 100644 objectivec/Tests/GPBCompileTest24.m delete mode 100644 objectivec/Tests/GPBCompileTest25.m create mode 100644 objectivec/Tests/any_test.proto create mode 100644 objectivec/Tests/expected_prefixes.txt create mode 100644 objectivec/Tests/map_proto2_unittest.proto create mode 100644 objectivec/Tests/map_unittest.proto create mode 100644 objectivec/Tests/unittest.proto create mode 100644 objectivec/Tests/unittest_import.proto create mode 100644 objectivec/Tests/unittest_import_public.proto create mode 100644 objectivec/Tests/unittest_mset.proto create mode 100644 objectivec/Tests/unittest_preserve_unknown_enum.proto create mode 100644 objectivec/defs.bzl mode change 100755 => 100644 objectivec/generate_well_known_types.sh create mode 100644 php/BUILD.bazel create mode 100644 php/REFCOUNTING.md create mode 100644 php/composer.json.dist delete mode 100644 php/ext/google/protobuf/bundled_php.h create mode 100644 php/ext/google/protobuf/config.w32 create mode 100644 php/ext/google/protobuf/generate_package_xml.sh delete mode 100644 php/ext/google/protobuf/make-preload.php delete mode 100644 php/ext/google/protobuf/package.xml create mode 100644 php/ext/google/protobuf/php_protobuf.h create mode 100644 php/ext/google/protobuf/template_package.xml create mode 100644 php/ext/google/protobuf/tests/unnecessary_zval.phpt create mode 100644 php/ext/google/protobuf/wkt.inc mode change 100755 => 100644 php/generate_descriptor_protos.sh create mode 100644 php/generate_test_protos.sh delete mode 100644 php/phpunit.xml mode change 100755 => 100644 php/release.sh create mode 100644 php/src/Google/Protobuf/Internal/AnyBase.php create mode 100644 php/src/Google/Protobuf/Internal/TimestampBase.php create mode 100644 php/tests/PreviouslyGeneratedClassTest.php delete mode 100644 php/tests/autoload.php delete mode 100644 php/tests/bootstrap_phpunit.php delete mode 100755 php/tests/compatibility_test.sh mode change 100755 => 100644 php/tests/compile_extension.sh create mode 100644 php/tests/force_c_ext.php mode change 100755 => 100644 php/tests/gdb_test.sh delete mode 100755 php/tests/generate_protos.sh create mode 100644 php/tests/generated_previous/GPBMetadata/ProtoPrevious/TestPreviouslyUnreservedMessage.php create mode 100644 php/tests/generated_previous/Previous/readonly.php create mode 100644 php/tests/memory_leak_test.sh mode change 100755 => 100644 php/tests/multirequest.sh create mode 100644 php/tests/proto_previous/test_previously_unreserved_message.proto delete mode 100755 php/tests/test.sh delete mode 100644 php/tests/undefined_test.php create mode 100644 pkg/BUILD.bazel create mode 100644 pkg/README.md create mode 100644 pkg/build_systems.bzl create mode 100644 pkg/cc_dist_library.bzl create mode 100644 pkg/test/BUILD.bazel create mode 100644 pkg/test/file_lists.cmake.golden create mode 100644 pkg/test/gen_file_lists_golden_test.sh create mode 100644 pkg/test/test_lib.cc create mode 100644 pkg/test/test_lib.h create mode 100644 protobuf_release.bzl create mode 100644 protobuf_version.bzl delete mode 100644 protoc-artifacts/README.md delete mode 100755 protoc-artifacts/build-protoc.sh delete mode 100755 protoc-artifacts/build-zip.sh delete mode 100644 protoc-artifacts/pom.xml delete mode 100755 protoc-artifacts/scl-enable-devtoolset.sh create mode 100644 python/BUILD.bazel create mode 100644 python/build_targets.bzl delete mode 100644 python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto delete mode 100644 python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto delete mode 100755 python/compatibility_tests/v2.5.0/setup.py delete mode 100755 python/compatibility_tests/v2.5.0/test.sh delete mode 100644 python/compatibility_tests/v2.5.0/tests/__init__.py delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/__init__.py delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py delete mode 100755 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py delete mode 100755 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message delete mode 100755 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py delete mode 100755 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py delete mode 100755 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt delete mode 100644 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt delete mode 100755 python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py create mode 100644 python/convert.c create mode 100644 python/convert.h create mode 100644 python/descriptor.c create mode 100644 python/descriptor.h create mode 100644 python/descriptor_containers.c create mode 100644 python/descriptor_containers.h create mode 100644 python/descriptor_pool.c create mode 100644 python/descriptor_pool.h create mode 100644 python/dist/BUILD.bazel create mode 100644 python/dist/MANIFEST.in create mode 100644 python/dist/dist.bzl create mode 100644 python/dist/setup.py create mode 100644 python/docs/Makefile mode change 100755 => 100644 python/docs/generate_docs.py create mode 100644 python/docs/google/protobuf/unknown_fields.rst create mode 100644 python/extension_dict.c create mode 100644 python/extension_dict.h mode change 100755 => 100644 python/google/protobuf/internal/_parameterized.py create mode 100644 python/google/protobuf/internal/builder.py mode change 100755 => 100644 python/google/protobuf/internal/descriptor_database_test.py mode change 100755 => 100644 python/google/protobuf/internal/descriptor_pool_test.py mode change 100755 => 100644 python/google/protobuf/internal/descriptor_test.py create mode 100644 python/google/protobuf/internal/field_mask.py create mode 100644 python/google/protobuf/internal/field_mask_test.py mode change 100755 => 100644 python/google/protobuf/internal/generator_test.py create mode 100644 python/google/protobuf/internal/import_test.py create mode 100644 python/google/protobuf/internal/import_test_package/import_public.proto create mode 100644 python/google/protobuf/internal/import_test_package/import_public_nested.proto mode change 100755 => 100644 python/google/protobuf/internal/json_format_test.py mode change 100755 => 100644 python/google/protobuf/internal/keywords_test.py mode change 100755 => 100644 python/google/protobuf/internal/message_factory_test.py mode change 100755 => 100644 python/google/protobuf/internal/message_test.py create mode 100644 python/google/protobuf/internal/numpy/BUILD.bazel create mode 100644 python/google/protobuf/internal/numpy/__init__.py create mode 100644 python/google/protobuf/internal/numpy/numpy_test.py mode change 100755 => 100644 python/google/protobuf/internal/proto_builder_test.py mode change 100755 => 100644 python/google/protobuf/internal/reflection_test.py mode change 100755 => 100644 python/google/protobuf/internal/service_reflection_test.py mode change 100755 => 100644 python/google/protobuf/internal/symbol_database_test.py mode change 100755 => 100644 python/google/protobuf/internal/text_encoding_test.py mode change 100755 => 100644 python/google/protobuf/internal/text_format_test.py create mode 100644 python/google/protobuf/internal/thread_safe_test.py mode change 100755 => 100644 python/google/protobuf/internal/unknown_fields_test.py mode change 100755 => 100644 python/google/protobuf/internal/well_known_types_test.py mode change 100755 => 100644 python/google/protobuf/internal/wire_format_test.py create mode 100644 python/google/protobuf/link_error_fast_cpp.cc create mode 100644 python/google/protobuf/link_error_pure_python.cc create mode 100644 python/google/protobuf/link_error_upb.cc delete mode 100644 python/google/protobuf/pyext/proto2_api_test.proto create mode 100644 python/google/protobuf/pyext/unknown_field_set.cc create mode 100644 python/google/protobuf/pyext/unknown_field_set.h create mode 100644 python/google/protobuf/testdata/__init__.py create mode 100644 python/google/protobuf/unknown_fields.py create mode 100644 python/google/protobuf/use_fast_cpp_protos.cc create mode 100644 python/google/protobuf/use_pure_python.cc create mode 100644 python/google/protobuf/use_upb_protos.cc create mode 100644 python/internal.bzl create mode 100644 python/map.c create mode 100644 python/map.h create mode 100644 python/message.c create mode 100644 python/message.h create mode 100644 python/minimal_test.py delete mode 100755 python/mox.py create mode 100644 python/pb_unit_tests/BUILD create mode 100644 python/pb_unit_tests/README.md create mode 100644 python/pb_unit_tests/descriptor_database_test_wrapper.py create mode 100644 python/pb_unit_tests/descriptor_pool_test_wrapper.py create mode 100644 python/pb_unit_tests/descriptor_test_wrapper.py create mode 100644 python/pb_unit_tests/generator_test_wrapper.py create mode 100644 python/pb_unit_tests/json_format_test_wrapper.py create mode 100644 python/pb_unit_tests/keywords_test_wrapper.py create mode 100644 python/pb_unit_tests/message_factory_test_wrapper.py create mode 100644 python/pb_unit_tests/message_test_wrapper.py create mode 100644 python/pb_unit_tests/numpy_test_wrapper.py create mode 100644 python/pb_unit_tests/proto_builder_test_wrapper.py create mode 100644 python/pb_unit_tests/pyproto_test_wrapper.bzl create mode 100644 python/pb_unit_tests/reflection_test_wrapper.py create mode 100644 python/pb_unit_tests/service_reflection_test_wrapper.py create mode 100644 python/pb_unit_tests/symbol_database_test_wrapper.py create mode 100644 python/pb_unit_tests/text_encoding_test_wrapper.py create mode 100644 python/pb_unit_tests/text_format_test_wrapper.py create mode 100644 python/pb_unit_tests/unknown_fields_test_wrapper.py create mode 100644 python/pb_unit_tests/well_known_types_test_wrapper.py create mode 100644 python/pb_unit_tests/wire_format_test_wrapper.py create mode 100644 python/protobuf.c create mode 100644 python/protobuf.h create mode 100644 python/protobuf_distutils/README.md create mode 100644 python/protobuf_distutils/protobuf_distutils/__init__.py create mode 100644 python/protobuf_distutils/protobuf_distutils/generate_py_protobufs.py create mode 100644 python/protobuf_distutils/setup.py create mode 100644 python/py_extension.bzl create mode 100644 python/python_api.h create mode 100644 python/python_version_test.py delete mode 100755 python/release.sh delete mode 100644 python/release/wheel/Dockerfile delete mode 100644 python/release/wheel/README.md delete mode 100755 python/release/wheel/build_wheel_manylinux.sh delete mode 100755 python/release/wheel/protobuf_optimized_pip.sh create mode 100644 python/repeated.c create mode 100644 python/repeated.h create mode 100644 python/requirements.txt mode change 100755 => 100644 python/setup.py delete mode 100755 python/stubout.py create mode 100644 python/unknown_fields.c create mode 100644 python/unknown_fields.h create mode 100644 python/version_script.lds create mode 100644 regenerate_stale_files.sh create mode 100644 ruby/BUILD.bazel create mode 100644 ruby/compatibility_tests/v3.0.0/BUILD.bazel mode change 100755 => 100644 ruby/compatibility_tests/v3.0.0/test.sh create mode 100644 ruby/compatibility_tests/v3.0.0/tests/BUILD.bazel mode change 100755 => 100644 ruby/compatibility_tests/v3.0.0/tests/basic.rb mode change 100755 => 100644 ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb mode change 100755 => 100644 ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb mode change 100755 => 100644 ruby/compatibility_tests/v3.0.0/tests/stress.rb create mode 100644 ruby/ext/google/protobuf_c/BUILD.bazel create mode 100644 ruby/ext/google/protobuf_c/Rakefile create mode 100644 ruby/ext/google/protobuf_c/convert.c create mode 100644 ruby/ext/google/protobuf_c/convert.h create mode 100644 ruby/ext/google/protobuf_c/defs.h delete mode 100644 ruby/ext/google/protobuf_c/encode_decode.c mode change 100755 => 100644 ruby/ext/google/protobuf_c/extconf.rb create mode 100644 ruby/ext/google/protobuf_c/glue.c create mode 100644 ruby/ext/google/protobuf_c/map.h create mode 100644 ruby/ext/google/protobuf_c/message.h create mode 100644 ruby/ext/google/protobuf_c/repeated_field.h create mode 100644 ruby/ext/google/protobuf_c/ruby-upb.c create mode 100644 ruby/ext/google/protobuf_c/ruby-upb.h create mode 100644 ruby/ext/google/protobuf_c/shared_convert.c create mode 100644 ruby/ext/google/protobuf_c/shared_convert.h create mode 100644 ruby/ext/google/protobuf_c/shared_message.c create mode 100644 ruby/ext/google/protobuf_c/shared_message.h delete mode 100644 ruby/ext/google/protobuf_c/storage.c delete mode 100644 ruby/ext/google/protobuf_c/upb.c delete mode 100644 ruby/ext/google/protobuf_c/upb.h create mode 100644 ruby/google-protobuf.gemspec create mode 100644 ruby/lib/google/BUILD.bazel create mode 100644 ruby/lib/google/protobuf.rb create mode 100644 ruby/lib/google/protobuf/descriptor_dsl.rb create mode 100644 ruby/lib/google/protobuf/ffi/descriptor.rb create mode 100644 ruby/lib/google/protobuf/ffi/descriptor_pool.rb create mode 100644 ruby/lib/google/protobuf/ffi/enum_descriptor.rb create mode 100644 ruby/lib/google/protobuf/ffi/ffi.rb create mode 100644 ruby/lib/google/protobuf/ffi/field_descriptor.rb create mode 100644 ruby/lib/google/protobuf/ffi/file_descriptor.rb create mode 100644 ruby/lib/google/protobuf/ffi/internal/arena.rb create mode 100644 ruby/lib/google/protobuf/ffi/internal/convert.rb create mode 100644 ruby/lib/google/protobuf/ffi/internal/pointer_helper.rb create mode 100644 ruby/lib/google/protobuf/ffi/internal/type_safety.rb create mode 100644 ruby/lib/google/protobuf/ffi/map.rb create mode 100644 ruby/lib/google/protobuf/ffi/message.rb create mode 100644 ruby/lib/google/protobuf/ffi/object_cache.rb create mode 100644 ruby/lib/google/protobuf/ffi/oneof_descriptor.rb create mode 100644 ruby/lib/google/protobuf/ffi/repeated_field.rb create mode 100644 ruby/lib/google/protobuf/message_exts.rb create mode 100644 ruby/lib/google/protobuf/object_cache.rb create mode 100644 ruby/lib/google/protobuf/repeated_field.rb create mode 100644 ruby/lib/google/protobuf/well_known_types.rb create mode 100644 ruby/lib/google/protobuf_ffi.rb create mode 100644 ruby/lib/google/protobuf_native.rb create mode 100644 ruby/lib/google/tasks/ffi.rake create mode 100644 ruby/src/main/java/BUILD.bazel delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java create mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java delete mode 100644 ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java create mode 100644 ruby/src/main/java/sentinel.proto delete mode 100644 ruby/src/main/sentinel.proto create mode 100644 ruby/tests/BUILD.bazel mode change 100755 => 100644 ruby/tests/basic.rb mode change 100755 => 100644 ruby/tests/basic_proto2.rb mode change 100755 => 100644 ruby/tests/encode_decode_test.rb mode change 100755 => 100644 ruby/tests/gc_test.rb mode change 100755 => 100644 ruby/tests/generated_code_proto2_test.rb mode change 100755 => 100644 ruby/tests/generated_code_test.rb create mode 100644 ruby/tests/implementation.rb create mode 100644 ruby/tests/multi_level_nesting_test.proto create mode 100644 ruby/tests/multi_level_nesting_test.rb create mode 100644 ruby/tests/object_cache_test.rb mode change 100755 => 100644 ruby/tests/repeated_field_test.rb create mode 100644 ruby/tests/ruby_version.rb mode change 100755 => 100644 ruby/tests/stress.rb mode change 100755 => 100644 ruby/tests/type_errors.rb mode change 100755 => 100644 ruby/tests/well_known_types_test.rb delete mode 100755 ruby/travis-test.sh create mode 100644 rust/BUILD create mode 100644 rust/aspects.bzl create mode 100644 rust/cpp.rs create mode 100644 rust/cpp_kernel/BUILD create mode 100644 rust/cpp_kernel/cpp_api.h create mode 100644 rust/cpp_kernel/rust_alloc_for_cpp_api.rs create mode 100644 rust/defs.bzl create mode 100644 rust/internal.rs create mode 100644 rust/macros.rs create mode 100644 rust/optional.rs create mode 100644 rust/primitive.rs create mode 100644 rust/protobuf.rs create mode 100644 rust/proxied.rs create mode 100644 rust/shared.rs create mode 100644 rust/string.rs create mode 100644 rust/test/BUILD create mode 100644 rust/test/child.proto create mode 100644 rust/test/cpp/BUILD create mode 100644 rust/test/cpp/interop/BUILD create mode 100644 rust/test/cpp/interop/main.rs create mode 100644 rust/test/cpp/interop/test_utils.cc create mode 100644 rust/test/dots_in_package.proto create mode 100644 rust/test/nested.proto create mode 100644 rust/test/no_package.proto create mode 100644 rust/test/no_package_import.proto create mode 100644 rust/test/no_package_other.proto create mode 100644 rust/test/package.proto create mode 100644 rust/test/package_import.proto create mode 100644 rust/test/package_other.proto create mode 100644 rust/test/package_other_different.proto create mode 100644 rust/test/parent.proto create mode 100644 rust/test/reserved.proto create mode 100644 rust/test/rust_proto_library_unit_test/BUILD create mode 100644 rust/test/rust_proto_library_unit_test/child.proto create mode 100644 rust/test/rust_proto_library_unit_test/defs.bzl create mode 100644 rust/test/rust_proto_library_unit_test/empty.cc create mode 100644 rust/test/rust_proto_library_unit_test/empty.rs create mode 100644 rust/test/rust_proto_library_unit_test/parent.proto create mode 100644 rust/test/rust_proto_library_unit_test/rust_proto_library_unit_test.bzl create mode 100644 rust/test/rust_proto_library_unit_test/some_proto.proto create mode 100644 rust/test/shared/BUILD create mode 100644 rust/test/shared/accessors_proto3_test.rs create mode 100644 rust/test/shared/accessors_test.rs create mode 100644 rust/test/shared/child_parent_test.rs create mode 100644 rust/test/shared/matchers.rs create mode 100644 rust/test/shared/nested_messages_test.rs create mode 100644 rust/test/shared/package_test.rs create mode 100644 rust/test/shared/reserved_test.rs create mode 100644 rust/test/shared/serialization_test.rs create mode 100644 rust/test/shared/simple_nested_test.rs create mode 100644 rust/test/upb/BUILD create mode 100644 rust/upb.rs create mode 100644 rust/upb_kernel/BUILD create mode 100644 rust/upb_kernel/upb_api.c create mode 100644 rust/utf8.rs create mode 100644 rust/vtable.rs create mode 100644 src/BUILD.bazel delete mode 100644 src/Makefile.am create mode 100644 src/file_lists.cmake create mode 100644 src/google/protobuf/BUILD.bazel create mode 100644 src/google/protobuf/arena_align.cc create mode 100644 src/google/protobuf/arena_align.h create mode 100644 src/google/protobuf/arena_align_test.cc create mode 100644 src/google/protobuf/arena_allocation_policy.h create mode 100644 src/google/protobuf/arena_cleanup.h delete mode 100644 src/google/protobuf/arena_impl.h create mode 100644 src/google/protobuf/arenastring.cc create mode 100644 src/google/protobuf/arenaz_sampler.cc create mode 100644 src/google/protobuf/arenaz_sampler.h create mode 100644 src/google/protobuf/arenaz_sampler_test.cc create mode 100644 src/google/protobuf/bridge/BUILD.bazel create mode 100644 src/google/protobuf/bridge/message_set.proto create mode 100644 src/google/protobuf/compiler/BUILD.bazel create mode 100644 src/google/protobuf/compiler/allowlists/BUILD.bazel create mode 100644 src/google/protobuf/compiler/allowlists/allowlist.h create mode 100644 src/google/protobuf/compiler/allowlists/allowlist_test.cc create mode 100644 src/google/protobuf/compiler/allowlists/allowlists.h create mode 100644 src/google/protobuf/compiler/allowlists/editions.cc create mode 100644 src/google/protobuf/compiler/allowlists/empty_package.cc create mode 100644 src/google/protobuf/compiler/allowlists/open_enum.cc create mode 100644 src/google/protobuf/compiler/allowlists/unused_imports.cc create mode 100644 src/google/protobuf/compiler/allowlists/weak_imports.cc create mode 100644 src/google/protobuf/compiler/code_generator_unittest.cc create mode 100644 src/google/protobuf/compiler/command_line_interface_tester.cc create mode 100644 src/google/protobuf/compiler/command_line_interface_tester.h create mode 100644 src/google/protobuf/compiler/cpp/BUILD.bazel create mode 100644 src/google/protobuf/compiler/cpp/arena_ctor_visibility_test.cc create mode 100644 src/google/protobuf/compiler/cpp/bootstrap_unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/copy_unittest.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_enum.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_enum.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_enum_field.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_enum_field.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_extension.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_extension.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_field.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_field.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_file.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_file.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_generator.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_helpers.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_helpers.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_map_field.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_map_field.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_message.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_message.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_message_field.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_message_field.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_move_unittest.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_options.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_primitive_field.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_primitive_field.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_service.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_service.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_string_field.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_string_field.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto delete mode 100644 src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto delete mode 100644 src/google/protobuf/compiler/cpp/cpp_unittest.cc delete mode 100644 src/google/protobuf/compiler/cpp/cpp_unittest.h delete mode 100644 src/google/protobuf/compiler/cpp/cpp_unittest.inc create mode 100644 src/google/protobuf/compiler/cpp/enum.cc create mode 100644 src/google/protobuf/compiler/cpp/enum.h create mode 100644 src/google/protobuf/compiler/cpp/extension.cc create mode 100644 src/google/protobuf/compiler/cpp/extension.h create mode 100644 src/google/protobuf/compiler/cpp/field.cc create mode 100644 src/google/protobuf/compiler/cpp/field.h create mode 100644 src/google/protobuf/compiler/cpp/field_generators/cord_field.cc create mode 100644 src/google/protobuf/compiler/cpp/field_generators/enum_field.cc create mode 100644 src/google/protobuf/compiler/cpp/field_generators/generators.h create mode 100644 src/google/protobuf/compiler/cpp/field_generators/map_field.cc create mode 100644 src/google/protobuf/compiler/cpp/field_generators/message_field.cc create mode 100644 src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc create mode 100644 src/google/protobuf/compiler/cpp/field_generators/string_field.cc create mode 100644 src/google/protobuf/compiler/cpp/file.cc create mode 100644 src/google/protobuf/compiler/cpp/file.h create mode 100644 src/google/protobuf/compiler/cpp/file_unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/generator.cc create mode 100644 src/google/protobuf/compiler/cpp/generator.h create mode 100644 src/google/protobuf/compiler/cpp/generator_unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/helpers.cc create mode 100644 src/google/protobuf/compiler/cpp/helpers.h create mode 100644 src/google/protobuf/compiler/cpp/main.cc create mode 100644 src/google/protobuf/compiler/cpp/message.cc create mode 100644 src/google/protobuf/compiler/cpp/message.h create mode 100644 src/google/protobuf/compiler/cpp/message_layout_helper.h create mode 100644 src/google/protobuf/compiler/cpp/message_size_unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/move_unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/names.h create mode 100644 src/google/protobuf/compiler/cpp/options.h create mode 100644 src/google/protobuf/compiler/cpp/padding_optimizer.cc create mode 100644 src/google/protobuf/compiler/cpp/padding_optimizer.h create mode 100644 src/google/protobuf/compiler/cpp/parse_function_generator.cc create mode 100644 src/google/protobuf/compiler/cpp/parse_function_generator.h create mode 100644 src/google/protobuf/compiler/cpp/plugin_unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/service.cc create mode 100644 src/google/protobuf/compiler/cpp/service.h create mode 100644 src/google/protobuf/compiler/cpp/test_bad_identifiers.proto create mode 100644 src/google/protobuf/compiler/cpp/test_large_enum_value.proto create mode 100644 src/google/protobuf/compiler/cpp/tracker.cc create mode 100644 src/google/protobuf/compiler/cpp/tracker.h create mode 100644 src/google/protobuf/compiler/cpp/unittest.cc create mode 100644 src/google/protobuf/compiler/cpp/unittest.h create mode 100644 src/google/protobuf/compiler/cpp/unittest.inc create mode 100644 src/google/protobuf/compiler/csharp/BUILD.bazel delete mode 100644 src/google/protobuf/compiler/csharp/csharp_names.h create mode 100644 src/google/protobuf/compiler/csharp/names.cc create mode 100644 src/google/protobuf/compiler/csharp/names.h create mode 100644 src/google/protobuf/compiler/fake_plugin.cc create mode 100644 src/google/protobuf/compiler/java/BUILD.bazel create mode 100644 src/google/protobuf/compiler/java/context.cc create mode 100644 src/google/protobuf/compiler/java/context.h create mode 100644 src/google/protobuf/compiler/java/doc_comment.cc create mode 100644 src/google/protobuf/compiler/java/doc_comment.h create mode 100644 src/google/protobuf/compiler/java/doc_comment_unittest.cc create mode 100644 src/google/protobuf/compiler/java/enum.cc create mode 100644 src/google/protobuf/compiler/java/enum.h create mode 100644 src/google/protobuf/compiler/java/enum_field.cc create mode 100644 src/google/protobuf/compiler/java/enum_field.h create mode 100644 src/google/protobuf/compiler/java/enum_field_lite.cc create mode 100644 src/google/protobuf/compiler/java/enum_field_lite.h create mode 100644 src/google/protobuf/compiler/java/enum_lite.cc create mode 100644 src/google/protobuf/compiler/java/enum_lite.h create mode 100644 src/google/protobuf/compiler/java/extension.cc create mode 100644 src/google/protobuf/compiler/java/extension.h create mode 100644 src/google/protobuf/compiler/java/extension_lite.cc create mode 100644 src/google/protobuf/compiler/java/extension_lite.h create mode 100644 src/google/protobuf/compiler/java/field.cc create mode 100644 src/google/protobuf/compiler/java/field.h create mode 100644 src/google/protobuf/compiler/java/file.cc create mode 100644 src/google/protobuf/compiler/java/file.h create mode 100644 src/google/protobuf/compiler/java/generator.cc create mode 100644 src/google/protobuf/compiler/java/generator.h create mode 100644 src/google/protobuf/compiler/java/generator_factory.cc create mode 100644 src/google/protobuf/compiler/java/generator_factory.h create mode 100644 src/google/protobuf/compiler/java/helpers.cc create mode 100644 src/google/protobuf/compiler/java/helpers.h delete mode 100644 src/google/protobuf/compiler/java/java_context.cc delete mode 100644 src/google/protobuf/compiler/java/java_context.h delete mode 100644 src/google/protobuf/compiler/java/java_doc_comment.cc delete mode 100644 src/google/protobuf/compiler/java/java_doc_comment.h delete mode 100644 src/google/protobuf/compiler/java/java_doc_comment_unittest.cc delete mode 100644 src/google/protobuf/compiler/java/java_enum.cc delete mode 100644 src/google/protobuf/compiler/java/java_enum.h delete mode 100644 src/google/protobuf/compiler/java/java_enum_field.cc delete mode 100644 src/google/protobuf/compiler/java/java_enum_field.h delete mode 100644 src/google/protobuf/compiler/java/java_enum_field_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_enum_field_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_enum_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_enum_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_extension.cc delete mode 100644 src/google/protobuf/compiler/java/java_extension.h delete mode 100644 src/google/protobuf/compiler/java/java_extension_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_extension_lite.h create mode 100644 src/google/protobuf/compiler/java/java_features.pb.cc create mode 100644 src/google/protobuf/compiler/java/java_features.pb.h delete mode 100644 src/google/protobuf/compiler/java/java_field.cc delete mode 100644 src/google/protobuf/compiler/java/java_field.h delete mode 100644 src/google/protobuf/compiler/java/java_file.cc delete mode 100644 src/google/protobuf/compiler/java/java_file.h delete mode 100644 src/google/protobuf/compiler/java/java_generator.cc delete mode 100644 src/google/protobuf/compiler/java/java_generator_factory.cc delete mode 100644 src/google/protobuf/compiler/java/java_generator_factory.h delete mode 100644 src/google/protobuf/compiler/java/java_helpers.cc delete mode 100644 src/google/protobuf/compiler/java/java_helpers.h delete mode 100644 src/google/protobuf/compiler/java/java_map_field.cc delete mode 100644 src/google/protobuf/compiler/java/java_map_field.h delete mode 100644 src/google/protobuf/compiler/java/java_map_field_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_map_field_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_message.cc delete mode 100644 src/google/protobuf/compiler/java/java_message.h delete mode 100644 src/google/protobuf/compiler/java/java_message_builder.cc delete mode 100644 src/google/protobuf/compiler/java/java_message_builder.h delete mode 100644 src/google/protobuf/compiler/java/java_message_builder_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_message_builder_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_message_field.cc delete mode 100644 src/google/protobuf/compiler/java/java_message_field.h delete mode 100644 src/google/protobuf/compiler/java/java_message_field_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_message_field_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_message_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_message_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_name_resolver.cc delete mode 100644 src/google/protobuf/compiler/java/java_name_resolver.h delete mode 100644 src/google/protobuf/compiler/java/java_names.h delete mode 100644 src/google/protobuf/compiler/java/java_options.h delete mode 100644 src/google/protobuf/compiler/java/java_plugin_unittest.cc delete mode 100644 src/google/protobuf/compiler/java/java_primitive_field.cc delete mode 100644 src/google/protobuf/compiler/java/java_primitive_field.h delete mode 100644 src/google/protobuf/compiler/java/java_primitive_field_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_primitive_field_lite.h delete mode 100644 src/google/protobuf/compiler/java/java_service.cc delete mode 100644 src/google/protobuf/compiler/java/java_service.h delete mode 100644 src/google/protobuf/compiler/java/java_shared_code_generator.cc delete mode 100644 src/google/protobuf/compiler/java/java_shared_code_generator.h delete mode 100644 src/google/protobuf/compiler/java/java_string_field.cc delete mode 100644 src/google/protobuf/compiler/java/java_string_field.h delete mode 100644 src/google/protobuf/compiler/java/java_string_field_lite.cc delete mode 100644 src/google/protobuf/compiler/java/java_string_field_lite.h create mode 100644 src/google/protobuf/compiler/java/kotlin_generator.cc create mode 100644 src/google/protobuf/compiler/java/kotlin_generator.h create mode 100644 src/google/protobuf/compiler/java/map_field.cc create mode 100644 src/google/protobuf/compiler/java/map_field.h create mode 100644 src/google/protobuf/compiler/java/map_field_lite.cc create mode 100644 src/google/protobuf/compiler/java/map_field_lite.h create mode 100644 src/google/protobuf/compiler/java/message.cc create mode 100644 src/google/protobuf/compiler/java/message.h create mode 100644 src/google/protobuf/compiler/java/message_builder.cc create mode 100644 src/google/protobuf/compiler/java/message_builder.h create mode 100644 src/google/protobuf/compiler/java/message_builder_lite.cc create mode 100644 src/google/protobuf/compiler/java/message_builder_lite.h create mode 100644 src/google/protobuf/compiler/java/message_field.cc create mode 100644 src/google/protobuf/compiler/java/message_field.h create mode 100644 src/google/protobuf/compiler/java/message_field_lite.cc create mode 100644 src/google/protobuf/compiler/java/message_field_lite.h create mode 100644 src/google/protobuf/compiler/java/message_lite.cc create mode 100644 src/google/protobuf/compiler/java/message_lite.h create mode 100644 src/google/protobuf/compiler/java/message_serialization.cc create mode 100644 src/google/protobuf/compiler/java/message_serialization.h create mode 100644 src/google/protobuf/compiler/java/message_serialization_unittest.cc create mode 100644 src/google/protobuf/compiler/java/message_serialization_unittest.proto create mode 100644 src/google/protobuf/compiler/java/name_resolver.cc create mode 100644 src/google/protobuf/compiler/java/name_resolver.h create mode 100644 src/google/protobuf/compiler/java/names.cc create mode 100644 src/google/protobuf/compiler/java/names.h create mode 100644 src/google/protobuf/compiler/java/options.h create mode 100644 src/google/protobuf/compiler/java/plugin_unittest.cc create mode 100644 src/google/protobuf/compiler/java/primitive_field.cc create mode 100644 src/google/protobuf/compiler/java/primitive_field.h create mode 100644 src/google/protobuf/compiler/java/primitive_field_lite.cc create mode 100644 src/google/protobuf/compiler/java/primitive_field_lite.h create mode 100644 src/google/protobuf/compiler/java/service.cc create mode 100644 src/google/protobuf/compiler/java/service.h create mode 100644 src/google/protobuf/compiler/java/shared_code_generator.cc create mode 100644 src/google/protobuf/compiler/java/shared_code_generator.h create mode 100644 src/google/protobuf/compiler/java/string_field.cc create mode 100644 src/google/protobuf/compiler/java/string_field.h create mode 100644 src/google/protobuf/compiler/java/string_field_lite.cc create mode 100644 src/google/protobuf/compiler/java/string_field_lite.h delete mode 100644 src/google/protobuf/compiler/js/js_generator.cc delete mode 100644 src/google/protobuf/compiler/js/js_generator.h delete mode 100644 src/google/protobuf/compiler/js/well_known_types_embed.cc delete mode 100644 src/google/protobuf/compiler/js/well_known_types_embed.h create mode 100644 src/google/protobuf/compiler/objectivec/BUILD.bazel create mode 100644 src/google/protobuf/compiler/objectivec/enum.cc create mode 100644 src/google/protobuf/compiler/objectivec/enum.h create mode 100644 src/google/protobuf/compiler/objectivec/enum_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/enum_field.h create mode 100644 src/google/protobuf/compiler/objectivec/extension.cc create mode 100644 src/google/protobuf/compiler/objectivec/extension.h create mode 100644 src/google/protobuf/compiler/objectivec/field.cc create mode 100644 src/google/protobuf/compiler/objectivec/field.h create mode 100644 src/google/protobuf/compiler/objectivec/file.cc create mode 100644 src/google/protobuf/compiler/objectivec/file.h create mode 100644 src/google/protobuf/compiler/objectivec/generator.cc create mode 100644 src/google/protobuf/compiler/objectivec/generator.h create mode 100644 src/google/protobuf/compiler/objectivec/helpers.cc create mode 100644 src/google/protobuf/compiler/objectivec/helpers.h create mode 100644 src/google/protobuf/compiler/objectivec/import_writer.cc create mode 100644 src/google/protobuf/compiler/objectivec/import_writer.h create mode 100644 src/google/protobuf/compiler/objectivec/line_consumer.cc create mode 100644 src/google/protobuf/compiler/objectivec/line_consumer.h create mode 100644 src/google/protobuf/compiler/objectivec/line_consumer_unittest.cc create mode 100644 src/google/protobuf/compiler/objectivec/map_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/map_field.h create mode 100644 src/google/protobuf/compiler/objectivec/message.cc create mode 100644 src/google/protobuf/compiler/objectivec/message.h create mode 100644 src/google/protobuf/compiler/objectivec/message_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/message_field.h mode change 100755 => 100644 src/google/protobuf/compiler/objectivec/method_dump.sh create mode 100644 src/google/protobuf/compiler/objectivec/names.cc create mode 100644 src/google/protobuf/compiler/objectivec/names.h create mode 100644 src/google/protobuf/compiler/objectivec/names_unittest.cc create mode 100644 src/google/protobuf/compiler/objectivec/nsobject_methods.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum_field.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_extension.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_extension.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_field.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_field.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_file.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_file.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_generator.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_generator.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_helpers.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_helpers.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_map_field.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_map_field.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message_field.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message_field.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_oneof.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_oneof.h delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc delete mode 100644 src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h create mode 100644 src/google/protobuf/compiler/objectivec/oneof.cc create mode 100644 src/google/protobuf/compiler/objectivec/oneof.h create mode 100644 src/google/protobuf/compiler/objectivec/options.h create mode 100644 src/google/protobuf/compiler/objectivec/primitive_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/primitive_field.h create mode 100644 src/google/protobuf/compiler/objectivec/text_format_decode_data.cc create mode 100644 src/google/protobuf/compiler/objectivec/text_format_decode_data.h create mode 100644 src/google/protobuf/compiler/objectivec/text_format_decode_data_unittest.cc create mode 100644 src/google/protobuf/compiler/php/BUILD.bazel create mode 100644 src/google/protobuf/compiler/php/names.cc create mode 100644 src/google/protobuf/compiler/php/names.h create mode 100644 src/google/protobuf/compiler/python/BUILD.bazel create mode 100644 src/google/protobuf/compiler/python/generator.cc create mode 100644 src/google/protobuf/compiler/python/generator.h create mode 100644 src/google/protobuf/compiler/python/helpers.cc create mode 100644 src/google/protobuf/compiler/python/helpers.h create mode 100644 src/google/protobuf/compiler/python/plugin_unittest.cc create mode 100644 src/google/protobuf/compiler/python/pyi_generator.cc create mode 100644 src/google/protobuf/compiler/python/pyi_generator.h delete mode 100644 src/google/protobuf/compiler/python/python_generator.cc delete mode 100644 src/google/protobuf/compiler/python/python_plugin_unittest.cc create mode 100644 src/google/protobuf/compiler/retention.cc create mode 100644 src/google/protobuf/compiler/retention.h create mode 100644 src/google/protobuf/compiler/retention_unittest.cc create mode 100644 src/google/protobuf/compiler/ruby/BUILD.bazel create mode 100644 src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto create mode 100644 src/google/protobuf/compiler/rust/BUILD.bazel create mode 100644 src/google/protobuf/compiler/rust/accessors/accessor_generator.h create mode 100644 src/google/protobuf/compiler/rust/accessors/accessors.cc create mode 100644 src/google/protobuf/compiler/rust/accessors/accessors.h create mode 100644 src/google/protobuf/compiler/rust/accessors/singular_message.cc create mode 100644 src/google/protobuf/compiler/rust/accessors/singular_scalar.cc create mode 100644 src/google/protobuf/compiler/rust/accessors/singular_string.cc create mode 100644 src/google/protobuf/compiler/rust/accessors/unsupported_field.cc create mode 100644 src/google/protobuf/compiler/rust/context.cc create mode 100644 src/google/protobuf/compiler/rust/context.h create mode 100644 src/google/protobuf/compiler/rust/generator.cc create mode 100644 src/google/protobuf/compiler/rust/generator.h create mode 100644 src/google/protobuf/compiler/rust/message.cc create mode 100644 src/google/protobuf/compiler/rust/message.h create mode 100644 src/google/protobuf/compiler/rust/naming.cc create mode 100644 src/google/protobuf/compiler/rust/naming.h create mode 100644 src/google/protobuf/compiler/rust/oneof.cc create mode 100644 src/google/protobuf/compiler/rust/oneof.h create mode 100644 src/google/protobuf/compiler/rust/relative_path.cc create mode 100644 src/google/protobuf/compiler/rust/relative_path.h create mode 100644 src/google/protobuf/compiler/rust/relative_path_test.cc create mode 100644 src/google/protobuf/compiler/test_plugin_injection.bzl create mode 100644 src/google/protobuf/compiler/versions.h create mode 100644 src/google/protobuf/compiler/versions_suffix.h mode change 100755 => 100644 src/google/protobuf/compiler/zip_output_unittest.sh create mode 100644 src/google/protobuf/cpp_edition_defaults.h create mode 100644 src/google/protobuf/cpp_features.pb.cc create mode 100644 src/google/protobuf/cpp_features.pb.h create mode 100644 src/google/protobuf/cpp_features.proto create mode 100644 src/google/protobuf/descriptor_legacy.h create mode 100644 src/google/protobuf/descriptor_visitor.h create mode 100644 src/google/protobuf/descriptor_visitor_test.cc create mode 100644 src/google/protobuf/editions/BUILD create mode 100644 src/google/protobuf/editions/codegen_tests/BUILD create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_enum.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_group.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_import.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_optional.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_packed.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_proto3_enum.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_required.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_unpacked.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_utf8_disabled.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_utf8_lite.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto2_utf8_verify.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_enum.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_implicit.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_import.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_optional.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_packed.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_unpacked.proto create mode 100644 src/google/protobuf/editions/codegen_tests/proto3_utf8_strict.proto create mode 100644 src/google/protobuf/editions/defaults_test_embedded.h.template create mode 100644 src/google/protobuf/editions/generated_files_test.cc create mode 100644 src/google/protobuf/editions/generated_reflection_test.cc create mode 100644 src/google/protobuf/editions/golden/compare_cpp_codegen_failure.txt create mode 100644 src/google/protobuf/editions/golden/compare_cpp_codegen_failure.xml create mode 100644 src/google/protobuf/editions/golden/compare_cpp_codegen_multiple.txt create mode 100644 src/google/protobuf/editions/golden/compare_cpp_codegen_multiple.xml create mode 100644 src/google/protobuf/editions/golden/compare_cpp_codegen_success.txt create mode 100644 src/google/protobuf/editions/golden/compare_cpp_codegen_success.xml create mode 100644 src/google/protobuf/editions/golden/editions_transform_proto2.proto create mode 100644 src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto create mode 100644 src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto create mode 100644 src/google/protobuf/editions/golden/editions_transform_proto3.proto create mode 100644 src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto create mode 100644 src/google/protobuf/editions/golden/simple_proto2.proto create mode 100644 src/google/protobuf/editions/golden/simple_proto2_import.proto create mode 100644 src/google/protobuf/editions/golden/simple_proto3.proto create mode 100644 src/google/protobuf/editions/golden/test_messages_proto2.proto create mode 100644 src/google/protobuf/editions/golden/test_messages_proto3.proto create mode 100644 src/google/protobuf/editions/proto/editions_transform_proto2.proto create mode 100644 src/google/protobuf/editions/proto/editions_transform_proto2_lite.proto create mode 100644 src/google/protobuf/editions/proto/editions_transform_proto2_utf8_disabled.proto create mode 100644 src/google/protobuf/editions/proto/editions_transform_proto3.proto create mode 100644 src/google/protobuf/editions/proto/editions_transform_proto3_utf8_disabled.proto create mode 100644 src/google/protobuf/editions/proto/test_editions_default_features.proto create mode 100644 src/google/protobuf/endian.h create mode 100644 src/google/protobuf/explicitly_constructed.h create mode 100644 src/google/protobuf/feature_resolver.cc create mode 100644 src/google/protobuf/feature_resolver.h create mode 100644 src/google/protobuf/feature_resolver_test.cc create mode 100644 src/google/protobuf/field_access_listener.h create mode 100644 src/google/protobuf/generated_enum_util_test.cc create mode 100644 src/google/protobuf/generated_message_bases.cc create mode 100644 src/google/protobuf/generated_message_bases.h delete mode 100644 src/google/protobuf/generated_message_table_driven.cc delete mode 100644 src/google/protobuf/generated_message_table_driven.h delete mode 100644 src/google/protobuf/generated_message_table_driven_lite.cc delete mode 100644 src/google/protobuf/generated_message_table_driven_lite.h create mode 100644 src/google/protobuf/generated_message_tctable_decl.h create mode 100644 src/google/protobuf/generated_message_tctable_full.cc create mode 100644 src/google/protobuf/generated_message_tctable_gen.cc create mode 100644 src/google/protobuf/generated_message_tctable_gen.h create mode 100644 src/google/protobuf/generated_message_tctable_impl.h create mode 100644 src/google/protobuf/generated_message_tctable_lite.cc create mode 100644 src/google/protobuf/generated_message_tctable_lite_test.cc create mode 100644 src/google/protobuf/has_bits_test.cc create mode 100644 src/google/protobuf/inlined_string_field.cc create mode 100644 src/google/protobuf/inlined_string_field_unittest.cc create mode 100644 src/google/protobuf/internal_message_util.cc create mode 100644 src/google/protobuf/internal_message_util.h create mode 100644 src/google/protobuf/internal_message_util_unittest.cc create mode 100644 src/google/protobuf/internal_visibility.h create mode 100644 src/google/protobuf/internal_visibility_for_testing.h create mode 100644 src/google/protobuf/io/BUILD.bazel delete mode 100755 src/google/protobuf/io/gzip_stream_unittest.sh create mode 100644 src/google/protobuf/io/printer_death_test.cc create mode 100644 src/google/protobuf/io/test_zero_copy_stream.h create mode 100644 src/google/protobuf/io/test_zero_copy_stream_test.cc create mode 100644 src/google/protobuf/io/zero_copy_sink.cc create mode 100644 src/google/protobuf/io/zero_copy_sink.h create mode 100644 src/google/protobuf/io/zero_copy_sink_test.cc create mode 100644 src/google/protobuf/json/BUILD.bazel create mode 100644 src/google/protobuf/json/internal/descriptor_traits.h create mode 100644 src/google/protobuf/json/internal/lexer.cc create mode 100644 src/google/protobuf/json/internal/lexer.h create mode 100644 src/google/protobuf/json/internal/lexer_test.cc create mode 100644 src/google/protobuf/json/internal/message_path.cc create mode 100644 src/google/protobuf/json/internal/message_path.h create mode 100644 src/google/protobuf/json/internal/parser.cc create mode 100644 src/google/protobuf/json/internal/parser.h create mode 100644 src/google/protobuf/json/internal/parser_traits.h create mode 100644 src/google/protobuf/json/internal/unparser.cc create mode 100644 src/google/protobuf/json/internal/unparser.h create mode 100644 src/google/protobuf/json/internal/unparser_traits.h create mode 100644 src/google/protobuf/json/internal/untyped_message.cc create mode 100644 src/google/protobuf/json/internal/untyped_message.h create mode 100644 src/google/protobuf/json/internal/writer.cc create mode 100644 src/google/protobuf/json/internal/writer.h create mode 100644 src/google/protobuf/json/internal/zero_copy_buffered_stream.cc create mode 100644 src/google/protobuf/json/internal/zero_copy_buffered_stream.h create mode 100644 src/google/protobuf/json/internal/zero_copy_buffered_stream_test.cc create mode 100644 src/google/protobuf/json/json.cc create mode 100644 src/google/protobuf/json/json.h create mode 100644 src/google/protobuf/json/json_test.cc create mode 100644 src/google/protobuf/map.cc delete mode 100644 src/google/protobuf/map_entry_lite.h create mode 100644 src/google/protobuf/map_probe_benchmark.cc create mode 100644 src/google/protobuf/map_proto3_unittest.proto create mode 100644 src/google/protobuf/map_test.inc create mode 100644 src/google/protobuf/port.cc create mode 100644 src/google/protobuf/port_test.cc create mode 100644 src/google/protobuf/raw_ptr.cc create mode 100644 src/google/protobuf/raw_ptr.h create mode 100644 src/google/protobuf/raw_ptr_test.cc create mode 100644 src/google/protobuf/redaction_metric_test.cc create mode 100644 src/google/protobuf/reflection_mode.cc create mode 100644 src/google/protobuf/reflection_mode.h create mode 100644 src/google/protobuf/reflection_mode_test.cc create mode 100644 src/google/protobuf/reflection_tester.cc create mode 100644 src/google/protobuf/reflection_tester.h create mode 100644 src/google/protobuf/repeated_ptr_field.cc create mode 100644 src/google/protobuf/repeated_ptr_field.h create mode 100644 src/google/protobuf/retention_test.cc create mode 100644 src/google/protobuf/serial_arena.h create mode 100644 src/google/protobuf/string_block.h create mode 100644 src/google/protobuf/string_block_test.cc create mode 100644 src/google/protobuf/string_member_robber.h create mode 100644 src/google/protobuf/stubs/BUILD.bazel delete mode 100644 src/google/protobuf/stubs/bytestream.cc delete mode 100644 src/google/protobuf/stubs/bytestream.h delete mode 100644 src/google/protobuf/stubs/bytestream_unittest.cc delete mode 100644 src/google/protobuf/stubs/casts.h mode change 100755 => 100644 src/google/protobuf/stubs/common.cc delete mode 100644 src/google/protobuf/stubs/fastmem.h delete mode 100644 src/google/protobuf/stubs/hash.h delete mode 100644 src/google/protobuf/stubs/int128.cc delete mode 100644 src/google/protobuf/stubs/int128.h delete mode 100644 src/google/protobuf/stubs/int128_unittest.cc delete mode 100644 src/google/protobuf/stubs/logging.h delete mode 100644 src/google/protobuf/stubs/macros.h delete mode 100644 src/google/protobuf/stubs/map_util.h delete mode 100644 src/google/protobuf/stubs/mathutil.h delete mode 100644 src/google/protobuf/stubs/mutex.h delete mode 100644 src/google/protobuf/stubs/once.h delete mode 100644 src/google/protobuf/stubs/status.cc delete mode 100644 src/google/protobuf/stubs/status.h delete mode 100644 src/google/protobuf/stubs/status_test.cc delete mode 100644 src/google/protobuf/stubs/statusor.cc delete mode 100644 src/google/protobuf/stubs/statusor.h delete mode 100644 src/google/protobuf/stubs/statusor_test.cc delete mode 100644 src/google/protobuf/stubs/stl_util.h delete mode 100644 src/google/protobuf/stubs/stringpiece.cc delete mode 100644 src/google/protobuf/stubs/stringpiece.h delete mode 100644 src/google/protobuf/stubs/stringpiece_unittest.cc delete mode 100644 src/google/protobuf/stubs/stringprintf.cc delete mode 100644 src/google/protobuf/stubs/stringprintf.h delete mode 100644 src/google/protobuf/stubs/stringprintf_unittest.cc delete mode 100644 src/google/protobuf/stubs/structurally_valid.cc delete mode 100644 src/google/protobuf/stubs/structurally_valid_unittest.cc delete mode 100644 src/google/protobuf/stubs/strutil.cc delete mode 100644 src/google/protobuf/stubs/strutil.h delete mode 100644 src/google/protobuf/stubs/strutil_unittest.cc delete mode 100644 src/google/protobuf/stubs/substitute.cc delete mode 100644 src/google/protobuf/stubs/substitute.h delete mode 100644 src/google/protobuf/stubs/template_util.h delete mode 100644 src/google/protobuf/stubs/template_util_unittest.cc delete mode 100644 src/google/protobuf/stubs/time.cc delete mode 100644 src/google/protobuf/stubs/time.h delete mode 100644 src/google/protobuf/stubs/time_test.cc create mode 100644 src/google/protobuf/test_textproto.h create mode 100644 src/google/protobuf/testdata/__init__.py create mode 100644 src/google/protobuf/testing/BUILD.bazel delete mode 100644 src/google/protobuf/testing/zcgunzip.cc delete mode 100644 src/google/protobuf/testing/zcgzip.cc create mode 100644 src/google/protobuf/thread_safe_arena.h create mode 100644 src/google/protobuf/unittest_extension_set.proto create mode 100644 src/google/protobuf/unittest_features.proto create mode 100644 src/google/protobuf/unittest_invalid_features.proto create mode 100644 src/google/protobuf/unittest_proto3_bad_macros.proto create mode 100644 src/google/protobuf/unittest_retention.proto create mode 100644 src/google/protobuf/util/BUILD.bazel delete mode 100644 src/google/protobuf/util/internal/constants.h delete mode 100644 src/google/protobuf/util/internal/datapiece.cc delete mode 100644 src/google/protobuf/util/internal/datapiece.h delete mode 100644 src/google/protobuf/util/internal/default_value_objectwriter.cc delete mode 100644 src/google/protobuf/util/internal/default_value_objectwriter.h delete mode 100644 src/google/protobuf/util/internal/default_value_objectwriter_test.cc delete mode 100644 src/google/protobuf/util/internal/error_listener.cc delete mode 100644 src/google/protobuf/util/internal/error_listener.h delete mode 100644 src/google/protobuf/util/internal/expecting_objectwriter.h delete mode 100644 src/google/protobuf/util/internal/field_mask_utility.cc delete mode 100644 src/google/protobuf/util/internal/field_mask_utility.h delete mode 100644 src/google/protobuf/util/internal/json_escaping.cc delete mode 100644 src/google/protobuf/util/internal/json_escaping.h delete mode 100644 src/google/protobuf/util/internal/json_objectwriter.cc delete mode 100644 src/google/protobuf/util/internal/json_objectwriter.h delete mode 100644 src/google/protobuf/util/internal/json_objectwriter_test.cc delete mode 100644 src/google/protobuf/util/internal/json_stream_parser.cc delete mode 100644 src/google/protobuf/util/internal/json_stream_parser.h delete mode 100644 src/google/protobuf/util/internal/json_stream_parser_test.cc delete mode 100644 src/google/protobuf/util/internal/location_tracker.h delete mode 100644 src/google/protobuf/util/internal/mock_error_listener.h delete mode 100644 src/google/protobuf/util/internal/object_location_tracker.h delete mode 100644 src/google/protobuf/util/internal/object_source.h delete mode 100644 src/google/protobuf/util/internal/object_writer.cc delete mode 100644 src/google/protobuf/util/internal/object_writer.h delete mode 100644 src/google/protobuf/util/internal/proto_writer.cc delete mode 100644 src/google/protobuf/util/internal/proto_writer.h delete mode 100644 src/google/protobuf/util/internal/protostream_objectsource.cc delete mode 100644 src/google/protobuf/util/internal/protostream_objectsource.h delete mode 100644 src/google/protobuf/util/internal/protostream_objectsource_test.cc delete mode 100644 src/google/protobuf/util/internal/protostream_objectwriter.cc delete mode 100644 src/google/protobuf/util/internal/protostream_objectwriter.h delete mode 100644 src/google/protobuf/util/internal/protostream_objectwriter_test.cc delete mode 100644 src/google/protobuf/util/internal/structured_objectwriter.h delete mode 100644 src/google/protobuf/util/internal/testdata/anys.proto delete mode 100644 src/google/protobuf/util/internal/testdata/books.proto delete mode 100644 src/google/protobuf/util/internal/testdata/default_value.proto delete mode 100644 src/google/protobuf/util/internal/testdata/default_value_test.proto delete mode 100644 src/google/protobuf/util/internal/testdata/field_mask.proto delete mode 100644 src/google/protobuf/util/internal/testdata/maps.proto delete mode 100644 src/google/protobuf/util/internal/testdata/oneofs.proto delete mode 100644 src/google/protobuf/util/internal/testdata/proto3.proto delete mode 100644 src/google/protobuf/util/internal/testdata/struct.proto delete mode 100644 src/google/protobuf/util/internal/testdata/timestamp_duration.proto delete mode 100644 src/google/protobuf/util/internal/testdata/wrappers.proto delete mode 100644 src/google/protobuf/util/internal/type_info.cc delete mode 100644 src/google/protobuf/util/internal/type_info.h delete mode 100644 src/google/protobuf/util/internal/type_info_test_helper.cc delete mode 100644 src/google/protobuf/util/internal/type_info_test_helper.h delete mode 100644 src/google/protobuf/util/internal/utility.cc delete mode 100644 src/google/protobuf/util/internal/utility.h delete mode 100644 src/google/protobuf/util/json_util.cc delete mode 100644 src/google/protobuf/util/json_util_test.cc create mode 100644 src/google/protobuf/util/message_differencer_unittest_proto3.proto create mode 100644 src/google/protobuf/varint_shuffle.h create mode 100644 src/google/protobuf/varint_shuffle_test.cc create mode 100644 src/google/protobuf/wire_format_unittest.inc delete mode 100755 tests.sh delete mode 100644 third_party/BUILD create mode 100644 third_party/BUILD.bazel create mode 100644 third_party/abseil-cpp/absl/algorithm/algorithm.h create mode 100644 third_party/abseil-cpp/absl/algorithm/container.h create mode 100644 third_party/abseil-cpp/absl/base/attributes.h create mode 100644 third_party/abseil-cpp/absl/base/call_once.h create mode 100644 third_party/abseil-cpp/absl/base/casts.h create mode 100644 third_party/abseil-cpp/absl/base/config.h create mode 100644 third_party/abseil-cpp/absl/base/const_init.h create mode 100644 third_party/abseil-cpp/absl/base/dynamic_annotations.h create mode 100644 third_party/abseil-cpp/absl/base/internal/atomic_hook.h create mode 100644 third_party/abseil-cpp/absl/base/internal/atomic_hook_test_helper.h create mode 100644 third_party/abseil-cpp/absl/base/internal/cycleclock.h create mode 100644 third_party/abseil-cpp/absl/base/internal/cycleclock_config.h create mode 100644 third_party/abseil-cpp/absl/base/internal/direct_mmap.h create mode 100644 third_party/abseil-cpp/absl/base/internal/dynamic_annotations.h create mode 100644 third_party/abseil-cpp/absl/base/internal/endian.h create mode 100644 third_party/abseil-cpp/absl/base/internal/errno_saver.h create mode 100644 third_party/abseil-cpp/absl/base/internal/exception_safety_testing.h create mode 100644 third_party/abseil-cpp/absl/base/internal/exception_testing.h create mode 100644 third_party/abseil-cpp/absl/base/internal/fast_type_id.h create mode 100644 third_party/abseil-cpp/absl/base/internal/hide_ptr.h create mode 100644 third_party/abseil-cpp/absl/base/internal/identity.h create mode 100644 third_party/abseil-cpp/absl/base/internal/inline_variable.h create mode 100644 third_party/abseil-cpp/absl/base/internal/inline_variable_testing.h create mode 100644 third_party/abseil-cpp/absl/base/internal/invoke.h create mode 100644 third_party/abseil-cpp/absl/base/internal/low_level_alloc.h create mode 100644 third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h create mode 100644 third_party/abseil-cpp/absl/base/internal/nullability_impl.h create mode 100644 third_party/abseil-cpp/absl/base/internal/per_thread_tls.h create mode 100644 third_party/abseil-cpp/absl/base/internal/prefetch.h create mode 100644 third_party/abseil-cpp/absl/base/internal/pretty_function.h create mode 100644 third_party/abseil-cpp/absl/base/internal/raw_logging.h create mode 100644 third_party/abseil-cpp/absl/base/internal/scheduling_mode.h create mode 100644 third_party/abseil-cpp/absl/base/internal/scoped_set_env.h create mode 100644 third_party/abseil-cpp/absl/base/internal/spinlock.h create mode 100644 third_party/abseil-cpp/absl/base/internal/spinlock_wait.h create mode 100644 third_party/abseil-cpp/absl/base/internal/strerror.h create mode 100644 third_party/abseil-cpp/absl/base/internal/sysinfo.h create mode 100644 third_party/abseil-cpp/absl/base/internal/thread_annotations.h create mode 100644 third_party/abseil-cpp/absl/base/internal/thread_identity.h create mode 100644 third_party/abseil-cpp/absl/base/internal/throw_delegate.h create mode 100644 third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h create mode 100644 third_party/abseil-cpp/absl/base/internal/unaligned_access.h create mode 100644 third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h create mode 100644 third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h create mode 100644 third_party/abseil-cpp/absl/base/log_severity.h create mode 100644 third_party/abseil-cpp/absl/base/macros.h create mode 100644 third_party/abseil-cpp/absl/base/nullability.h create mode 100644 third_party/abseil-cpp/absl/base/optimization.h create mode 100644 third_party/abseil-cpp/absl/base/options.h create mode 100644 third_party/abseil-cpp/absl/base/policy_checks.h create mode 100644 third_party/abseil-cpp/absl/base/port.h create mode 100644 third_party/abseil-cpp/absl/base/prefetch.h create mode 100644 third_party/abseil-cpp/absl/base/thread_annotations.h create mode 100644 third_party/abseil-cpp/absl/cleanup/cleanup.h create mode 100644 third_party/abseil-cpp/absl/cleanup/internal/cleanup.h create mode 100644 third_party/abseil-cpp/absl/container/btree_map.h create mode 100644 third_party/abseil-cpp/absl/container/btree_set.h create mode 100644 third_party/abseil-cpp/absl/container/btree_test.h create mode 100644 third_party/abseil-cpp/absl/container/fixed_array.h create mode 100644 third_party/abseil-cpp/absl/container/flat_hash_map.h create mode 100644 third_party/abseil-cpp/absl/container/flat_hash_set.h create mode 100644 third_party/abseil-cpp/absl/container/inlined_vector.h create mode 100644 third_party/abseil-cpp/absl/container/internal/btree.h create mode 100644 third_party/abseil-cpp/absl/container/internal/btree_container.h create mode 100644 third_party/abseil-cpp/absl/container/internal/common.h create mode 100644 third_party/abseil-cpp/absl/container/internal/common_policy_traits.h create mode 100644 third_party/abseil-cpp/absl/container/internal/compressed_tuple.h create mode 100644 third_party/abseil-cpp/absl/container/internal/container_memory.h create mode 100644 third_party/abseil-cpp/absl/container/internal/counting_allocator.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hash_generator_testing.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hash_policy_testing.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hashtable_debug.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h create mode 100644 third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h create mode 100644 third_party/abseil-cpp/absl/container/internal/inlined_vector.h create mode 100644 third_party/abseil-cpp/absl/container/internal/layout.h create mode 100644 third_party/abseil-cpp/absl/container/internal/node_slot_policy.h create mode 100644 third_party/abseil-cpp/absl/container/internal/raw_hash_map.h create mode 100644 third_party/abseil-cpp/absl/container/internal/raw_hash_set.h create mode 100644 third_party/abseil-cpp/absl/container/internal/test_instance_tracker.h create mode 100644 third_party/abseil-cpp/absl/container/internal/tracked.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_map_constructor_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_map_lookup_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_map_members_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_map_modifiers_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_set_constructor_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_set_lookup_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_set_members_test.h create mode 100644 third_party/abseil-cpp/absl/container/internal/unordered_set_modifiers_test.h create mode 100644 third_party/abseil-cpp/absl/container/node_hash_map.h create mode 100644 third_party/abseil-cpp/absl/container/node_hash_set.h create mode 100644 third_party/abseil-cpp/absl/crc/crc32c.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/cpu_detect.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc32c.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc32c_inline.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc_internal.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/crc_memcpy.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h create mode 100644 third_party/abseil-cpp/absl/crc/internal/non_temporal_memcpy.h create mode 100644 third_party/abseil-cpp/absl/debugging/failure_signal_handler.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/demangle.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/examine_stack.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/stack_consumption.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/symbolize.h create mode 100644 third_party/abseil-cpp/absl/debugging/internal/vdso_support.h create mode 100644 third_party/abseil-cpp/absl/debugging/leak_check.h create mode 100644 third_party/abseil-cpp/absl/debugging/stacktrace.h create mode 100644 third_party/abseil-cpp/absl/debugging/symbolize.h create mode 100644 third_party/abseil-cpp/absl/flags/commandlineflag.h create mode 100644 third_party/abseil-cpp/absl/flags/config.h create mode 100644 third_party/abseil-cpp/absl/flags/declare.h create mode 100644 third_party/abseil-cpp/absl/flags/flag.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/commandlineflag.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/flag.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/parse.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/path_util.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/private_handle_accessor.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/program_name.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/registry.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/sequence_lock.h create mode 100644 third_party/abseil-cpp/absl/flags/internal/usage.h create mode 100644 third_party/abseil-cpp/absl/flags/marshalling.h create mode 100644 third_party/abseil-cpp/absl/flags/parse.h create mode 100644 third_party/abseil-cpp/absl/flags/reflection.h create mode 100644 third_party/abseil-cpp/absl/flags/usage.h create mode 100644 third_party/abseil-cpp/absl/flags/usage_config.h create mode 100644 third_party/abseil-cpp/absl/functional/any_invocable.h create mode 100644 third_party/abseil-cpp/absl/functional/bind_front.h create mode 100644 third_party/abseil-cpp/absl/functional/function_ref.h create mode 100644 third_party/abseil-cpp/absl/functional/internal/any_invocable.h create mode 100644 third_party/abseil-cpp/absl/functional/internal/front_binder.h create mode 100644 third_party/abseil-cpp/absl/functional/internal/function_ref.h create mode 100644 third_party/abseil-cpp/absl/hash/hash.h create mode 100644 third_party/abseil-cpp/absl/hash/hash_testing.h create mode 100644 third_party/abseil-cpp/absl/hash/internal/city.h create mode 100644 third_party/abseil-cpp/absl/hash/internal/hash.h create mode 100644 third_party/abseil-cpp/absl/hash/internal/hash_test.h create mode 100644 third_party/abseil-cpp/absl/hash/internal/low_level_hash.h create mode 100644 third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h create mode 100644 third_party/abseil-cpp/absl/log/absl_check.h create mode 100644 third_party/abseil-cpp/absl/log/absl_log.h create mode 100644 third_party/abseil-cpp/absl/log/check.h create mode 100644 third_party/abseil-cpp/absl/log/die_if_null.h create mode 100644 third_party/abseil-cpp/absl/log/flags.h create mode 100644 third_party/abseil-cpp/absl/log/globals.h create mode 100644 third_party/abseil-cpp/absl/log/initialize.h create mode 100644 third_party/abseil-cpp/absl/log/internal/append_truncated.h create mode 100644 third_party/abseil-cpp/absl/log/internal/check_impl.h create mode 100644 third_party/abseil-cpp/absl/log/internal/check_op.h create mode 100644 third_party/abseil-cpp/absl/log/internal/conditions.h create mode 100644 third_party/abseil-cpp/absl/log/internal/config.h create mode 100644 third_party/abseil-cpp/absl/log/internal/flags.h create mode 100644 third_party/abseil-cpp/absl/log/internal/globals.h create mode 100644 third_party/abseil-cpp/absl/log/internal/log_format.h create mode 100644 third_party/abseil-cpp/absl/log/internal/log_impl.h create mode 100644 third_party/abseil-cpp/absl/log/internal/log_message.h create mode 100644 third_party/abseil-cpp/absl/log/internal/log_sink_set.h create mode 100644 third_party/abseil-cpp/absl/log/internal/nullguard.h create mode 100644 third_party/abseil-cpp/absl/log/internal/nullstream.h create mode 100644 third_party/abseil-cpp/absl/log/internal/proto.h create mode 100644 third_party/abseil-cpp/absl/log/internal/strip.h create mode 100644 third_party/abseil-cpp/absl/log/internal/structured.h create mode 100644 third_party/abseil-cpp/absl/log/internal/test_actions.h create mode 100644 third_party/abseil-cpp/absl/log/internal/test_helpers.h create mode 100644 third_party/abseil-cpp/absl/log/internal/test_matchers.h create mode 100644 third_party/abseil-cpp/absl/log/internal/voidify.h create mode 100644 third_party/abseil-cpp/absl/log/log.h create mode 100644 third_party/abseil-cpp/absl/log/log_entry.h create mode 100644 third_party/abseil-cpp/absl/log/log_sink.h create mode 100644 third_party/abseil-cpp/absl/log/log_sink_registry.h create mode 100644 third_party/abseil-cpp/absl/log/log_streamer.h create mode 100644 third_party/abseil-cpp/absl/log/scoped_mock_log.h create mode 100644 third_party/abseil-cpp/absl/log/structured.h create mode 100644 third_party/abseil-cpp/absl/memory/memory.h create mode 100644 third_party/abseil-cpp/absl/meta/type_traits.h create mode 100644 third_party/abseil-cpp/absl/numeric/bits.h create mode 100644 third_party/abseil-cpp/absl/numeric/int128.h create mode 100644 third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc create mode 100644 third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc create mode 100644 third_party/abseil-cpp/absl/numeric/internal/bits.h create mode 100644 third_party/abseil-cpp/absl/numeric/internal/representation.h create mode 100644 third_party/abseil-cpp/absl/profiling/internal/exponential_biased.h create mode 100644 third_party/abseil-cpp/absl/profiling/internal/periodic_sampler.h create mode 100644 third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h create mode 100644 third_party/abseil-cpp/absl/random/bernoulli_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/beta_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/bit_gen_ref.h create mode 100644 third_party/abseil-cpp/absl/random/discrete_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/distributions.h create mode 100644 third_party/abseil-cpp/absl/random/exponential_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/gaussian_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/internal/chi_square.h create mode 100644 third_party/abseil-cpp/absl/random/internal/distribution_caller.h create mode 100644 third_party/abseil-cpp/absl/random/internal/distribution_test_util.h create mode 100644 third_party/abseil-cpp/absl/random/internal/explicit_seed_seq.h create mode 100644 third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h create mode 100644 third_party/abseil-cpp/absl/random/internal/fastmath.h create mode 100644 third_party/abseil-cpp/absl/random/internal/generate_real.h create mode 100644 third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h create mode 100644 third_party/abseil-cpp/absl/random/internal/mock_helpers.h create mode 100644 third_party/abseil-cpp/absl/random/internal/mock_overload_set.h create mode 100644 third_party/abseil-cpp/absl/random/internal/nanobenchmark.h create mode 100644 third_party/abseil-cpp/absl/random/internal/nonsecure_base.h create mode 100644 third_party/abseil-cpp/absl/random/internal/pcg_engine.h create mode 100644 third_party/abseil-cpp/absl/random/internal/platform.h create mode 100644 third_party/abseil-cpp/absl/random/internal/pool_urbg.h create mode 100644 third_party/abseil-cpp/absl/random/internal/randen.h create mode 100644 third_party/abseil-cpp/absl/random/internal/randen_detect.h create mode 100644 third_party/abseil-cpp/absl/random/internal/randen_engine.h create mode 100644 third_party/abseil-cpp/absl/random/internal/randen_hwaes.h create mode 100644 third_party/abseil-cpp/absl/random/internal/randen_slow.h create mode 100644 third_party/abseil-cpp/absl/random/internal/randen_traits.h create mode 100644 third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h create mode 100644 third_party/abseil-cpp/absl/random/internal/seed_material.h create mode 100644 third_party/abseil-cpp/absl/random/internal/sequence_urbg.h create mode 100644 third_party/abseil-cpp/absl/random/internal/traits.h create mode 100644 third_party/abseil-cpp/absl/random/internal/uniform_helper.h create mode 100644 third_party/abseil-cpp/absl/random/internal/wide_multiply.h create mode 100644 third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/mock_distributions.h create mode 100644 third_party/abseil-cpp/absl/random/mocking_bit_gen.h create mode 100644 third_party/abseil-cpp/absl/random/poisson_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/random.h create mode 100644 third_party/abseil-cpp/absl/random/seed_gen_exception.h create mode 100644 third_party/abseil-cpp/absl/random/seed_sequences.h create mode 100644 third_party/abseil-cpp/absl/random/uniform_int_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/uniform_real_distribution.h create mode 100644 third_party/abseil-cpp/absl/random/zipf_distribution.h create mode 100644 third_party/abseil-cpp/absl/status/internal/status_internal.h create mode 100644 third_party/abseil-cpp/absl/status/internal/statusor_internal.h create mode 100644 third_party/abseil-cpp/absl/status/status.h create mode 100644 third_party/abseil-cpp/absl/status/status_payload_printer.h create mode 100644 third_party/abseil-cpp/absl/status/statusor.h create mode 100644 third_party/abseil-cpp/absl/strings/ascii.h create mode 100644 third_party/abseil-cpp/absl/strings/charconv.h create mode 100644 third_party/abseil-cpp/absl/strings/cord.h create mode 100644 third_party/abseil-cpp/absl/strings/cord_analysis.h create mode 100644 third_party/abseil-cpp/absl/strings/cord_buffer.h create mode 100644 third_party/abseil-cpp/absl/strings/cord_test_helpers.h create mode 100644 third_party/abseil-cpp/absl/strings/cordz_test_helpers.h create mode 100644 third_party/abseil-cpp/absl/strings/escaping.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/char_map.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/charconv_parse.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_data_edge.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_internal.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cord_rep_test_util.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_functions.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_handle.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_info.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_sample_token.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_update_scope.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/escaping.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/escaping_test_common.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/has_absl_stringify.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/memutil.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/numbers_test_common.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/ostringstream.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/pow10_helper.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/arg.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/bind.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/checker.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/extension.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/output.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_format/parser.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_join_internal.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/str_split_internal.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/string_constant.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/stringify_sink.h create mode 100644 third_party/abseil-cpp/absl/strings/internal/utf8.h create mode 100644 third_party/abseil-cpp/absl/strings/match.h create mode 100644 third_party/abseil-cpp/absl/strings/numbers.h create mode 100644 third_party/abseil-cpp/absl/strings/str_cat.h create mode 100644 third_party/abseil-cpp/absl/strings/str_format.h create mode 100644 third_party/abseil-cpp/absl/strings/str_join.h create mode 100644 third_party/abseil-cpp/absl/strings/str_replace.h create mode 100644 third_party/abseil-cpp/absl/strings/str_split.h create mode 100644 third_party/abseil-cpp/absl/strings/string_view.h create mode 100644 third_party/abseil-cpp/absl/strings/strip.h create mode 100644 third_party/abseil-cpp/absl/strings/substitute.h create mode 100644 third_party/abseil-cpp/absl/synchronization/barrier.h create mode 100644 third_party/abseil-cpp/absl/synchronization/blocking_counter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/futex.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/thread_pool.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/waiter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/waiter_base.h create mode 100644 third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.h create mode 100644 third_party/abseil-cpp/absl/synchronization/mutex.h create mode 100644 third_party/abseil-cpp/absl/synchronization/notification.h create mode 100644 third_party/abseil-cpp/absl/time/civil_time.h create mode 100644 third_party/abseil-cpp/absl/time/clock.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h create mode 100644 third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h create mode 100644 third_party/abseil-cpp/absl/time/internal/test_util.h create mode 100644 third_party/abseil-cpp/absl/time/time.h create mode 100644 third_party/abseil-cpp/absl/types/any.h create mode 100644 third_party/abseil-cpp/absl/types/bad_any_cast.h create mode 100644 third_party/abseil-cpp/absl/types/bad_optional_access.h create mode 100644 third_party/abseil-cpp/absl/types/bad_variant_access.h create mode 100644 third_party/abseil-cpp/absl/types/compare.h create mode 100644 third_party/abseil-cpp/absl/types/internal/conformance_aliases.h create mode 100644 third_party/abseil-cpp/absl/types/internal/conformance_archetype.h create mode 100644 third_party/abseil-cpp/absl/types/internal/conformance_profile.h create mode 100644 third_party/abseil-cpp/absl/types/internal/conformance_testing.h create mode 100644 third_party/abseil-cpp/absl/types/internal/conformance_testing_helpers.h create mode 100644 third_party/abseil-cpp/absl/types/internal/optional.h create mode 100644 third_party/abseil-cpp/absl/types/internal/parentheses.h create mode 100644 third_party/abseil-cpp/absl/types/internal/span.h create mode 100644 third_party/abseil-cpp/absl/types/internal/transform_args.h create mode 100644 third_party/abseil-cpp/absl/types/internal/variant.h create mode 100644 third_party/abseil-cpp/absl/types/optional.h create mode 100644 third_party/abseil-cpp/absl/types/span.h create mode 100644 third_party/abseil-cpp/absl/types/variant.h create mode 100644 third_party/abseil-cpp/absl/utility/internal/if_constexpr.h create mode 100644 third_party/abseil-cpp/absl/utility/utility.h create mode 100644 third_party/jsoncpp.BUILD create mode 100644 third_party/lunit/BUILD.bazel create mode 100644 third_party/lunit/LICENSE create mode 100644 third_party/lunit/README.google create mode 100644 third_party/lunit/console.lua create mode 100644 third_party/lunit/lunit.lua delete mode 100644 third_party/six.BUILD create mode 100644 third_party/utf8_range/.bazelrc create mode 100644 third_party/utf8_range/.github/workflows/bazel_tests.yml create mode 100644 third_party/utf8_range/.github/workflows/cmake_tests.yml create mode 100644 third_party/utf8_range/.gitignore create mode 100644 third_party/utf8_range/BUILD.bazel create mode 100644 third_party/utf8_range/CMakeLists.txt create mode 100644 third_party/utf8_range/CONTRIBUTING.md create mode 100644 third_party/utf8_range/LICENSE create mode 100644 third_party/utf8_range/README.md create mode 100644 third_party/utf8_range/UTF-8-demo.txt create mode 100644 third_party/utf8_range/WORKSPACE create mode 100644 third_party/utf8_range/ascii.cpp create mode 100644 third_party/utf8_range/boost.cpp create mode 100644 third_party/utf8_range/cmake/utf8_range-config.cmake.in create mode 100644 third_party/utf8_range/cmake/utf8_range.pc.cmake create mode 100644 third_party/utf8_range/fuzz/BUILD.bazel create mode 100644 third_party/utf8_range/fuzz/utf8_fuzzer.dict create mode 100644 third_party/utf8_range/fuzz/utf8_validity_fuzzer.cc create mode 100644 third_party/utf8_range/lemire-avx2.c create mode 100644 third_party/utf8_range/lemire-neon.c create mode 100644 third_party/utf8_range/lemire-sse.c create mode 100644 third_party/utf8_range/lookup.c create mode 100644 third_party/utf8_range/main.c create mode 100644 third_party/utf8_range/naive.c create mode 100644 third_party/utf8_range/range-avx2.c create mode 100644 third_party/utf8_range/range-neon.c create mode 100644 third_party/utf8_range/range-sse.c create mode 100644 third_party/utf8_range/range2-neon.c create mode 100644 third_party/utf8_range/range2-sse.c create mode 100644 third_party/utf8_range/utf8_corpus_dir/utf8_corpus_durst.txt create mode 100644 third_party/utf8_range/utf8_corpus_dir/utf8_corpus_kuhn.txt create mode 100644 third_party/utf8_range/utf8_range.h create mode 100644 third_party/utf8_range/utf8_to_utf16/Makefile create mode 100644 third_party/utf8_range/utf8_to_utf16/iconv.c create mode 100644 third_party/utf8_range/utf8_to_utf16/main.c create mode 100644 third_party/utf8_range/utf8_to_utf16/naive.c create mode 100644 third_party/utf8_range/utf8_validity.cc create mode 100644 third_party/utf8_range/utf8_validity.h create mode 100644 third_party/utf8_range/utf8_validity_test.cc create mode 100644 third_party/utf8_range/workspace_deps.bzl create mode 100644 third_party/zlib.BUILD create mode 100644 toolchain/BUILD.bazel create mode 100644 toolchain/cc_toolchain_config.bzl create mode 100644 toolchain/toolchains.bazelrc create mode 100644 upb/BUILD create mode 100644 upb/README.md create mode 100644 upb/base/BUILD create mode 100644 upb/base/descriptor_constants.h create mode 100644 upb/base/internal/log2.h create mode 100644 upb/base/status.c create mode 100644 upb/base/status.h create mode 100644 upb/base/status.hpp create mode 100644 upb/base/string_view.h create mode 100644 upb/cmake/BUILD.bazel create mode 100644 upb/cmake/CMakeLists.txt create mode 100644 upb/cmake/README.md create mode 100644 upb/cmake/build_defs.bzl create mode 100644 upb/cmake/google/protobuf/descriptor.upb.c create mode 100644 upb/cmake/google/protobuf/descriptor.upb.h create mode 100644 upb/cmake/google/protobuf/descriptor.upb_minitable.c create mode 100644 upb/cmake/google/protobuf/descriptor.upb_minitable.h create mode 100644 upb/cmake/make_cmakelists.py create mode 100644 upb/cmake/push_auto_update.sh create mode 100644 upb/cmake/staleness_test.py create mode 100644 upb/cmake/staleness_test_lib.py create mode 100644 upb/collections/BUILD create mode 100644 upb/collections/array.h create mode 100644 upb/collections/map.h create mode 100644 upb/conformance/BUILD create mode 100644 upb/conformance/conformance_upb.c create mode 100644 upb/conformance/conformance_upb_failures.txt create mode 100644 upb/generated_code_support.h create mode 100644 upb/hash/BUILD create mode 100644 upb/hash/common.c create mode 100644 upb/hash/common.h create mode 100644 upb/hash/int_table.h create mode 100644 upb/hash/str_table.h create mode 100644 upb/hash/test.cc create mode 100644 upb/io/BUILD create mode 100644 upb/io/README.md create mode 100644 upb/io/chunked_input_stream.c create mode 100644 upb/io/chunked_input_stream.h create mode 100644 upb/io/chunked_output_stream.c create mode 100644 upb/io/chunked_output_stream.h create mode 100644 upb/io/string.h create mode 100644 upb/io/string_test.cc create mode 100644 upb/io/tokenizer.c create mode 100644 upb/io/tokenizer.h create mode 100644 upb/io/tokenizer_test.cc create mode 100644 upb/io/zero_copy_input_stream.h create mode 100644 upb/io/zero_copy_output_stream.h create mode 100644 upb/io/zero_copy_stream_test.cc create mode 100644 upb/json/BUILD create mode 100644 upb/json/decode.c create mode 100644 upb/json/decode.h create mode 100644 upb/json/decode_test.cc create mode 100644 upb/json/encode.c create mode 100644 upb/json/encode.h create mode 100644 upb/json/encode_test.cc create mode 100644 upb/json/test.proto create mode 100644 upb/lex/BUILD create mode 100644 upb/lex/atoi.c create mode 100644 upb/lex/atoi.h create mode 100644 upb/lex/atoi_test.cc create mode 100644 upb/lex/round_trip.c create mode 100644 upb/lex/round_trip.h create mode 100644 upb/lex/strtod.c create mode 100644 upb/lex/strtod.h create mode 100644 upb/lex/unicode.c create mode 100644 upb/lex/unicode.h create mode 100644 upb/mem/BUILD create mode 100644 upb/mem/alloc.c create mode 100644 upb/mem/alloc.h create mode 100644 upb/mem/arena.c create mode 100644 upb/mem/arena.h create mode 100644 upb/mem/arena.hpp create mode 100644 upb/mem/arena_test.cc create mode 100644 upb/mem/internal/arena.h create mode 100644 upb/message/BUILD create mode 100644 upb/message/accessors.c create mode 100644 upb/message/accessors.h create mode 100644 upb/message/accessors_split64.h create mode 100644 upb/message/accessors_test.cc create mode 100644 upb/message/array.c create mode 100644 upb/message/array.h create mode 100644 upb/message/array_split64.h create mode 100644 upb/message/array_test.cc create mode 100644 upb/message/copy.c create mode 100644 upb/message/copy.h create mode 100644 upb/message/copy_test.cc create mode 100644 upb/message/internal/accessors.h create mode 100644 upb/message/internal/array.h create mode 100644 upb/message/internal/extension.h create mode 100644 upb/message/internal/map.h create mode 100644 upb/message/internal/map_entry.h create mode 100644 upb/message/internal/map_sorter.h create mode 100644 upb/message/internal/message.h create mode 100644 upb/message/internal/types.h create mode 100644 upb/message/map.c create mode 100644 upb/message/map.h create mode 100644 upb/message/map_gencode_util.h create mode 100644 upb/message/map_sorter.c create mode 100644 upb/message/map_test.cc create mode 100644 upb/message/message.c create mode 100644 upb/message/message.h create mode 100644 upb/message/promote.c create mode 100644 upb/message/promote.h create mode 100644 upb/message/promote_test.cc create mode 100644 upb/message/tagged_ptr.h create mode 100644 upb/message/test.cc create mode 100644 upb/message/test.proto create mode 100644 upb/message/types.h create mode 100644 upb/message/utf8_test.cc create mode 100644 upb/message/utf8_test.proto create mode 100644 upb/message/value.h create mode 100644 upb/mini_descriptor/BUILD create mode 100644 upb/mini_descriptor/build_enum.c create mode 100644 upb/mini_descriptor/build_enum.h create mode 100644 upb/mini_descriptor/decode.c create mode 100644 upb/mini_descriptor/decode.h create mode 100644 upb/mini_descriptor/internal/base92.c create mode 100644 upb/mini_descriptor/internal/base92.h create mode 100644 upb/mini_descriptor/internal/decoder.h create mode 100644 upb/mini_descriptor/internal/encode.c create mode 100644 upb/mini_descriptor/internal/encode.h create mode 100644 upb/mini_descriptor/internal/encode.hpp create mode 100644 upb/mini_descriptor/internal/encode_test.cc create mode 100644 upb/mini_descriptor/internal/modifiers.h create mode 100644 upb/mini_descriptor/internal/wire_constants.h create mode 100644 upb/mini_descriptor/link.c create mode 100644 upb/mini_descriptor/link.h create mode 100644 upb/mini_table/BUILD create mode 100644 upb/mini_table/compat.c create mode 100644 upb/mini_table/compat.h create mode 100644 upb/mini_table/compat_test.cc create mode 100644 upb/mini_table/enum.h create mode 100644 upb/mini_table/extension.h create mode 100644 upb/mini_table/extension_registry.c create mode 100644 upb/mini_table/extension_registry.h create mode 100644 upb/mini_table/field.h create mode 100644 upb/mini_table/file.h create mode 100644 upb/mini_table/internal/enum.h create mode 100644 upb/mini_table/internal/extension.h create mode 100644 upb/mini_table/internal/field.h create mode 100644 upb/mini_table/internal/file.h create mode 100644 upb/mini_table/internal/message.c create mode 100644 upb/mini_table/internal/message.h create mode 100644 upb/mini_table/internal/sub.h create mode 100644 upb/mini_table/message.c create mode 100644 upb/mini_table/message.h create mode 100644 upb/mini_table/sub.h create mode 100644 upb/port/BUILD create mode 100644 upb/port/atomic.h create mode 100644 upb/port/def.inc create mode 100644 upb/port/undef.inc create mode 100644 upb/port/vsnprintf_compat.h create mode 100644 upb/reflection/common.h create mode 100644 upb/reflection/def.h create mode 100644 upb/reflection/def.hpp create mode 100644 upb/reflection/def_pool.c create mode 100644 upb/reflection/def_pool.h create mode 100644 upb/reflection/def_type.c create mode 100644 upb/reflection/def_type.h create mode 100644 upb/reflection/desc_state.c create mode 100644 upb/reflection/enum_def.c create mode 100644 upb/reflection/enum_def.h create mode 100644 upb/reflection/enum_reserved_range.c create mode 100644 upb/reflection/enum_reserved_range.h create mode 100644 upb/reflection/enum_value_def.c create mode 100644 upb/reflection/enum_value_def.h create mode 100644 upb/reflection/extension_range.c create mode 100644 upb/reflection/extension_range.h create mode 100644 upb/reflection/field_def.c create mode 100644 upb/reflection/field_def.h create mode 100644 upb/reflection/file_def.c create mode 100644 upb/reflection/file_def.h create mode 100644 upb/reflection/internal/def_builder.c create mode 100644 upb/reflection/internal/def_builder.h create mode 100644 upb/reflection/internal/def_builder_test.cc create mode 100644 upb/reflection/internal/def_pool.h create mode 100644 upb/reflection/internal/desc_state.h create mode 100644 upb/reflection/internal/enum_def.h create mode 100644 upb/reflection/internal/enum_reserved_range.h create mode 100644 upb/reflection/internal/enum_value_def.h create mode 100644 upb/reflection/internal/extension_range.h create mode 100644 upb/reflection/internal/field_def.h create mode 100644 upb/reflection/internal/file_def.h create mode 100644 upb/reflection/internal/message_def.h create mode 100644 upb/reflection/internal/message_reserved_range.h create mode 100644 upb/reflection/internal/method_def.h create mode 100644 upb/reflection/internal/oneof_def.h create mode 100644 upb/reflection/internal/service_def.h create mode 100644 upb/reflection/internal/strdup2.c create mode 100644 upb/reflection/internal/strdup2.h create mode 100644 upb/reflection/message.c create mode 100644 upb/reflection/message.h create mode 100644 upb/reflection/message.hpp create mode 100644 upb/reflection/message_def.c create mode 100644 upb/reflection/message_def.h create mode 100644 upb/reflection/message_reserved_range.c create mode 100644 upb/reflection/message_reserved_range.h create mode 100644 upb/reflection/method_def.c create mode 100644 upb/reflection/method_def.h create mode 100644 upb/reflection/oneof_def.c create mode 100644 upb/reflection/oneof_def.h create mode 100644 upb/reflection/service_def.c create mode 100644 upb/reflection/service_def.h create mode 100644 upb/reflection/stage0/google/protobuf/descriptor.upb.c create mode 100644 upb/reflection/stage0/google/protobuf/descriptor.upb.h create mode 100644 upb/test/BUILD create mode 100644 upb/test/empty.proto create mode 100644 upb/test/fuzz_util.cc create mode 100644 upb/test/fuzz_util.h create mode 100644 upb/test/parse_text_proto.h create mode 100644 upb/test/proto3_test.cc create mode 100644 upb/test/proto3_test.proto create mode 100644 upb/test/test.proto create mode 100644 upb/test/test_cpp.cc create mode 100644 upb/test/test_cpp.proto create mode 100644 upb/test/test_generated_code.cc create mode 100644 upb/test/test_import_empty_srcs.cc create mode 100644 upb/test/test_import_empty_srcs.proto create mode 100644 upb/test/test_mini_table_oneof.cc create mode 100644 upb/text/BUILD create mode 100644 upb/text/encode.c create mode 100644 upb/text/encode.h create mode 100644 upb/upb.hpp create mode 100644 upb/upb_so.c create mode 100644 upb/util/BUILD create mode 100644 upb/util/README.md create mode 100644 upb/util/compare.c create mode 100644 upb/util/compare.h create mode 100644 upb/util/compare_test.cc create mode 100644 upb/util/def_to_proto.c create mode 100644 upb/util/def_to_proto.h create mode 100644 upb/util/def_to_proto_fuzz_test.cc create mode 100644 upb/util/def_to_proto_public_import_test.proto create mode 100644 upb/util/def_to_proto_regular_import_test.proto create mode 100644 upb/util/def_to_proto_test.cc create mode 100644 upb/util/def_to_proto_test.h create mode 100644 upb/util/def_to_proto_test.proto create mode 100644 upb/util/def_to_proto_weak_import_test.proto create mode 100644 upb/util/def_to_proto_wweak_import_test.proto create mode 100644 upb/util/required_fields.c create mode 100644 upb/util/required_fields.h create mode 100644 upb/util/required_fields_test.cc create mode 100644 upb/util/required_fields_test.proto create mode 100644 upb/wire/BUILD create mode 100644 upb/wire/decode.c create mode 100644 upb/wire/decode.h create mode 100644 upb/wire/decode_fast.c create mode 100644 upb/wire/decode_fast.h create mode 100644 upb/wire/encode.c create mode 100644 upb/wire/encode.h create mode 100644 upb/wire/eps_copy_input_stream.c create mode 100644 upb/wire/eps_copy_input_stream.h create mode 100644 upb/wire/eps_copy_input_stream_test.cc create mode 100644 upb/wire/internal/constants.h create mode 100644 upb/wire/internal/decode.h create mode 100644 upb/wire/internal/swap.h create mode 100644 upb/wire/reader.c create mode 100644 upb/wire/reader.h create mode 100644 upb/wire/types.h delete mode 100755 update_compatibility_version.py delete mode 100755 update_file_lists.sh create mode 100644 update_subtrees.sh delete mode 100755 update_version.py delete mode 100644 util/python/BUILD create mode 100644 version.json diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000..dc5c301 --- /dev/null +++ b/.bazelignore @@ -0,0 +1,4 @@ +# These are fetched as external repositories. +third_party/abseil-cpp +third_party/googletest +_build/ diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..eba2a89 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,32 @@ +build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 + +build:dbg --compilation_mode=dbg + +build:opt --compilation_mode=opt + +build:san-common --config=dbg --strip=never --copt=-O0 --copt=-fno-omit-frame-pointer + +build:asan --config=san-common --copt=-fsanitize=address --linkopt=-fsanitize=address +build:asan --copt=-DADDRESS_SANITIZER=1 +# ASAN hits ODR violations with shared linkage due to rules_proto. +build:asan --dynamic_mode=off + +build:msan --config=san-common --copt=-fsanitize=memory --linkopt=-fsanitize=memory +build:msan --copt=-fsanitize-memory-track-origins +build:msan --copt=-fsanitize-memory-use-after-dtor +build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1 +build:msan --copt=-DMEMORY_SANITIZER=1 + +build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread +build:tsan --copt=-DTHREAD_SANITIZER=1 + +build:ubsan --config=san-common --copt=-fsanitize=undefined --linkopt=-fsanitize=undefined +build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 +build:ubsan --copt=-DUNDEFINED_SANITIZER=1 +# Workaround for the fact that Bazel links with $CC, not $CXX +# https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748 +build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr + +# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel +# https://github.com/protocolbuffers/protobuf/issues/14313 +common --noenable_bzlmod diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 51c63e2..0000000 --- a/.gitattributes +++ /dev/null @@ -1,15 +0,0 @@ -*.tgz filter=lfs diff=lfs merge=lfs -text -*.trp filter=lfs diff=lfs merge=lfs -text -*.apk filter=lfs diff=lfs merge=lfs -text -*.jar filter=lfs diff=lfs merge=lfs -text -*.mp4 filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text -*.asm filter=lfs diff=lfs merge=lfs -text -*.8svn filter=lfs diff=lfs merge=lfs -text -*.9svn filter=lfs diff=lfs merge=lfs -text -*.dylib filter=lfs diff=lfs merge=lfs -text -*.exe filter=lfs diff=lfs merge=lfs -text -*.a filter=lfs diff=lfs merge=lfs -text -*.so filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text -*.dll filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index a7ca0e2..f25b4f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,24 @@ -# autogen.sh-generated files -Makefile.in -src/Makefile.in -config.guess -config.h.in -config.sub -configure -depcomp -install-sh -ltmain.sh -missing - -aclocal.m4 -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 -autom4te.cache +# CMake-generated files +.ninja_deps +.ninja_logs +cmake/protobuf/*.cmake +cmake_install.cmake +CMakeCache.txt +CTestTestfile.cmake +CMakeFiles/* +Testing/Temporary/* + +/core +/protoc +/test_plugin +/tests +/lite-test +/protoc-*.* # downloaded files /gmock # in-tree configure-generated files -Makefile -src/Makefile /config.h config.log config.status @@ -38,15 +33,15 @@ stamp-h1 *.o *.lo *.la -src/.libs *.so +*.a .dirstamp any_test.pb.* map*unittest.pb.* unittest*.pb.* -cpp_test*.pb.* +src/google/protobuf/compiler/cpp/test*.pb.* src/google/protobuf/util/**/*.pb.cc src/google/protobuf/util/**/*.pb.h @@ -57,13 +52,13 @@ python/**/*.egg python/.eggs/ python/.tox python/build/ +python/docs/_build/ src/js_embed -src/protoc -src/unittest_proto_middleman # vim generated *.swp +*~ # Generated test scaffolding src/no_warning_test.cc @@ -81,15 +76,17 @@ src/**/*.log src/**/*.trs # JavaBuild output. -java/core/target -java/util/target -javanano/target +java/**/target java/.idea java/**/*.iml # Windows native output. cmake/build build_msvc +# Directories suggested by cmake/README.md +/debug/ +/solution/ +/release/ # NuGet packages: we want the repository configuration, but not the # packages themselves. @@ -103,7 +100,7 @@ build_msvc # needed to trigger "pod install" to rerun the preinstall commands. Pods/ -# Comformance test output +# Conformance test output conformance/.libs/ conformance/com/ conformance/conformance-cpp @@ -117,6 +114,7 @@ conformance/Conformance.pbobjc.h conformance/Conformance.pbobjc.m conformance/conformance_pb.js conformance/conformance_pb.rb +conformance/core conformance/failing_tests.txt conformance/google/ conformance/google-protobuf/ @@ -135,15 +133,25 @@ conformance/*.class # php test output composer.lock +php/.phpunit.result.cache +php/tests/.phpunit.result.cache php/tests/generated/ php/tests/old_protoc +php/tests/phpunit-9.phar php/tests/protobuf/ +php/tests/core +php/tests/vgcore* +php/tests/multirequest.result +php/tests/nohup.out +php/tests/.phpunit.result.cache +php/tests/phpunit-* php/ext/google/protobuf/.libs/ php/ext/google/protobuf/Makefile.fragments php/ext/google/protobuf/Makefile.global php/ext/google/protobuf/Makefile.objects php/ext/google/protobuf/acinclude.m4 php/ext/google/protobuf/build/ +php/ext/google/protobuf/bundled_php.c php/ext/google/protobuf/config.h php/ext/google/protobuf/config.h.in~ php/ext/google/protobuf/config.nice @@ -151,52 +159,56 @@ php/ext/google/protobuf/configure.ac php/ext/google/protobuf/configure.in php/ext/google/protobuf/mkinstalldirs php/ext/google/protobuf/run-tests.php +php/ext/google/protobuf/third_party/ vendor/ -# JavaScript artifacts -js/commonjs_out/ -js/compatibility_tests/v3.0.0/commonjs_out* -js/compatibility_tests/v3.0.0/protoc -js/compatibility_tests/v3.0.0/testproto_libs1.js -js/compatibility_tests/v3.0.0/testproto_libs1_new.js -js/compatibility_tests/v3.0.0/testproto_libs2.js -js/compatibility_tests/v3.0.0/testproto_libs2_new.js -js/deps.js -js/google-protobuf.js -js/google/ -js/node_modules/ -js/testproto_libs1.js -js/testproto_libs2.js - # Ignore the bazel symlinks /bazel-* # ruby test output -ruby/lib/ ruby/tests/basic_test_pb.rb ruby/tests/basic_test_proto2_pb.rb ruby/tests/generated_code_pb.rb ruby/tests/test_import_pb.rb ruby/tests/test_ruby_package_pb.rb ruby/tests/generated_code_proto2_pb.rb +ruby/tests/multi_level_nesting_test_pb.rb ruby/tests/test_import_proto2_pb.rb ruby/tests/test_ruby_package_proto2_pb.rb -ruby/Gemfile.lock ruby/compatibility_tests/v3.0.0/protoc ruby/compatibility_tests/v3.0.0/tests/generated_code_pb.rb ruby/compatibility_tests/v3.0.0/tests/test_import_pb.rb +ruby/Gemfile.lock # IntelliJ CLion Config files and build output cmake/.idea cmake/cmake-build-debug/ # Common build subdirectories. -./.build/ -./_build/ +.build/ +_build/ # Visual Studio 2017 .vs +# Visual Studio Code +/.vscode/ + # IntelliJ .idea *.iml + +# Eclipse +**/.settings +**/.project +**/.classpath + +# BenchmarkDotNet +BenchmarkDotNet.Artifacts/ + +# Clangd uses these common ephemeral files +.cache +compile_commands.json + +# Ignore GHA NodeJS files +.github/**/node_modules/ diff --git a/.gitmodules b/.gitmodules index bcd125a..495082f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,11 @@ -[submodule "third_party/benchmark"] - path = third_party/benchmark - url = https://github.com/google/benchmark.git [submodule "third_party/googletest"] path = third_party/googletest url = https://github.com/google/googletest.git ignore = dirty +[submodule "third_party/abseil-cpp"] + path = third_party/abseil-cpp + url = https://github.com/abseil/abseil-cpp.git + branch = lts_2023_08_02 +[submodule "third_party/jsoncpp"] + path = third_party/jsoncpp + url = https://github.com/open-source-parsers/jsoncpp.git diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..88f4c10 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,22 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +sphinx: + configuration: python/docs/conf.py + fail_on_warning: false + +# Setup build requirements for docs. +# Use conda so that we can install the latest libprotobuf package without +# having to build from scratch just for docs builds. +conda: + environment: python/docs/environment.yml + +python: + version: 3.7 + install: + - method: setuptools + path: python diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..23efee4 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,609 @@ +# Bazel (https://bazel.build/) BUILD file for Protobuf. + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library") +load("@rules_java//java:defs.bzl", "java_lite_proto_library", "java_proto_library") +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") +load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS") +load(":protobuf.bzl", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library", "internal_ruby_proto_library") + +licenses(["notice"]) + +exports_files(["LICENSE"]) + +################################################################################ +# Well Known Types Proto Library Rules +# +# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf +################################################################################ +# These proto_library rules can be used with one of the language specific proto +# library rules i.e. java_proto_library: +# +# java_proto_library( +# name = "any_java_proto", +# deps = ["@com_google_protobuf//:any_proto"], +# ) +################################################################################ + +alias( + name = "any_proto", + actual = "//src/google/protobuf:any_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "api_proto", + actual = "//src/google/protobuf:api_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "duration_proto", + actual = "//src/google/protobuf:duration_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "empty_proto", + actual = "//src/google/protobuf:empty_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "field_mask_proto", + actual = "//src/google/protobuf:field_mask_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "source_context_proto", + actual = "//src/google/protobuf:source_context_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "struct_proto", + actual = "//src/google/protobuf:struct_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "timestamp_proto", + actual = "//src/google/protobuf:timestamp_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "type_proto", + actual = "//src/google/protobuf:type_proto", + visibility = ["//visibility:public"], +) + +alias( + name = "wrappers_proto", + actual = "//src/google/protobuf:wrappers_proto", + visibility = ["//visibility:public"], +) + +# Source files: these are aliases to a filegroup, not a `proto_library`. +# +# (This is _probably_ not what you want.) +alias( + name = "lite_well_known_protos", + actual = "//src/google/protobuf:well_known_type_protos", # filegroup + visibility = ["//visibility:public"], +) + +alias( + name = "well_known_type_protos", + actual = "//src/google/protobuf:well_known_type_protos", # filegroup + visibility = ["//visibility:public"], +) + +# Built-in runtime protos: these are part of protobuf's internal +# implementation, but are not Well-Known Types. + +alias( + name = "cpp_features_proto", + actual = "//src/google/protobuf:cpp_features_proto", # proto_library + visibility = ["//visibility:public"], +) + +alias( + name = "descriptor_proto", + actual = "//src/google/protobuf:descriptor_proto", # proto_library + visibility = ["//visibility:public"], +) + +alias( + name = "descriptor_proto_srcs", + actual = "//src/google/protobuf:descriptor_proto_srcs", # filegroup + visibility = ["//visibility:public"], +) + +alias( + name = "compiler_plugin_proto", + actual = "//src/google/protobuf/compiler:plugin_proto", # proto_library + visibility = ["//visibility:public"], +) + +cc_library( + name = "cc_wkt_protos", + deprecation = "Only for backward compatibility. Do not use.", + visibility = ["//visibility:public"], +) + +# Source protos that are typically part of the protobuf runtime. +# +# DEPRECATED: Prefer :well_known_type_protos for the Well-Known Types +# (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) +# or :descriptor_proto(_srcs) for descriptor.proto (source), or +# :compiler_plugin_proto for compiler/plugin.proto. +filegroup( + name = "well_known_protos", + srcs = [ + ":descriptor_proto_srcs", + ":well_known_type_protos", + "//src/google/protobuf/compiler:plugin.proto", + ], + deprecation = "Prefer :well_known_type_protos instead.", + visibility = ["//visibility:public"], +) + +internal_ruby_proto_library( + name = "well_known_ruby_protos", + srcs = [":well_known_protos"], + default_runtime = "", + includes = ["src"], + visibility = [ + "//conformance:__pkg__", + "//ruby:__subpackages__", + ], +) + +################################################################################ +# Protocol Buffers Compiler +################################################################################ + +alias( + name = "protoc_lib", + actual = "//src/google/protobuf/compiler:protoc_lib", + visibility = ["//visibility:public"], +) + +cc_binary( + name = "protoc", + copts = COPTS, + linkopts = LINK_OPTS, + visibility = ["//visibility:public"], + deps = ["//src/google/protobuf/compiler:protoc_lib"], +) + +cc_binary( + name = "protoc_static", + copts = COPTS, + features = select({ + # This isn't possible on mac because there is no static library for lcrt0.o + "@platforms//os:osx": [], + "//build_defs:config_osx": [], + # When cross-compiling we need to statically link all C++ libraries. + "//conditions:default": ["fully_static_link"], + }), + linkopts = LINK_OPTS, + visibility = ["//visibility:public"], + deps = ["//src/google/protobuf/compiler:protoc_lib"], +) + +################################################################################ +# C++ runtime +################################################################################ + +# Expose the runtime for the proto_lang_toolchain so that it can also be used in +# a user-defined proto_lang_toolchain. +alias( + name = "protobuf_nowkt", + actual = "//src/google/protobuf:protobuf_nowkt", + visibility = ["//visibility:public"], +) + +# The "lite" runtime works for .proto files that specify the option: +# optimize_for = LITE_RUNTIME; +# +# The lite runtime does not include the `Reflection` APIs (including +# `Descriptor` and related types) or Well-Known Types. +# +# See also: +# https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#message +# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf +alias( + name = "protobuf_lite", + actual = "//src/google/protobuf:protobuf_lite", + visibility = ["//visibility:public"], +) + +cc_library( + name = "protobuf", + copts = COPTS, + include_prefix = "google/protobuf/io", + linkopts = LINK_OPTS, + visibility = ["//visibility:public"], + deps = [ + "//src/google/protobuf", + "//src/google/protobuf/compiler:importer", + "//src/google/protobuf/util:delimited_message_util", + "//src/google/protobuf/util:differencer", + "//src/google/protobuf/util:field_mask_util", + "//src/google/protobuf/util:json_util", + "//src/google/protobuf/util:time_util", + "//src/google/protobuf/util:type_resolver_util", + ], +) + +# This provides just the header files for use in projects that need to build +# shared libraries for dynamic loading. This target is available until Bazel +# adds native support for such use cases. +# TODO: Remove this target once the support gets added to Bazel. +alias( + name = "protobuf_headers", + actual = "//src/google/protobuf:protobuf_headers", + visibility = ["//visibility:public"], +) + +alias( + name = "json", + actual = "//src/google/protobuf/json", + visibility = ["//visibility:public"], +) + +################################################################################ +# Java support +################################################################################ + +alias( + name = "protobuf_java", + actual = "//java/core", + visibility = ["//visibility:public"], +) + +alias( + name = "protobuf_javalite", + actual = "//java/lite", + visibility = ["//visibility:public"], +) + +alias( + name = "protobuf_java_util", + actual = "//java/util", + visibility = ["//visibility:public"], +) + +alias( + name = "java_toolchain", + actual = "//java/core:toolchain", + visibility = ["//visibility:public"], +) + +alias( + name = "javalite_toolchain", + actual = "//java/lite:toolchain", + visibility = ["//visibility:public"], +) + +################################################################################ +# Python support +################################################################################ + +alias( + name = "protobuf_python", + actual = "//python:protobuf_python", + visibility = ["//visibility:public"], +) + +alias( + name = "python_srcs", + actual = "//python:python_srcs", + visibility = ["//python:__subpackages__"], +) + +alias( + name = "python_test_srcs", + actual = "//python:python_test_srcs", + visibility = ["//python:__subpackages__"], +) + +alias( + name = "well_known_types_py_pb2", + actual = "//python:well_known_types_py_pb2", + visibility = ["//visibility:public"], +) + +alias( + name = "python_common_test_protos", + actual = "//python:python_common_test_protos", + visibility = ["//visibility:public"], +) + +alias( + name = "python_specific_test_protos", + actual = "//python:python_specific_test_protos", + visibility = ["//visibility:public"], +) + +proto_lang_toolchain( + name = "cc_toolchain", + blacklisted_protos = [ + "//:compiler_plugin_proto", + "//:descriptor_proto", + ], + command_line = "--cpp_out=$(OUT)", + runtime = "//src/google/protobuf:protobuf_nowkt", + visibility = ["//visibility:public"], +) + +################################################################################ +# Objective-C support +################################################################################ + +alias( + name = "objectivec", + actual = "//objectivec", + tags = ["manual"], + visibility = ["//visibility:public"], +) + +alias( + name = "protobuf_objc", + actual = "//objectivec", + tags = ["manual"], + visibility = ["//visibility:public"], +) + +################################################################################ +# Test protos +################################################################################ + +alias( + name = "lite_test_proto_srcs", + actual = "//src/google/protobuf:lite_test_proto_srcs", # proto_library + visibility = ["//:__subpackages__"], +) + +alias( + name = "lite_test_protos", + actual = "//src/google/protobuf:lite_test_protos", # proto_library + visibility = ["//:__subpackages__"], +) + +alias( + name = "test_proto_srcs", + actual = "//src/google/protobuf:test_proto_srcs", # filegroup + visibility = ["//:__subpackages__"], +) + +alias( + name = "test_protos", + actual = "//src/google/protobuf:test_protos", # proto_library + visibility = ["//:__subpackages__"], +) + +# Validate generated proto source inputs: + +genrule( + name = "generated_protos", + testonly = 1, + srcs = ["//src/google/protobuf:test_proto_srcs"], + outs = ["unittest_gen_import.proto"], + cmd = "cat src/google/protobuf/unittest_import.proto > $@", +) + +proto_library( + name = "generated_protos_proto", + testonly = 1, + srcs = [":generated_protos"], + deps = ["//src/google/protobuf:generic_test_protos"], +) + +internal_py_proto_library( + name = "generated_protos_py", + testonly = 1, + srcs = [":generated_protos"], + default_runtime = "", + protoc = ":protoc", + deps = ["//python:python_common_test_protos"], +) + +################################################################################ +# Conformance tests +################################################################################ + +cc_proto_library( + name = "test_messages_proto2_cc_proto", + visibility = [ + "//conformance:__pkg__", + "//src:__subpackages__", + ], + deps = ["//src/google/protobuf:test_messages_proto2_proto"], +) + +cc_proto_library( + name = "test_messages_proto3_cc_proto", + visibility = [ + "//conformance:__pkg__", + "//src:__subpackages__", + ], + deps = ["//src/google/protobuf:test_messages_proto3_proto"], +) + +java_proto_library( + name = "test_messages_proto2_java_proto", + visibility = [ + "//conformance:__pkg__", + "//java:__subpackages__", + ], + deps = ["//src/google/protobuf:test_messages_proto2_proto"], +) + +java_proto_library( + name = "test_messages_proto3_java_proto", + visibility = [ + "//conformance:__pkg__", + "//java:__subpackages__", + ], + deps = ["//src/google/protobuf:test_messages_proto3_proto"], +) + +java_lite_proto_library( + name = "test_messages_proto2_java_proto_lite", + visibility = [ + "//conformance:__pkg__", + "//java:__subpackages__", + ], + deps = ["//src/google/protobuf:test_messages_proto2_proto"], +) + +java_lite_proto_library( + name = "test_messages_proto3_java_proto_lite", + visibility = [ + "//conformance:__pkg__", + "//java:__subpackages__", + ], + deps = ["//src/google/protobuf:test_messages_proto3_proto"], +) + +internal_objc_proto_library( + name = "test_messages_proto2_objc_proto", + testonly = 1, + srcs = ["//src/google/protobuf:test_messages_proto2.proto"], + includes = ["src/google/protobuf"], + visibility = [ + "//conformance:__pkg__", + "//objectivec:__subpackages__", + ], +) + +internal_objc_proto_library( + name = "test_messages_proto3_objc_proto", + testonly = 1, + srcs = ["//src/google/protobuf:test_messages_proto3.proto"], + includes = [ + "src/google/protobuf", + # The above must come first. + "src", + ], + proto_deps = [":well_known_protos"], + visibility = [ + "//conformance:__pkg__", + "//objectivec:__subpackages__", + ], +) + +internal_php_proto_library( + name = "test_messages_proto3_php_proto", + testonly = 1, + srcs = ["//src/google/protobuf:test_messages_proto3.proto"], + outs = [ + "GPBMetadata/TestMessagesProto3.php", + "Protobuf_test_messages/Proto3/EnumOnlyProto3.php", + "Protobuf_test_messages/Proto3/EnumOnlyProto3/PBBool.php", + "Protobuf_test_messages/Proto3/ForeignEnum.php", + "Protobuf_test_messages/Proto3/ForeignMessage.php", + "Protobuf_test_messages/Proto3/NullHypothesisProto3.php", + "Protobuf_test_messages/Proto3/TestAllTypesProto3.php", + "Protobuf_test_messages/Proto3/TestAllTypesProto3/AliasedEnum.php", + "Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedEnum.php", + "Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedMessage.php", + ], + includes = [ + "src/google/protobuf", + # The above must come first. + "src", + ], + proto_deps = [":well_known_protos"], + visibility = [ + "//conformance:__pkg__", + "//php:__subpackages__", + ], +) + +internal_ruby_proto_library( + name = "test_messages_proto2_ruby_proto", + testonly = 1, + srcs = ["//src/google/protobuf:test_messages_proto2.proto"], + includes = ["src/google/protobuf"], + visibility = [ + "//conformance:__pkg__", + "//ruby:__subpackages__", + ], +) + +internal_ruby_proto_library( + name = "test_messages_proto3_ruby_proto", + testonly = 1, + srcs = ["//src/google/protobuf:test_messages_proto3.proto"], + includes = [ + "src/google/protobuf", + # The above must come first. + "src", + ], + visibility = [ + "//conformance:__pkg__", + "//ruby:__subpackages__", + ], + deps = [":well_known_ruby_protos"], +) + +filegroup( + name = "bzl_srcs", + srcs = glob(["**/*.bzl"]), + visibility = ["//visibility:public"], +) + +################################################################################ +# Packaging rules +################################################################################ + +# Files included in all source distributions +pkg_files( + name = "common_dist_files", + srcs = glob( + [ + "*.bzl", + "cmake/*.cmake", + "cmake/*.in", + "editors/*", + ], + allow_empty = True, + ) + [ + "BUILD.bazel", + "CMakeLists.txt", + "CONTRIBUTORS.txt", + "LICENSE", + "README.md", + "WORKSPACE", + "cmake/README.md", + "generate_descriptor_proto.sh", + "maven_install.json", + "//third_party:BUILD.bazel", + "//third_party:zlib.BUILD", + ], + strip_prefix = strip_prefix.from_root(""), + visibility = ["//pkg:__pkg__"], +) + +# Additional files for C# +pkg_files( + name = "csharp_dist_files", + srcs = [ + "global.json", + ], + visibility = ["//pkg:__pkg__"], +) + +# Additional files for ObjC +pkg_files( + name = "objectivec_dist_files", + srcs = [ + "Protobuf.podspec", + ], + visibility = ["//pkg:__pkg__"], +) diff --git a/BUILD.gn b/BUILD.gn index a94abf7..ce140b9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -17,7 +17,11 @@ THIRDPARTY_PROTOBUF_SUBSYS_NAME = "thirdparty" THIRDPARTY_PROTOBUF_PART_NAME = "protobuf" config("protobuf_config") { - include_dirs = [ "src" ] + include_dirs = [ + "src", + "third_party/abseil-cpp", + ] + cflags = [ "-Wno-gcc-compat" ] } ohos_shared_library("protobuf_lite") { @@ -25,44 +29,43 @@ ohos_shared_library("protobuf_lite") { sources = [ "src/google/protobuf/any_lite.cc", "src/google/protobuf/arena.cc", + "src/google/protobuf/arena_align.cc", + "src/google/protobuf/arenastring.cc", + "src/google/protobuf/arenaz_sampler.cc", "src/google/protobuf/extension_set.cc", "src/google/protobuf/generated_enum_util.cc", - "src/google/protobuf/generated_message_table_driven_lite.cc", + "src/google/protobuf/generated_message_tctable_lite.cc", "src/google/protobuf/generated_message_util.cc", "src/google/protobuf/implicit_weak_message.cc", + "src/google/protobuf/inlined_string_field.cc", "src/google/protobuf/io/coded_stream.cc", "src/google/protobuf/io/io_win32.cc", - "src/google/protobuf/io/strtod.cc", "src/google/protobuf/io/zero_copy_stream.cc", "src/google/protobuf/io/zero_copy_stream_impl.cc", "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "src/google/protobuf/map.cc", "src/google/protobuf/message_lite.cc", "src/google/protobuf/parse_context.cc", + "src/google/protobuf/port.cc", + "src/google/protobuf/raw_ptr.cc", "src/google/protobuf/repeated_field.cc", - "src/google/protobuf/stubs/bytestream.cc", + "src/google/protobuf/repeated_ptr_field.cc", "src/google/protobuf/stubs/common.cc", - "src/google/protobuf/stubs/int128.cc", - "src/google/protobuf/stubs/status.cc", - "src/google/protobuf/stubs/statusor.cc", - "src/google/protobuf/stubs/stringpiece.cc", - "src/google/protobuf/stubs/stringprintf.cc", - "src/google/protobuf/stubs/structurally_valid.cc", - "src/google/protobuf/stubs/strutil.cc", - "src/google/protobuf/stubs/time.cc", "src/google/protobuf/wire_format_lite.cc", + "third_party/utf8_range/utf8_validity.cc", ] - if (!is_asan && !is_debug) { - version_script = "libprotobuf_lite.map" - } + + #if (!is_asan && !is_debug) { + # version_script = "libprotobuf_lite.map" + #} include_dirs = [ "src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc", "src", + "third_party/utf8_range", ] if (!is_mingw) { - if (current_toolchain != host_toolchain) { - external_deps = [ "hilog:libhilog" ] - } + external_deps = [ "abseil-cpp:absl_base_static" ] } else { defines = [ "_FILE_OFFSET_BITS_SET_LSEEK" ] } @@ -87,44 +90,43 @@ ohos_static_library("protobuf_lite_static") { sources = [ "src/google/protobuf/any_lite.cc", "src/google/protobuf/arena.cc", + "src/google/protobuf/arena_align.cc", + "src/google/protobuf/arenastring.cc", + "src/google/protobuf/arenaz_sampler.cc", "src/google/protobuf/extension_set.cc", "src/google/protobuf/generated_enum_util.cc", - "src/google/protobuf/generated_message_table_driven_lite.cc", + "src/google/protobuf/generated_message_tctable_lite.cc", "src/google/protobuf/generated_message_util.cc", "src/google/protobuf/implicit_weak_message.cc", + "src/google/protobuf/inlined_string_field.cc", "src/google/protobuf/io/coded_stream.cc", "src/google/protobuf/io/io_win32.cc", - "src/google/protobuf/io/strtod.cc", "src/google/protobuf/io/zero_copy_stream.cc", "src/google/protobuf/io/zero_copy_stream_impl.cc", "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "src/google/protobuf/map.cc", "src/google/protobuf/message_lite.cc", "src/google/protobuf/parse_context.cc", + "src/google/protobuf/port.cc", + "src/google/protobuf/raw_ptr.cc", "src/google/protobuf/repeated_field.cc", - "src/google/protobuf/stubs/bytestream.cc", + "src/google/protobuf/repeated_ptr_field.cc", "src/google/protobuf/stubs/common.cc", - "src/google/protobuf/stubs/int128.cc", - "src/google/protobuf/stubs/status.cc", - "src/google/protobuf/stubs/statusor.cc", - "src/google/protobuf/stubs/stringpiece.cc", - "src/google/protobuf/stubs/stringprintf.cc", - "src/google/protobuf/stubs/structurally_valid.cc", - "src/google/protobuf/stubs/strutil.cc", - "src/google/protobuf/stubs/time.cc", "src/google/protobuf/wire_format_lite.cc", + "third_party/utf8_range/utf8_validity.cc", ] include_dirs = [ "src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc", "src", + "third_party/utf8_range", ] if (!is_mingw) { - if (default_toolchain == current_toolchain) { - # target build, not host build - defines = [ "HAVE_HILOG" ] - external_deps = [ "hilog:libhilog" ] - } + # target build, not host build + defines = [ "HAVE_HILOG" ] + external_deps = [ "abseil-cpp:absl_base_static" ] } else { + external_deps = [ "abseil-cpp:absl_base_static" ] defines = [ "_FILE_OFFSET_BITS_SET_LSEEK" ] } @@ -135,6 +137,7 @@ ohos_static_library("protobuf_lite_static") { cflags = [ "-Wno-deprecated-declarations", "-Wno-sign-compare", + "-Wno-gcc-compat", "-D HAVE_PTHREAD", ] if (is_mingw) { @@ -150,29 +153,68 @@ ohos_shared_library("protobuf") { sources = [ "src/google/protobuf/any.cc", "src/google/protobuf/any.pb.cc", + "src/google/protobuf/any_lite.cc", "src/google/protobuf/api.pb.cc", + "src/google/protobuf/arena.cc", + "src/google/protobuf/arena_align.cc", + "src/google/protobuf/arenastring.cc", + "src/google/protobuf/arenaz_sampler.cc", "src/google/protobuf/compiler/importer.cc", "src/google/protobuf/compiler/parser.cc", + "src/google/protobuf/cpp_features.pb.cc", "src/google/protobuf/descriptor.cc", "src/google/protobuf/descriptor.pb.cc", "src/google/protobuf/descriptor_database.cc", "src/google/protobuf/duration.pb.cc", "src/google/protobuf/dynamic_message.cc", "src/google/protobuf/empty.pb.cc", + "src/google/protobuf/extension_set.cc", "src/google/protobuf/extension_set_heavy.cc", + "src/google/protobuf/feature_resolver.cc", "src/google/protobuf/field_mask.pb.cc", + "src/google/protobuf/generated_enum_util.cc", + "src/google/protobuf/generated_message_bases.cc", "src/google/protobuf/generated_message_reflection.cc", - "src/google/protobuf/generated_message_table_driven.cc", + "src/google/protobuf/generated_message_tctable_full.cc", + "src/google/protobuf/generated_message_tctable_gen.cc", + "src/google/protobuf/generated_message_tctable_lite.cc", + "src/google/protobuf/generated_message_util.cc", + "src/google/protobuf/implicit_weak_message.cc", + "src/google/protobuf/inlined_string_field.cc", + "src/google/protobuf/internal_message_util.cc", + "src/google/protobuf/io/coded_stream.cc", "src/google/protobuf/io/gzip_stream.cc", + "src/google/protobuf/io/io_win32.cc", "src/google/protobuf/io/printer.cc", + "src/google/protobuf/io/strtod.cc", "src/google/protobuf/io/tokenizer.cc", + "src/google/protobuf/io/zero_copy_sink.cc", + "src/google/protobuf/io/zero_copy_stream.cc", + "src/google/protobuf/io/zero_copy_stream_impl.cc", + "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "src/google/protobuf/json/internal/lexer.cc", + "src/google/protobuf/json/internal/message_path.cc", + "src/google/protobuf/json/internal/parser.cc", + "src/google/protobuf/json/internal/unparser.cc", + "src/google/protobuf/json/internal/untyped_message.cc", + "src/google/protobuf/json/internal/writer.cc", + "src/google/protobuf/json/internal/zero_copy_buffered_stream.cc", + "src/google/protobuf/json/json.cc", + "src/google/protobuf/map.cc", "src/google/protobuf/map_field.cc", "src/google/protobuf/message.cc", + "src/google/protobuf/message_lite.cc", + "src/google/protobuf/parse_context.cc", + "src/google/protobuf/port.cc", + "src/google/protobuf/raw_ptr.cc", + "src/google/protobuf/reflection_mode.cc", "src/google/protobuf/reflection_ops.cc", + "src/google/protobuf/repeated_field.cc", + "src/google/protobuf/repeated_ptr_field.cc", "src/google/protobuf/service.cc", "src/google/protobuf/source_context.pb.cc", "src/google/protobuf/struct.pb.cc", - "src/google/protobuf/stubs/substitute.cc", + "src/google/protobuf/stubs/common.cc", "src/google/protobuf/text_format.cc", "src/google/protobuf/timestamp.pb.cc", "src/google/protobuf/type.pb.cc", @@ -180,31 +222,19 @@ ohos_shared_library("protobuf") { "src/google/protobuf/util/delimited_message_util.cc", "src/google/protobuf/util/field_comparator.cc", "src/google/protobuf/util/field_mask_util.cc", - "src/google/protobuf/util/internal/datapiece.cc", - "src/google/protobuf/util/internal/default_value_objectwriter.cc", - "src/google/protobuf/util/internal/error_listener.cc", - "src/google/protobuf/util/internal/field_mask_utility.cc", - "src/google/protobuf/util/internal/json_escaping.cc", - "src/google/protobuf/util/internal/json_objectwriter.cc", - "src/google/protobuf/util/internal/json_stream_parser.cc", - "src/google/protobuf/util/internal/object_writer.cc", - "src/google/protobuf/util/internal/proto_writer.cc", - "src/google/protobuf/util/internal/protostream_objectsource.cc", - "src/google/protobuf/util/internal/protostream_objectwriter.cc", - "src/google/protobuf/util/internal/type_info.cc", - "src/google/protobuf/util/internal/type_info_test_helper.cc", - "src/google/protobuf/util/internal/utility.cc", - "src/google/protobuf/util/json_util.cc", "src/google/protobuf/util/message_differencer.cc", "src/google/protobuf/util/time_util.cc", "src/google/protobuf/util/type_resolver_util.cc", "src/google/protobuf/wire_format.cc", + "src/google/protobuf/wire_format_lite.cc", "src/google/protobuf/wrappers.pb.cc", + "third_party/utf8_range/utf8_validity.cc", ] include_dirs = [ "src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc", "src", + "third_party/utf8_range", ] cflags_cc = [ "-Wno-sign-compare", @@ -217,9 +247,11 @@ ohos_shared_library("protobuf") { ] deps = [ ":protobuf_lite" ] - if (!is_asan && !is_debug) { - version_script = "libprotobuf.map" - } + external_deps = [ "abseil-cpp:absl_base_static" ] + + #if (!is_asan && !is_debug) { + # version_script = "libprotobuf.map" + #} public_configs = [ ":protobuf_config" ] install_enable = true @@ -231,29 +263,68 @@ ohos_static_library("protobuf_static") { sources = [ "src/google/protobuf/any.cc", "src/google/protobuf/any.pb.cc", + "src/google/protobuf/any_lite.cc", "src/google/protobuf/api.pb.cc", + "src/google/protobuf/arena.cc", + "src/google/protobuf/arena_align.cc", + "src/google/protobuf/arenastring.cc", + "src/google/protobuf/arenaz_sampler.cc", "src/google/protobuf/compiler/importer.cc", "src/google/protobuf/compiler/parser.cc", + "src/google/protobuf/cpp_features.pb.cc", "src/google/protobuf/descriptor.cc", "src/google/protobuf/descriptor.pb.cc", "src/google/protobuf/descriptor_database.cc", "src/google/protobuf/duration.pb.cc", "src/google/protobuf/dynamic_message.cc", "src/google/protobuf/empty.pb.cc", + "src/google/protobuf/extension_set.cc", "src/google/protobuf/extension_set_heavy.cc", + "src/google/protobuf/feature_resolver.cc", "src/google/protobuf/field_mask.pb.cc", + "src/google/protobuf/generated_enum_util.cc", + "src/google/protobuf/generated_message_bases.cc", "src/google/protobuf/generated_message_reflection.cc", - "src/google/protobuf/generated_message_table_driven.cc", + "src/google/protobuf/generated_message_tctable_full.cc", + "src/google/protobuf/generated_message_tctable_gen.cc", + "src/google/protobuf/generated_message_tctable_lite.cc", + "src/google/protobuf/generated_message_util.cc", + "src/google/protobuf/implicit_weak_message.cc", + "src/google/protobuf/inlined_string_field.cc", + "src/google/protobuf/internal_message_util.cc", + "src/google/protobuf/io/coded_stream.cc", "src/google/protobuf/io/gzip_stream.cc", + "src/google/protobuf/io/io_win32.cc", "src/google/protobuf/io/printer.cc", + "src/google/protobuf/io/strtod.cc", "src/google/protobuf/io/tokenizer.cc", + "src/google/protobuf/io/zero_copy_sink.cc", + "src/google/protobuf/io/zero_copy_stream.cc", + "src/google/protobuf/io/zero_copy_stream_impl.cc", + "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", + "src/google/protobuf/json/internal/lexer.cc", + "src/google/protobuf/json/internal/message_path.cc", + "src/google/protobuf/json/internal/parser.cc", + "src/google/protobuf/json/internal/unparser.cc", + "src/google/protobuf/json/internal/untyped_message.cc", + "src/google/protobuf/json/internal/writer.cc", + "src/google/protobuf/json/internal/zero_copy_buffered_stream.cc", + "src/google/protobuf/json/json.cc", + "src/google/protobuf/map.cc", "src/google/protobuf/map_field.cc", "src/google/protobuf/message.cc", + "src/google/protobuf/message_lite.cc", + "src/google/protobuf/parse_context.cc", + "src/google/protobuf/port.cc", + "src/google/protobuf/raw_ptr.cc", + "src/google/protobuf/reflection_mode.cc", "src/google/protobuf/reflection_ops.cc", + "src/google/protobuf/repeated_field.cc", + "src/google/protobuf/repeated_ptr_field.cc", "src/google/protobuf/service.cc", "src/google/protobuf/source_context.pb.cc", "src/google/protobuf/struct.pb.cc", - "src/google/protobuf/stubs/substitute.cc", + "src/google/protobuf/stubs/common.cc", "src/google/protobuf/text_format.cc", "src/google/protobuf/timestamp.pb.cc", "src/google/protobuf/type.pb.cc", @@ -261,31 +332,19 @@ ohos_static_library("protobuf_static") { "src/google/protobuf/util/delimited_message_util.cc", "src/google/protobuf/util/field_comparator.cc", "src/google/protobuf/util/field_mask_util.cc", - "src/google/protobuf/util/internal/datapiece.cc", - "src/google/protobuf/util/internal/default_value_objectwriter.cc", - "src/google/protobuf/util/internal/error_listener.cc", - "src/google/protobuf/util/internal/field_mask_utility.cc", - "src/google/protobuf/util/internal/json_escaping.cc", - "src/google/protobuf/util/internal/json_objectwriter.cc", - "src/google/protobuf/util/internal/json_stream_parser.cc", - "src/google/protobuf/util/internal/object_writer.cc", - "src/google/protobuf/util/internal/proto_writer.cc", - "src/google/protobuf/util/internal/protostream_objectsource.cc", - "src/google/protobuf/util/internal/protostream_objectwriter.cc", - "src/google/protobuf/util/internal/type_info.cc", - "src/google/protobuf/util/internal/type_info_test_helper.cc", - "src/google/protobuf/util/internal/utility.cc", - "src/google/protobuf/util/json_util.cc", "src/google/protobuf/util/message_differencer.cc", "src/google/protobuf/util/time_util.cc", "src/google/protobuf/util/type_resolver_util.cc", "src/google/protobuf/wire_format.cc", + "src/google/protobuf/wire_format_lite.cc", "src/google/protobuf/wrappers.pb.cc", + "third_party/utf8_range/utf8_validity.cc", ] include_dirs = [ "src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc", "src", + "third_party/utf8_range", ] cflags_cc = [ "-Wno-sign-compare", @@ -295,9 +354,15 @@ ohos_static_library("protobuf_static") { "-Wno-sign-compare", "-D HAVE_PTHREAD", "-Wno-deprecated-declarations", + "-Wno-gcc-compat", ] deps = [ ":protobuf_lite_static" ] + external_deps = [ "abseil-cpp:absl_base_static" ] + if (is_mingw) { + # ../../third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc:60:9: error: 'lseek' macro redefined [-Werror,-Wmacro-redefined] + cflags += [ "-Wno-macro-redefined" ] + } public_configs = [ ":protobuf_config" ] subsystem_name = "${THIRDPARTY_PROTOBUF_SUBSYS_NAME}" @@ -306,22 +371,30 @@ ohos_static_library("protobuf_static") { ohos_shared_library("protoc_lib") { sources = [ + "src/google/protobuf/compiler/allowlists/editions.cc", + "src/google/protobuf/compiler/allowlists/empty_package.cc", + "src/google/protobuf/compiler/allowlists/open_enum.cc", + "src/google/protobuf/compiler/allowlists/unused_imports.cc", + "src/google/protobuf/compiler/allowlists/weak_imports.cc", "src/google/protobuf/compiler/code_generator.cc", "src/google/protobuf/compiler/command_line_interface.cc", - "src/google/protobuf/compiler/cpp/cpp_enum.cc", - "src/google/protobuf/compiler/cpp/cpp_enum_field.cc", - "src/google/protobuf/compiler/cpp/cpp_extension.cc", - "src/google/protobuf/compiler/cpp/cpp_field.cc", - "src/google/protobuf/compiler/cpp/cpp_file.cc", - "src/google/protobuf/compiler/cpp/cpp_generator.cc", - "src/google/protobuf/compiler/cpp/cpp_helpers.cc", - "src/google/protobuf/compiler/cpp/cpp_map_field.cc", - "src/google/protobuf/compiler/cpp/cpp_message.cc", - "src/google/protobuf/compiler/cpp/cpp_message_field.cc", - "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", - "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", - "src/google/protobuf/compiler/cpp/cpp_service.cc", - "src/google/protobuf/compiler/cpp/cpp_string_field.cc", + "src/google/protobuf/compiler/cpp/enum.cc", + "src/google/protobuf/compiler/cpp/extension.cc", + "src/google/protobuf/compiler/cpp/field.cc", + "src/google/protobuf/compiler/cpp/field_generators/cord_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/enum_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/map_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/message_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/string_field.cc", + "src/google/protobuf/compiler/cpp/file.cc", + "src/google/protobuf/compiler/cpp/generator.cc", + "src/google/protobuf/compiler/cpp/helpers.cc", + "src/google/protobuf/compiler/cpp/message.cc", + "src/google/protobuf/compiler/cpp/padding_optimizer.cc", + "src/google/protobuf/compiler/cpp/parse_function_generator.cc", + "src/google/protobuf/compiler/cpp/service.cc", + "src/google/protobuf/compiler/cpp/tracker.cc", "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc", "src/google/protobuf/compiler/csharp/csharp_enum.cc", "src/google/protobuf/compiler/csharp/csharp_enum_field.cc", @@ -338,60 +411,84 @@ ohos_shared_library("protoc_lib") { "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc", "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc", "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc", - "src/google/protobuf/compiler/java/java_context.cc", - "src/google/protobuf/compiler/java/java_doc_comment.cc", - "src/google/protobuf/compiler/java/java_enum.cc", - "src/google/protobuf/compiler/java/java_enum_field.cc", - "src/google/protobuf/compiler/java/java_enum_field_lite.cc", - "src/google/protobuf/compiler/java/java_enum_lite.cc", - "src/google/protobuf/compiler/java/java_extension.cc", - "src/google/protobuf/compiler/java/java_extension_lite.cc", - "src/google/protobuf/compiler/java/java_field.cc", - "src/google/protobuf/compiler/java/java_file.cc", - "src/google/protobuf/compiler/java/java_generator.cc", - "src/google/protobuf/compiler/java/java_generator_factory.cc", - "src/google/protobuf/compiler/java/java_helpers.cc", - "src/google/protobuf/compiler/java/java_map_field.cc", - "src/google/protobuf/compiler/java/java_map_field_lite.cc", - "src/google/protobuf/compiler/java/java_message.cc", - "src/google/protobuf/compiler/java/java_message_builder.cc", - "src/google/protobuf/compiler/java/java_message_builder_lite.cc", - "src/google/protobuf/compiler/java/java_message_field.cc", - "src/google/protobuf/compiler/java/java_message_field_lite.cc", - "src/google/protobuf/compiler/java/java_message_lite.cc", - "src/google/protobuf/compiler/java/java_name_resolver.cc", - "src/google/protobuf/compiler/java/java_primitive_field.cc", - "src/google/protobuf/compiler/java/java_primitive_field_lite.cc", - "src/google/protobuf/compiler/java/java_service.cc", - "src/google/protobuf/compiler/java/java_shared_code_generator.cc", - "src/google/protobuf/compiler/java/java_string_field.cc", - "src/google/protobuf/compiler/java/java_string_field_lite.cc", - "src/google/protobuf/compiler/js/js_generator.cc", - "src/google/protobuf/compiler/js/well_known_types_embed.cc", - "src/google/protobuf/compiler/objectivec/objectivec_enum.cc", - "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_extension.cc", - "src/google/protobuf/compiler/objectivec/objectivec_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_file.cc", - "src/google/protobuf/compiler/objectivec/objectivec_generator.cc", - "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc", - "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_message.cc", - "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", - "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", + "src/google/protobuf/compiler/csharp/names.cc", + "src/google/protobuf/compiler/java/context.cc", + "src/google/protobuf/compiler/java/doc_comment.cc", + "src/google/protobuf/compiler/java/enum.cc", + "src/google/protobuf/compiler/java/enum_field.cc", + "src/google/protobuf/compiler/java/enum_field_lite.cc", + "src/google/protobuf/compiler/java/enum_lite.cc", + "src/google/protobuf/compiler/java/extension.cc", + "src/google/protobuf/compiler/java/extension_lite.cc", + "src/google/protobuf/compiler/java/field.cc", + "src/google/protobuf/compiler/java/file.cc", + "src/google/protobuf/compiler/java/generator.cc", + "src/google/protobuf/compiler/java/generator_factory.cc", + "src/google/protobuf/compiler/java/helpers.cc", + "src/google/protobuf/compiler/java/java_features.pb.cc", + "src/google/protobuf/compiler/java/kotlin_generator.cc", + "src/google/protobuf/compiler/java/map_field.cc", + "src/google/protobuf/compiler/java/map_field_lite.cc", + "src/google/protobuf/compiler/java/message.cc", + "src/google/protobuf/compiler/java/message_builder.cc", + "src/google/protobuf/compiler/java/message_builder_lite.cc", + "src/google/protobuf/compiler/java/message_field.cc", + "src/google/protobuf/compiler/java/message_field_lite.cc", + "src/google/protobuf/compiler/java/message_lite.cc", + "src/google/protobuf/compiler/java/message_serialization.cc", + "src/google/protobuf/compiler/java/name_resolver.cc", + "src/google/protobuf/compiler/java/names.cc", + "src/google/protobuf/compiler/java/primitive_field.cc", + "src/google/protobuf/compiler/java/primitive_field_lite.cc", + "src/google/protobuf/compiler/java/service.cc", + "src/google/protobuf/compiler/java/shared_code_generator.cc", + "src/google/protobuf/compiler/java/string_field.cc", + "src/google/protobuf/compiler/java/string_field_lite.cc", + "src/google/protobuf/compiler/objectivec/enum.cc", + "src/google/protobuf/compiler/objectivec/enum_field.cc", + "src/google/protobuf/compiler/objectivec/extension.cc", + "src/google/protobuf/compiler/objectivec/field.cc", + "src/google/protobuf/compiler/objectivec/file.cc", + "src/google/protobuf/compiler/objectivec/generator.cc", + "src/google/protobuf/compiler/objectivec/helpers.cc", + "src/google/protobuf/compiler/objectivec/import_writer.cc", + "src/google/protobuf/compiler/objectivec/line_consumer.cc", + "src/google/protobuf/compiler/objectivec/map_field.cc", + "src/google/protobuf/compiler/objectivec/message.cc", + "src/google/protobuf/compiler/objectivec/message_field.cc", + "src/google/protobuf/compiler/objectivec/names.cc", + "src/google/protobuf/compiler/objectivec/oneof.cc", + "src/google/protobuf/compiler/objectivec/primitive_field.cc", + "src/google/protobuf/compiler/objectivec/text_format_decode_data.cc", + "src/google/protobuf/compiler/php/names.cc", "src/google/protobuf/compiler/php/php_generator.cc", "src/google/protobuf/compiler/plugin.cc", "src/google/protobuf/compiler/plugin.pb.cc", - "src/google/protobuf/compiler/python/python_generator.cc", + "src/google/protobuf/compiler/python/generator.cc", + "src/google/protobuf/compiler/python/helpers.cc", + "src/google/protobuf/compiler/python/pyi_generator.cc", + "src/google/protobuf/compiler/retention.cc", "src/google/protobuf/compiler/ruby/ruby_generator.cc", + "src/google/protobuf/compiler/rust/accessors/accessors.cc", + "src/google/protobuf/compiler/rust/accessors/singular_message.cc", + "src/google/protobuf/compiler/rust/accessors/singular_scalar.cc", + "src/google/protobuf/compiler/rust/accessors/singular_string.cc", + "src/google/protobuf/compiler/rust/accessors/unsupported_field.cc", + "src/google/protobuf/compiler/rust/context.cc", + "src/google/protobuf/compiler/rust/generator.cc", + "src/google/protobuf/compiler/rust/message.cc", + "src/google/protobuf/compiler/rust/naming.cc", + "src/google/protobuf/compiler/rust/oneof.cc", + "src/google/protobuf/compiler/rust/relative_path.cc", "src/google/protobuf/compiler/subprocess.cc", "src/google/protobuf/compiler/zip_writer.cc", + "third_party/utf8_range/utf8_validity.cc", ] include_dirs = [ "src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc", "src", + "third_party/utf8_range", ] cflags_cc = [ "-Wno-sign-compare", @@ -410,9 +507,11 @@ ohos_shared_library("protoc_lib") { ":protobuf", ":protobuf_lite", ] - if (!is_asan && !is_debug) { - version_script = "libprotoc.map" - } + external_deps = [ "abseil-cpp:absl_base_static" ] + + #if (!is_asan && !is_debug) { + # version_script = "libprotoc.map" + #} install_enable = false public_configs = [ ":protobuf_config" ] subsystem_name = "${THIRDPARTY_PROTOBUF_SUBSYS_NAME}" @@ -421,22 +520,30 @@ ohos_shared_library("protoc_lib") { ohos_static_library("protoc_static_lib") { sources = [ + "src/google/protobuf/compiler/allowlists/editions.cc", + "src/google/protobuf/compiler/allowlists/empty_package.cc", + "src/google/protobuf/compiler/allowlists/open_enum.cc", + "src/google/protobuf/compiler/allowlists/unused_imports.cc", + "src/google/protobuf/compiler/allowlists/weak_imports.cc", "src/google/protobuf/compiler/code_generator.cc", "src/google/protobuf/compiler/command_line_interface.cc", - "src/google/protobuf/compiler/cpp/cpp_enum.cc", - "src/google/protobuf/compiler/cpp/cpp_enum_field.cc", - "src/google/protobuf/compiler/cpp/cpp_extension.cc", - "src/google/protobuf/compiler/cpp/cpp_field.cc", - "src/google/protobuf/compiler/cpp/cpp_file.cc", - "src/google/protobuf/compiler/cpp/cpp_generator.cc", - "src/google/protobuf/compiler/cpp/cpp_helpers.cc", - "src/google/protobuf/compiler/cpp/cpp_map_field.cc", - "src/google/protobuf/compiler/cpp/cpp_message.cc", - "src/google/protobuf/compiler/cpp/cpp_message_field.cc", - "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", - "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", - "src/google/protobuf/compiler/cpp/cpp_service.cc", - "src/google/protobuf/compiler/cpp/cpp_string_field.cc", + "src/google/protobuf/compiler/cpp/enum.cc", + "src/google/protobuf/compiler/cpp/extension.cc", + "src/google/protobuf/compiler/cpp/field.cc", + "src/google/protobuf/compiler/cpp/field_generators/cord_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/enum_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/map_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/message_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc", + "src/google/protobuf/compiler/cpp/field_generators/string_field.cc", + "src/google/protobuf/compiler/cpp/file.cc", + "src/google/protobuf/compiler/cpp/generator.cc", + "src/google/protobuf/compiler/cpp/helpers.cc", + "src/google/protobuf/compiler/cpp/message.cc", + "src/google/protobuf/compiler/cpp/padding_optimizer.cc", + "src/google/protobuf/compiler/cpp/parse_function_generator.cc", + "src/google/protobuf/compiler/cpp/service.cc", + "src/google/protobuf/compiler/cpp/tracker.cc", "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc", "src/google/protobuf/compiler/csharp/csharp_enum.cc", "src/google/protobuf/compiler/csharp/csharp_enum_field.cc", @@ -453,60 +560,84 @@ ohos_static_library("protoc_static_lib") { "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc", "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc", "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc", - "src/google/protobuf/compiler/java/java_context.cc", - "src/google/protobuf/compiler/java/java_doc_comment.cc", - "src/google/protobuf/compiler/java/java_enum.cc", - "src/google/protobuf/compiler/java/java_enum_field.cc", - "src/google/protobuf/compiler/java/java_enum_field_lite.cc", - "src/google/protobuf/compiler/java/java_enum_lite.cc", - "src/google/protobuf/compiler/java/java_extension.cc", - "src/google/protobuf/compiler/java/java_extension_lite.cc", - "src/google/protobuf/compiler/java/java_field.cc", - "src/google/protobuf/compiler/java/java_file.cc", - "src/google/protobuf/compiler/java/java_generator.cc", - "src/google/protobuf/compiler/java/java_generator_factory.cc", - "src/google/protobuf/compiler/java/java_helpers.cc", - "src/google/protobuf/compiler/java/java_map_field.cc", - "src/google/protobuf/compiler/java/java_map_field_lite.cc", - "src/google/protobuf/compiler/java/java_message.cc", - "src/google/protobuf/compiler/java/java_message_builder.cc", - "src/google/protobuf/compiler/java/java_message_builder_lite.cc", - "src/google/protobuf/compiler/java/java_message_field.cc", - "src/google/protobuf/compiler/java/java_message_field_lite.cc", - "src/google/protobuf/compiler/java/java_message_lite.cc", - "src/google/protobuf/compiler/java/java_name_resolver.cc", - "src/google/protobuf/compiler/java/java_primitive_field.cc", - "src/google/protobuf/compiler/java/java_primitive_field_lite.cc", - "src/google/protobuf/compiler/java/java_service.cc", - "src/google/protobuf/compiler/java/java_shared_code_generator.cc", - "src/google/protobuf/compiler/java/java_string_field.cc", - "src/google/protobuf/compiler/java/java_string_field_lite.cc", - "src/google/protobuf/compiler/js/js_generator.cc", - "src/google/protobuf/compiler/js/well_known_types_embed.cc", - "src/google/protobuf/compiler/objectivec/objectivec_enum.cc", - "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_extension.cc", - "src/google/protobuf/compiler/objectivec/objectivec_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_file.cc", - "src/google/protobuf/compiler/objectivec/objectivec_generator.cc", - "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc", - "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_message.cc", - "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", - "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", - "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", + "src/google/protobuf/compiler/csharp/names.cc", + "src/google/protobuf/compiler/java/context.cc", + "src/google/protobuf/compiler/java/doc_comment.cc", + "src/google/protobuf/compiler/java/enum.cc", + "src/google/protobuf/compiler/java/enum_field.cc", + "src/google/protobuf/compiler/java/enum_field_lite.cc", + "src/google/protobuf/compiler/java/enum_lite.cc", + "src/google/protobuf/compiler/java/extension.cc", + "src/google/protobuf/compiler/java/extension_lite.cc", + "src/google/protobuf/compiler/java/field.cc", + "src/google/protobuf/compiler/java/file.cc", + "src/google/protobuf/compiler/java/generator.cc", + "src/google/protobuf/compiler/java/generator_factory.cc", + "src/google/protobuf/compiler/java/helpers.cc", + "src/google/protobuf/compiler/java/java_features.pb.cc", + "src/google/protobuf/compiler/java/kotlin_generator.cc", + "src/google/protobuf/compiler/java/map_field.cc", + "src/google/protobuf/compiler/java/map_field_lite.cc", + "src/google/protobuf/compiler/java/message.cc", + "src/google/protobuf/compiler/java/message_builder.cc", + "src/google/protobuf/compiler/java/message_builder_lite.cc", + "src/google/protobuf/compiler/java/message_field.cc", + "src/google/protobuf/compiler/java/message_field_lite.cc", + "src/google/protobuf/compiler/java/message_lite.cc", + "src/google/protobuf/compiler/java/message_serialization.cc", + "src/google/protobuf/compiler/java/name_resolver.cc", + "src/google/protobuf/compiler/java/names.cc", + "src/google/protobuf/compiler/java/primitive_field.cc", + "src/google/protobuf/compiler/java/primitive_field_lite.cc", + "src/google/protobuf/compiler/java/service.cc", + "src/google/protobuf/compiler/java/shared_code_generator.cc", + "src/google/protobuf/compiler/java/string_field.cc", + "src/google/protobuf/compiler/java/string_field_lite.cc", + "src/google/protobuf/compiler/objectivec/enum.cc", + "src/google/protobuf/compiler/objectivec/enum_field.cc", + "src/google/protobuf/compiler/objectivec/extension.cc", + "src/google/protobuf/compiler/objectivec/field.cc", + "src/google/protobuf/compiler/objectivec/file.cc", + "src/google/protobuf/compiler/objectivec/generator.cc", + "src/google/protobuf/compiler/objectivec/helpers.cc", + "src/google/protobuf/compiler/objectivec/import_writer.cc", + "src/google/protobuf/compiler/objectivec/line_consumer.cc", + "src/google/protobuf/compiler/objectivec/map_field.cc", + "src/google/protobuf/compiler/objectivec/message.cc", + "src/google/protobuf/compiler/objectivec/message_field.cc", + "src/google/protobuf/compiler/objectivec/names.cc", + "src/google/protobuf/compiler/objectivec/oneof.cc", + "src/google/protobuf/compiler/objectivec/primitive_field.cc", + "src/google/protobuf/compiler/objectivec/text_format_decode_data.cc", + "src/google/protobuf/compiler/php/names.cc", "src/google/protobuf/compiler/php/php_generator.cc", "src/google/protobuf/compiler/plugin.cc", "src/google/protobuf/compiler/plugin.pb.cc", - "src/google/protobuf/compiler/python/python_generator.cc", + "src/google/protobuf/compiler/python/generator.cc", + "src/google/protobuf/compiler/python/helpers.cc", + "src/google/protobuf/compiler/python/pyi_generator.cc", + "src/google/protobuf/compiler/retention.cc", "src/google/protobuf/compiler/ruby/ruby_generator.cc", + "src/google/protobuf/compiler/rust/accessors/accessors.cc", + "src/google/protobuf/compiler/rust/accessors/singular_message.cc", + "src/google/protobuf/compiler/rust/accessors/singular_scalar.cc", + "src/google/protobuf/compiler/rust/accessors/singular_string.cc", + "src/google/protobuf/compiler/rust/accessors/unsupported_field.cc", + "src/google/protobuf/compiler/rust/context.cc", + "src/google/protobuf/compiler/rust/generator.cc", + "src/google/protobuf/compiler/rust/message.cc", + "src/google/protobuf/compiler/rust/naming.cc", + "src/google/protobuf/compiler/rust/oneof.cc", + "src/google/protobuf/compiler/rust/relative_path.cc", "src/google/protobuf/compiler/subprocess.cc", "src/google/protobuf/compiler/zip_writer.cc", + "third_party/utf8_range/utf8_validity.cc", ] include_dirs = [ "src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc", "src", + "third_party/utf8_range", ] cflags_cc = [ "-Wno-sign-compare", @@ -525,7 +656,7 @@ ohos_static_library("protoc_static_lib") { ":protobuf_lite_static", ":protobuf_static", ] - + external_deps = [ "abseil-cpp:absl_base_static" ] public_configs = [ ":protobuf_config" ] subsystem_name = "${THIRDPARTY_PROTOBUF_SUBSYS_NAME}" part_name = "${THIRDPARTY_PROTOBUF_PART_NAME}" @@ -545,6 +676,10 @@ if (current_toolchain == host_toolchain) { "-Wno-sign-compare", "-Wno-deprecated-declarations", ] + external_deps = [ "abseil-cpp:absl_base_static" ] + if (is_mac || is_ios) { + frameworks = [ "Foundation.framework" ] + } cflags = [ "-Wno-sign-compare", "-D HAVE_PTHREAD", diff --git a/CHANGES.txt b/CHANGES.txt deleted file mode 100644 index 76910c4..0000000 --- a/CHANGES.txt +++ /dev/null @@ -1,2465 +0,0 @@ -2020-07-14 version 3.13.0-rc1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++: - * Removed deprecated unsafe arena string accessors - * Enabled heterogeneous lookup for std::string keys in maps. - * Removed implicit conversion from StringPiece to std::string - * Fix use-after-destroy bug when the Map is allocated in the arena. - * Improved the randomness of map ordering - * Added stack overflow protection for text format with unknown fields - * Use std::hash for proto maps to help with portability. - * Added more Windows macros to proto whitelist. - * Arena constructors for map entry messages are now marked "explicit" - (for regular messages they were already explicit). - * Fix subtle aliasing bug in RepeatedField::Add - * Fix mismatch between MapEntry ByteSize and Serialize with respect to unset - fields. - - Python: - * JSON format conformance fixes: - * Reject lowercase t for Timestamp json format. - * Print full_name directly for extensions (no camelCase). - * Reject boolean values for integer fields. - * Reject NaN, Infinity, -Infinity that is not quoted. - * Base64 fixes for bytes fields: accept URL-safe base64 and missing padding. - * Bugfix for fields/files named "async" or "await". - * Improved the error message when AttributeError is returned from __getattr__ - in EnumTypeWrapper. - - Java: - * Fixed a bug where setting optional proto3 enums with setFooValue() would - not mark the value as present. - * Add Subtract function to FieldMaskUtil. - - C#: - * Dropped support for netstandard1.0 (replaced by support for netstandard1.1). - This was required to modernize the parsing stack to use the `Span` - type internally. (#7351) - * Add `ParseFrom(ReadOnlySequence)` method to enable GC friendly - parsing with reduced allocations and buffer copies. (#7351) - * Add support for serialization directly to a `IBufferWriter` or - to a `Span` to enable GC friendly serialization. - The new API is available as extension methods on the `IMessage` type. (#7576) - * Add `GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE` define to make - generated code compatible with old C# compilers (pre-roslyn compilers - from .NET framework and old versions of mono) that do not support - ref structs. Users that are still on a legacy stack that does - not support C# 7.2 compiler might need to use the new define - in their projects to be able to build the newly generated code. (#7490) - * Due to the major overhaul of parsing and serialization internals (#7351 and #7576), - it is recommended to regenerate your generated code to achieve the best - performance (the legacy generated code will still work, but might incur - a slight performance penalty). - -2020-06-01 version 3.12.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - Objective-C - * Tweak the union used for Extensions to support old generated code. #7573 - -2020-05-26 version 3.12.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Simplified the template export macros to fix the build for mingw32. (#7539) - - Objective-C - * Fix for the :protobuf_objc target in the Bazel BUILD file. (#7538) - -2020-05-20 version 3.12.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - Ruby - * Re-add binary gems for Ruby 2.3 and 2.4. These are EOL upstream, however - many people still use them and dropping support will require more - coordination. - -2020-05-12 version 3.12.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - Protocol Compiler - * [experimental] Singular, non-message typed fields in proto3 now support - presence tracking. This is enabled by adding the "optional" field label and - passing the --experimental_allow_proto3_optional flag to protoc. - * For usage info, see docs/field_presence.md. - * During this experimental phase, code generators should update to support - proto3 presence, see docs/implementing_proto3_presence.md for instructions. - * Allow duplicate symbol names when multiple descriptor sets are passed on - the command-line, to match the behavior when multiple .proto files are passed. - * Deterministic `protoc --descriptor_set_out` (#7175) - - C++ - * [experimental] Added proto3 presence support. - * New descriptor APIs to support proto3 presence. - * Enable Arenas by default on all .proto files. - * Documented that users are not allowed to subclass Message or MessageLite. - * Mark generated classes as final; inheriting from protos is strongly discouraged. - * Add stack overflow protection for text format with unknown fields. - * Add accessors for map key and value FieldDescriptors. - * Add FieldMaskUtil::FromFieldNumbers(). - * MessageDifferencer: use ParsePartial() on Any fields so the diff does not - fail when there are missing required fields. - * ReflectionOps::Merge(): lookup messages in the right factory, if it can. - * Added Descriptor::WellKnownTypes enum and Descriptor::well_known_type() - accessor as an easier way of determining if a message is a Well-Known Type. - * Optimized RepeatedField::Add() when it is used in a loop. - * Made proto move/swap more efficient. - * De-virtualize the GetArena() method in MessageLite. - * Improves performance of json_stream_parser.cc by factor 1000 (#7230) - * bug: #7076 undefine Windows OUT and OPTIONAL macros (#7087) - * Fixed a bug in FieldDescriptor::DebugString() that would erroneously print - an "optional" label for a field in a oneof. - * Fix bug in parsing bool extensions that assumed they are always 1 byte. - * Fix off-by-one error in FieldOptions::ByteSize() when extensions are present. - * Clarified the comments to show an example of the difference between - Descriptor::extension and DescriptorPool::FindAllExtensions. - * Add a compiler option 'code_size' to force optimize_for=code_size on all - protos where this is possible. - - Java - * [experimental] Added proto3 presence support. - * Mark java enum _VALUE constants as @Deprecated if the enum field is deprecated - * reduce size for enums with allow_alias set to true. - * Sort map fields alphabetically by the field's key when printing textproto. - * Fixed a bug in map sorting that appeared in -rc1 and -rc2 (#7508). - * TextFormat.merge() handles Any as top level type. - * Throw a descriptive IllegalArgumentException when calling - getValueDescriptor() on enum special value UNRECOGNIZED instead of - ArrayIndexOutOfBoundsException. - * Fixed an issue with JsonFormat.printer() where setting printingEnumsAsInts() - would override the configuration passed into includingDefaultValueFields(). - * Implement overrides of indexOf() and contains() on primitive lists returned - for repeated fields to avoid autoboxing the list contents. - * Add overload to FieldMaskUtil.fromStringList that accepts a descriptor. - * [bazel] Move Java runtime/toolchains into //java (#7190) - - Python - * [experimental] Added proto3 presence support. - * [experimental] fast import protobuf module, only works with cpp generated code linked in. - * Truncate 'float' fields to 4 bytes of precision in setters for pure-Python - implementation (C++ extension was already doing this). - * Fixed a memory leak in C++ bindings. - * Added a deprecation warning when code tries to create Descriptor objects - directly. - * Fix unintended comparison between bytes and string in descriptor.py. - * Avoid printing excess digits for float fields in TextFormat. - * Remove Python 2.5 syntax compatibility from the proto compiler generated _pb2.py module code. - * Drop 3.3, 3.4 and use single version docker images for all python tests (#7396) - - JavaScript - * Fix js message pivot selection (#6813) - - PHP - * Persistent Descriptor Pool (#6899) - * Implement lazy loading of php class for proto messages (#6911) - * Correct @return in Any.unpack docblock (#7089) - * Ignore unknown enum value when ignore_unknown specified (#7455) - - Ruby - * [experimental] Implemented proto3 presence for Ruby. (#7406) - * Stop building binary gems for ruby <2.5 (#7453) - * Fix for wrappers with a zero value (#7195) - * Fix for JSON serialization of 0/empty-valued wrapper types (#7198) - * Call "Class#new" over rb_class_new_instance in decoding (#7352) - * Build extensions for Ruby 2.7 (#7027) - * assigning 'nil' to submessage should clear the field. (#7397) - - C# - * [experimental] Add support for proto3 presence fields in C# (#7382) - * Mark GetOption API as obsolete and expose the "GetOptions()" method on descriptors instead (#7491) - * Remove Has/Clear members for C# message fields in proto2 (#7429) - * Enforce recursion depth checking for unknown fields (#7132) - * Fix conformance test failures for Google.Protobuf (#6910) - * Cleanup various bits of Google.Protobuf (#6674) - * Fix latest ArgumentException for C# extensions (#6938) - * Remove unnecessary branch from ReadTag (#7289) - - Objective-C - * [experimental] ObjC Proto3 optional support (#7421) - * Block subclassing of generated classes (#7124) - * Use references to Obj C classes instead of names in descriptors. (#7026) - * Revisit how the WKTs are bundled with ObjC. (#7173) - - Other - * Add a proto_lang_toolchain for javalite (#6882) - * [bazel] Update gtest and deprecate //external:{gtest,gtest_main} (#7237) - * Add application note for explicit presence tracking. (#7390) - * Howto doc for implementing proto3 presence in a code generator. (#7407) - - -2020-02-14 version 3.11.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C# - * Fix latest ArgumentException for C# extensions (#7188) - * Enforce recursion depth checking for unknown fields (#7210) - - Ruby - * Fix wrappers with a zero value (#7195) - * Fix JSON serialization of 0/empty-valued wrapper types (#7198) - -2020-01-31 version 3.11.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Add OUT and OPTIONAL to windows portability files (#7087) - - PHP - * Refactored ulong to zend_ulong for php7.4 compatibility (#7147) - * Call register_class before getClass from desc to fix segfault (#7077) - - -2019-12-10 version 3.11.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - PHP - * Make c extension portable for php 7.4 (#6968) - - -2019-12-02 version 3.11.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - PHP - * Extern declare protobuf_globals (#6946) - - -2019-11-19 version 3.11.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Make serialization method naming consistent - * Make proto runtime + generated code free of deprecation warnings - * Moved ShutdownProtobufLibrary() to message_lite.h. For backward compatibility a declaration is still available in stubs/common.h, but users should prefer message_lite.h - * Removed non-namespace macro EXPECT_OK() - * Removed mathlimits.h from stubs in favor of using std::numeric_limits from C++11 - * Fixed bug in parser when ending on a group tag - * Add a helper function to UnknownFieldSet to deal with the changing return value of message::unknown_fields() - * Fix incorrect use of string_view iterators - * Support direct pickling of nested messages - * Skip extension tag validation for MessageSet if unknown dependencies are allowed - * Updated deprecation macros to annotate deprecated code (#6612) - * Remove conversion warning in MapEntryFuncs::ByteSizeLong (#6766) - * Revert "Make shared libraries be able to link to MSVC static runtime libraries, so that VC runtime is not required." (#6914) - - Java - * Remove the usage of MethodHandle, so that Android users prior to API version 26 can use protobuf-java - * Publish ProGuard config for javalite - * Fix for StrictMode disk read violation in ExtensionRegistryLite - * Include part of the ByteString's content in its toString(). - * Include unknown fields when merging proto3 messages in Java lite builders - - Python - * Add float_precision option in json format printer - * Optionally print bytes fields as messages in unknown fields, if possible - * FieldPath: fix testing IsSet on root path '' - * Experimental code gen (fast import protobuf module) which only work with cpp generated code linked in - - JavaScript - * Remove guard for Symbol iterator for jspb.Map - - PHP - * Avoid too much overhead in layout_init (#6716) - * Lazily Create Singular Wrapper Message (#6833) - * Implement lazy loading of php class for proto messages (#6911) - - Ruby - * Ruby lazy wrappers optimization (#6797) - - C# - * (RepeatedField): Capacity property to resize the internal array (#6530) - * Experimental proto2 support is now officially available (#4642, #5183, #5350, #5936) - * Getting started doc: https://github.com/protocolbuffers/protobuf/blob/master/docs/csharp/proto2.md - * Add length checks to ExtensionCollection (#6759) - * Optimize parsing of some primitive and wrapper types (#6843) - * Use 3 parameter Encoding.GetString for default string values (#6828) - * Change _Extensions property to normal body rather than expression (#6856) - - Objective C - * Fixed unaligned reads for 32bit arm with newer Xcode versions (#6678) - - -2019-09-03 version 3.10.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Switch the proto parser to the faster MOMI parser. - * Properly escape Struct keys in the proto3 JSON serializer. - * Fix crash on uninitialized map entries. - * Informed the compiler of has-bit invariant to produce better code - * Unused imports of files defining descriptor extensions will now be reported - * Add proto2::util::RemoveSubranges to remove multiple subranges in linear time. - * Added BaseTextGenerator::GetCurrentIndentationSize() - * Made implicit weak fields compatible with the Apple linker - * Support 32 bit values for ProtoStreamObjectWriter to Struct. - * Removed the internal-only header coded_stream_inl.h and the internal-only methods defined there. - * Enforced no SWIG wrapping of descriptor_database.h (other headers already had this restriction). - * Implementation of the equivalent of the MOMI parser for serialization. This removes one of the two serialization routines, by making the fast array serialization routine completely general. SerializeToCodedStream can now be implemented in terms of the much much faster array serialization. The array serialization regresses slightly, but when array serialization is not possible this wins big. - * Do not convert unknown field name to snake case to accurately report error. - * Fix a UBSAN warnings. (#6333) - * Add podspec for C++ (#6404) - * protoc: fix source code info location for missing label (#6436) - * C++ Add move constructor for Reflection's SetString (#6477) - - Java - * Call loadDescriptor outside of synchronized block to remove one possible source of deadlock. - * Have oneof enums implement a separate interface (other than EnumLite) for clarity. - * Opensource Android Memory Accessors - * Update TextFormat to make use of the new TypeRegistry. - * Support getFieldBuilder and getRepeatedFieldBuilder in ExtendableBuilder - * Update JsonFormat to make use of the new TypeRegistry. - * Add proguard config generator for GmmBenchmarkSuiteLite. - * Change ProtobufArrayList to use Object[] instead of ArrayList for 5-10% faster parsing - * Implement ProtobufArrayList.add(E) for 20% (5%-40%) faster overall protolite2 parsing - * Make a copy of JsonFormat.TypeRegistry at the protobuf top level package. This will eventually replace JsonFormat.TypeRegistry. - * Fix javadoc warnings in generated files (#6231) - * Java: Add Automatic-Module-Name entries to the Manifest (#6568) - - Python - * Add descriptor methods in descriptor_pool are deprecated. - * Uses explicit imports to prevent multithread test failures in py3. - * Added __delitem__ for Python extension dict - * Update six version to 1.12.0 and fix legacy_create_init issue (#6391) - - JavaScript - * Remove deprecated boolean option to getResultBase64String(). - * Fix sint64 zig-zag encoding. - * Simplify hash64 string conversion to avoid DIGIT array. Should reduce overhead if these functions aren't used, and be more efficient by avoiding linear array searches. - * Change the parameter types of binaryReaderFn in ExtensionFieldBinaryInfo to (number, ?, ?). - * Create dates.ts and time_of_days.ts to mirror Java versions. This is a near-identical conversion of c.g.type.util.{Dates,TimeOfDays} respectively. - * Migrate moneys to TypeScript. - - PHP - * Fix incorrect leap day for Timestamp (#6696) - * Initialize well known type values (#6713) - - Ruby - * Fix scope resolution for Google namespace (#5878) - * Support hashes for struct initializers (#5716) - * Optimized away the creation of empty string objects. (#6502) - * Roll forward Ruby upb changes now that protobuf Ruby build is fixed (#5866) - * Optimized layout_mark() for Ruby (#6521) - * Optimization for layout_init() (#6547) - * Fix for GC of Ruby map frames. (#6533) - * Fixed leap year handling by reworking upb_mktime() -> upb_timegm(). (#6695) - - Objective C - * Remove OSReadLittle* due to alignment requirements (#6678) - * Don't use unions and instead use memcpy for the type swaps. (#6672) - - Other - * Override CocoaPods module to lowercase (#6464) - - -2019-06-28 version 3.9.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Optimize and simplify implementation of RepeatedPtrFieldBase - * Don't create unnecessary unknown field sets. - * Remove branch from accessors to repeated field element array. - * Added delimited parse and serialize util. - * Reduce size by not emitting constants for fieldnumbers - * Fix a bug when comparing finite and infinite field values with explicit tolerances. - * TextFormat::Parser should use a custom Finder to look up extensions by number if one is provided. - * Add MessageLite::Utf8DebugString() to make MessageLite more compatible with Message. - * Fail fast for better performance in DescriptorPool::FindExtensionByNumber() if descriptor has no defined extensions. - * Adding the file name to help debug colliding extensions - * Added FieldDescriptor::PrintableNameForExtension() and DescriptorPool::FindExtensionByPrintableName(). - The latter will replace Reflection::FindKnownExtensionByName(). - * Replace NULL with nullptr - * Created a new Add method in repeated field that allows adding a range of elements all at once. - * Enabled enum name-to-value mapping functions for C++ lite - * Avoid dynamic initialization in descriptor.proto generated code - * Move stream functions to MessageLite from Message. - * Move all zero_copy_stream functionality to io_lite. - * Do not create array of matched fields for simple repeated fields - * Enabling silent mode by default to reduce make compilation noise. (#6237) - - Java - * Expose TextFormat.Printer and make it configurable. Deprecate the static methods. - * Library for constructing google.protobuf.Struct and google.protobuf.Value - * Make OneofDescriptor extend GenericDescriptor. - * Expose streamingness of service methods from MethodDescriptor. - * Fix a bug where TextFormat fails to parse Any filed with > 1 embedded message sub-fields. - * Establish consistent JsonFormat behavior for nulls in oneofs, regardless of order. - * Update GSON version to 3.8.5. (#6268) - * Add `protobuf_java_lite` Bazel target. (#6177) - - Python - * Change implementation of Name() for enums that allow aliases in proto2 in Python - to be in line with claims in C++ implementation (to return first value). - * Explicitly say what field cannot be set when the new value fails a type check. - * Duplicate register in descriptor pool will raise errors - * Add __slots__ to all well_known_types classes, custom attributes are not allowed anymore. - * text_format only present 8 valid digits for float fields by default - - JavaScript - * Add Oneof enum to the list of goog.provide - - PHP - * Make php message class final to avoid mocking. (#6277) - * Rename get/setXXXValue to get/setXXXWrapper. (#6295) - - Ruby - * Remove to_hash methods. (#6166) - - -2019-04-29 version 3.8.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Use std::atomic in case of myriad2 platform - * Always declare enums to be int-sized - * Added DebugString() and ShortDebugString() methods on MessageLite - * Specialized different parse loop control flows - * Make hasbits potentially in register. The or's start forming an obstacle because it's a read modify store on the same mem address on each iteration. - * Move to an internal MACRO for parser validity checks. - * Improve map parsing performance. - * Make MergePartialFromCodedStream non virtual. This allows direct calls, potential inlining and is also a code health improvement - * Add an overall limit to parse_context to prevent reading past it. This allows to remove a annoying level of indirection. - * Fix a mistake, we shouldn't verify map key/value strings for utf8 in opt mode for proto2. - * Further improvements to cut binary size. - * Prepare to make MergePartialFromCodedStream non-virtual. - * A report on some interesting behavior change in python (caused by b/27494216) made me realize there is a check that needs to be done in case the parse ended on a end group tag. - * Add a note of caution to the comments around skip in CodedOutputStream. - * Simplify end check. - * Add overload for ParseMessage for MessageLite/Message types. If the explicit type is not known inlining won't help de-virtualizing the virtual call. - * Reduce linker input. It turns out that ParseMessage is not inlined, producing template instantiations that are used only once and save nothing but cost more. - * Improve the parser. - * [c++17] Changed proto2::RepeatedPtrField iterators to no longer derive from the deprecated std::iterator class. - * Change the default value of case_insensitive_enum_parsing to false for JsonStringToMessage. - * Add a warning if a field name doesn't match the style guide. - * Fix TextFormat not round-trip correctly when float value is max float. - * Added locationed info for some errors at compiler - * Python reserved keywords are now working with getattr()/setattr() for most descriptors. - * Added AllowUnknownField() in text_format - * Append '_' to C++ reserved keywords for message, enum, extension - * Fix MSVC warning C4244 in protobuf's parse_context.h. - * Updating Iterators to be compatible with C++17 in MSVC. - * Use capability annotation in mutex.h - * Fix "UndefinedBehaviorSanitizer: cfi-bad-type" - * CriticalSectionLock class as a lightweight replacement for std::mutex on Windows platforms. - * Removed vestigial wire_format_lite_inl.h - - C# - * Added System.Memory dependency. - - Java - * Make Java protoc code generator ignore optimize_for LITE_RUNTIME. Users should instead use the Java lite protoc plugin. - * Change Extension getMessageDefaultInstance() to return Message instead of MessageLite. - * Prevent malicious input streams from leaking buffers for ByteString or ByteBuffer parsing. - * Release new Javalite runtime. - * Show warning in case potential file name conflict. - * Allow Java reserved keywords to be used in extensions. - * Added setAllowUnknownFields() in text format - * Add memoization to ExtensionRegistryLite.getEmptyRegistry() - * Improve performance of CodedOutputStream.writeUInt32NoTag - * Add an optimized mismatch-finding algorithm to UnsafeUtil. - * When serializing uint32 varints, check that we have MAX_VARINT32_SIZE bytes left, not just MAX_VARINT_SIZE. - * Minor optimization to RopeByteString.PieceIterator - - JavaScript - * Simplify generated toObject code when the default value is used. - - Python - * Changes implementation of Name() for enums that allow aliases in proto2 in Python to be in line with claims in C++ implementation (to return first value). - * Added double_format option in text format printer. - * Added iter and __contains__ to extension dict - * Added allow_unknown_field option in python text format parser - * Fixed Timestamp.ToDatetime() loses precision issue - * Support unknown field in text format printer. - * Float field will be convert to inf if bigger than struct.unpack('f', b'\xff\xff\x7f\x7f')[0] which is about 3.4028234664e+38, - convert to -inf if smaller than -3.4028234664e+38 - * Allowed casting str->bytes in Message.__setstate__ - - Ruby - * Helper methods to get enum name for Ruby. - - -2019-01-24 version 3.7.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Introduced new MOMI (maybe-outside-memory-interval) parser. - * Add an option to json_util to parse enum as case-insensitive. In the future, enum parsing in json_util will become case-sensitive. - * Added conformance test for enum aliases - * Added support for --cpp_out=speed:... - * Added use of C++ override keyword where appropriate - * Many other cleanups and fixes. - - Java - * Fix illegal reflective access warning in JDK 9+ - * Add BOM - - Python - * Added Python 3.7 compatibility. - * Modified ParseFromString to return bytes parsed . - * Introduce Proto C API. - * FindFileContainingSymbol in descriptor pool is now able to find field and enum values. - * reflection.MakeClass() and reflection.ParseMessage() are deprecated. - * Added DescriptorPool.FindMethodByName() method in pure python (c extension already has it) - * Flipped proto3 to preserve unknown fields by default. - * Added support for memoryview in python3 proto message parsing. - * Added MergeFrom for repeated scalar fields in c extension (pure python already has it) - * Surrogates are now rejected at setters in python3. - * Added public unknown field API. - * RecursionLimit is also set to max if allow_oversize_protos is enabled. - * Disallow duplicate scalars in proto3 text_format parse. - * Fix some segment faults for c extension map field. - - PHP - * Most issues for json encoding/decoding in the c extension have been fixed. There are still some edge cases not fixed. For more details, check conformance/failure_list_php_c.txt. - * Supports php 7.3 - * Added helper methods to convert between enum values and names. - * Allow setting/getting wrapper message fields using primitive values. - * Various bug fixes. - - Ruby - * Ruby 2.6 support. - * Drops support for ruby < 2.3. - * Most issues for json encoding/decoding in the c extension have been fixed. There are still some edge cases not fixed. For more details, check conformance/failure_list_ruby.txt. - * Json parsing can specify an option to ignore unknown fields: msg.decode_json(data, {ignore_unknown_fields: true}). - * Added support for proto2 syntax (partially). - * Various bug fixes. - - Csharp - * More support for FieldMask include merge, intersect and more. - * Increasing the default recursion limit to 100. - * Support loading FileDescriptors dynamically. - * Provide access to comments from descriptors. - * Added Any.Is method. - * Compatible with C# 6 - * Added IComparable and comparison operators on Timestamp. - - Objective C - * Add ability to introspect list of enum values (#4678) - * Copy the value when setting message/data fields (#5215) - * Support suppressing the objc package prefix checks on a list of files (#5309) - * More complete keyword and NSObject method (via categories) checks for field names, can result in more fields being rename, but avoids the collisions at runtime (#5289) - * Small fixes to TextFormat generation for extensions (#5362) - * Provide more details/context in deprecation messages (#5412) - * Array/Dictionary enumeration blocks NS_NOESCAPE annotation for Swift (#5421) - * Properly annotate extensions for ARC when their names imply behaviors (#5427) - * Enum alias name collision improvements (#5480) - - -2018-07-27 version 3.6.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Introduced workaround for Windows issue with std::atomic and std::once_flag - initialization (#4777, #4773). - - PHP - * Added compatibility with PHP 7.3 (#4898). - - Ruby - * Fixed Ruby crash involving Any encoding (#4718). - -2018-06-01 version 3.6.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - - C++ - * Starting from this release, we now require C++11. For those we cannot yet - upgrade to C++11, we will try to keep the 3.5.x branch updated with - critical bug fixes only. If you have any concerns about this, please - comment on issue #2780. - * Moved to C++11 types like std::atomic and std::unique_ptr and away from our - old custom-built equivalents. - * Added support for repeated message fields in lite protos using implicit - weak fields. This is an experimental feature that allows the linker to - strip out more unused messages than previously was possible. - * Fixed SourceCodeInfo for interpreted options and extension range options. - * Fixed always_print_enums_as_ints option for JSON serialization. - * Added support for ignoring unknown enum values when parsing JSON. - * Create std::string in Arena memory. - * Fixed ValidateDateTime to correctly check the day. - * Fixed bug in ZeroCopyStreamByteSink. - * Various other cleanups and fixes. - - Java - * Dropped support for Java 6. - * Added a UTF-8 decoder that uses Unsafe to directly decode a byte buffer. - * Added deprecation annotations to generated code for deprecated oneof - fields. - * Fixed map field serialization in DynamicMessage. - * Cleanup and documentation for Java Lite runtime. - * Various other fixes and cleanups - * Fixed unboxed arraylists to handle an edge case - * Improved performance for copying between unboxed arraylists - * Fixed lite protobuf to avoid Java compiler warnings - * Improved test coverage for lite runtime - * Performance improvements for lite runtime - - Python - * Fixed bytes/string map key incompatibility between C++ and pure-Python - implementations (issue #4029) - * Added __init__.py files to compiler and util subpackages - * Use /MT for all Windows versions - * Fixed an issue affecting the Python-C++ implementation when used with - Cython (issue #2896) - * Various text format fixes - * Various fixes to resolve behavior differences between the pure-Python and - Python-C++ implementations - - PHP - * Added php_metadata_namespace to control the file path of generated metadata - file. - * Changed generated classes of nested message/enum. E.g., Foo.Bar, which - previously generates Foo_Bar, now generates Foo/Bar - * Added array constructor. When creating a message, users can pass a php - array whose content is field name to value pairs into constructor. The - created message will be initialized according to the array. Note that - message field should use a message value instead of a sub-array. - * Various bug fixes. - - Objective-C - * We removed some helper class methods from GPBDictionary to shrink the size - of the library, the functionary is still there, but you may need to do some - specific +alloc / -init… methods instead. - * Minor improvements in the performance of object field getters/setters by - avoiding some memory management overhead. - * Fix a memory leak during the raising of some errors. - * Make header importing completely order independent. - * Small code improvements for things the undefined behaviors compiler option - was flagging. - - Ruby - * Added ruby_package file option to control the module of generated class. - * Various bug fixes. - - Javascript - * Allow setting string to int64 field. - - Csharp - * Unknown fields are now parsed and then sent back on the wire. They can be - discarded at parse time via a CodedInputStream option. - * Movement towards working with .NET 3.5 and Unity - * Expression trees are no longer used - * AOT generics issues in Unity/il2cpp have a workaround (see this commit for - details) - * Floating point values are now compared bitwise (affects NaN value - comparisons) - * The default size limit when parsing is now 2GB rather than 64MB - * MessageParser now supports parsing from a slice of a byte array - * JSON list parsing now accepts null values where the underlying proto - representation does - -2017-12-20 version 3.5.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - Planned Future Changes - * Make C++ implementation C++11 only: we plan to require C++11 to build - protobuf code starting from 3.6.0 release. Please join this github issue: - https://github.com/protocolbuffers/protobuf/issues/2780 to provide your feedback. - - protoc - * Fixed a bug introduced in 3.5.0 and protoc in Windows now accepts non-ascii - characters in paths again. - - C++ - * Removed several usages of C++11 features in the code base. - * Fixed some compiler warnings. - - PHP - * Fixed memory leak in C-extension implementation. - * Added discardUnknokwnFields API. - * Removed duplicated typedef in C-extension headers. - * Avoided calling private php methods (timelib_update_ts). - * Fixed Any.php to use fully-qualified name for DescriptorPool. - - Ruby - * Added Google_Protobuf_discard_unknown for discarding unknown fields in - messages. - - C# - * Unknown fields are now preserved by default. - * Floating point values are now bitwise compared, affecting message equality - check and Contains() API in map and repeated fields. - - -2017-11-13 version 3.5.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - Planned Future Changes - * Make C++ implementation C++11 only: we plan to require C++11 to build - protobuf code starting from 3.6.0 release. Please join this github issue: - https://github.com/protocolbuffers/protobuf/issues/2780 to provide your feedback. - - General - * Unknown fields are now preserved in proto3 for most of the language - implementations for proto3 by default. See the per-language section for - details. - * reserve keyword are now supported in enums - - C++ - * Proto3 messages are now preserving unknown fields by default. If you rely on - unknowns fields being dropped. Please use DiscardUnknownFields() explicitly. - * Deprecated the unsafe_arena_release_* and unsafe_arena_add_allocated_* - methods for string fields. - * Added move constructor and move assignment to RepeatedField, - RepeatedPtrField and google::protobuf::Any. - * Added perfect forwarding in Arena::CreateMessage - * In-progress experimental support for implicit weak fields with lite protos. - This feature allows the linker to strip out more unused messages and reduce - binary size. - * Various performance optimizations. - - Java - * Proto3 messages are now preserving unknown fields by default. If you’d like - to drop unknown fields, please use the DiscardUnknownFieldsParser API. For - example: - Parser parser = DiscardUnknownFieldsParser.wrap(Foo.parser()); - Foo foo = parser.parseFrom(input); - * Added a new CodedInputStream decoder for Iterable with direct - ByteBuffers. - * TextFormat now prints unknown length-delimited fields as messages if - possible. - * FieldMaskUtil.merge() no longer creates unnecessary empty messages when a - message field is unset in both source message and destination message. - * Various performance optimizations. - - Python - * Proto3 messages are now preserving unknown fields by default. Use - message.DiscardUnknownFields() to drop unknown fields. - * Add FieldDescriptor.file in generated code. - * Add descriptor pool FindOneofByName in pure python. - * Change unknown enum values into unknown field set . - * Add more Python dict/list compatibility for Struct/ListValue. - * Add utf-8 support for text_format.Merge()/Parse(). - * Support numeric unknown enum values for proto3 JSON format. - * Add warning for Unexpected end-group tag in cpp extension. - - PHP - * Proto3 messages are now preserving unknown fields. - * Provide well known type messages in runtime. - * Add prefix ‘PB’ to generated class of reserved names. - * Fixed all conformance tests for encode/decode json in php runtime. C - extension needs more work. - - Objective-C - * Fixed some issues around copying of messages with unknown fields and then - mutating the unknown fields in the copy. - - C# - * Added unknown field support in JsonParser. - * Fixed oneof message field merge. - * Simplify parsing messages from array slices. - - Ruby - * Unknown fields are now preserved by default. - * Fixed several bugs for segment fault. - - Javascript - * Decoder can handle both paced and unpacked data no matter how the proto is - defined. - * Decoder now accept long varint for 32 bit integers. - - -2017-08-14 version 3.4.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - Planned Future Changes - * There are some changes that are not included in this release but are planned - for the near future - - Preserve unknown fields in proto3: We are going to bring unknown fields - back into proto3. In this release, some languages start to support - preserving unknown fields in proto3, controlled by flags/options. Some - languages also introduce explicit APIs to drop unknown fields for - migration. Please read the change log sections by languages for details. - For general timeline and plan: - - https://docs.google.com/document/d/1KMRX-G91Aa-Y2FkEaHeeviLRRNblgIahbsk4wA14gRk/view - - For issues and discussions: - - https://github.com/protocolbuffers/protobuf/issues/272 - - - Make C++ implementation C++11 only: we plan to require C++11 to build - protobuf code starting from 3.5.0 or 3.6.0 release, after unknown fields - semantic changes are finished. Please join this - github issue: - - https://github.com/protocolbuffers/protobuf/issues/2780 - - to provide your feedback. - - General - * Extension ranges now accept options and are customizable. - * "reserve" keyword now supports “max†in field number ranges, - e.g. reserve 1000 to max; - - C++ - * Proto3 messages are now able to preserve unknown fields. The default - behavior is still to drop unknowns, which will be flipped in a future - release. If you rely on unknowns fields being dropped. Please use - Message::DiscardUnknownFields() explicitly. - * Packable proto3 fields are now packed by default in serialization. - * Following C++11 features are introduced when C++11 is available: - - move-constructor and move-assignment are introduced to messages - - Repeated fields constructor now takes std::initializer_list - - rvalue setters are introduced for string fields - * Experimental Table-Driven parsing and serialization available to test. To - enable it, pass in table_driven_parsing table_driven_serialization protoc - generator flags for C++ - - $ protoc --cpp_out=table_driven_parsing,table_driven_serialization:./ \ - test.proto - - * lite generator parameter supported by the generator. Once set, all generated - files, use lite runtime regardless of the optimizer_for setting in the - .proto file. - * Various optimizations to make C++ code more performant on PowerPC platform - * Fixed maps data corruption when the maps are modified by both reflection API - and generated API. - * Deterministic serialization on maps reflection now uses stable sort. - * file() accessors are introduced to various *Descriptor classes to make - writing template function easier. - * ByteSize() and SpaceUsed() are deprecated.Use ByteSizeLong() and - SpaceUsedLong() instead - * Consistent hash function is used for maps in DEBUG and NDEBUG build. - * "using namespace std" is removed from stubs/common.h - * Various performance optimizations and bug fixes - - Java - * Introduced new parser API DiscardUnknownFieldsParser in preparation of - proto3 unknown fields preservation change. Users who want to drop unknown - fields should migrate to use this new parser API. For example: - - Parser parser = DiscardUnknownFieldsParser.wrap(Foo.parser()); - Foo foo = parser.parseFrom(input); - - * Introduced new TextFormat API printUnicodeFieldValue() that prints field - value without escaping unicode characters. - * Added Durations.compare(Duration, Duration) and - Timestamps.compare(Timestamp, Timestamp). - * JsonFormat now accepts base64url encoded bytes fields. - * Optimized CodedInputStream to do less copies when parsing large bytes - fields. - * Optimized TextFormat to allocate less memory when printing. - - Python - * SerializeToString API is changed to SerializeToString(self, **kwargs), - deterministic parameter is accepted for deterministic serialization. - * Added sort_keys parameter in json format to make the output deterministic. - * Added indent parameter in json format. - * Added extension support in json format. - * Added __repr__ support for repeated field in cpp implementation. - * Added file in FieldDescriptor. - * Added pretty-print filter to text format. - * Services and method descriptors are always printed even if generic_service - option is turned off. - * Note: AppEngine 2.5 is deprecated on June 2017 that AppEngine 2.5 will - never update protobuf runtime. Users who depend on AppEngine 2.5 should use - old protoc. - - PHP - * Support PHP generic services. Specify file option php_generic_service=true - to enable generating service interface. - * Message, repeated and map fields setters take value instead of reference. - * Added map iterator in c extension. - * Support json  encode/decode. - * Added more type info in getter/setter phpdoc - * Fixed the problem that c extension and php implementation cannot be used - together. - * Added file option php_namespace to use custom php namespace instead of - package. - * Added fluent setter. - * Added descriptor API in runtime for custom encode/decode. - * Various bug fixes. - - Objective-C - * Fix for GPBExtensionRegistry copying and add tests. - * Optimize GPBDictionary.m codegen to reduce size of overall library by 46K - per architecture. - * Fix some cases of reading of 64bit map values. - * Properly error on a tag with field number zero. - * Preserve unknown fields in proto3 syntax files. - * Document the exceptions on some of the writing apis. - - C# - * Implemented IReadOnlyDictionary in MapField - * Added TryUnpack method for Any message in addition to Unpack. - * Converted C# projects to MSBuild (csproj) format. - - Ruby - * Several bug fixes. - - Javascript - * Added support of field option js_type. Now one can specify the JS type of a - 64-bit integer field to be string in the generated code by adding option - [jstype = JS_STRING] on the field. - -2017-04-05 version 3.3.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - Planned Future Changes - * There are some changes that are not included in this release but are - planned for the near future: - - Preserve unknown fields in proto3: please read this doc: - - https://docs.google.com/document/d/1KMRX-G91Aa-Y2FkEaHeeviLRRNblgIahbsk4wA14gRk/view - - for the timeline and follow up this github issue: - - https://github.com/protocolbuffers/protobuf/issues/272 - - for discussion. - - Make C++ implementation C++11 only: we plan to require C++11 to build - protobuf code starting from 3.4.0 or 3.5.0 release. Please join this - github issue: - - https://github.com/protocolbuffers/protobuf/issues/2780 - - to provide your feedback. - - C++ - * Fixed map fields serialization of DynamicMessage to correctly serialize - both key and value regardless of their presence. - * Parser now rejects field number 0 correctly. - * New API Message::SpaceUsedLong() that’s equivalent to - Message::SpaceUsed() but returns the value in size_t. - * JSON support - - New flag always_print_enums_as_ints in JsonPrintOptions. - - New flag preserve_proto_field_names in JsonPrintOptions. It will instruct - the JSON printer to use the original field name declared in the .proto - file instead of converting them to lowerCamelCase when printing JSON. - - JsonPrintOptions.always_print_primtive_fields now works for oneof message - fields. - - Fixed a bug that doesn’t allow different fields to set the same json_name - value. - - Fixed a performance bug that causes excessive memory copy when printing - large messages. - * Various performance optimizations. - - Java - * Map field setters eagerly validate inputs and throw NullPointerExceptions - as appropriate. - * Added ByteBuffer overloads to the generated parsing methods and the Parser - interface. - * proto3 enum's getNumber() method now throws on UNRECOGNIZED values. - * Output of JsonFormat is now locale independent. - - Python - * Added FindServiceByName() in the pure-Python DescriptorPool. This works only - for descriptors added with DescriptorPool.Add(). Generated descriptor_pool - does not support this yet. - * Added a descriptor_pool parameter for parsing Any in text_format.Parse(). - * descriptor_pool.FindFileContainingSymbol() now is able to find nested - extensions. - * Extending empty [] to repeated field now sets parent message presence. - - PHP - * Added file option php_class_prefix. The prefix will be prepended to all - generated classes defined in the file. - * When encoding, negative int32 values are sign-extended to int64. - * Repeated/Map field setter accepts a regular PHP array. Type checking is - done on the array elements. - * encode/decode are renamed to serializeToString/mergeFromString. - * Added mergeFrom, clear method on Message. - * Fixed a bug that oneof accessor didn’t return the field name that is - actually set. - * C extension now works with php7. - * This is the first GA release of PHP. We guarantee that old generated code - can always work with new runtime and new generated code. - - Objective-C - * Fixed help for GPBTimestamp for dates before the epoch that contain - fractional seconds. - * Added GPBMessageDropUnknownFieldsRecursively() to remove unknowns from a - message and any sub messages. - * Addressed a threading race in extension registration/lookup. - * Increased the max message parsing depth to 100 to match the other languages. - * Removed some use of dispatch_once in favor of atomic compare/set since it - needs to be heap based. - * Fixes for new Xcode 8.3 warnings. - - C# - * Fixed MapField.Values.CopyTo, which would throw an exception unnecessarily - if provided exactly the right size of array to copy to. - * Fixed enum JSON formatting when multiple names mapped to the same numeric - value. - * Added JSON formatting option to format enums as integers. - * Modified RepeatedField to implement IReadOnlyList. - * Introduced the start of custom option handling; it's not as pleasant as it - might be, but the information is at least present. We expect to extend code - generation to improve this in the future. - * Introduced ByteString.FromStream and ByteString.FromStreamAsync to - efficiently create a ByteString from a stream. - * Added whole-message deprecation, which decorates the class with [Obsolete]. - - Ruby - * Fixed Message#to_h for messages with map fields. - * Fixed memcpy() in binary gems to work for old glibc, without breaking the - build for non-glibc libc’s like musl. - - Javascript - * Added compatibility tests for version 3.0.0. - * Added conformance tests. - * Fixed serialization of extensions: we need to emit a value even if it is - falsy (like the number 0). - * Use closurebuilder.py in favor of calcdeps.py for compiling JavaScript. - -2017-01-23 version 3.2.0 (C++/Java/Python/PHP/Ruby/Objective-C/C#/JavaScript/Lite) - General - * Added protoc version number to protoc plugin protocol. It can be used by - protoc plugin to detect which version of protoc is used with the plugin and - mitigate known problems in certain version of protoc. - - C++ - * The default parsing byte size limit has been raised from 64MB to 2GB. - * Added rvalue setters for non-arena string fields. - * Enabled debug logging for Android. - * Fixed a double-free problem when using Reflection::SetAllocatedMessage() - with extension fields. - * Fixed several deterministic serialization bugs: - * MessageLite::SerializeAsString() now respects the global deterministic - serialization flag. - * Extension fields are serialized deterministically as well. Fixed protocol - compiler to correctly report importing-self as an error. - * Fixed FileDescriptor::DebugString() to print custom options correctly. - * Various performance/codesize optimizations and cleanups. - - Java - * The default parsing byte size limit has been raised from 64MB to 2GB. - * Added recursion limit when parsing JSON. - * Fixed a bug that enumType.getDescriptor().getOptions() doesn't have custom - options. - * Fixed generated code to support field numbers up to 2^29-1. - - Python - * You can now assign NumPy scalars/arrays (np.int32, np.int64) to protobuf - fields, and assigning other numeric types has been optimized for - performance. - * Pure-Python: message types are now garbage-collectable. - * Python/C++: a lot of internal cleanup/refactoring. - - PHP (Alpha) - * For 64-bit integers type (int64/uint64/sfixed64/fixed64/sint64), use PHP - integer on 64-bit environment and PHP string on 32-bit environment. - * PHP generated code also conforms to PSR-4 now. - * Fixed ZTS build for c extension. - * Fixed c extension build on Mac. - * Fixed c extension build on 32-bit linux. - * Fixed the bug that message without namespace is not found in the descriptor - pool. (#2240) - * Fixed the bug that repeated field is not iterable in c extension. - * Message names Empty will be converted to GPBEmpty in generated code. - * Added phpdoc in generated files. - * The released API is almost stable. Unless there is large problem, we won't - change it. See - https://developers.google.com/protocol-buffers/docs/reference/php-generated - for more details. - - Objective-C - * Added support for push/pop of the stream limit on CodedInputStream for - anyone doing manual parsing. - - C# - * No changes. - - Ruby - * Message objects now support #respond_to? for field getters/setters. - * You can now compare “message == non_message_object†and it will return false - instead of throwing an exception. - * JRuby: fixed #hashCode to properly reflect the values in the message. - - Javascript - * Deserialization of repeated fields no longer has quadratic performance - behavior. - * UTF-8 encoding/decoding now properly supports high codepoints. - * Added convenience methods for some well-known types: Any, Struct, and - Timestamp. These make it easier to convert data between native JavaScript - types and the well-known protobuf types. - -2016-09-23 version 3.1.0 (C++/Java/Python/PHP/Ruby/Objective-C/C#/JavaScript/Lite) - General - * Proto3 support in PHP (alpha). - * Various bug fixes. - - C++ - * Added MessageLite::ByteSizeLong() that’s equivalent to - MessageLite::ByteSize() but returns the value in size_t. Useful to check - whether a message is over the 2G size limit that protobuf can support. - * Moved default_instances to global variables. This allows default_instance - addresses to be known at compile time. - * Adding missing generic gcc 64-bit atomicops. - * Restore New*Callback into google::protobuf namespace since these are used - by the service stubs code - * JSON support. - * Fixed some conformance issues. - * Fixed a JSON serialization bug for bytes fields. - - Java - * Fixed a bug in TextFormat that doesn’t accept empty repeated fields (i.e., - “field: [ ]â€). - * JSON support - * Fixed JsonFormat to do correct snake_case-to-camelCase conversion for - non-style-conforming field names. - * Fixed JsonFormat to parse empty Any message correctly. - * Added an option to JsonFormat.Parser to ignore unknown fields. - * Experimental API - * Added UnsafeByteOperations.unsafeWrap(byte[]) to wrap a byte array into - ByteString without copy. - - Python - * JSON support - * Fixed some conformance issues. - - PHP (Alpha) - * We have added the proto3 support for PHP via both a pure PHP package and a - native c extension. The pure PHP package is intended to provide usability - to wider range of PHP platforms, while the c extension is intended to - provide higher performance. Both implementations provide the same runtime - APIs and share the same generated code. Users don’t need to re-generate - code for the same proto definition when they want to switch the - implementation later. The pure PHP package is included in the php/src - directory, and the c extension is included in the php/ext directory. - - Both implementations provide idiomatic PHP APIs: - * All messages and enums are defined as PHP classes. - * All message fields can only be accessed via getter/setter. - * Both repeated field elements and map elements are stored in containers - that act like a normal PHP array. - - Unlike several existing third-party PHP implementations for protobuf, our - implementations are built on a "strongly-typed" philosophy: message fields - and array/map containers will throw exceptions eagerly when values of the - incorrect type (not including those that can be type converted, e.g., - double <-> integer <-> numeric string) are inserted. - - Currently, pure PHP runtime supports php5.5, 5.6 and 7 on linux. C - extension runtime supports php5.5 and 5.6 on linux. - - See php/README.md for more details about installment. See - https://developers.google.com/protocol-buffers/docs/phptutorial for more - details about APIs. - - Objective-C - * Helpers are now provided for working the Any well known type (see - GPBWellKnownTypes.h for the api additions). - * Some improvements in startup code (especially when extensions aren’t used). - - Javascript - * Fixed missing import of jspb.Map - * Fixed valueWriterFn variable name - - Ruby - * Fixed hash computation for JRuby's RubyMessage - * Make sure map parsing frames are GC-rooted. - * Added API support for well-known types. - - C# - * Removed check on dependency in the C# reflection API. - -2016-09-06 version 3.0.2 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite) - General - * Various bug fixes. - - Objective C - * Fix for oneofs in proto3 syntax files where fields were set to the zero - value. - * Fix for embedded null character in strings. - * CocoaDocs support - - Ruby - * Fixed memory corruption bug in parsing that could occur under GC pressure. - - Javascript - * jspb.Map is now properly exported to CommonJS modules. - - C# - * Removed legacy_enum_values flag. - - -2016-07-27 version 3.0.0 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite) - General - * This log only contains changes since the beta-4 release. Summarized change - log since the last stable release (v2.6.1) can be found in the github - release page. - - Compatibility Notice - * v3.0.0 is the first API stable release of the v3.x series. We do not expect - any future API breaking changes. - * For C++, Java Lite and Objective-C, source level compatibility is - guaranteed. Upgrading from v3.0.0 to newer minor version releases will be - source compatible. For example, if your code compiles against protobuf - v3.0.0, it will continue to compile after you upgrade protobuf library to - v3.1.0. - * For other languages, both source level compatibility and binary level - compatibility are guaranteed. For example, if you have a Java binary built - against protobuf v3.0.0. After switching the protobuf runtime binary to - v3.1.0, your built binary should continue to work. - * Compatibility is only guaranteed for documented API and documented - behaviors. If you are using undocumented API (e.g., use anything in the C++ - internal namespace), it can be broken by minor version releases in an - undetermined manner. - - Ruby - * When you assign a string field `a.string_field = "X"`, we now call - #encode(UTF-8) on the string and freeze the copy. This saves you from - needing to ensure the string is already encoded as UTF-8. It also prevents - you from mutating the string after it has been assigned (this is how we - ensure it stays valid UTF-8). - * The generated file for `foo.proto` is now `foo_pb.rb` instead of just - `foo.rb`. This makes it easier to see which imports/requires are from - protobuf generated code, and also prevents conflicts with any `foo.rb` file - you might have written directly in Ruby. It is a backward-incompatible - change: you will need to update all of your `require` statements. - * For package names like `foo_bar`, we now translate this to the Ruby module - `FooBar`. This is more idiomatic Ruby than what we used to do (`Foo_bar`). - - JavaScript - * Scalar fields like numbers and boolean now return defaults instead of - `undefined` or `null` when they are unset. You can test for presence - explicitly by calling `hasFoo()`, which we now generate for scalar fields. - - Java Lite - * Java Lite is now implemented as a separate plugin, maintained in the - `javalite` branch. Both lite runtime and protoc artifacts will be available - in Maven. - - C# - * Target platforms now .NET 4.5, selected portable subsets and .NET Core. - * legacy_enum_values option is no longer supported. - -2016-07-15 version 3.0.0-beta-4 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript) - General - * Added a deterministic serialization API for C++. The deterministic - serialization guarantees that given a binary, equal messages will be - serialized to the same bytes. This allows applications like MapReduce to - group equal messages based on the serialized bytes. The deterministic - serialization is, however, NOT canonical across languages; it is also - unstable across different builds with schema changes due to unknown fields. - Users who need canonical serialization, e.g. persistent storage in a - canonical form, fingerprinting, etc, should define their own - canonicalization specification and implement the serializer using reflection - APIs rather than relying on this API. - * Added OneofOptions. You can now define custom options for oneof groups. - import "google/protobuf/descriptor.proto"; - extend google.protobuf.OneofOptions { - optional int32 my_oneof_extension = 12345; - } - message Foo { - oneof oneof_group { - (my_oneof_extension) = 54321; - ... - } - } - - C++ (beta) - * Introduced a deterministic serialization API in - CodedOutputStream::SetSerializationDeterministic(bool). See the notes about - deterministic serialization in the General section. - * Added google::protobuf::Map::swap() to swap two map fields. - * Fixed a memory leak when calling Reflection::ReleaseMessage() on a message - allocated on arena. - * Improved error reporting when parsing text format protos. - * JSON - - Added a new parser option to ignore unknown fields when parsing JSON. - - Added convenient methods for message to/from JSON conversion. - * Various performance optimizations. - - Java (beta) - * File option "java_generate_equals_and_hash" is now deprecated. equals() and - hashCode() methods are generated by default. - * Added a new JSON printer option "omittingInsignificantWhitespace" to produce - a more compact JSON output. The printer will pretty-print by default. - * Updated Java runtime to be compatible with 2.5.0/2.6.1 generated protos. - - Python (beta) - * Added support to pretty print Any messages in text format. - * Added a flag to ignore unknown fields when parsing JSON. - * Bugfix: "@type" field of a JSON Any message is now correctly put before - other fields. - - Objective-C (beta) - * Updated the code to support compiling with more compiler warnings - enabled. (Issue 1616) - * Exposing more detailed errors for parsing failures. (PR 1623) - * Small (breaking) change to the naming of some methods on the support classes - for map<>. There were collisions with the system provided KVO support, so - the names were changed to avoid those issues. (PR 1699) - * Fixed for proper Swift bridging of error handling during parsing. (PR 1712) - * Complete support for generating sources that will go into a Framework and - depend on generated sources from other Frameworks. (Issue 1457) - - C# (beta) - * RepeatedField optimizations. - * Support for .NET Core. - * Minor bug fixes. - * Ability to format a single value in JsonFormatter (advanced usage only). - * Modifications to attributes applied to generated code. - - Javascript (alpha) - * Maps now have a real map API instead of being treated as repeated fields. - * Well-known types are now provided in the google-protobuf package, and the - code generator knows to require() them from that package. - * Bugfix: non-canonical varints are correctly decoded. - - Ruby (alpha) - * Accessors for oneof fields now return default values instead of nil. - - Java Lite - * Java lite support is removed from protocol compiler. It will be supported - as a protocol compiler plugin in a separate code branch. - -2016-05-16 version 3.0.0-beta-3 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript) - General - * Supported Proto3 lite-runtime in C++/Java for mobile platforms. - * Any type now supports APIs to specify prefixes other than - type.googleapis.com - * Removed javanano_use_deprecated_package option; Nano will always has its own - ".nano" package. - - C++ (Beta) - * Improved hash maps. - - Improved hash maps comments. In particular, please note that equal hash - maps will not necessarily have the same iteration order and - serialization. - - Added a new hash maps implementation that will become the default in a - later release. - * Arenas - - Several inlined methods in Arena were moved to out-of-line to improve - build performance and code size. - - Added SpaceAllocatedAndUsed() to report both space used and allocated - - Added convenient class UnsafeArenaAllocatedRepeatedPtrFieldBackInserter - * Any - - Allow custom type URL prefixes in Any packing. - - TextFormat now expand the Any type rather than printing bytes. - * Performance optimizations and various bug fixes. - - Java (Beta) - * Introduced an ExperimentalApi annotation. Annotated APIs are experimental - and are subject to change in a backward incompatible way in future releases. - * Introduced zero-copy serialization as an ExperimentalApi - - Introduction of the `ByteOutput` interface. This is similar to - `OutputStream` but provides semantics for lazy writing (i.e. no - immediate copy required) of fields that are considered to be immutable. - - `ByteString` now supports writing to a `ByteOutput`, which will directly - expose the internals of the `ByteString` (i.e. `byte[]` or `ByteBuffer`) - to the `ByteOutput` without copying. - - `CodedOutputStream` now supports writing to a `ByteOutput`. `ByteString` - instances that are too large to fit in the internal buffer will be - (lazily) written to the `ByteOutput` directly. - - This allows applications using large `ByteString` fields to avoid - duplication of these fields entirely. Such an application can supply a - `ByteOutput` that chains together the chunks received from - `CodedOutputStream` before forwarding them onto the IO system. - * Other related changes to `CodedOutputStream` - - Additional use of `sun.misc.Unsafe` where possible to perform fast - access to `byte[]` and `ByteBuffer` values and avoiding unnecessary - range checking. - - `ByteBuffer`-backed `CodedOutputStream` now writes directly to the - `ByteBuffer` rather than to an intermediate array. - * Improved lite-runtime. - - Lite protos now implement deep equals/hashCode/toString - - Significantly improved the performance of Builder#mergeFrom() and - Builder#mergeDelimitedFrom() - * Various bug fixes and small feature enhancement. - - Fixed stack overflow when in hashCode() for infinite recursive oneofs. - - Fixed the lazy field parsing in lite to merge rather than overwrite. - - TextFormat now supports reporting line/column numbers on errors. - - Updated to add appropriate @Override for better compiler errors. - - Python (Beta) - * Added JSON format for Any, Struct, Value and ListValue - * [ ] is now accepted for both repeated scalar fields and repeated message - fields in text format parser. - * Numerical field name is now supported in text format. - * Added DiscardUnknownFields API for python protobuf message. - - Objective-C (Beta) - * Proto comments now come over as HeaderDoc comments in the generated sources - so Xcode can pick them up and display them. - * The library headers have been updated to use HeaderDoc comments so Xcode can - pick them up and display them. - * The per message and per field overhead in both generated code and runtime - object sizes was reduced. - * Generated code now include deprecated annotations when the proto file - included them. - - C# (Beta) - In general: some changes are breaking, which require regenerating messages. - Most user-written code will not be impacted *except* for the renaming of enum - values. - - * Allow custom type URL prefixes in `Any` packing, and ignore them when - unpacking - * `protoc` is now in a separate NuGet package (Google.Protobuf.Tools) - * New option: `internal_access` to generate internal classes - * Enum values are now PascalCased, and if there's a prefix which matches the - name of the enum, that is removed (so an enum `COLOR` with a value - `COLOR_BLUE` would generate a value of just `Blue`). An option - (`legacy_enum_values`) is temporarily available to disable this, but the - option will be removed for GA. - * `json_name` option is now honored - * If group tags are encountered when parsing, they are validated more - thoroughly (although we don't support actual groups) - * NuGet dependencies are better specified - * Breaking: `Preconditions` is renamed to `ProtoPreconditions` - * Breaking: `GeneratedCodeInfo` is renamed to `GeneratedClrTypeInfo` - * `JsonFormatter` now allows writing to a `TextWriter` - * New interface, `ICustomDiagnosticMessage` to allow more compact - representations from `ToString` - * `CodedInputStream` and `CodedOutputStream` now implement `IDisposable`, - which simply disposes of the streams they were constructed with - * Map fields no longer support null values (in line with other languages) - * Improvements in JSON formatting and parsing - - Javascript (Alpha) - * Better support for "bytes" fields: bytes fields can be read as either a - base64 string or UInt8Array (in environments where TypedArray is supported). - * New support for CommonJS imports. This should make it easier to use the - JavaScript support in Node.js and tools like WebPack. See js/README.md for - more information. - * Some significant internal refactoring to simplify and modularize the code. - - Ruby (Alpha) - * JSON serialization now properly uses camelCased names, with a runtime option - that will preserve original names from .proto files instead. - * Well-known types are now included in the distribution. - * Release now includes binary gems for Windows, Mac, and Linux instead of just - source gems. - * Bugfix for serializing oneofs. - - C++/Java Lite (Alpha) - A new "lite" generator parameter was introduced in the protoc for C++ and - Java for Proto3 syntax messages. Example usage: - - ./protoc --cpp_out=lite:$OUTPUT_PATH foo.proto - - The protoc will treat the current input and all the transitive dependencies - as LITE. The same generator parameter must be used to generate the - dependencies. - - In Proto3 syntax files, "optimized_for=LITE_RUNTIME" is no longer supported. - - -2015-12-30 version 3.0.0-beta-2 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript) - General - * Introduced a new language implementation: JavaScript. - * Added a new field option "json_name". By default proto field names are - converted to "lowerCamelCase" in proto3 JSON format. This option can be - used to override this behavior and specify a different JSON name for the - field. - * Added conformance tests to ensure implementations are following proto3 JSON - specification. - - C++ (Beta) - * Various bug fixes and improvements to the JSON support utility: - - Duplicate map keys in JSON are now rejected (i.e., translation will - fail). - - Fixed wire-format for google.protobuf.Value/ListValue. - - Fixed precision loss when converting google.protobuf.Timestamp. - - Fixed a bug when parsing invalid UTF-8 code points. - - Fixed a memory leak. - - Reduced call stack usage. - - Java (Beta) - * Cleaned up some unused methods on CodedOutputStream. - * Presized lists for packed fields during parsing in the lite runtime to - reduce allocations and improve performance. - * Improved the performance of unknown fields in the lite runtime. - * Introduced UnsafeByteStrings to support zero-copy ByteString creation. - * Various bug fixes and improvements to the JSON support utility: - - Fixed a thread-safety bug. - - Added a new option “preservingProtoFieldNames†to JsonFormat. - - Added a new option “includingDefaultValueFields†to JsonFormat. - - Updated the JSON utility to comply with proto3 JSON specification. - - Python (Beta) - * Added proto3 JSON format utility. It includes support for all field types - and a few well-known types except for Any and Struct. - * Added runtime support for Any, Timestamp, Duration and FieldMask. - * [ ] is now accepted for repeated scalar fields in text format parser. - * Map fields now have proper O(1) performance for lookup/insert/delete - when using the Python/C++ implementation. They were previously using O(n) - search-based algorithms because the C++ reflection interface didn't - support true map operations. - - Objective-C (Beta) - * Various bug-fixes and code tweaks to pass more strict compiler warnings. - * Now has conformance test coverage and is passing all tests. - - C# (Beta) - * Various bug-fixes. - * Code generation: Files generated in directories based on namespace. - * Code generation: Include comments from .proto files in XML doc - comments (naively) - * Code generation: Change organization/naming of "reflection class" (access - to file descriptor) - * Code generation and library: Add Parser property to MessageDescriptor, - and introduce a non-generic parser type. - * Library: Added TypeRegistry to support JSON parsing/formatting of Any. - * Library: Added Any.Pack/Unpack support. - * Library: Implemented JSON parsing. - - Javascript (Alpha) - * Added proto3 support for JavaScript. The runtime is written in pure - JavaScript and works in browsers and in Node.js. To generate JavaScript - code for your proto, invoke protoc with "--js_out". See js/README.md - for more build instructions. - -2015-08-26 version 3.0.0-beta-1 (C++/Java/Python/Ruby/Nano/Objective-C/C#) - About Beta - * This is the first beta release of protobuf v3.0.0. Not all languages - have reached beta stage. Languages not marked as beta are still in - alpha (i.e., be prepared for API breaking changes). - - General - * Proto3 JSON is supported in several languages (fully supported in C++ - and Java, partially supported in Ruby/C#). The JSON spec is defined in - the proto3 language guide: - - https://developers.google.com/protocol-buffers/docs/proto3#json - - We will publish a more detailed spec to define the exact behavior of - proto3-conformant JSON serializers and parsers. Until then, do not rely - on specific behaviors of the implementation if it’s not documented in - the above spec. More specifically, the behavior is not yet finalized for - the following: - - Parsing invalid JSON input (e.g., input with trailing commas). - - Non-camelCase names in JSON input. - - The same field appears multiple times in JSON input. - - JSON arrays contain “null†values. - - The message has unknown fields. - - * Proto3 now enforces strict UTF-8 checking. Parsing will fail if a string - field contains non UTF-8 data. - - C++ (Beta) - * Introduced new utility functions/classes in the google/protobuf/util - directory: - - MessageDifferencer: compare two proto messages and report their - differences. - - JsonUtil: support converting protobuf binary format to/from JSON. - - TimeUtil: utility functions to work with well-known types Timestamp - and Duration. - - FieldMaskUtil: utility functions to work with FieldMask. - - * Performance optimization of arena construction and destruction. - * Bug fixes for arena and maps support. - * Changed to use cmake for Windows Visual Studio builds. - * Added Bazel support. - - Java (Beta) - * Introduced a new util package that will be distributed as a separate - artifact in maven. It contains: - - JsonFormat: convert proto messages to/from JSON. - - TimeUtil: utility functions to work with Timestamp and Duration. - - FieldMaskUtil: utility functions to work with FieldMask. - - * The static PARSER in each generated message is deprecated, and it will - be removed in a future release. A static parser() getter is generated - for each message type instead. - * Performance optimizations for String fields serialization. - * Performance optimizations for Lite runtime on Android: - - Reduced allocations - - Reduced method overhead after ProGuarding - - Reduced code size after ProGuarding - - Python (Alpha) - * Removed legacy Python 2.5 support. - * Moved to a single Python 2.x/3.x-compatible codebase, instead of using 2to3. - * Fixed build/tests on Python 2.6, 2.7, 3.3, and 3.4. - - Pure-Python works on all four. - - Python/C++ implementation works on all but 3.4, due to changes in the - Python/C++ API in 3.4. - * Some preliminary work has been done to allow for multiple DescriptorPools - with Python/C++. - - Ruby (Alpha) - * Many bugfixes: - - fixed parsing/serialization of bytes, sint, sfixed types - - other parser bugfixes - - fixed memory leak affecting Ruby 2.2 - - JavaNano (Alpha) - * JavaNano generated code now will be put in a nano package by default to - avoid conflicts with Java generated code. - - Objective-C (Alpha) - * Added non-null markup to ObjC library. Requires SDK 8.4+ to build. - * Many bugfixes: - - Removed the class/enum filter. - - Renamed some internal types to avoid conflicts with the well-known types - protos. - - Added missing support for parsing repeated primitive fields in packed or - unpacked forms. - - Added *Count for repeated and map<> fields to avoid auto-create when - checking for them being set. - - C# (Alpha) - * Namespace changed to Google.Protobuf (and NuGet package will be named - correspondingly). - * Target platforms now .NET 4.5 and selected portable subsets only. - * Removed lite runtime. - * Reimplementation to use mutable message types. - * Null references used to represent "no value" for message type fields. - * Proto3 semantics supported; proto2 files are prohibited for C# codegen. - Most proto3 features supported: - - JSON formatting (a.k.a. serialization to JSON), including well-known - types (except for Any). - - Wrapper types mapped to nullable value types (or string/ByteString - allowing nullability). JSON parsing is not supported yet. - - maps - - oneof - - enum unknown value preservation - -2015-05-25 version 3.0.0-alpha-3 (Objective-C/C#): - General - * Introduced two new language implementations (Objective-C, C#) to proto3. - * Explicit "optional" keyword are disallowed in proto3 syntax, as fields are - optional by default. - * Group fields are no longer supported in proto3 syntax. - * Changed repeated primitive fields to use packed serialization by default in - proto3 (implemented for C++, Java, Python in this release). The user can - still disable packed serialization by setting packed to false for now. - * Added well-known type protos (any.proto, empty.proto, timestamp.proto, - duration.proto, etc.). Users can import and use these protos just like - regular proto files. Additional runtime support will be added for them in - future releases (in the form of utility helper functions, or having them - replaced by language specific types in generated code). - * Added a "reserved" keyword in both proto2 and proto3 syntax. User can use - this keyword to declare reserved field numbers and names to prevent them - from being reused by other fields in the same message. - - To reserve field numbers, add a reserved declaration in your message: - - message TestMessage { - reserved 2, 15, 9 to 11, 3; - } - - This reserves field numbers 2, 3, 9, 10, 11 and 15. If a user uses any of - these as field numbers, the protocol buffer compiler will report an error. - - Field names can also be reserved: - - message TestMessage { - reserved "foo", "bar"; - } - - * Various bug fixes since 3.0.0-alpha-2 - - Objective-C - Objective-C includes a code generator and a native objective-c runtime - library. By adding “--objc_out†to protoc, the code generator will generate - a header(*.pbobjc.h) and an implementation file(*.pbobjc.m) for each proto - file. - - In this first release, the generated interface provides: enums, messages, - field support(single, repeated, map, oneof), proto2 and proto3 syntax - support, parsing and serialization. It’s compatible with ARC and non-ARC - usage. Besides, user can also access it via the swift bridging header. - - See objectivec/README.md for details. - - C# - * C# protobufs are based on project - https://github.com/jskeet/protobuf-csharp-port. The original project was - frozen and all the new development will happen here. - * Codegen plugin for C# was completely rewritten to C++ and is now an - integral part of protoc. - * Some refactorings and cleanup has been applied to the C# runtime library. - * Only proto2 is supported in C# at the moment, proto3 support is in - progress and will likely bring significant breaking changes to the API. - - See csharp/README.md for details. - - C++ - * Added runtime support for Any type. To use Any in your proto file, first - import the definition of Any: - - // foo.proto - import "google/protobuf/any.proto"; - message Foo { - google.protobuf.Any any_field = 1; - } - message Bar { - int32 value = 1; - } - - Then in C++ you can access the Any field using PackFrom()/UnpackTo() - methods: - - Foo foo; - Bar bar = ...; - foo.mutable_any_field()->PackFrom(bar); - ... - if (foo.any_field().IsType()) { - foo.any_field().UnpackTo(&bar); - ... - } - * In text format, entries of a map field will be sorted by key. - - Java - * Continued optimizations on the lite runtime to improve performance for - Android. - - Python - * Added map support. - - maps now have a dict-like interface (msg.map_field[key] = value) - - existing code that modifies maps via the repeated field interface - will need to be updated. - - Ruby - * Improvements to RepeatedField's emulation of the Ruby Array API. - * Various speedups and internal cleanups. - -2015-02-26 version 3.0.0-alpha-2 (Python/Ruby/JavaNano): - General - * Introduced three new language implementations (Ruby, JavaNano, and - Python) to proto3. - * Various bug fixes since 3.0.0-alpha-1 - - Python: - Python has received several updates, most notably support for proto3 - semantics in any .proto file that declares syntax="proto3". - Messages declared in proto3 files no longer represent field presence - for scalar fields (number, enums, booleans, or strings). You can - no longer call HasField() for such fields, and they are serialized - based on whether they have a non-zero/empty/false value. - - One other notable change is in the C++-accelerated implementation. - Descriptor objects (which describe the protobuf schema and allow - reflection over it) are no longer duplicated between the Python - and C++ layers. The Python descriptors are now simple wrappers - around the C++ descriptors. This change should significantly - reduce the memory usage of programs that use a lot of message - types. - - Ruby: - We have added proto3 support for Ruby via a native C extension. - - The Ruby extension itself is included in the ruby/ directory, and details on - building and installing the extension are in ruby/README.md. The extension - will also be published as a Ruby gem. Code generator support is included as - part of `protoc` with the `--ruby_out` flag. - - The Ruby extension implements a user-friendly DSL to define message types - (also generated by the code generator from `.proto` files). Once a message - type is defined, the user may create instances of the message that behave in - ways idiomatic to Ruby. For example: - - - Message fields are present as ordinary Ruby properties (getter method - `foo` and setter method `foo=`). - - Repeated field elements are stored in a container that acts like a native - Ruby array, and map elements are stored in a container that acts like a - native Ruby hashmap. - - The usual well-known methods, such as `#to_s`, `#dup`, and the like, are - present. - - Unlike several existing third-party Ruby extensions for protobuf, this - extension is built on a "strongly-typed" philosophy: message fields and - array/map containers will throw exceptions eagerly when values of the - incorrect type are inserted. - - See ruby/README.md for details. - - JavaNano: - JavaNano is a special code generator and runtime library designed especially - for resource-restricted systems, like Android. It is very resource-friendly - in both the amount of code and the runtime overhead. Here is an an overview - of JavaNano features compared with the official Java protobuf: - - - No descriptors or message builders. - - All messages are mutable; fields are public Java fields. - - For optional fields only, encapsulation behind setter/getter/hazzer/ - clearer functions is opt-in, which provide proper 'has' state support. - - For proto2, if not opted in, has state (field presence) is not available. - Serialization outputs all fields not equal to their defaults. - The behavior is consistent with proto3 semantics. - - Required fields (proto2 only) are always serialized. - - Enum constants are integers; protection against invalid values only - when parsing from the wire. - - Enum constants can be generated into container interfaces bearing - the enum's name (so the referencing code is in Java style). - - CodedInputByteBufferNano can only take byte[] (not InputStream). - - Similarly CodedOutputByteBufferNano can only write to byte[]. - - Repeated fields are in arrays, not ArrayList or Vector. Null array - elements are allowed and silently ignored. - - Full support for serializing/deserializing repeated packed fields. - - Support extensions (in proto2). - - Unset messages/groups are null, not an immutable empty default - instance. - - toByteArray(...) and mergeFrom(...) are now static functions of - MessageNano. - - The 'bytes' type translates to the Java type byte[]. - - See javanano/README.txt for details. - -2014-12-01 version 3.0.0-alpha-1 (C++/Java): - - General - * Introduced Protocol Buffers language version 3 (aka proto3). - - When protobuf was initially opensourced it implemented Protocol Buffers - language version 2 (aka proto2), which is why the version number - started from v2.0.0. From v3.0.0, a new language version (proto3) is - introduced while the old version (proto2) will continue to be supported. - - The main intent of introducing proto3 is to clean up protobuf before - pushing the language as the foundation of Google's new API platform. - In proto3, the language is simplified, both for ease of use and to - make it available in a wider range of programming languages. At the - same time a few features are added to better support common idioms - found in APIs. - - The following are the main new features in language version 3: - - 1. Removal of field presence logic for primitive value fields, removal - of required fields, and removal of default values. This makes proto3 - significantly easier to implement with open struct representations, - as in languages like Android Java, Objective C, or Go. - 2. Removal of unknown fields. - 3. Removal of extensions, which are instead replaced by a new standard - type called Any. - 4. Fix semantics for unknown enum values. - 5. Addition of maps. - 6. Addition of a small set of standard types for representation of time, - dynamic data, etc. - 7. A well-defined encoding in JSON as an alternative to binary proto - encoding. - - This release (v3.0.0-alpha-1) includes partial proto3 support for C++ and - Java. Items 6 (well-known types) and 7 (JSON format) in the above feature - list are not implemented. - - A new notion "syntax" is introduced to specify whether a .proto file - uses proto2 or proto3: - - // foo.proto - syntax = "proto3"; - message Bar {...} - - If omitted, the protocol compiler will generate a warning and "proto2" will - be used as the default. This warning will be turned into an error in a - future release. - - We recommend that new Protocol Buffers users use proto3. However, we do not - generally recommend that existing users migrate from proto2 from proto3 due - to API incompatibility, and we will continue to support proto2 for a long - time. - - * Added support for map fields (implemented in C++/Java for both proto2 and - proto3). - - Map fields can be declared using the following syntax: - - message Foo { - map values = 1; - } - - Data of a map field will be stored in memory as an unordered map and it - can be accessed through generated accessors. - - C++ - * Added arena allocation support (for both proto2 and proto3). - - Profiling shows memory allocation and deallocation constitutes a significant - fraction of CPU-time spent in protobuf code and arena allocation is a - technique introduced to reduce this cost. With arena allocation, new - objects will be allocated from a large piece of preallocated memory and - deallocation of these objects is almost free. Early adoption shows 20% to - 50% improvement in some Google binaries. - - To enable arena support, add the following option to your .proto file: - - option cc_enable_arenas = true; - - Protocol compiler will generate additional code to make the generated - message classes work with arenas. This does not change the existing API - of protobuf messages and does not affect wire format. Your existing code - should continue to work after adding this option. In the future we will - make this option enabled by default. - - To actually take advantage of arena allocation, you need to use the arena - APIs when creating messages. A quick example of using the arena API: - - { - google::protobuf::Arena arena; - // Allocate a protobuf message in the arena. - MyMessage* message = Arena::CreateMessage(&arena); - // All submessages will be allocated in the same arena. - if (!message->ParseFromString(data)) { - // Deal with malformed input data. - } - // Must not delete the message here. It will be deleted automatically - // when the arena is destroyed. - } - - Currently arena does not work with map fields. Enabling arena in a .proto - file containing map fields will result in compile errors in the generated - code. This will be addressed in a future release. - -2014-10-20 version 2.6.1: - - C++ - * Added atomicops support for Solaris. - * Released memory allocated by InitializeDefaultRepeatedFields() and - GetEmptyString(). Some memory sanitizers reported them as memory leaks. - - Java - * Updated DynamicMessage.setField() to handle repeated enum values - correctly. - * Fixed a bug that caused NullPointerException to be thrown when - converting manually constructed FileDescriptorProto to - FileDescriptor. - - Python - * Fixed WhichOneof() to work with de-serialized protobuf messages. - * Fixed a missing file problem of Python C++ implementation. - -2014-08-15 version 2.6.0: - - General - * Added oneofs(unions) feature. Fields in the same oneof will share - memory and at most one field can be set at the same time. Use the - oneof keyword to define a oneof like: - message SampleMessage { - oneof test_oneof { - string name = 4; - YourMessage sub_message = 9; - } - } - * Files, services, enums, messages, methods and enum values can be marked - as deprecated now. - * Added Support for list values, including lists of messages, when - parsing text-formatted protos in C++ and Java. - For example: foo: [1, 2, 3] - - C++ - * Enhanced customization on TestFormat printing. - * Added SwapFields() in reflection API to swap a subset of fields. - Added SetAllocatedMessage() in reflection API. - * Repeated primitive extensions are now packable. The - [packed=true] option only affects serializers. Therefore, it is - possible to switch a repeated extension field to packed format - without breaking backwards-compatibility. - * Various speed optimizations. - - Java - * writeTo() method in ByteString can now write a substring to an - output stream. Added endWith() method for ByteString. - * ByteString and ByteBuffer are now supported in CodedInputStream - and CodedOutputStream. - * java_generate_equals_and_hash can now be used with the LITE_RUNTIME. - - Python - * A new C++-backed extension module (aka "cpp api v2") that replaces the - old ("cpp api v1") one. Much faster than the pure Python code. This one - resolves many bugs and is recommended for general use over the - pure Python when possible. - * Descriptors now have enum_types_by_name and extension_types_by_name dict - attributes. - * Support for Python 3. - -2013-02-27 version 2.5.0: - - General - * New notion "import public" that allows a proto file to forward the content - it imports to its importers. For example, - // foo.proto - import public "bar.proto"; - import "baz.proto"; - - // qux.proto - import "foo.proto"; - // Stuff defined in bar.proto may be used in this file, but stuff from - // baz.proto may NOT be used without importing it explicitly. - This is useful for moving proto files. To move a proto file, just leave - a single "import public" in the old proto file. - * New enum option "allow_alias" that specifies whether different symbols can - be assigned the same numeric value. Default value is "true". Setting it to - false causes the compiler to reject enum definitions where multiple symbols - have the same numeric value. - Note: We plan to flip the default value to "false" in a future release. - Projects using enum aliases should set the option to "true" in their .proto - files. - - C++ - * New generated method set_allocated_foo(Type* foo) for message and string - fields. This method allows you to set the field to a pre-allocated object - and the containing message takes the ownership of that object. - * Added SetAllocatedExtension() and ReleaseExtension() to extensions API. - * Custom options are now formatted correctly when descriptors are printed in - text format. - * Various speed optimizations. - - Java - * Comments in proto files are now collected and put into generated code as - comments for corresponding classes and data members. - * Added Parser to parse directly into messages without a Builder. For - example, - Foo foo = Foo.PARSER.ParseFrom(input); - Using Parser is ~25% faster than using Builder to parse messages. - * Added getters/setters to access the underlying ByteString of a string field - directly. - * ByteString now supports more operations: substring(), prepend(), and - append(). The implementation of ByteString uses a binary tree structure - to support these operations efficiently. - * New method findInitializationErrors() that lists all missing required - fields. - * Various code size and speed optimizations. - - Python - * Added support for dynamic message creation. DescriptorDatabase, - DescriptorPool, and MessageFactory work like their C++ counterparts to - simplify Descriptor construction from *DescriptorProtos, and MessageFactory - provides a message instance from a Descriptor. - * Added pickle support for protobuf messages. - * Unknown fields are now preserved after parsing. - * Fixed bug where custom options were not correctly populated. Custom - options can be accessed now. - * Added EnumTypeWrapper that provides better accessibility to enum types. - * Added ParseMessage(descriptor, bytes) to generate a new Message instance - from a descriptor and a byte string. - -2011-05-01 version 2.4.1: - - C++ - * Fixed the friendship problem for old compilers to make the library now gcc 3 - compatible again. - * Fixed vcprojects/extract_includes.bat to extract compiler/plugin.h. - - Java - * Removed usages of JDK 1.6 only features to make the library now JDK 1.5 - compatible again. - * Fixed a bug about negative enum values. - * serialVersionUID is now defined in generated messages for java serializing. - * Fixed protoc to use java.lang.Object, which makes "Object" now a valid - message name again. - - Python - * Experimental C++ implementation now requires C++ protobuf library installed. - See the README.txt in the python directory for details. - -2011-02-02 version 2.4.0: - - General - * The RPC (cc|java|py)_generic_services default value is now false instead of - true. - * Custom options can have aggregate types. For example, - message MyOption { - optional string comment = 1; - optional string author = 2; - } - extend google.protobuf.FieldOptions { - optional MyOption myoption = 12345; - } - This option can now be set as follows: - message SomeType { - optional int32 field = 1 [(myoption) = { comment:'x' author:'y' }]; - } - - C++ - * Various speed and code size optimizations. - * Added a release_foo() method on string and message fields. - * Fixed gzip_output_stream sub-stream handling. - - Java - * Builders now maintain sub-builders for sub-messages. Use getFooBuilder() to - get the builder for the sub-message "foo". This allows you to repeatedly - modify deeply-nested sub-messages without rebuilding them. - * Builder.build() no longer invalidates the Builder for generated messages - (You may continue to modify it and then build another message). - * Code generator will generate efficient equals() and hashCode() - implementations if new option java_generate_equals_and_hash is enabled. - (Otherwise, reflection-based implementations are used.) - * Generated messages now implement Serializable. - * Fields with [deprecated=true] will be marked with @Deprecated in Java. - * Added lazy conversion of UTF-8 encoded strings to String objects to improve - performance. - * Various optimizations. - * Enum value can be accessed directly, instead of calling getNumber() on the - enum member. - * For each enum value, an integer constant is also generated with the suffix - _VALUE. - - Python - * Added an experimental C++ implementation for Python messages via a Python - extension. Implementation type is controlled by an environment variable - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION (valid values: "cpp" and "python") - The default value is currently "python" but will be changed to "cpp" in - future release. - * Improved performance on message instantiation significantly. - Most of the work on message instantiation is done just once per message - class, instead of once per message instance. - * Improved performance on text message parsing. - * Allow add() to forward keyword arguments to the concrete class. - E.g. instead of - item = repeated_field.add() - item.foo = bar - item.baz = quux - You can do: - repeated_field.add(foo=bar, baz=quux) - * Added a sort() interface to the BaseContainer. - * Added an extend() method to repeated composite fields. - * Added UTF8 debug string support. - -2010-01-08 version 2.3.0: - - General - * Parsers for repeated numeric fields now always accept both packed and - unpacked input. The [packed=true] option only affects serializers. - Therefore, it is possible to switch a field to packed format without - breaking backwards-compatibility -- as long as all parties are using - protobuf 2.3.0 or above, at least. - * The generic RPC service code generated by the C++, Java, and Python - generators can be disabled via file options: - option cc_generic_services = false; - option java_generic_services = false; - option py_generic_services = false; - This allows plugins to generate alternative code, possibly specific to some - particular RPC implementation. - - protoc - * Now supports a plugin system for code generators. Plugins can generate - code for new languages or inject additional code into the output of other - code generators. Plugins are just binaries which accept a protocol buffer - on stdin and write a protocol buffer to stdout, so they may be written in - any language. See src/google/protobuf/compiler/plugin.proto. - **WARNING**: Plugins are experimental. The interface may change in a - future version. - * If the output location ends in .zip or .jar, protoc will write its output - to a zip/jar archive instead of a directory. For example: - protoc --java_out=myproto_srcs.jar --python_out=myproto.zip myproto.proto - Currently the archive contents are not compressed, though this could change - in the future. - * inf, -inf, and nan can now be used as default values for float and double - fields. - - C++ - * Various speed and code size optimizations. - * DynamicMessageFactory is now fully thread-safe. - * Message::Utf8DebugString() method is like DebugString() but avoids escaping - UTF-8 bytes. - * Compiled-in message types can now contain dynamic extensions, through use - of CodedInputStream::SetExtensionRegistry(). - * Now compiles shared libraries (DLLs) by default on Cygwin and MinGW, to - match other platforms. Use --disable-shared to avoid this. - - Java - * parseDelimitedFrom() and mergeDelimitedFrom() now detect EOF and return - false/null instead of throwing an exception. - * Fixed some initialization ordering bugs. - * Fixes for OpenJDK 7. - - Python - * 10-25 times faster than 2.2.0, still pure-Python. - * Calling a mutating method on a sub-message always instantiates the message - in its parent even if the mutating method doesn't actually mutate anything - (e.g. parsing from an empty string). - * Expanded descriptors a bit. - -2009-08-11 version 2.2.0: - - C++ - * Lite mode: The "optimize_for = LITE_RUNTIME" option causes the compiler - to generate code which only depends libprotobuf-lite, which is much smaller - than libprotobuf but lacks descriptors, reflection, and some other features. - * Fixed bug where Message.Swap(Message) was only implemented for - optimize_for_speed. Swap now properly implemented in both modes - (Issue 91). - * Added RemoveLast and SwapElements(index1, index2) to Reflection - interface for repeated elements. - * Added Swap(Message) to Reflection interface. - * Floating-point literals in generated code that are intended to be - single-precision now explicitly have 'f' suffix to avoid pedantic warnings - produced by some compilers. - * The [deprecated=true] option now causes the C++ code generator to generate - a GCC-style deprecation annotation (no-op on other compilers). - * google::protobuf::GetEnumDescriptor() returns the - EnumDescriptor for that type -- useful for templates which cannot call - SomeGeneratedEnumType_descriptor(). - * Various optimizations and obscure bug fixes. - - Java - * Lite mode: The "optimize_for = LITE_RUNTIME" option causes the compiler - to generate code which only depends libprotobuf-lite, which is much smaller - than libprotobuf but lacks descriptors, reflection, and some other features. - * Lots of style cleanups. - - Python - * Fixed endianness bug with floats and doubles. - * Text format parsing support. - * Fix bug with parsing packed repeated fields in embedded messages. - * Ability to initialize fields by passing keyword args to constructor. - * Support iterators in extend and __setslice__ for containers. - -2009-05-13 version 2.1.0: - - General - * Repeated fields of primitive types (types other that string, group, and - nested messages) may now use the option [packed = true] to get a more - efficient encoding. In the new encoding, the entire list is written - as a single byte blob using the "length-delimited" wire type. Within - this blob, the individual values are encoded the same way they would - be normally except without a tag before each value (thus, they are - tightly "packed"). - * For each field, the generated code contains an integer constant assigned - to the field number. For example, the .proto file: - message Foo { optional int bar_baz = 123; } - would generate the following constants, all with the integer value 123: - C++: Foo::kBarBazFieldNumber - Java: Foo.BAR_BAZ_FIELD_NUMBER - Python: Foo.BAR_BAZ_FIELD_NUMBER - Constants are also generated for extensions, with the same naming scheme. - These constants may be used as switch cases. - * Updated bundled Google Test to version 1.3.0. Google Test is now bundled - in its verbatim form as a nested autoconf package, so you can drop in any - other version of Google Test if needed. - * optimize_for = SPEED is now the default, by popular demand. Use - optimize_for = CODE_SIZE if code size is more important in your app. - * It is now an error to define a default value for a repeated field. - Previously, this was silently ignored (it had no effect on the generated - code). - * Fields can now be marked deprecated like: - optional int32 foo = 1 [deprecated = true]; - Currently this does not have any actual effect, but in the future the code - generators may generate deprecation annotations in each language. - * Cross-compiling should now be possible using the --with-protoc option to - configure. See README.txt for more info. - - protoc - * --error_format=msvs option causes errors to be printed in Visual Studio - format, which should allow them to be clicked on in the build log to go - directly to the error location. - * The type name resolver will no longer resolve type names to fields. For - example, this now works: - message Foo {} - message Bar { - optional int32 Foo = 1; - optional Foo baz = 2; - } - Previously, the type of "baz" would resolve to "Bar.Foo", and you'd get - an error because Bar.Foo is a field, not a type. Now the type of "baz" - resolves to the message type Foo. This change is unlikely to make a - difference to anyone who follows the Protocol Buffers style guide. - - C++ - * Several optimizations, including but not limited to: - - Serialization, especially to flat arrays, is 10%-50% faster, possibly - more for small objects. - - Several descriptor operations which previously required locking no longer - do. - - Descriptors are now constructed lazily on first use, rather than at - process startup time. This should save memory in programs which do not - use descriptors or reflection. - - UnknownFieldSet completely redesigned to be more efficient (especially in - terms of memory usage). - - Various optimizations to reduce code size (though the serialization speed - optimizations increased code size). - * Message interface has method ParseFromBoundedZeroCopyStream() which parses - a limited number of bytes from an input stream rather than parsing until - EOF. - * GzipInputStream and GzipOutputStream support reading/writing gzip- or - zlib-compressed streams if zlib is available. - (google/protobuf/io/gzip_stream.h) - * DescriptorPool::FindAllExtensions() and corresponding - DescriptorDatabase::FindAllExtensions() can be used to enumerate all - extensions of a given type. - * For each enum type Foo, protoc will generate functions: - const string& Foo_Name(Foo value); - bool Foo_Parse(const string& name, Foo* result); - The former returns the name of the enum constant corresponding to the given - value while the latter finds the value corresponding to a name. - * RepeatedField and RepeatedPtrField now have back-insertion iterators. - * String fields now have setters that take a char* and a size, in addition - to the existing ones that took char* or const string&. - * DescriptorPool::AllowUnknownDependencies() may be used to tell - DescriptorPool to create placeholder descriptors for unknown entities - referenced in a FileDescriptorProto. This can allow you to parse a .proto - file without having access to other .proto files that it imports, for - example. - * Updated gtest to latest version. The gtest package is now included as a - nested autoconf package, so it should be able to drop new versions into the - "gtest" subdirectory without modification. - - Java - * Fixed bug where Message.mergeFrom(Message) failed to merge extensions. - * Message interface has new method toBuilder() which is equivalent to - newBuilderForType().mergeFrom(this). - * All enums now implement the ProtocolMessageEnum interface. - * Setting a field to null now throws NullPointerException. - * Fixed tendency for TextFormat's parsing to overflow the stack when - parsing large string values. The underlying problem is with Java's - regex implementation (which unfortunately uses recursive backtracking - rather than building an NFA). Worked around by making use of possessive - quantifiers. - * Generated service classes now also generate pure interfaces. For a service - Foo, Foo.Interface is a pure interface containing all of the service's - defined methods. Foo.newReflectiveService() can be called to wrap an - instance of this interface in a class that implements the generic - RpcService interface, which provides reflection support that is usually - needed by RPC server implementations. - * RPC interfaces now support blocking operation in addition to non-blocking. - The protocol compiler generates separate blocking and non-blocking stubs - which operate against separate blocking and non-blocking RPC interfaces. - RPC implementations will have to implement the new interfaces in order to - support blocking mode. - * New I/O methods parseDelimitedFrom(), mergeDelimitedFrom(), and - writeDelimitedTo() read and write "delimited" messages from/to a stream, - meaning that the message size precedes the data. This way, you can write - multiple messages to a stream without having to worry about delimiting - them yourself. - * Throw a more descriptive exception when build() is double-called. - * Add a method to query whether CodedInputStream is at the end of the input - stream. - * Add a method to reset a CodedInputStream's size counter; useful when - reading many messages with the same stream. - * equals() and hashCode() now account for unknown fields. - - Python - * Added slicing support for repeated scalar fields. Added slice retrieval and - removal of repeated composite fields. - * Updated RPC interfaces to allow for blocking operation. A client may - now pass None for a callback when making an RPC, in which case the - call will block until the response is received, and the response - object will be returned directly to the caller. This interface change - cannot be used in practice until RPC implementations are updated to - implement it. - * Changes to input_stream.py should make protobuf compatible with appengine. - -2008-11-25 version 2.0.3: - - protoc - * Enum values may now have custom options, using syntax similar to field - options. - * Fixed bug where .proto files which use custom options but don't actually - define them (i.e. they import another .proto file defining the options) - had to explicitly import descriptor.proto. - * Adjacent string literals in .proto files will now be concatenated, like in - C. - * If an input file is a Windows absolute path (e.g. "C:\foo\bar.proto") and - the import path only contains "." (or contains "." but does not contain - the file), protoc incorrectly thought that the file was under ".", because - it thought that the path was relative (since it didn't start with a slash). - This has been fixed. - - C++ - * Generated message classes now have a Swap() method which efficiently swaps - the contents of two objects. - * All message classes now have a SpaceUsed() method which returns an estimate - of the number of bytes of allocated memory currently owned by the object. - This is particularly useful when you are reusing a single message object - to improve performance but want to make sure it doesn't bloat up too large. - * New method Message::SerializeAsString() returns a string containing the - serialized data. May be more convenient than calling - SerializeToString(string*). - * In debug mode, log error messages when string-type fields are found to - contain bytes that are not valid UTF-8. - * Fixed bug where a message with multiple extension ranges couldn't parse - extensions. - * Fixed bug where MergeFrom(const Message&) didn't do anything if invoked on - a message that contained no fields (but possibly contained extensions). - * Fixed ShortDebugString() to not be O(n^2). Durr. - * Fixed crash in TextFormat parsing if the first token in the input caused a - tokenization error. - * Fixed obscure bugs in zero_copy_stream_impl.cc. - * Added support for HP C++ on Tru64. - * Only build tests on "make check", not "make". - * Fixed alignment issue that caused crashes when using DynamicMessage on - 64-bit Sparc machines. - * Simplify template usage to work with MSVC 2003. - * Work around GCC 4.3.x x86_64 compiler bug that caused crashes on startup. - (This affected Fedora 9 in particular.) - * Now works on "Solaris 10 using recent Sun Studio". - - Java - * New overload of mergeFrom() which parses a slice of a byte array instead - of the whole thing. - * New method ByteString.asReadOnlyByteBuffer() does what it sounds like. - * Improved performance of isInitialized() when optimizing for code size. - - Python - * Corrected ListFields() signature in Message base class to match what - subclasses actually implement. - * Some minor refactoring. - * Don't pass self as first argument to superclass constructor (no longer - allowed in Python 2.6). - -2008-09-29 version 2.0.2: - - General - * License changed from Apache 2.0 to 3-Clause BSD. - * It is now possible to define custom "options", which are basically - annotations which may be placed on definitions in a .proto file. - For example, you might define a field option called "foo" like so: - import "google/protobuf/descriptor.proto" - extend google.protobuf.FieldOptions { - optional string foo = 12345; - } - Then you annotate a field using the "foo" option: - message MyMessage { - optional int32 some_field = 1 [(foo) = "bar"] - } - The value of this option is then visible via the message's - Descriptor: - const FieldDescriptor* field = - MyMessage::descriptor()->FindFieldByName("some_field"); - assert(field->options().GetExtension(foo) == "bar"); - This feature has been implemented and tested in C++ and Java. - Other languages may or may not need to do extra work to support - custom options, depending on how they construct descriptors. - - C++ - * Fixed some GCC warnings that only occur when using -pedantic. - * Improved static initialization code, making ordering more - predictable among other things. - * TextFormat will no longer accept messages which contain multiple - instances of a singular field. Previously, the latter instance - would overwrite the former. - * Now works on systems that don't have hash_map. - - Java - * Print @Override annotation in generated code where appropriate. - - Python - * Strings now use the "unicode" type rather than the "str" type. - String fields may still be assigned ASCII "str" values; they will - automatically be converted. - * Adding a property to an object representing a repeated field now - raises an exception. For example: - # No longer works (and never should have). - message.some_repeated_field.foo = 1 - - Windows - * We now build static libraries rather than DLLs by default on MSVC. - See vsprojects/readme.txt for more information. - -2008-08-15 version 2.0.1: - - protoc - * New flags --encode and --decode can be used to convert between protobuf text - format and binary format from the command-line. - * New flag --descriptor_set_out can be used to write FileDescriptorProtos for - all parsed files directly into a single output file. This is particularly - useful if you wish to parse .proto files from programs written in languages - other than C++: just run protoc as a background process and have it output - a FileDescriptorList, then parse that natively. - * Improved error message when an enum value's name conflicts with another - symbol defined in the enum type's scope, e.g. if two enum types declared - in the same scope have values with the same name. This is disallowed for - compatibility with C++, but this wasn't clear from the error. - * Fixed absolute output paths on Windows. - * Allow trailing slashes in --proto_path mappings. - - C++ - * Reflection objects are now per-class rather than per-instance. To make this - possible, the Reflection interface had to be changed such that all methods - take the Message instance as a parameter. This change improves performance - significantly in memory-bandwidth-limited use cases, since it makes the - message objects smaller. Note that source-incompatible interface changes - like this will not be made again after the library leaves beta. - * Heuristically detect sub-messages when printing unknown fields. - * Fix static initialization ordering bug that caused crashes at startup when - compiling on Mac with static linking. - * Fixed TokenizerTest when compiling with -DNDEBUG on Linux. - * Fixed incorrect definition of kint32min. - * Fix bytes type setter to work with byte sequences with embedded NULLs. - * Other irrelevant tweaks. - - Java - * Fixed UnknownFieldSet's parsing of varints larger than 32 bits. - * Fixed TextFormat's parsing of "inf" and "nan". - * Fixed TextFormat's parsing of comments. - * Added info to Java POM that will be required when we upload the - package to a Maven repo. - - Python - * MergeFrom(message) and CopyFrom(message) are now implemented. - * SerializeToString() raises an exception if the message is missing required - fields. - * Code organization improvements. - * Fixed doc comments for RpcController and RpcChannel, which had somehow been - swapped. - * Fixed text_format_test on Windows where floating-point exponents sometimes - contain extra zeros. - * Fix Python service CallMethod() implementation. - - Other - * Improved readmes. - * VIM syntax highlighting improvements. - -2008-07-07 version 2.0.0: - - * First public release. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..162fb1c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,362 @@ +# Minimum CMake required. If available, accept the policy-controlled behavior up +# to 3.26. +cmake_minimum_required(VERSION 3.10...3.26) + +# Revert to old behavior for MSVC debug symbols. +if(POLICY CMP0141) + cmake_policy(SET CMP0141 OLD) +endif() + +if(protobuf_VERBOSE) + message(STATUS "Protocol Buffers Configuring...") +endif() + +# Project +project(protobuf C CXX) + +if(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE) + if(CMAKE_PROJECT_NAME STREQUAL "protobuf") + get_filename_component(CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) + endif() + get_filename_component(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) + get_filename_component(PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR} DIRECTORY) + get_filename_component(protobuf_SOURCE_DIR ${protobuf_SOURCE_DIR} DIRECTORY) +endif() + +# Options +option(protobuf_INSTALL "Install protobuf binaries and files" ON) +option(protobuf_BUILD_TESTS "Build tests" ON) +option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF) +option(protobuf_BUILD_EXAMPLES "Build examples" OFF) +option(protobuf_BUILD_PROTOBUF_BINARIES "Build protobuf libraries and protoc compiler" ON) +option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON) +option(protobuf_BUILD_LIBPROTOC "Build libprotoc" OFF) +option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF) +option(protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "") +option(protobuf_ALLOW_CCACHE "Adjust build flags to allow for ccache support." OFF) +if (BUILD_SHARED_LIBS) + set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON) +else (BUILD_SHARED_LIBS) + set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF) +endif (BUILD_SHARED_LIBS) +option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT}) +include(CMakeDependentOption) +cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON + "NOT protobuf_BUILD_SHARED_LIBS" OFF) +set(protobuf_WITH_ZLIB_DEFAULT ON) +option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT}) +set(protobuf_DEBUG_POSTFIX "d" + CACHE STRING "Default debug postfix") +mark_as_advanced(protobuf_DEBUG_POSTFIX) + +if(WITH_PROTOC) + set(protobuf_PROTOC_EXE protoc) + set(protobuf_BUILD_PROTOC_BINARIES OFF) + add_executable(protoc IMPORTED) + set_property(TARGET protoc PROPERTY IMPORTED_LOCATION ${WITH_PROTOC}) +endif() + +# User options +include(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake) + +if (protobuf_BUILD_SHARED_LIBS) + # This is necessary for linking in Abseil. + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # Build Abseil as shared libraries to avoid ODR violations. + set(BUILD_SHARED_LIBS ON) + + # Output directory is correct by default for most build setups. However, when + # building Protobuf as a DLL, it is important to have the DLL in the same + # directory as the executable using it. Thus, we put all binaries in a single + # /bin directory. + if (MSVC) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + endif () +endif () + +# Version metadata +set(protobuf_VERSION_STRING "4.25.2") +set(protobuf_DESCRIPTION "Protocol Buffers") +set(protobuf_CONTACT "protobuf@googlegroups.com") + +# Overrides for option dependencies +if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS) + set(protobuf_BUILD_LIBPROTOC ON) +endif () +if (NOT protobuf_BUILD_PROTOBUF_BINARIES) + set(protobuf_INSTALL OFF) +endif() +# Parse version tweaks +set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$") +string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1" + protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}") +string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2" + protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}") +string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3" + protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}") +string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5" + protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}") + +message(STATUS "${protobuf_VERSION_PRERELEASE}") + +# Package version +set(protobuf_VERSION + "${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") + +if(protobuf_VERSION_PRERELEASE) + set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}") +else() + set(protobuf_VERSION "${protobuf_VERSION}.0") +endif() +message(STATUS "${protobuf_VERSION}") + +if(protobuf_VERBOSE) + message(STATUS "Configuration script parsing status [") + message(STATUS " Description : ${protobuf_DESCRIPTION}") + message(STATUS " Version : ${protobuf_VERSION} (${protobuf_VERSION_STRING})") + message(STATUS " Contact : ${protobuf_CONTACT}") + message(STATUS "]") +endif() + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map +"{ + global: + main; + local: + *; +};") +# CheckLinkerFlag module available in CMake >=3.18. +if(${CMAKE_VERSION} VERSION_GREATER 3.18 OR ${CMAKE_VERSION} VERSION_EQUAL 3.18) + include(CheckLinkerFlag) + check_linker_flag(CXX -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map protobuf_HAVE_LD_VERSION_SCRIPT) +else() + include(CheckCXXSourceCompiles) + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map) + check_cxx_source_compiles(" + int main() { + return 0; + } + " protobuf_HAVE_LD_VERSION_SCRIPT) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +endif() +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cmaketest.map) + +find_package(Threads REQUIRED) + +# We can install dependencies from submodules if we're running +# CMake v3.13 or newer. +if(CMAKE_VERSION VERSION_LESS 3.13) + set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE OFF) +else() + set(_protobuf_INSTALL_SUPPORTED_FROM_MODULE ON) +endif() + +set(_protobuf_FIND_ZLIB) +if (protobuf_WITH_ZLIB) + find_package(ZLIB) + if (ZLIB_FOUND) + set(HAVE_ZLIB 1) + # FindZLIB module define ZLIB_INCLUDE_DIRS variable + # Set ZLIB_INCLUDE_DIRECTORIES for compatible + set(ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRECTORIES} ${ZLIB_INCLUDE_DIRS}) + # Using imported target if exists + if (TARGET ZLIB::ZLIB) + set(ZLIB_LIBRARIES ZLIB::ZLIB) + set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()") + endif (TARGET ZLIB::ZLIB) + else (ZLIB_FOUND) + set(HAVE_ZLIB 0) + # Explicitly set these to empty (override NOT_FOUND) so cmake doesn't + # complain when we use them later. + set(ZLIB_INCLUDE_DIRECTORIES) + set(ZLIB_LIBRARIES) + endif (ZLIB_FOUND) +endif (protobuf_WITH_ZLIB) + +# We need to link with libatomic on systems that do not have builtin atomics, or +# don't have builtin support for 8 byte atomics +set(protobuf_LINK_LIBATOMIC false) +if (NOT MSVC) + include(CheckCXXSourceCompiles) + set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++14) + check_cxx_source_compiles(" + #include + int main() { + return static_cast(std::atomic{}); + } + " protobuf_HAVE_BUILTIN_ATOMICS) + if (NOT protobuf_HAVE_BUILTIN_ATOMICS) + set(protobuf_LINK_LIBATOMIC true) + endif (NOT protobuf_HAVE_BUILTIN_ATOMICS) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) +endif (NOT MSVC) + +if (protobuf_BUILD_SHARED_LIBS) + set(protobuf_SHARED_OR_STATIC "SHARED") +else (protobuf_BUILD_SHARED_LIBS) + set(protobuf_SHARED_OR_STATIC "STATIC") + # The CMAKE__FLAGS(_)? is meant to be user controlled. + # Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags + # making programmatic control difficult. Prefer the functionality in newer + # CMake versions when available. + if(${CMAKE_VERSION} VERSION_GREATER 3.15 OR ${CMAKE_VERSION} VERSION_EQUAL 3.15) + if (protobuf_MSVC_STATIC_RUNTIME) + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>DLL) + endif() + else() + # In case we are building static libraries, link also the runtime library statically + # so that MSVCR*.DLL is not required at runtime. + # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx + # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd + # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F + if (MSVC AND protobuf_MSVC_STATIC_RUNTIME) + foreach(flag_var + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif(${flag_var} MATCHES "/MD") + endforeach(flag_var) + endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME) + endif() +endif (protobuf_BUILD_SHARED_LIBS) + +# Export all symbols on Windows when building shared libraries +SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +if (MSVC) + string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) + string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR}) + string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}") + + if (protobuf_ALLOW_CCACHE) + # In order to support ccache, we need to remove the /Zi option because it + # puts debug symbols into separate pdb files (which in incompatible with + # ccache). This can be replaced with /Z7 to preserve debug symbols, which + # embeds debug symbols into the object files instead of creating a separate + # pdb file, which isn't currently supported by ccache. However, this bloats + # the ccache size by about a factor of 2x, making it very expensive in CI. + # Instead, we strip debug symbols to reduce this overhead. + foreach(v + CMAKE_C_FLAGS_DEBUG + CMAKE_CXX_FLAGS_DEBUG + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_RELWITHDEBINFO + ) + string(REGEX REPLACE "[-/]Z[iI7]" "/DEBUG:NONE" ${v} "${${v}}") + endforeach() + endif() + + # Suppress linker warnings about files with no symbols defined. + string(APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221") + + # use English language (0x409) in resource compiler + string(APPEND CMAKE_RC_FLAGS " -l0x409") + + # Generate the version.rc file used elsewhere. + configure_file(${protobuf_SOURCE_DIR}/cmake/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) + set(protobuf_version_rc_file ${CMAKE_CURRENT_BINARY_DIR}/version.rc) + + # Add the "lib" prefix for generated .lib outputs. + set(LIB_PREFIX lib) +else (MSVC) + # No version.rc file. + set(protobuf_version_rc_file) + + # When building with "make", "lib" prefix will be added automatically by + # the build tool. + set(LIB_PREFIX) +endif (MSVC) + +include_directories( + ${ZLIB_INCLUDE_DIRECTORIES} + ${protobuf_BINARY_DIR} + ${protobuf_SOURCE_DIR}/src) + +set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library") +set_property(CACHE protobuf_ABSL_PROVIDER PROPERTY STRINGS "module" "package") + +set(protobuf_JSONCPP_PROVIDER "module" CACHE STRING "Provider of jsoncpp library") +set_property(CACHE protobuf_JSONCPP_PROVIDER PROPERTY STRINGS "module" "package") + +if (protobuf_BUILD_TESTS) + include(${protobuf_SOURCE_DIR}/cmake/gtest.cmake) +endif (protobuf_BUILD_TESTS) + +include(${protobuf_SOURCE_DIR}/cmake/abseil-cpp.cmake) + +if (protobuf_BUILD_PROTOBUF_BINARIES) + include(${protobuf_SOURCE_DIR}/cmake/utf8_range.cmake) + include(${protobuf_SOURCE_DIR}/cmake/libprotobuf-lite.cmake) + if (NOT DEFINED protobuf_LIB_PROTOBUF_LITE) + set(protobuf_LIB_PROTOBUF_LITE libprotobuf-lite) + endif () + include(${protobuf_SOURCE_DIR}/cmake/libprotobuf.cmake) + if (NOT DEFINED protobuf_LIB_PROTOBUF) + set(protobuf_LIB_PROTOBUF libprotobuf) + endif () + if (protobuf_BUILD_LIBPROTOC) + include(${protobuf_SOURCE_DIR}/cmake/libprotoc.cmake) + if (NOT DEFINED protobuf_LIB_PROTOC) + set(protobuf_LIB_PROTOC libprotoc) + endif () + endif () + if (protobuf_BUILD_PROTOC_BINARIES) + include(${protobuf_SOURCE_DIR}/cmake/protoc.cmake) + if (NOT DEFINED protobuf_PROTOC_EXE) + set(protobuf_PROTOC_EXE protoc) + endif () + endif () +else () + find_package(Protobuf NO_MODULE) + if (Protobuf_FOUND) + set(protobuf_PROTOC_EXE protobuf::protoc) + set(protobuf_LIB_PROTOC protobuf::libprotoc) + set(protobuf_LIB_PROTOBUF protobuf::libprotobuf) + set(protobuf_LIB_PROTOBUF_LITE protobuf::libprotobuf-lite) + message(STATUS "CMake installation of Protobuf found.") + endif () +endif () + +# Ensure we have a protoc executable and protobuf libraries if we need one +if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES) + if (NOT DEFINED protobuf_PROTOC_EXE) + find_program(protobuf_PROTOC_EXE protoc REQUIRED) + message(STATUS "Found system ${protobuf_PROTOC_EXE}.") + endif () + if(protobuf_VERBOSE) + message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}") + message(STATUS "Using libprotobuf : ${protobuf_LIB_PROTOBUF}") + message(STATUS "Using libprotobuf-lite : ${protobuf_LIB_PROTOBUF_LITE}") + message(STATUS "Using libprotoc : ${protobuf_LIB_PROTOC}") + endif(protobuf_VERBOSE) +endif () + +if (protobuf_BUILD_TESTS) + enable_testing() + include(${protobuf_SOURCE_DIR}/cmake/tests.cmake) +endif (protobuf_BUILD_TESTS) + +if (protobuf_BUILD_CONFORMANCE) + include(${protobuf_SOURCE_DIR}/cmake/conformance.cmake) +endif (protobuf_BUILD_CONFORMANCE) + +if (protobuf_INSTALL) + include(${protobuf_SOURCE_DIR}/cmake/install.cmake) +endif (protobuf_INSTALL) + +if (protobuf_BUILD_EXAMPLES) + include(${protobuf_SOURCE_DIR}/cmake/examples.cmake) +endif (protobuf_BUILD_EXAMPLES) + +if(protobuf_VERBOSE) + message(STATUS "Protocol Buffers Configuring done") +endif(protobuf_VERBOSE) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ba19063 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +This project is governed by +[Protobuf's Code of Conduct](https://github.com/protocolbuffers/.github/blob/main/profile/CODE_OF_CONDUCT.md). + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index db1ff31..a16d63c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,9 +1,31 @@ # Contributing to Protocol Buffers -We welcome your contributions to protocol buffers. This doc describes the +We welcome some types of contributions to protocol buffers. This doc describes the process to contribute patches to protobuf and the general guidelines we expect contributors to follow. +## What We Accept + +* Bug fixes with unit tests demonstrating the problem are very welcome. + We also appreciate bug reports, even when they don't come with a patch. + Bug fixes without tests are usually not accepted. +* New APIs and features with adequate test coverage and documentation + may be accepted if they do not compromise backwards + compatibility. However there's a fairly high bar of usefulness a new public + method must clear before it will be accepted. Features that are fine in + isolation are often rejected because they don't have enough impact to justify the + conceptual burden and ongoing maintenance cost. It's best to file an issue + and get agreement from maintainers on the value of a new feature before + working on a PR. +* Performance optimizations may be accepted if they have convincing benchmarks that demonstrate + an improvement and they do not significantly increase complexity. +* Changes to existing APIs are almost never accepted. Stability and + backwards compatibility are paramount. In the unlikely event a breaking change + is required, it must usually be implemented in google3 first. +* Changes to the wire and text formats are never accepted. Any breaking change + to these formats would have to be implemented as a completely new format. + We cannot begin generating protos that cannot be parsed by existing code. + ## Before You Start We accept patches in the form of github pull requests. If you are new to @@ -31,11 +53,11 @@ conforming. ## Contributing Process -Most pull requests should go to the master branch and the change will be +Most pull requests should go to the main branch and the change will be included in the next major/minor version release (e.g., 3.6.0 release). If you need to include a bug fix in a patch release (e.g., 3.5.2), make sure it’s -already merged to master, and then create a pull request cherry-picking the -commits from master branch to the release branch (e.g., branch 3.5.x). +already merged to main, and then create a pull request cherry-picking the +commits from main branch to the release branch (e.g., branch 3.5.x). For each pull request, a protobuf team member will be assigned to review the pull request. For minor cleanups, the pull request may be merged right away @@ -58,7 +80,7 @@ the final release. * Create small PRs that are narrowly focused on addressing a single concern. We often receive PRs that are trying to fix several things at a time, but if only one fix is considered acceptable, nothing gets merged and both author's - & review's time is wasted. Create more PRs to address different concerns and + & reviewer's time is wasted. Create more PRs to address different concerns and everyone will be happy. * For speculative changes, consider opening an issue and discussing it first. If you are suggesting a behavioral or API change, make sure you get explicit @@ -74,9 +96,9 @@ the final release. of inactivity. * Maintain clean commit history and use meaningful commit messages. PRs with messy commit history are difficult to review and won't be merged. Use rebase - -i upstream/master to curate your commit history and/or to bring in latest - changes from master (but avoid rebasing in the middle of a code review). -* Keep your PR up to date with upstream/master (if there are merge conflicts, + -i upstream/main to curate your commit history and/or to bring in latest + changes from main (but avoid rebasing in the middle of a code review). +* Keep your PR up to date with upstream/main (if there are merge conflicts, we can't really merge your change). * All tests need to be passing before your change can be merged. We recommend you run tests locally before creating your PR to catch breakages early on. diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index b8d97fc..c2da98f 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -100,3 +100,8 @@ Patch contributors: Andrew Paprocki * Fixed minor IBM xlC compiler build issues * Added atomicops for AIX (POWER) + Nipunn Koorapati + * Provide a type alias field ValueType on EnumTypeWrapper + * Match service argument names to abstract interface + + diff --git a/Cargo.bazel.lock b/Cargo.bazel.lock new file mode 100644 index 0000000..8067490 --- /dev/null +++ b/Cargo.bazel.lock @@ -0,0 +1,772 @@ +{ + "checksum": "8bc2d235f612e77f4dca1b6886cc8bd14df348168fea27a687805ed9518a8f1a", + "crates": { + "aho-corasick 1.1.2": { + "name": "aho-corasick", + "version": "1.1.2", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/aho-corasick/1.1.2/download", + "sha256": "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" + } + }, + "targets": [ + { + "Library": { + "crate_name": "aho_corasick", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "aho_corasick", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "perf-literal", + "std" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "memchr 2.6.4", + "target": "memchr" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "1.1.2" + }, + "license": "Unlicense OR MIT" + }, + "autocfg 1.1.0": { + "name": "autocfg", + "version": "1.1.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/autocfg/1.1.0/download", + "sha256": "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + } + }, + "targets": [ + { + "Library": { + "crate_name": "autocfg", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "autocfg", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2015", + "version": "1.1.0" + }, + "license": "Apache-2.0 OR MIT" + }, + "direct-cargo-bazel-deps 0.0.1": { + "name": "direct-cargo-bazel-deps", + "version": "0.0.1", + "repository": null, + "targets": [ + { + "Library": { + "crate_name": "direct_cargo_bazel_deps", + "crate_root": ".direct_cargo_bazel_deps.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "direct_cargo_bazel_deps", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "googletest 0.10.0", + "target": "googletest" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "0.0.1" + }, + "license": null + }, + "googletest 0.10.0": { + "name": "googletest", + "version": "0.10.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/googletest/0.10.0/download", + "sha256": "09213705c85aa0e4b4fff44a3a826a556979a34a266df6bcda703a49c69fb61e" + } + }, + "targets": [ + { + "Library": { + "crate_name": "googletest", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "googletest", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "num-traits 0.2.17", + "target": "num_traits" + }, + { + "id": "regex 1.10.0", + "target": "regex" + } + ], + "selects": {} + }, + "edition": "2021", + "proc_macro_deps": { + "common": [ + { + "id": "googletest_macro 0.10.0", + "target": "googletest_macro" + }, + { + "id": "rustversion 1.0.14", + "target": "rustversion" + } + ], + "selects": {} + }, + "version": "0.10.0" + }, + "license": "Apache-2.0" + }, + "googletest_macro 0.10.0": { + "name": "googletest_macro", + "version": "0.10.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/googletest_macro/0.10.0/download", + "sha256": "005e4cb962c56efd249bdeeb4ac232b11e1c45a2e49793bba2b2982dcc3f2e9d" + } + }, + "targets": [ + { + "ProcMacro": { + "crate_name": "googletest_macro", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "googletest_macro", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "quote 1.0.33", + "target": "quote" + }, + { + "id": "syn 2.0.38", + "target": "syn" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "0.10.0" + }, + "license": "Apache-2.0" + }, + "memchr 2.6.4": { + "name": "memchr", + "version": "2.6.4", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/memchr/2.6.4/download", + "sha256": "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + } + }, + "targets": [ + { + "Library": { + "crate_name": "memchr", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "memchr", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "alloc", + "default", + "std" + ], + "selects": {} + }, + "edition": "2021", + "version": "2.6.4" + }, + "license": "Unlicense OR MIT" + }, + "num-traits 0.2.17": { + "name": "num-traits", + "version": "0.2.17", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/num-traits/0.2.17/download", + "sha256": "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" + } + }, + "targets": [ + { + "Library": { + "crate_name": "num_traits", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "num_traits", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "std" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "num-traits 0.2.17", + "target": "build_script_build" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "0.2.17" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "autocfg 1.1.0", + "target": "autocfg" + } + ], + "selects": {} + } + }, + "license": "MIT OR Apache-2.0" + }, + "proc-macro2 1.0.69": { + "name": "proc-macro2", + "version": "1.0.69", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/proc-macro2/1.0.69/download", + "sha256": "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" + } + }, + "targets": [ + { + "Library": { + "crate_name": "proc_macro2", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "proc_macro2", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "proc-macro" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "proc-macro2 1.0.69", + "target": "build_script_build" + }, + { + "id": "unicode-ident 1.0.12", + "target": "unicode_ident" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "1.0.69" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ] + }, + "license": "MIT OR Apache-2.0" + }, + "quote 1.0.33": { + "name": "quote", + "version": "1.0.33", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/quote/1.0.33/download", + "sha256": "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" + } + }, + "targets": [ + { + "Library": { + "crate_name": "quote", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "quote", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "proc-macro" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "proc-macro2 1.0.69", + "target": "proc_macro2" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "1.0.33" + }, + "license": "MIT OR Apache-2.0" + }, + "regex 1.10.0": { + "name": "regex", + "version": "1.10.0", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/regex/1.10.0/download", + "sha256": "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" + } + }, + "targets": [ + { + "Library": { + "crate_name": "regex", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "regex", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "perf", + "perf-backtrack", + "perf-cache", + "perf-dfa", + "perf-inline", + "perf-literal", + "perf-onepass", + "std", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "aho-corasick 1.1.2", + "target": "aho_corasick" + }, + { + "id": "memchr 2.6.4", + "target": "memchr" + }, + { + "id": "regex-automata 0.4.1", + "target": "regex_automata" + }, + { + "id": "regex-syntax 0.8.1", + "target": "regex_syntax" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "1.10.0" + }, + "license": "MIT OR Apache-2.0" + }, + "regex-automata 0.4.1": { + "name": "regex-automata", + "version": "0.4.1", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/regex-automata/0.4.1/download", + "sha256": "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" + } + }, + "targets": [ + { + "Library": { + "crate_name": "regex_automata", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "regex_automata", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "alloc", + "dfa-onepass", + "hybrid", + "meta", + "nfa-backtrack", + "nfa-pikevm", + "nfa-thompson", + "perf-inline", + "perf-literal", + "perf-literal-multisubstring", + "perf-literal-substring", + "std", + "syntax", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment", + "unicode-word-boundary" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "aho-corasick 1.1.2", + "target": "aho_corasick" + }, + { + "id": "memchr 2.6.4", + "target": "memchr" + }, + { + "id": "regex-syntax 0.8.1", + "target": "regex_syntax" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "0.4.1" + }, + "license": "MIT OR Apache-2.0" + }, + "regex-syntax 0.8.1": { + "name": "regex-syntax", + "version": "0.8.1", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/regex-syntax/0.8.1/download", + "sha256": "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" + } + }, + "targets": [ + { + "Library": { + "crate_name": "regex_syntax", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "regex_syntax", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "default", + "std", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment" + ], + "selects": {} + }, + "edition": "2021", + "version": "0.8.1" + }, + "license": "MIT OR Apache-2.0" + }, + "rustversion 1.0.14": { + "name": "rustversion", + "version": "1.0.14", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/rustversion/1.0.14/download", + "sha256": "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + } + }, + "targets": [ + { + "ProcMacro": { + "crate_name": "rustversion", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build/build.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "rustversion", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "rustversion 1.0.14", + "target": "build_script_build" + } + ], + "selects": {} + }, + "edition": "2018", + "version": "1.0.14" + }, + "build_script_attrs": { + "data_glob": [ + "**" + ] + }, + "license": "MIT OR Apache-2.0" + }, + "syn 2.0.38": { + "name": "syn", + "version": "2.0.38", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/syn/2.0.38/download", + "sha256": "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" + } + }, + "targets": [ + { + "Library": { + "crate_name": "syn", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "syn", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "clone-impls", + "default", + "derive", + "full", + "parsing", + "printing", + "proc-macro", + "quote" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "proc-macro2 1.0.69", + "target": "proc_macro2" + }, + { + "id": "quote 1.0.33", + "target": "quote" + }, + { + "id": "unicode-ident 1.0.12", + "target": "unicode_ident" + } + ], + "selects": {} + }, + "edition": "2021", + "version": "2.0.38" + }, + "license": "MIT OR Apache-2.0" + }, + "unicode-ident 1.0.12": { + "name": "unicode-ident", + "version": "1.0.12", + "repository": { + "Http": { + "url": "https://crates.io/api/v1/crates/unicode-ident/1.0.12/download", + "sha256": "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + } + }, + "targets": [ + { + "Library": { + "crate_name": "unicode_ident", + "crate_root": "src/lib.rs", + "srcs": [ + "**/*.rs" + ] + } + } + ], + "library_target_name": "unicode_ident", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2018", + "version": "1.0.12" + }, + "license": "(MIT OR Apache-2.0) AND Unicode-DFS-2016" + } + }, + "binary_crates": [], + "workspace_members": { + "direct-cargo-bazel-deps 0.0.1": "" + }, + "conditions": {} +} + diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..e075e97 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,133 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "direct-cargo-bazel-deps" +version = "0.0.1" +dependencies = [ + "googletest", +] + +[[package]] +name = "googletest" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09213705c85aa0e4b4fff44a3a826a556979a34a266df6bcda703a49c69fb61e" +dependencies = [ + "googletest_macro", + "num-traits", + "regex", + "rustversion", +] + +[[package]] +name = "googletest_macro" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005e4cb962c56efd249bdeeb4ac232b11e1c45a2e49793bba2b2982dcc3f2e9d" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..2d43e46 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,2 @@ +# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel +# https://github.com/protocolbuffers/protobuf/issues/14313 diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index ee8b73c..0000000 --- a/Makefile.am +++ /dev/null @@ -1,1415 +0,0 @@ -## Process this file with automake to produce Makefile.in - -ACLOCAL_AMFLAGS = -I m4 - -AUTOMAKE_OPTIONS = foreign - -# Build . before src so that our all-local and clean-local hooks kicks in at -# the right time. -SUBDIRS = . src - -# Always include third_party directories in distributions. -DIST_SUBDIRS = src conformance benchmarks third_party/googletest - -# Build gmock before we build protobuf tests. We don't add gmock to SUBDIRS -# because then "make check" would also build and run all of gmock's own tests, -# which takes a lot of time and is generally not useful to us. Also, we don't -# want "make install" to recurse into gmock since we don't want to overwrite -# the installed version of gmock if there is one. -check-local: - @echo "Making lib/libgmock.a lib/libgmock_main.a in gmock" - @cd third_party/googletest/googletest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la - @cd third_party/googletest/googlemock && $(MAKE) $(AM_MAKEFLAGS) lib/libgmock.la lib/libgmock_main.la - -# We would like to clean gmock when "make clean" is invoked. But we have to -# be careful because clean-local is also invoked during "make distclean", but -# "make distclean" already recurses into gmock because it's listed among the -# DIST_SUBDIRS. distclean will delete gmock/Makefile, so if we then try to -# cd to the directory again and "make clean" it will fail. So, check that the -# Makefile exists before recursing. -clean-local: - @if test -e third_party/googletest/Makefile; then \ - echo "Making clean in googletest"; \ - cd third_party/googletest && $(MAKE) $(AM_MAKEFLAGS) clean; \ - fi; \ - if test -e conformance/Makefile; then \ - echo "Making clean in conformance"; \ - cd conformance && $(MAKE) $(AM_MAKEFLAGS) clean; \ - fi; \ - if test -e benchmarks/Makefile; then \ - echo "Making clean in benchmarks"; \ - cd benchmarks && $(MAKE) $(AM_MAKEFLAGS) clean; \ - fi; \ - if test -e objectivec/DevTools; then \ - echo "Cleaning any ObjC pyc files"; \ - rm -f objectivec/DevTools/*.pyc; \ - fi - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = protobuf.pc protobuf-lite.pc - -csharp_EXTRA_DIST= \ - global.json \ - csharp/.gitignore \ - csharp/CHANGES.txt \ - csharp/Google.Protobuf.Tools.targets \ - csharp/Google.Protobuf.Tools.nuspec \ - csharp/README.md \ - csharp/build_packages.bat \ - csharp/build_tools.sh \ - csharp/buildall.bat \ - csharp/buildall.sh \ - csharp/generate_protos.sh \ - csharp/install_dotnet_sdk.ps1 \ - csharp/keys/Google.Protobuf.public.snk \ - csharp/keys/Google.Protobuf.snk \ - csharp/keys/README.md \ - csharp/protos/README.md \ - csharp/protos/map_unittest_proto3.proto \ - csharp/protos/old_extensions1.proto \ - csharp/protos/old_extensions2.proto \ - csharp/protos/unittest_issue6936_a.proto \ - csharp/protos/unittest_issue6936_b.proto \ - csharp/protos/unittest_issue6936_c.proto \ - csharp/protos/unittest_custom_options_proto3.proto \ - csharp/protos/unittest_import_public_proto3.proto \ - csharp/protos/unittest_import_public.proto \ - csharp/protos/unittest_import_proto3.proto \ - csharp/protos/unittest_import.proto \ - csharp/protos/unittest_issues.proto \ - csharp/protos/unittest_proto3.proto \ - csharp/protos/unittest_selfreferential_options.proto \ - csharp/protos/unittest.proto \ - csharp/src/AddressBook/AddPerson.cs \ - csharp/src/AddressBook/Addressbook.cs \ - csharp/src/AddressBook/AddressBook.csproj \ - csharp/src/AddressBook/ListPeople.cs \ - csharp/src/AddressBook/Program.cs \ - csharp/src/AddressBook/SampleUsage.cs \ - csharp/src/Google.Protobuf.Benchmarks/BenchmarkDatasetConfig.cs \ - csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs \ - csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs \ - csharp/src/Google.Protobuf.Benchmarks/Google.Protobuf.Benchmarks.csproj \ - csharp/src/Google.Protobuf.Benchmarks/GoogleMessageBenchmark.cs \ - csharp/src/Google.Protobuf.Benchmarks/ParseMessagesBenchmark.cs \ - csharp/src/Google.Protobuf.Benchmarks/ParseRawPrimitivesBenchmark.cs \ - csharp/src/Google.Protobuf.Benchmarks/Program.cs \ - csharp/src/Google.Protobuf.Benchmarks/wrapper_benchmark_messages.proto \ - csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs \ - csharp/src/Google.Protobuf.Benchmarks/WriteMessagesBenchmark.cs \ - csharp/src/Google.Protobuf.Benchmarks/WriteRawPrimitivesBenchmark.cs \ - csharp/src/Google.Protobuf.Conformance/Conformance.cs \ - csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \ - csharp/src/Google.Protobuf.Conformance/Program.cs \ - csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \ - csharp/src/Google.Protobuf.JsonDump/Program.cs \ - csharp/src/Google.Protobuf.Test/Buffers/ArrayBufferWriter.cs \ - csharp/src/Google.Protobuf.Test/ByteStringTest.cs \ - csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs \ - csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \ - csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs \ - csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs \ - csharp/src/Google.Protobuf.Test/Collections/ProtobufEqualityComparersTest.cs \ - csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs \ - csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs \ - csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs \ - csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs \ - csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs \ - csharp/src/Google.Protobuf.Test/EqualityTester.cs \ - csharp/src/Google.Protobuf.Test/ExtensionSetTest.cs \ - csharp/src/Google.Protobuf.Test/FieldCodecTest.cs \ - csharp/src/Google.Protobuf.Test/FieldMaskTreeTest.cs \ - csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs \ - csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs \ - csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj \ - csharp/src/Google.Protobuf.Test/IssuesTest.cs \ - csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \ - csharp/src/Google.Protobuf.Test/JsonParserTest.cs \ - csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \ - csharp/src/Google.Protobuf.Test/LegacyGeneratedCodeTest.cs \ - csharp/src/Google.Protobuf.Test/MessageParsingHelpers.cs \ - csharp/src/Google.Protobuf.Test/Proto3OptionalTest.cs \ - csharp/src/Google.Protobuf.Test/ReadOnlySequenceFactory.cs \ - csharp/src/Google.Protobuf.Test/RefStructCompatibilityTest.cs \ - csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs \ - csharp/src/Google.Protobuf.Test/Reflection/DescriptorDeclarationTest.cs \ - csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \ - csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs \ - csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs \ - csharp/src/Google.Protobuf.Test/SampleEnum.cs \ - csharp/src/Google.Protobuf.Test/SampleMessages.cs \ - csharp/src/Google.Protobuf.Test/SampleNaNs.cs \ - csharp/src/Google.Protobuf.Test/TestCornerCases.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/ForeignMessagePartial.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions1.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/OldExtensions2.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs \ - csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs \ - csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs \ - csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs \ - csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs \ - csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \ - csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \ - csharp/src/Google.Protobuf.Test/UnknownFieldSetTest.cs \ - csharp/src/Google.Protobuf.Test/testprotos.pb \ - csharp/src/Google.Protobuf.sln \ - csharp/src/Google.Protobuf/ByteArray.cs \ - csharp/src/Google.Protobuf/ByteString.cs \ - csharp/src/Google.Protobuf/CodedInputStream.cs \ - csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs \ - csharp/src/Google.Protobuf/CodedOutputStream.cs \ - csharp/src/Google.Protobuf/Collections/Lists.cs \ - csharp/src/Google.Protobuf/Collections/MapField.cs \ - csharp/src/Google.Protobuf/Collections/ProtobufEqualityComparers.cs \ - csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs \ - csharp/src/Google.Protobuf/Collections/RepeatedField.cs \ - csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs \ - csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs \ - csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs \ - csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs \ - csharp/src/Google.Protobuf/Extension.cs \ - csharp/src/Google.Protobuf/ExtensionRegistry.cs \ - csharp/src/Google.Protobuf/ExtensionSet.cs \ - csharp/src/Google.Protobuf/ExtensionValue.cs \ - csharp/src/Google.Protobuf/FieldCodec.cs \ - csharp/src/Google.Protobuf/FieldMaskTree.cs \ - csharp/src/Google.Protobuf/FrameworkPortability.cs \ - csharp/src/Google.Protobuf/Google.Protobuf.csproj \ - csharp/src/Google.Protobuf/IBufferMessage.cs \ - csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs \ - csharp/src/Google.Protobuf/IDeepCloneable.cs \ - csharp/src/Google.Protobuf/IExtendableMessage.cs \ - csharp/src/Google.Protobuf/IMessage.cs \ - csharp/src/Google.Protobuf/InvalidJsonException.cs \ - csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs \ - csharp/src/Google.Protobuf/JsonFormatter.cs \ - csharp/src/Google.Protobuf/JsonParser.cs \ - csharp/src/Google.Protobuf/JsonToken.cs \ - csharp/src/Google.Protobuf/JsonTokenizer.cs \ - csharp/src/Google.Protobuf/LimitedInputStream.cs \ - csharp/src/Google.Protobuf/MessageExtensions.cs \ - csharp/src/Google.Protobuf/MessageParser.cs \ - csharp/src/Google.Protobuf/ObjectIntPair.cs \ - csharp/src/Google.Protobuf/ParseContext.cs \ - csharp/src/Google.Protobuf/ParserInternalState.cs \ - csharp/src/Google.Protobuf/ParsingPrimitives.cs \ - csharp/src/Google.Protobuf/ParsingPrimitivesMessages.cs \ - csharp/src/Google.Protobuf/ParsingPrimitivesWrappers.cs \ - csharp/src/Google.Protobuf/ProtoPreconditions.cs \ - csharp/src/Google.Protobuf/SegmentedBufferHelper.cs \ - csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs \ - csharp/src/Google.Protobuf/Reflection/CustomOptions.cs \ - csharp/src/Google.Protobuf/Reflection/Descriptor.cs \ - csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs \ - csharp/src/Google.Protobuf/Reflection/DescriptorDeclaration.cs \ - csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs \ - csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs \ - csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs \ - csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/ExtensionAccessor.cs \ - csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs \ - csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs \ - csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/FieldType.cs \ - csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/GeneratedClrTypeInfo.cs \ - csharp/src/Google.Protobuf/Reflection/IDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs \ - csharp/src/Google.Protobuf/Reflection/MapFieldAccessor.cs \ - csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/OneofAccessor.cs \ - csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs \ - csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/ReflectionUtil.cs \ - csharp/src/Google.Protobuf/Reflection/RepeatedFieldAccessor.cs \ - csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs \ - csharp/src/Google.Protobuf/Reflection/SingleFieldAccessor.cs \ - csharp/src/Google.Protobuf/Reflection/TypeRegistry.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Any.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Api.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/TimestampPartial.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Type.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \ - csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \ - csharp/src/Google.Protobuf/WireFormat.cs \ - csharp/src/Google.Protobuf/WritingPrimitivesMessages.cs \ - csharp/src/Google.Protobuf/WritingPrimitives.cs \ - csharp/src/Google.Protobuf/WriterInternalState.cs \ - csharp/src/Google.Protobuf/WriteContext.cs \ - csharp/src/Google.Protobuf/WriteBufferHelper.cs \ - csharp/src/Google.Protobuf/UnknownField.cs \ - csharp/src/Google.Protobuf/UnknownFieldSet.cs - -java_EXTRA_DIST= \ - java/README.md \ - java/bom/pom.xml \ - java/core/BUILD \ - java/core/generate-sources-build.xml \ - java/core/generate-test-sources-build.xml \ - java/core/pom.xml \ - java/core/src/main/java/com/google/protobuf/AbstractMessage.java \ - java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java \ - java/core/src/main/java/com/google/protobuf/AbstractParser.java \ - java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java \ - java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java \ - java/core/src/main/java/com/google/protobuf/Android.java \ - java/core/src/main/java/com/google/protobuf/ArrayDecoders.java \ - java/core/src/main/java/com/google/protobuf/BinaryReader.java \ - java/core/src/main/java/com/google/protobuf/BinaryWriter.java \ - java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java \ - java/core/src/main/java/com/google/protobuf/BlockingService.java \ - java/core/src/main/java/com/google/protobuf/BooleanArrayList.java \ - java/core/src/main/java/com/google/protobuf/BufferAllocator.java \ - java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java \ - java/core/src/main/java/com/google/protobuf/ByteOutput.java \ - java/core/src/main/java/com/google/protobuf/ByteString.java \ - java/core/src/main/java/com/google/protobuf/CodedInputStream.java \ - java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java \ - java/core/src/main/java/com/google/protobuf/CodedOutputStream.java \ - java/core/src/main/java/com/google/protobuf/CodedOutputStreamWriter.java \ - java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java \ - java/core/src/main/java/com/google/protobuf/Descriptors.java \ - java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java \ - java/core/src/main/java/com/google/protobuf/DoubleArrayList.java \ - java/core/src/main/java/com/google/protobuf/DynamicMessage.java \ - java/core/src/main/java/com/google/protobuf/ExperimentalApi.java \ - java/core/src/main/java/com/google/protobuf/Extension.java \ - java/core/src/main/java/com/google/protobuf/ExtensionLite.java \ - java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java \ - java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java \ - java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java \ - java/core/src/main/java/com/google/protobuf/ExtensionSchema.java \ - java/core/src/main/java/com/google/protobuf/ExtensionSchemaFull.java \ - java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java \ - java/core/src/main/java/com/google/protobuf/ExtensionSchemas.java \ - java/core/src/main/java/com/google/protobuf/FieldInfo.java \ - java/core/src/main/java/com/google/protobuf/FieldSet.java \ - java/core/src/main/java/com/google/protobuf/FieldType.java \ - java/core/src/main/java/com/google/protobuf/FloatArrayList.java \ - java/core/src/main/java/com/google/protobuf/GeneratedMessage.java \ - java/core/src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java \ - java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java \ - java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java \ - java/core/src/main/java/com/google/protobuf/IntArrayList.java \ - java/core/src/main/java/com/google/protobuf/Internal.java \ - java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \ - java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java \ - java/core/src/main/java/com/google/protobuf/JavaType.java \ - java/core/src/main/java/com/google/protobuf/LazyField.java \ - java/core/src/main/java/com/google/protobuf/LazyFieldLite.java \ - java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java \ - java/core/src/main/java/com/google/protobuf/LazyStringList.java \ - java/core/src/main/java/com/google/protobuf/ListFieldSchema.java \ - java/core/src/main/java/com/google/protobuf/LongArrayList.java \ - java/core/src/main/java/com/google/protobuf/ManifestSchemaFactory.java \ - java/core/src/main/java/com/google/protobuf/MapEntry.java \ - java/core/src/main/java/com/google/protobuf/MapEntryLite.java \ - java/core/src/main/java/com/google/protobuf/MapField.java \ - java/core/src/main/java/com/google/protobuf/MapFieldLite.java \ - java/core/src/main/java/com/google/protobuf/MapFieldSchema.java \ - java/core/src/main/java/com/google/protobuf/MapFieldSchemaFull.java \ - java/core/src/main/java/com/google/protobuf/MapFieldSchemaLite.java \ - java/core/src/main/java/com/google/protobuf/MapFieldSchemas.java \ - java/core/src/main/java/com/google/protobuf/Message.java \ - java/core/src/main/java/com/google/protobuf/MessageInfo.java \ - java/core/src/main/java/com/google/protobuf/MessageInfoFactory.java \ - java/core/src/main/java/com/google/protobuf/MessageLite.java \ - java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java \ - java/core/src/main/java/com/google/protobuf/MessageLiteToString.java \ - java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java \ - java/core/src/main/java/com/google/protobuf/MessageReflection.java \ - java/core/src/main/java/com/google/protobuf/MessageSchema.java \ - java/core/src/main/java/com/google/protobuf/MessageSetSchema.java \ - java/core/src/main/java/com/google/protobuf/MutabilityOracle.java \ - java/core/src/main/java/com/google/protobuf/NewInstanceSchema.java \ - java/core/src/main/java/com/google/protobuf/NewInstanceSchemaFull.java \ - java/core/src/main/java/com/google/protobuf/NewInstanceSchemaLite.java \ - java/core/src/main/java/com/google/protobuf/NewInstanceSchemas.java \ - java/core/src/main/java/com/google/protobuf/NioByteString.java \ - java/core/src/main/java/com/google/protobuf/OneofInfo.java \ - java/core/src/main/java/com/google/protobuf/Parser.java \ - java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java \ - java/core/src/main/java/com/google/protobuf/ProtoSyntax.java \ - java/core/src/main/java/com/google/protobuf/Protobuf.java \ - java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java \ - java/core/src/main/java/com/google/protobuf/ProtobufLists.java \ - java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java \ - java/core/src/main/java/com/google/protobuf/ProtocolStringList.java \ - java/core/src/main/java/com/google/protobuf/RawMessageInfo.java \ - java/core/src/main/java/com/google/protobuf/Reader.java \ - java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java \ - java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java \ - java/core/src/main/java/com/google/protobuf/RopeByteString.java \ - java/core/src/main/java/com/google/protobuf/RpcCallback.java \ - java/core/src/main/java/com/google/protobuf/RpcChannel.java \ - java/core/src/main/java/com/google/protobuf/RpcController.java \ - java/core/src/main/java/com/google/protobuf/RpcUtil.java \ - java/core/src/main/java/com/google/protobuf/Schema.java \ - java/core/src/main/java/com/google/protobuf/SchemaFactory.java \ - java/core/src/main/java/com/google/protobuf/SchemaUtil.java \ - java/core/src/main/java/com/google/protobuf/Service.java \ - java/core/src/main/java/com/google/protobuf/ServiceException.java \ - java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java \ - java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java \ - java/core/src/main/java/com/google/protobuf/SmallSortedMap.java \ - java/core/src/main/java/com/google/protobuf/StructuralMessageInfo.java \ - java/core/src/main/java/com/google/protobuf/TextFormat.java \ - java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java \ - java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java \ - java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java \ - java/core/src/main/java/com/google/protobuf/TypeRegistry.java \ - java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java \ - java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java \ - java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java \ - java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java \ - java/core/src/main/java/com/google/protobuf/UnknownFieldSetLiteSchema.java \ - java/core/src/main/java/com/google/protobuf/UnknownFieldSetSchema.java \ - java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java \ - java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java \ - java/core/src/main/java/com/google/protobuf/UnsafeUtil.java \ - java/core/src/main/java/com/google/protobuf/Utf8.java \ - java/core/src/main/java/com/google/protobuf/WireFormat.java \ - java/core/src/main/java/com/google/protobuf/Writer.java \ - java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java \ - java/core/src/test/java/com/google/protobuf/AbstractProto2LiteSchemaTest.java \ - java/core/src/test/java/com/google/protobuf/AbstractProto2SchemaTest.java \ - java/core/src/test/java/com/google/protobuf/AbstractProto3LiteSchemaTest.java \ - java/core/src/test/java/com/google/protobuf/AbstractProto3SchemaTest.java \ - java/core/src/test/java/com/google/protobuf/AbstractSchemaTest.java \ - java/core/src/test/java/com/google/protobuf/AnyTest.java \ - java/core/src/test/java/com/google/protobuf/ArrayDecodersTest.java \ - java/core/src/test/java/com/google/protobuf/BinaryProtocolTest.java \ - java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java \ - java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java \ - java/core/src/test/java/com/google/protobuf/ByteStringTest.java \ - java/core/src/test/java/com/google/protobuf/CachedFieldSizeTest.java \ - java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java \ - java/core/src/test/java/com/google/protobuf/CodedAdapterTest.java \ - java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java \ - java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java \ - java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java \ - java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java \ - java/core/src/test/java/com/google/protobuf/DescriptorsTest.java \ - java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java \ - java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java \ - java/core/src/test/java/com/google/protobuf/EnumTest.java \ - java/core/src/test/java/com/google/protobuf/ExperimentalMessageFactory.java \ - java/core/src/test/java/com/google/protobuf/ExperimentalSerializationUtil.java \ - java/core/src/test/java/com/google/protobuf/ExperimentalTestDataProvider.java \ - java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java \ - java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java \ - java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java \ - java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java \ - java/core/src/test/java/com/google/protobuf/IntArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java \ - java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java \ - java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java \ - java/core/src/test/java/com/google/protobuf/LazyFieldTest.java \ - java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java \ - java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java \ - java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java \ - java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java \ - java/core/src/test/java/com/google/protobuf/LongArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java \ - java/core/src/test/java/com/google/protobuf/MapForProto2Test.java \ - java/core/src/test/java/com/google/protobuf/MapLiteTest.java \ - java/core/src/test/java/com/google/protobuf/MapTest.java \ - java/core/src/test/java/com/google/protobuf/MessageTest.java \ - java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java \ - java/core/src/test/java/com/google/protobuf/NioByteStringTest.java \ - java/core/src/test/java/com/google/protobuf/PackedFieldTest.java \ - java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java \ - java/core/src/test/java/com/google/protobuf/ParserLiteTest.java \ - java/core/src/test/java/com/google/protobuf/ParserTest.java \ - java/core/src/test/java/com/google/protobuf/Proto2ExtensionLookupSchemaTest.java \ - java/core/src/test/java/com/google/protobuf/Proto2LiteSchemaTest.java \ - java/core/src/test/java/com/google/protobuf/Proto2MessageFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto2MessageInfoFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto2MessageLiteFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto2SchemaTest.java \ - java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java \ - java/core/src/test/java/com/google/protobuf/Proto3LiteSchemaTest.java \ - java/core/src/test/java/com/google/protobuf/Proto3MessageFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto3MessageInfoFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto3MessageLiteFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto3MessageLiteInfoFactory.java \ - java/core/src/test/java/com/google/protobuf/Proto3SchemaTest.java \ - java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java \ - java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java \ - java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java \ - java/core/src/test/java/com/google/protobuf/ServiceTest.java \ - java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java \ - java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java \ - java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java \ - java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java \ - java/core/src/test/java/com/google/protobuf/TestSchemas.java \ - java/core/src/test/java/com/google/protobuf/TestSchemasLite.java \ - java/core/src/test/java/com/google/protobuf/TestUtil.java \ - java/core/src/test/java/com/google/protobuf/TestUtilLite.java \ - java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java \ - java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java \ - java/core/src/test/java/com/google/protobuf/TextFormatTest.java \ - java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java \ - java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java \ - java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java \ - java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java \ - java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java \ - java/core/src/test/java/com/google/protobuf/Utf8Test.java \ - java/core/src/test/java/com/google/protobuf/Utf8Utils.java \ - java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java \ - java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java \ - java/core/src/test/java/com/google/protobuf/WireFormatTest.java \ - java/core/src/test/java/com/google/protobuf/WrappersLiteOfMethodTest.java \ - java/core/src/test/java/com/google/protobuf/WrappersOfMethodTest.java \ - java/core/src/test/proto/com/google/protobuf/any_test.proto \ - java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto \ - java/core/src/test/proto/com/google/protobuf/deprecated_file.proto \ - java/core/src/test/proto/com/google/protobuf/field_presence_test.proto \ - java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto \ - java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto \ - java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto \ - java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto \ - java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto \ - java/core/src/test/proto/com/google/protobuf/map_lite_test.proto \ - java/core/src/test/proto/com/google/protobuf/map_test.proto \ - java/core/src/test/proto/com/google/protobuf/message_lite_extension_util_test.proto\ - java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto \ - java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto \ - java/core/src/test/proto/com/google/protobuf/nested_extension.proto \ - java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto \ - java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto \ - java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto \ - java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto \ - java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto \ - java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto \ - java/core/src/test/proto/com/google/protobuf/packed_field_test.proto \ - java/core/src/test/proto/com/google/protobuf/proto2_message.proto \ - java/core/src/test/proto/com/google/protobuf/proto2_message_lite.proto \ - java/core/src/test/proto/com/google/protobuf/proto2_unknown_enum_values.proto \ - java/core/src/test/proto/com/google/protobuf/proto3_message.proto \ - java/core/src/test/proto/com/google/protobuf/proto3_message_lite.proto \ - java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto \ - java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto \ - java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \ - java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \ - java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto \ - java/core/src/test/proto/com/google/protobuf/wrappers_test.proto \ - java/lite.md \ - java/lite/BUILD \ - java/lite/generate-sources-build.xml \ - java/lite/generate-test-sources-build.xml \ - java/lite/lite.awk \ - java/lite/pom.xml \ - java/lite/process-lite-sources-build.xml \ - java/lite/src/test/java/com/google/protobuf/LiteTest.java \ - java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \ - java/pom.xml \ - java/util/BUILD \ - java/util/pom.xml \ - java/util/src/main/java/com/google/protobuf/util/Durations.java \ - java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java \ - java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \ - java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \ - java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \ - java/util/src/main/java/com/google/protobuf/util/Structs.java \ - java/util/src/main/java/com/google/protobuf/util/Timestamps.java \ - java/util/src/main/java/com/google/protobuf/util/Values.java \ - java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \ - java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \ - java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \ - java/util/src/test/java/com/google/protobuf/util/StructsTest.java \ - java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \ - java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \ - java/util/src/test/proto/com/google/protobuf/util/json_test.proto - -objectivec_EXTRA_DIST= \ - objectivec/.clang-format \ - objectivec/DevTools/check_version_stamps.sh \ - objectivec/DevTools/compile_testing_protos.sh \ - objectivec/DevTools/full_mac_build.sh \ - objectivec/DevTools/pddm.py \ - objectivec/DevTools/pddm_tests.py \ - objectivec/generate_well_known_types.sh \ - objectivec/google/protobuf/Any.pbobjc.h \ - objectivec/google/protobuf/Api.pbobjc.h \ - objectivec/google/protobuf/Duration.pbobjc.h \ - objectivec/google/protobuf/Empty.pbobjc.h \ - objectivec/google/protobuf/FieldMask.pbobjc.h \ - objectivec/google/protobuf/SourceContext.pbobjc.h \ - objectivec/google/protobuf/Struct.pbobjc.h \ - objectivec/google/protobuf/Timestamp.pbobjc.h \ - objectivec/google/protobuf/Type.pbobjc.h \ - objectivec/google/protobuf/Wrappers.pbobjc.h \ - objectivec/GPBAny.pbobjc.h \ - objectivec/GPBAny.pbobjc.m \ - objectivec/GPBApi.pbobjc.h \ - objectivec/GPBApi.pbobjc.m \ - objectivec/GPBArray.h \ - objectivec/GPBArray.m \ - objectivec/GPBArray_PackagePrivate.h \ - objectivec/GPBBootstrap.h \ - objectivec/GPBCodedInputStream.h \ - objectivec/GPBCodedInputStream.m \ - objectivec/GPBCodedInputStream_PackagePrivate.h \ - objectivec/GPBCodedOutputStream.h \ - objectivec/GPBCodedOutputStream.m \ - objectivec/GPBCodedOutputStream_PackagePrivate.h \ - objectivec/GPBDescriptor.h \ - objectivec/GPBDescriptor.m \ - objectivec/GPBDescriptor_PackagePrivate.h \ - objectivec/GPBDictionary.h \ - objectivec/GPBDictionary.m \ - objectivec/GPBDictionary_PackagePrivate.h \ - objectivec/GPBDuration.pbobjc.h \ - objectivec/GPBDuration.pbobjc.m \ - objectivec/GPBEmpty.pbobjc.h \ - objectivec/GPBEmpty.pbobjc.m \ - objectivec/GPBExtensionInternals.h \ - objectivec/GPBExtensionInternals.m \ - objectivec/GPBExtensionRegistry.h \ - objectivec/GPBExtensionRegistry.m \ - objectivec/GPBFieldMask.pbobjc.h \ - objectivec/GPBFieldMask.pbobjc.m \ - objectivec/GPBMessage.h \ - objectivec/GPBMessage.m \ - objectivec/GPBMessage_PackagePrivate.h \ - objectivec/GPBProtocolBuffers.h \ - objectivec/GPBProtocolBuffers.m \ - objectivec/GPBProtocolBuffers_RuntimeSupport.h \ - objectivec/GPBRootObject.h \ - objectivec/GPBRootObject.m \ - objectivec/GPBRootObject_PackagePrivate.h \ - objectivec/GPBRuntimeTypes.h \ - objectivec/GPBSourceContext.pbobjc.h \ - objectivec/GPBSourceContext.pbobjc.m \ - objectivec/GPBStruct.pbobjc.h \ - objectivec/GPBStruct.pbobjc.m \ - objectivec/GPBTimestamp.pbobjc.h \ - objectivec/GPBTimestamp.pbobjc.m \ - objectivec/GPBType.pbobjc.h \ - objectivec/GPBType.pbobjc.m \ - objectivec/GPBUnknownField.h \ - objectivec/GPBUnknownField.m \ - objectivec/GPBUnknownField_PackagePrivate.h \ - objectivec/GPBUnknownFieldSet.h \ - objectivec/GPBUnknownFieldSet.m \ - objectivec/GPBUnknownFieldSet_PackagePrivate.h \ - objectivec/GPBUtilities.h \ - objectivec/GPBUtilities.m \ - objectivec/GPBUtilities_PackagePrivate.h \ - objectivec/GPBWellKnownTypes.h \ - objectivec/GPBWellKnownTypes.m \ - objectivec/GPBWireFormat.h \ - objectivec/GPBWireFormat.m \ - objectivec/GPBWrappers.pbobjc.h \ - objectivec/GPBWrappers.pbobjc.m \ - objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj \ - objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ - objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \ - objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \ - objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ - objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ - objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj \ - objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ - objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \ - objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \ - objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ - objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ - objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj \ - objectivec/ProtocolBuffers_tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ - objectivec/ProtocolBuffers_tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \ - objectivec/ProtocolBuffers_tvOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \ - objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ - objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ - objectivec/README.md \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework \ - objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static \ - objectivec/Tests/CocoaPods/README.md \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m \ - objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m \ - objectivec/Tests/CocoaPods/run_tests.sh \ - objectivec/Tests/golden_message \ - objectivec/Tests/golden_packed_fields_message \ - objectivec/Tests/GPBARCUnittestProtos.m \ - objectivec/Tests/GPBArrayTests.m \ - objectivec/Tests/GPBCodedInputStreamTests.m \ - objectivec/Tests/GPBCodedOuputStreamTests.m \ - objectivec/Tests/GPBCompileTest01.m \ - objectivec/Tests/GPBCompileTest02.m \ - objectivec/Tests/GPBCompileTest03.m \ - objectivec/Tests/GPBCompileTest04.m \ - objectivec/Tests/GPBCompileTest05.m \ - objectivec/Tests/GPBCompileTest06.m \ - objectivec/Tests/GPBCompileTest07.m \ - objectivec/Tests/GPBCompileTest08.m \ - objectivec/Tests/GPBCompileTest09.m \ - objectivec/Tests/GPBCompileTest10.m \ - objectivec/Tests/GPBCompileTest11.m \ - objectivec/Tests/GPBCompileTest12.m \ - objectivec/Tests/GPBCompileTest13.m \ - objectivec/Tests/GPBCompileTest14.m \ - objectivec/Tests/GPBCompileTest15.m \ - objectivec/Tests/GPBCompileTest16.m \ - objectivec/Tests/GPBCompileTest17.m \ - objectivec/Tests/GPBCompileTest18.m \ - objectivec/Tests/GPBCompileTest19.m \ - objectivec/Tests/GPBCompileTest20.m \ - objectivec/Tests/GPBCompileTest21.m \ - objectivec/Tests/GPBCompileTest22.m \ - objectivec/Tests/GPBCompileTest23.m \ - objectivec/Tests/GPBCompileTest24.m \ - objectivec/Tests/GPBCompileTest25.m \ - objectivec/Tests/GPBConcurrencyTests.m \ - objectivec/Tests/GPBDescriptorTests.m \ - objectivec/Tests/GPBDictionaryTests+Bool.m \ - objectivec/Tests/GPBDictionaryTests+Int32.m \ - objectivec/Tests/GPBDictionaryTests+Int64.m \ - objectivec/Tests/GPBDictionaryTests+String.m \ - objectivec/Tests/GPBDictionaryTests+UInt32.m \ - objectivec/Tests/GPBDictionaryTests+UInt64.m \ - objectivec/Tests/GPBDictionaryTests.m \ - objectivec/Tests/GPBDictionaryTests.pddm \ - objectivec/Tests/GPBExtensionRegistryTest.m \ - objectivec/Tests/GPBMessageTests+ClassNames.m \ - objectivec/Tests/GPBMessageTests+Merge.m \ - objectivec/Tests/GPBMessageTests+Runtime.m \ - objectivec/Tests/GPBMessageTests+Serialization.m \ - objectivec/Tests/GPBMessageTests.m \ - objectivec/Tests/GPBObjectiveCPlusPlusTest.mm \ - objectivec/Tests/GPBPerfTests.m \ - objectivec/Tests/GPBSwiftTests.swift \ - objectivec/Tests/GPBTestUtilities.h \ - objectivec/Tests/GPBTestUtilities.m \ - objectivec/Tests/GPBUnittestProtos.m \ - objectivec/Tests/GPBUnittestProtos2.m \ - objectivec/Tests/GPBUnknownFieldSetTest.m \ - objectivec/Tests/GPBUtilitiesTests.m \ - objectivec/Tests/GPBWellKnownTypesTest.m \ - objectivec/Tests/GPBWireFormatTests.m \ - objectivec/Tests/text_format_extensions_unittest_data.txt \ - objectivec/Tests/text_format_map_unittest_data.txt \ - objectivec/Tests/text_format_unittest_data.txt \ - objectivec/Tests/unittest_cycle.proto \ - objectivec/Tests/unittest_deprecated.proto \ - objectivec/Tests/unittest_deprecated_file.proto \ - objectivec/Tests/unittest_extension_chain_a.proto \ - objectivec/Tests/unittest_extension_chain_b.proto \ - objectivec/Tests/unittest_extension_chain_c.proto \ - objectivec/Tests/unittest_extension_chain_d.proto \ - objectivec/Tests/unittest_extension_chain_e.proto \ - objectivec/Tests/unittest_extension_chain_f.proto \ - objectivec/Tests/unittest_extension_chain_g.proto \ - objectivec/Tests/unittest_objc.proto \ - objectivec/Tests/unittest_objc_options.proto \ - objectivec/Tests/unittest_objc_startup.proto \ - objectivec/Tests/unittest_runtime_proto2.proto \ - objectivec/Tests/unittest_runtime_proto3.proto \ - objectivec/Tests/UnitTests-Bridging-Header.h \ - objectivec/Tests/UnitTests-Info.plist \ - Protobuf.podspec - -php_EXTRA_DIST= \ - composer.json \ - php/README.md \ - php/composer.json \ - php/ext/google/protobuf/arena.c \ - php/ext/google/protobuf/arena.h \ - php/ext/google/protobuf/array.c \ - php/ext/google/protobuf/array.h \ - php/ext/google/protobuf/bundled_php.h \ - php/ext/google/protobuf/config.m4 \ - php/ext/google/protobuf/convert.c \ - php/ext/google/protobuf/convert.h \ - php/ext/google/protobuf/def.c \ - php/ext/google/protobuf/def.h \ - php/ext/google/protobuf/make-preload.php \ - php/ext/google/protobuf/map.c \ - php/ext/google/protobuf/map.h \ - php/ext/google/protobuf/message.c \ - php/ext/google/protobuf/message.h \ - php/ext/google/protobuf/names.c \ - php/ext/google/protobuf/names.h \ - php/ext/google/protobuf/package.xml \ - php/ext/google/protobuf/php-upb.c \ - php/ext/google/protobuf/php-upb.h \ - php/ext/google/protobuf/protobuf.c \ - php/ext/google/protobuf/protobuf.h \ - php/generate_descriptor_protos.sh \ - php/phpunit.xml \ - php/release.sh \ - php/src/GPBMetadata/Google/Protobuf/Any.php \ - php/src/GPBMetadata/Google/Protobuf/Api.php \ - php/src/GPBMetadata/Google/Protobuf/Duration.php \ - php/src/GPBMetadata/Google/Protobuf/FieldMask.php \ - php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php \ - php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \ - php/src/GPBMetadata/Google/Protobuf/SourceContext.php \ - php/src/GPBMetadata/Google/Protobuf/Struct.php \ - php/src/GPBMetadata/Google/Protobuf/Timestamp.php \ - php/src/GPBMetadata/Google/Protobuf/Type.php \ - php/src/GPBMetadata/Google/Protobuf/Wrappers.php \ - php/src/Google/Protobuf/Any.php \ - php/src/Google/Protobuf/Api.php \ - php/src/Google/Protobuf/BoolValue.php \ - php/src/Google/Protobuf/BytesValue.php \ - php/src/Google/Protobuf/Descriptor.php \ - php/src/Google/Protobuf/DescriptorPool.php \ - php/src/Google/Protobuf/DoubleValue.php \ - php/src/Google/Protobuf/Duration.php \ - php/src/Google/Protobuf/Enum.php \ - php/src/Google/Protobuf/EnumDescriptor.php \ - php/src/Google/Protobuf/EnumValue.php \ - php/src/Google/Protobuf/EnumValueDescriptor.php \ - php/src/Google/Protobuf/Field.php \ - php/src/Google/Protobuf/FieldDescriptor.php \ - php/src/Google/Protobuf/FieldMask.php \ - php/src/Google/Protobuf/Field/Cardinality.php \ - php/src/Google/Protobuf/Field_Cardinality.php \ - php/src/Google/Protobuf/Field/Kind.php \ - php/src/Google/Protobuf/Field_Kind.php \ - php/src/Google/Protobuf/FloatValue.php \ - php/src/Google/Protobuf/GPBEmpty.php \ - php/src/Google/Protobuf/Int32Value.php \ - php/src/Google/Protobuf/Int64Value.php \ - php/src/Google/Protobuf/Internal/CodedInputStream.php \ - php/src/Google/Protobuf/Internal/CodedOutputStream.php \ - php/src/Google/Protobuf/Internal/Descriptor.php \ - php/src/Google/Protobuf/Internal/DescriptorPool.php \ - php/src/Google/Protobuf/Internal/DescriptorProto.php \ - php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php \ - php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php \ - php/src/Google/Protobuf/Internal/EnumBuilderContext.php \ - php/src/Google/Protobuf/Internal/EnumDescriptor.php \ - php/src/Google/Protobuf/Internal/EnumDescriptorProto.php \ - php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php \ - php/src/Google/Protobuf/Internal/EnumOptions.php \ - php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php \ - php/src/Google/Protobuf/Internal/EnumValueOptions.php \ - php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php \ - php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \ - php/src/Google/Protobuf/Internal/FieldDescriptor.php \ - php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \ - php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php \ - php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php \ - php/src/Google/Protobuf/Internal/FieldOptions.php \ - php/src/Google/Protobuf/Internal/FieldOptions/CType.php \ - php/src/Google/Protobuf/Internal/FieldOptions/JSType.php \ - php/src/Google/Protobuf/Internal/FileDescriptor.php \ - php/src/Google/Protobuf/Internal/FileDescriptorProto.php \ - php/src/Google/Protobuf/Internal/FileDescriptorSet.php \ - php/src/Google/Protobuf/Internal/FileOptions.php \ - php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php \ - php/src/Google/Protobuf/Internal/GPBDecodeException.php \ - php/src/Google/Protobuf/Internal/GPBJsonWire.php \ - php/src/Google/Protobuf/Internal/GPBLabel.php \ - php/src/Google/Protobuf/Internal/GPBType.php \ - php/src/Google/Protobuf/Internal/GPBUtil.php \ - php/src/Google/Protobuf/Internal/GPBWire.php \ - php/src/Google/Protobuf/Internal/GPBWireType.php \ - php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \ - php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php \ - php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php \ - php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php \ - php/src/Google/Protobuf/Internal/MapEntry.php \ - php/src/Google/Protobuf/Internal/MapField.php \ - php/src/Google/Protobuf/Internal/MapFieldIter.php \ - php/src/Google/Protobuf/Internal/Message.php \ - php/src/Google/Protobuf/Internal/MessageBuilderContext.php \ - php/src/Google/Protobuf/Internal/MessageOptions.php \ - php/src/Google/Protobuf/Internal/MethodDescriptorProto.php \ - php/src/Google/Protobuf/Internal/MethodOptions.php \ - php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php \ - php/src/Google/Protobuf/Internal/OneofDescriptor.php \ - php/src/Google/Protobuf/Internal/OneofDescriptorProto.php \ - php/src/Google/Protobuf/Internal/OneofField.php \ - php/src/Google/Protobuf/Internal/OneofOptions.php \ - php/src/Google/Protobuf/Internal/RawInputStream.php \ - php/src/Google/Protobuf/Internal/RepeatedField.php \ - php/src/Google/Protobuf/Internal/RepeatedFieldIter.php \ - php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php \ - php/src/Google/Protobuf/Internal/ServiceOptions.php \ - php/src/Google/Protobuf/Internal/SourceCodeInfo.php \ - php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php \ - php/src/Google/Protobuf/Internal/UninterpretedOption.php \ - php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php \ - php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php \ - php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php \ - php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php \ - php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php \ - php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php \ - php/src/Google/Protobuf/Internal/FieldOptions_CType.php \ - php/src/Google/Protobuf/Internal/FieldOptions_JSType.php \ - php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php \ - php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php \ - php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php \ - php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php \ - php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php \ - php/src/Google/Protobuf/ListValue.php \ - php/src/Google/Protobuf/Method.php \ - php/src/Google/Protobuf/Mixin.php \ - php/src/Google/Protobuf/NullValue.php \ - php/src/Google/Protobuf/OneofDescriptor.php \ - php/src/Google/Protobuf/Option.php \ - php/src/Google/Protobuf/SourceContext.php \ - php/src/Google/Protobuf/StringValue.php \ - php/src/Google/Protobuf/Struct.php \ - php/src/Google/Protobuf/Syntax.php \ - php/src/Google/Protobuf/Timestamp.php \ - php/src/Google/Protobuf/Type.php \ - php/src/Google/Protobuf/UInt32Value.php \ - php/src/Google/Protobuf/UInt64Value.php \ - php/src/Google/Protobuf/Value.php \ - php/src/phpdoc.dist.xml \ - php/tests/ArrayTest.php \ - php/tests/autoload.php \ - php/tests/bootstrap_phpunit.php \ - php/tests/compatibility_test.sh \ - php/tests/compile_extension.sh \ - php/tests/DescriptorsTest.php \ - php/tests/EncodeDecodeTest.php \ - php/tests/gdb_test.sh \ - php/tests/generate_protos.sh \ - php/tests/GeneratedClassTest.php \ - php/tests/GeneratedPhpdocTest.php \ - php/tests/GeneratedServiceTest.php \ - php/tests/MapFieldTest.php \ - php/tests/memory_leak_test.php \ - php/tests/multirequest.php \ - php/tests/multirequest.sh \ - php/tests/PhpImplementationTest.php \ - php/tests/proto/empty/echo.proto \ - php/tests/proto/test.proto \ - php/tests/proto/test_descriptors.proto \ - php/tests/proto/test_empty_php_namespace.proto \ - php/tests/proto/test_import_descriptor_proto.proto \ - php/tests/proto/test_include.proto \ - php/tests/proto/test_no_namespace.proto \ - php/tests/proto/test_php_namespace.proto \ - php/tests/proto/test_prefix.proto \ - php/tests/proto/test_reserved_enum_lower.proto \ - php/tests/proto/test_reserved_enum_upper.proto \ - php/tests/proto/test_reserved_enum_value_lower.proto \ - php/tests/proto/test_reserved_enum_value_upper.proto \ - php/tests/proto/test_reserved_message_lower.proto \ - php/tests/proto/test_reserved_message_upper.proto \ - php/tests/proto/test_service.proto \ - php/tests/proto/test_service_namespace.proto \ - php/tests/proto/test_wrapper_type_setters.proto \ - php/tests/test.sh \ - php/tests/test_base.php \ - php/tests/test_util.php \ - php/tests/undefined_test.php \ - php/tests/valgrind.supp \ - php/tests/WellKnownTest.php \ - php/tests/WrapperTypeSettersTest.php - -python_EXTRA_DIST= \ - python/MANIFEST.in \ - python/google/__init__.py \ - python/google/protobuf/__init__.py \ - python/google/protobuf/compiler/__init__.py \ - python/google/protobuf/descriptor.py \ - python/google/protobuf/descriptor_database.py \ - python/google/protobuf/descriptor_pool.py \ - python/google/protobuf/internal/__init__.py \ - python/google/protobuf/internal/_parameterized.py \ - python/google/protobuf/internal/any_test.proto \ - python/google/protobuf/internal/any_test.proto \ - python/google/protobuf/internal/api_implementation.cc \ - python/google/protobuf/internal/api_implementation.py \ - python/google/protobuf/internal/containers.py \ - python/google/protobuf/internal/decoder.py \ - python/google/protobuf/internal/descriptor_database_test.py \ - python/google/protobuf/internal/descriptor_pool_test.py \ - python/google/protobuf/internal/descriptor_pool_test1.proto \ - python/google/protobuf/internal/descriptor_pool_test2.proto \ - python/google/protobuf/internal/descriptor_test.py \ - python/google/protobuf/internal/encoder.py \ - python/google/protobuf/internal/enum_type_wrapper.py \ - python/google/protobuf/internal/extension_dict.py \ - python/google/protobuf/internal/factory_test1.proto \ - python/google/protobuf/internal/factory_test2.proto \ - python/google/protobuf/internal/file_options_test.proto \ - python/google/protobuf/internal/generator_test.py \ - python/google/protobuf/internal/import_test_package/__init__.py \ - python/google/protobuf/internal/import_test_package/inner.proto \ - python/google/protobuf/internal/import_test_package/outer.proto \ - python/google/protobuf/internal/json_format_test.py \ - python/google/protobuf/internal/keywords_test.py \ - python/google/protobuf/internal/message_factory_test.py \ - python/google/protobuf/internal/message_listener.py \ - python/google/protobuf/internal/message_set_extensions.proto \ - python/google/protobuf/internal/message_test.py \ - python/google/protobuf/internal/missing_enum_values.proto \ - python/google/protobuf/internal/more_extensions.proto \ - python/google/protobuf/internal/more_extensions_dynamic.proto \ - python/google/protobuf/internal/more_messages.proto \ - python/google/protobuf/internal/no_package.proto \ - python/google/protobuf/internal/packed_field_test.proto \ - python/google/protobuf/internal/proto_builder_test.py \ - python/google/protobuf/internal/python_message.py \ - python/google/protobuf/internal/python_protobuf.cc \ - python/google/protobuf/internal/reflection_test.py \ - python/google/protobuf/internal/service_reflection_test.py \ - python/google/protobuf/internal/symbol_database_test.py \ - python/google/protobuf/internal/test_bad_identifiers.proto \ - python/google/protobuf/internal/test_proto3_optional.proto \ - python/google/protobuf/internal/test_util.py \ - python/google/protobuf/internal/testing_refleaks.py \ - python/google/protobuf/internal/text_encoding_test.py \ - python/google/protobuf/internal/text_format_test.py \ - python/google/protobuf/internal/type_checkers.py \ - python/google/protobuf/internal/unknown_fields_test.py \ - python/google/protobuf/internal/well_known_types.py \ - python/google/protobuf/internal/well_known_types.py \ - python/google/protobuf/internal/well_known_types_test.py \ - python/google/protobuf/internal/well_known_types_test.py \ - python/google/protobuf/internal/wire_format.py \ - python/google/protobuf/internal/wire_format_test.py \ - python/google/protobuf/json_format.py \ - python/google/protobuf/message.py \ - python/google/protobuf/message_factory.py \ - python/google/protobuf/python_protobuf.h \ - python/google/protobuf/proto_api.h \ - python/google/protobuf/proto_builder.py \ - python/google/protobuf/pyext/README \ - python/google/protobuf/pyext/__init__.py \ - python/google/protobuf/pyext/cpp_message.py \ - python/google/protobuf/pyext/descriptor.cc \ - python/google/protobuf/pyext/descriptor.h \ - python/google/protobuf/pyext/descriptor_containers.cc \ - python/google/protobuf/pyext/descriptor_containers.h \ - python/google/protobuf/pyext/descriptor_database.cc \ - python/google/protobuf/pyext/descriptor_database.h \ - python/google/protobuf/pyext/descriptor_pool.cc \ - python/google/protobuf/pyext/descriptor_pool.h \ - python/google/protobuf/pyext/extension_dict.cc \ - python/google/protobuf/pyext/extension_dict.h \ - python/google/protobuf/pyext/map_container.cc \ - python/google/protobuf/pyext/map_container.h \ - python/google/protobuf/pyext/message.cc \ - python/google/protobuf/pyext/message.h \ - python/google/protobuf/pyext/field.cc \ - python/google/protobuf/pyext/field.h \ - python/google/protobuf/pyext/unknown_fields.cc \ - python/google/protobuf/pyext/unknown_fields.h \ - python/google/protobuf/pyext/message_factory.cc \ - python/google/protobuf/pyext/message_factory.h \ - python/google/protobuf/pyext/message_module.cc \ - python/google/protobuf/pyext/proto2_api_test.proto \ - python/google/protobuf/pyext/python.proto \ - python/google/protobuf/pyext/repeated_composite_container.cc \ - python/google/protobuf/pyext/repeated_composite_container.h \ - python/google/protobuf/pyext/repeated_scalar_container.cc \ - python/google/protobuf/pyext/repeated_scalar_container.h \ - python/google/protobuf/pyext/safe_numerics.h \ - python/google/protobuf/pyext/scoped_pyobject_ptr.h \ - python/google/protobuf/reflection.py \ - python/google/protobuf/service.py \ - python/google/protobuf/service_reflection.py \ - python/google/protobuf/symbol_database.py \ - python/google/protobuf/text_encoding.py \ - python/google/protobuf/text_format.py \ - python/google/protobuf/util/__init__.py \ - python/release.sh \ - python/mox.py \ - python/setup.cfg \ - python/setup.py \ - python/stubout.py \ - python/tox.ini \ - python/README.md - -ruby_EXTRA_DIST= \ - ruby/Gemfile \ - ruby/.gitignore \ - ruby/README.md \ - ruby/Rakefile \ - ruby/compatibility_tests/v3.0.0/tests/test_import.proto \ - ruby/compatibility_tests/v3.0.0/tests/stress.rb \ - ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb \ - ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb \ - ruby/compatibility_tests/v3.0.0/tests/generated_code.proto \ - ruby/compatibility_tests/v3.0.0/tests/basic.rb \ - ruby/compatibility_tests/v3.0.0/test.sh \ - ruby/compatibility_tests/v3.0.0/Rakefile \ - ruby/compatibility_tests/v3.0.0/README.md \ - ruby/ext/google/protobuf_c/defs.c \ - ruby/ext/google/protobuf_c/encode_decode.c \ - ruby/ext/google/protobuf_c/extconf.rb \ - ruby/ext/google/protobuf_c/map.c \ - ruby/ext/google/protobuf_c/message.c \ - ruby/ext/google/protobuf_c/protobuf.c \ - ruby/ext/google/protobuf_c/protobuf.h \ - ruby/ext/google/protobuf_c/repeated_field.c \ - ruby/ext/google/protobuf_c/storage.c \ - ruby/ext/google/protobuf_c/upb.c \ - ruby/ext/google/protobuf_c/upb.h \ - ruby/ext/google/protobuf_c/wrap_memcpy.c \ - ruby/google-protobuf.gemspec \ - ruby/lib/google/protobuf/message_exts.rb \ - ruby/lib/google/protobuf/repeated_field.rb \ - ruby/lib/google/protobuf/well_known_types.rb \ - ruby/lib/google/protobuf.rb \ - ruby/pom.xml \ - ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java \ - ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java \ - ruby/src/main/java/com/google/protobuf/jruby/SentinelOuterClass.java \ - ruby/src/main/java/com/google/protobuf/jruby/Utils.java \ - ruby/src/main/java/google/ProtobufJavaService.java \ - ruby/src/main/sentinel.proto \ - ruby/tests/basic_proto2.rb \ - ruby/tests/basic_test_proto2.proto \ - ruby/tests/basic_test.proto \ - ruby/tests/basic.rb \ - ruby/tests/common_tests.rb \ - ruby/tests/encode_decode_test.rb \ - ruby/tests/gc_test.rb \ - ruby/tests/repeated_field_test.rb \ - ruby/tests/stress.rb \ - ruby/tests/generated_code_proto2_test.rb \ - ruby/tests/generated_code_proto2.proto \ - ruby/tests/generated_code.proto \ - ruby/tests/test_import_proto2.proto \ - ruby/tests/test_import.proto \ - ruby/tests/test_ruby_package_proto2.proto \ - ruby/tests/test_ruby_package.proto \ - ruby/tests/generated_code_test.rb \ - ruby/tests/well_known_types_test.rb \ - ruby/tests/type_errors.rb \ - ruby/travis-test.sh - -js_EXTRA_DIST= \ - js/README.md \ - js/binary/arith.js \ - js/binary/arith_test.js \ - js/binary/constants.js \ - js/binary/decoder.js \ - js/binary/decoder_test.js \ - js/binary/encoder.js \ - js/binary/message_test.js \ - js/binary/proto_test.js \ - js/binary/reader.js \ - js/binary/reader_test.js \ - js/binary/utils.js \ - js/binary/utils_test.js \ - js/binary/writer.js \ - js/binary/writer_test.js \ - js/commonjs/export.js \ - js/commonjs/export_asserts.js \ - js/commonjs/export_testdeps.js \ - js/commonjs/import_test.js \ - js/commonjs/jasmine.json \ - js/commonjs/rewrite_tests_for_commonjs.js \ - js/commonjs/strict_test.js \ - js/commonjs/test6/test6.proto \ - js/commonjs/test7/test7.proto \ - js/compatibility_tests/v3.0.0/binary/arith_test.js \ - js/compatibility_tests/v3.0.0/binary/decoder_test.js \ - js/compatibility_tests/v3.0.0/binary/proto_test.js \ - js/compatibility_tests/v3.0.0/binary/reader_test.js \ - js/compatibility_tests/v3.0.0/binary/utils_test.js \ - js/compatibility_tests/v3.0.0/binary/writer_test.js \ - js/compatibility_tests/v3.0.0/commonjs/export_asserts.js \ - js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js \ - js/compatibility_tests/v3.0.0/commonjs/import_test.js \ - js/compatibility_tests/v3.0.0/commonjs/jasmine.json \ - js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js \ - js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto \ - js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto \ - js/compatibility_tests/v3.0.0/data.proto \ - js/compatibility_tests/v3.0.0/debug_test.js \ - js/compatibility_tests/v3.0.0/jasmine1.json \ - js/compatibility_tests/v3.0.0/jasmine2.json \ - js/compatibility_tests/v3.0.0/jasmine3.json \ - js/compatibility_tests/v3.0.0/message_test.js \ - js/compatibility_tests/v3.0.0/proto3_test.js \ - js/compatibility_tests/v3.0.0/proto3_test.proto \ - js/compatibility_tests/v3.0.0/test2.proto \ - js/compatibility_tests/v3.0.0/test3.proto \ - js/compatibility_tests/v3.0.0/test4.proto \ - js/compatibility_tests/v3.0.0/test5.proto \ - js/compatibility_tests/v3.0.0/testbinary.proto \ - js/compatibility_tests/v3.0.0/testempty.proto \ - js/compatibility_tests/v3.0.0/test.proto \ - js/compatibility_tests/v3.0.0/test.sh \ - js/compatibility_tests/v3.1.0/testempty.proto \ - js/compatibility_tests/v3.1.0/testbinary.proto \ - js/compatibility_tests/v3.1.0/test5.proto \ - js/compatibility_tests/v3.1.0/test4.proto \ - js/compatibility_tests/v3.1.0/test3.proto \ - js/compatibility_tests/v3.1.0/test2.proto \ - js/compatibility_tests/v3.1.0/test.proto \ - js/compatibility_tests/v3.1.0/proto3_test.proto \ - js/compatibility_tests/v3.1.0/proto3_test.js \ - js/compatibility_tests/v3.1.0/message_test.js \ - js/compatibility_tests/v3.1.0/maps_test.js \ - js/compatibility_tests/v3.1.0/debug_test.js \ - js/compatibility_tests/v3.1.0/data.proto \ - js/compatibility_tests/v3.1.0/commonjs/test7/test7.proto \ - js/compatibility_tests/v3.1.0/commonjs/test6/test6.proto \ - js/compatibility_tests/v3.1.0/binary/writer_test.js \ - js/compatibility_tests/v3.1.0/binary/utils_test.js \ - js/compatibility_tests/v3.1.0/binary/reader_test.js \ - js/compatibility_tests/v3.1.0/binary/proto_test.js \ - js/compatibility_tests/v3.1.0/binary/decoder_test.js \ - js/compatibility_tests/v3.1.0/binary/arith_test.js \ - js/data.proto \ - js/debug.js \ - js/debug_test.js \ - js/experimental/runtime/kernel/message_set.js \ - js/experimental/runtime/kernel/message_set_test.js \ - js/experimental/runtime/kernel/tag.js \ - js/experimental/runtime/kernel/tag_test.js \ - js/gulpfile.js \ - js/jasmine.json \ - js/map.js \ - js/maps_test.js \ - js/message.js \ - js/message_test.js \ - js/node_loader.js \ - js/package.json \ - js/proto3_test.js \ - js/proto3_test.proto \ - js/test.proto \ - js/test2.proto \ - js/test3.proto \ - js/test4.proto \ - js/test5.proto \ - js/test8.proto \ - js/test9.proto \ - js/test10.proto \ - js/test11.proto \ - js/test12.proto \ - js/test13.proto \ - js/test14.proto \ - js/test15.proto \ - js/test_bootstrap.js \ - js/testbinary.proto \ - js/testempty.proto \ - js/testlargenumbers.proto \ - js/experimental/runtime/testing/jasmine_protobuf.js \ - js/experimental/runtime/testing/ensure_custom_equality_test.js \ - js/experimental/runtime/testing/binary/test_message.js \ - js/experimental/runtime/kernel/writer_test.js \ - js/experimental/runtime/kernel/writer.js \ - js/experimental/runtime/kernel/wire_type.js \ - js/experimental/runtime/kernel/uint8arrays_test.js \ - js/experimental/runtime/kernel/uint8arrays.js \ - js/experimental/runtime/kernel/uint32_test_pairs.js \ - js/experimental/runtime/kernel/typed_arrays_test.js \ - js/experimental/runtime/kernel/typed_arrays.js \ - js/experimental/runtime/kernel/textencoding_test.js \ - js/experimental/runtime/kernel/textencoding.js \ - js/experimental/runtime/kernel/storage.js \ - js/experimental/runtime/kernel/sint64_test_pairs.js \ - js/experimental/runtime/kernel/sint32_test_pairs.js \ - js/experimental/runtime/kernel/sfixed64_test_pairs.js \ - js/experimental/runtime/kernel/sfixed32_test_pairs.js \ - js/experimental/runtime/kernel/reader_test.js \ - js/experimental/runtime/kernel/reader.js \ - js/experimental/runtime/kernel/packed_uint32_test_pairs.js \ - js/experimental/runtime/kernel/packed_sint64_test_pairs.js \ - js/experimental/runtime/kernel/packed_sint32_test_pairs.js \ - js/experimental/runtime/kernel/packed_sfixed64_test_pairs.js \ - js/experimental/runtime/kernel/packed_sfixed32_test_pairs.js \ - js/experimental/runtime/kernel/packed_int64_test_pairs.js \ - js/experimental/runtime/kernel/packed_int32_test_pairs.js \ - js/experimental/runtime/kernel/packed_float_test_pairs.js \ - js/experimental/runtime/kernel/packed_fixed32_test_pairs.js \ - js/experimental/runtime/kernel/packed_double_test_pairs.js \ - js/experimental/runtime/kernel/packed_bool_test_pairs.js \ - js/experimental/runtime/kernel/kernel_test.js \ - js/experimental/runtime/kernel/kernel_repeated_test.js \ - js/experimental/runtime/kernel/kernel_compatibility_test.js \ - js/experimental/runtime/kernel/kernel.js \ - js/experimental/runtime/kernel/internal_message.js \ - js/experimental/runtime/kernel/int64_test_pairs.js \ - js/experimental/runtime/kernel/int32_test_pairs.js \ - js/experimental/runtime/kernel/indexer_test.js \ - js/experimental/runtime/kernel/indexer.js \ - js/experimental/runtime/kernel/float_test_pairs.js \ - js/experimental/runtime/kernel/fixed32_test_pairs.js \ - js/experimental/runtime/kernel/field.js \ - js/experimental/runtime/kernel/double_test_pairs.js \ - js/experimental/runtime/kernel/conformance/wire_format.js \ - js/experimental/runtime/kernel/conformance/test_all_types_proto3.js \ - js/experimental/runtime/kernel/conformance/test_all_types_proto2.js \ - js/experimental/runtime/kernel/conformance/conformance_testee_runner_node.js \ - js/experimental/runtime/kernel/conformance/conformance_testee.js \ - js/experimental/runtime/kernel/conformance/conformance_response.js \ - js/experimental/runtime/kernel/conformance/conformance_request.js \ - js/experimental/runtime/kernel/buffer_decoder_test.js \ - js/experimental/runtime/kernel/buffer_decoder_helper.js \ - js/experimental/runtime/kernel/buffer_decoder.js \ - js/experimental/runtime/kernel/bool_test_pairs.js \ - js/experimental/runtime/kernel/binary_storage_test.js \ - js/experimental/runtime/kernel/binary_storage.js \ - js/experimental/runtime/internal/checks_test.js \ - js/experimental/runtime/internal/checks.js \ - js/experimental/runtime/int64_test.js \ - js/experimental/runtime/int64.js \ - js/experimental/runtime/bytestring_test.js \ - js/experimental/runtime/bytestring_internal.js \ - js/experimental/runtime/bytestring.js \ - js/experimental/benchmarks/code_size/kernel/popular_types.js \ - js/experimental/benchmarks/code_size/kernel/all_types.js \ - js/experimental/benchmarks/code_size/code_size_base.js \ - js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto3.js \ - js/experimental/benchmarks/code_size/apps_jspb/popular_types_proto2.js \ - js/experimental/benchmarks/code_size/apps_jspb/all_types_proto3.js \ - js/experimental/benchmarks/code_size/apps_jspb/all_types_proto2.js - -all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST) - -EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ - autogen.sh \ - generate_descriptor_proto.sh \ - README.md \ - LICENSE \ - CONTRIBUTORS.txt \ - CHANGES.txt \ - update_file_lists.sh \ - BUILD \ - WORKSPACE \ - cmake/CMakeLists.txt \ - cmake/README.md \ - cmake/conformance.cmake \ - cmake/examples.cmake \ - cmake/extract_includes.bat.in \ - cmake/install.cmake \ - cmake/libprotobuf.cmake \ - cmake/libprotobuf-lite.cmake \ - cmake/libprotoc.cmake \ - cmake/protobuf-config-version.cmake.in \ - cmake/protobuf-config.cmake.in \ - cmake/protobuf-lite.pc.cmake \ - cmake/protobuf-module.cmake.in \ - cmake/protobuf-options.cmake \ - cmake/protobuf.pc.cmake \ - cmake/protoc.cmake \ - cmake/tests.cmake \ - cmake/version.rc.in \ - compiler_config_setting.bzl \ - build_files_updated_unittest.sh \ - cc_proto_blacklist_test.bzl \ - editors/README.txt \ - editors/proto.vim \ - editors/protobuf-mode.el \ - examples/AddPerson.java \ - examples/BUILD \ - examples/CMakeLists.txt \ - examples/ListPeople.java \ - examples/Makefile \ - examples/README.md \ - examples/WORKSPACE \ - examples/add_person.cc \ - examples/add_person.dart \ - examples/add_person.go \ - examples/add_person.py \ - examples/add_person_test.go \ - examples/addressbook.proto \ - examples/list_people.cc \ - examples/list_people.dart \ - examples/list_people.go \ - examples/list_people.py \ - examples/list_people_test.go \ - examples/pubspec.yaml \ - protobuf.bzl \ - protobuf_deps.bzl \ - python/release/wheel/build_wheel_manylinux.sh \ - python/release/wheel/Dockerfile \ - python/release/wheel/protobuf_optimized_pip.sh \ - python/release/wheel/README.md \ - third_party/six.BUILD \ - third_party/zlib.BUILD \ - util/python/BUILD - - -# Deletes all the files generated by autogen.sh. -MAINTAINERCLEANFILES = \ - aclocal.m4 \ - ar-lib \ - config.guess \ - config.sub \ - configure \ - depcomp \ - install-sh \ - ltmain.sh \ - Makefile.in \ - missing \ - mkinstalldirs \ - config.h.in \ - stamp.h.in \ - m4/ltsugar.m4 \ - m4/libtool.m4 \ - m4/ltversion.m4 \ - m4/lt~obsolete.m4 \ - m4/ltoptions.m4 diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec new file mode 100644 index 0000000..6a02640 --- /dev/null +++ b/Protobuf-C++.podspec @@ -0,0 +1,40 @@ +Pod::Spec.new do |s| + s.name = 'Protobuf-C++' + s.version = '4.25.2' + s.summary = 'Protocol Buffers v3 runtime library for C++.' + s.homepage = 'https://github.com/google/protobuf' + s.license = 'BSD-3-Clause' + s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } + s.cocoapods_version = '>= 1.0' + + s.source = { :git => 'https://github.com/google/protobuf.git', + :tag => "v#{s.version}" } + + s.source_files = 'src/google/protobuf/*.{h,cc,inc}', + 'src/google/protobuf/stubs/*.{h,cc}', + 'src/google/protobuf/io/*.{h,cc}', + 'src/google/protobuf/util/*.{h,cc}' + + # Excluding all the tests in the directories above + s.exclude_files = 'src/google/**/*_test.{h,cc,inc}', + 'src/google/**/*_unittest.{h,cc}', + 'src/google/protobuf/test_util*.{h,cc}', + 'src/google/protobuf/map_lite_test_util.{h,cc}', + 'src/google/protobuf/map_test_util*.{h,cc,inc}', + 'src/google/protobuf/reflection_tester.{h,cc}' + + s.header_mappings_dir = 'src' + + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.13' + s.tvos.deployment_target = '12.0' + s.watchos.deployment_target = '6.0' + + s.pod_target_xcconfig = { + # Do not let src/google/protobuf/stubs/time.h override system API + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + 'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/src"' + } + +end diff --git a/Protobuf.podspec b/Protobuf.podspec new file mode 100644 index 0000000..a91120f --- /dev/null +++ b/Protobuf.podspec @@ -0,0 +1,50 @@ +# This file describes to Cocoapods how to integrate the Objective-C runtime into a dependent +# project. +# Despite this file being specific to Objective-C, it needs to be on the root of the repository. +# Otherwise, Cocoapods gives trouble like not picking up the license file correctly, or not letting +# dependent projects use the :git notation to refer to the library. +Pod::Spec.new do |s| + s.name = 'Protobuf' + s.version = '3.25.2' + s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' + s.homepage = 'https://github.com/protocolbuffers/protobuf' + s.license = 'BSD-3-Clause' + s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } + s.cocoapods_version = '>= 1.0' + + s.source = { :git => 'https://github.com/protocolbuffers/protobuf.git', + :tag => "v#{s.version}" } + + s.source_files = 'objectivec/*.{h,m}', + 'objectivec/google/protobuf/Any.pbobjc.h', + 'objectivec/google/protobuf/Api.pbobjc.h', + 'objectivec/google/protobuf/Duration.pbobjc.h', + 'objectivec/google/protobuf/Empty.pbobjc.h', + 'objectivec/google/protobuf/FieldMask.pbobjc.h', + 'objectivec/google/protobuf/SourceContext.pbobjc.h', + 'objectivec/google/protobuf/Struct.pbobjc.h', + 'objectivec/google/protobuf/Timestamp.pbobjc.h', + 'objectivec/google/protobuf/Type.pbobjc.h', + 'objectivec/google/protobuf/Wrappers.pbobjc.h' + # The following would cause duplicate symbol definitions. GPBProtocolBuffers is expected to be + # left out, as it's an umbrella implementation file. + s.exclude_files = 'objectivec/GPBProtocolBuffers.m' + + # Set a CPP symbol so the code knows to use framework imports. + s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' } + s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' } + + s.ios.deployment_target = '10.0' + s.osx.deployment_target = '10.12' + s.tvos.deployment_target = '12.0' + s.watchos.deployment_target = '6.0' + s.requires_arc = false + + # The unittest need the generate sources from the testing related .proto + # files. So to add a `test_spec`, there would also need to be something like a + # `script_phases` to generate them, but there would also need to be a way to + # ensure `protoc` had be built. Another option would be to move to a model + # where the needed files are always generated and checked in. Neither of these + # seem that great at the moment, so the tests have *not* been wired into here + # at this time. +end diff --git a/README.OpenSource b/README.OpenSource old mode 100755 new mode 100644 index 5912dc2..79d82b7 --- a/README.OpenSource +++ b/README.OpenSource @@ -3,7 +3,7 @@ "Name": "google/protobuf", "License": "BSD 3-Clause License", "License File": "LICENSE", - "Version Number": "3.13.0", + "Version Number": "4.25.2", "Upstream URL": "https://github.com/protocolbuffers/protobuf", "Description": "Protocol Buffers - Google's data interchange format." } diff --git a/README.md b/README.md index d5155ae..8e0f555 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,44 @@ Protocol Buffers - Google's data interchange format =================================================== -Copyright 2008 Google Inc. +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/protocolbuffers/protobuf/badge)](https://securityscorecards.dev/viewer/?uri=github.com/protocolbuffers/protobuf) -https://developers.google.com/protocol-buffers/ +Copyright 2023 Google LLC Overview -------- Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. You -can find [protobuf's documentation on the Google Developers site](https://developers.google.com/protocol-buffers/). +can learn more about it in [protobuf's documentation](https://protobuf.dev). This README file contains protobuf installation instructions. To install protobuf, you need to install the protocol compiler (used to compile .proto files) and the protobuf runtime for your chosen programming language. -Protocol Compiler Installation +Protobuf Compiler Installation ------------------------------ -The protocol compiler is written in C++. If you are using C++, please follow +The protobuf compiler is written in C++. If you are using C++, please follow the [C++ Installation Instructions](src/README.md) to install protoc along with the C++ runtime. For non-C++ users, the simplest way to install the protocol compiler is to -download a pre-built binary from our release page: - - [https://github.com/protocolbuffers/protobuf/releases](https://github.com/protocolbuffers/protobuf/releases) +download a pre-built binary from our [GitHub release page](https://github.com/protocolbuffers/protobuf/releases). In the downloads section of each release, you can find pre-built binaries in -zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary -as well as a set of standard .proto files distributed along with protobuf. +zip packages: `protoc-$VERSION-$PLATFORM.zip`. It contains the protoc binary +as well as a set of standard `.proto` files distributed along with protobuf. If you are looking for an old version that is not available in the release -page, check out the maven repo here: - - [https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/) +page, check out the [Maven repository](https://repo1.maven.org/maven2/com/google/protobuf/protoc/). These pre-built binaries are only provided for released versions. If you want -to use the github master version at HEAD, or you need to modify protobuf code, +to use the github main version at HEAD, or you need to modify protobuf code, or you are using C++, it's recommended to build your own protoc binary from source. -If you would like to build protoc binary from source, see the [C++ Installation -Instructions](src/README.md). +If you would like to build protoc binary from source, see the [C++ Installation Instructions](src/README.md). Protobuf Runtime Installation ----------------------------- @@ -52,26 +47,24 @@ Protobuf supports several different programming languages. For each programming language, you can find instructions in the corresponding source directory about how to install protobuf runtime for that specific language: -| Language | Source | Ubuntu | MacOS | Windows | -|--------------------------------------|-------------------------------------------------------------|--------|-------|---------| -| C++ (include C++ runtime and protoc) | [src](src) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcpp_distcheck%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-bazel.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fbazel%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-dist_install.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fdist_install%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp_distcheck%2Fcontinuous) | [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) | -| Java | [java](java) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_compatibility%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_jdk7.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_jdk7%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_oracle7.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_oracle7%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-java_linkage_monitor.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjava_linkage_monitor%2Fcontinuous) | | | -| Python | [python](python) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python27.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython27%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python35.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython35%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python36.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython36%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python37.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython37%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_compatibility%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python27_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython27_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python35_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython35_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python36_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython36_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python37_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython37_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_release%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython_cpp%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython_release%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/windows-python-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fwindows%2Fpython_release%2Fcontinuous) | -| Objective-C | [objectivec](objectivec) | | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_cocoapods_integration.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_cocoapods_integration%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_ios_debug.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_ios_debug%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_ios_release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_ios_release%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-objectivec_osx.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fobjectivec_osx%2Fcontinuous) | | -| C# | [csharp](csharp) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-csharp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcsharp%2Fcontinuous) | | [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/windows-csharp-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fwindows%2Fcsharp_release%2Fcontinuous) | -| JavaScript | [js](js) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-javascript.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fjavascript%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-javascript.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fjavascript%2Fcontinuous) | | -| Ruby | [ruby](ruby) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby23.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby23%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby24.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby24%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby25.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby25%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby26.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby26%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-ruby-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fruby_release%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby23.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby23%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby24.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby24%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby25.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby25%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby26.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby26%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-ruby-release.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fruby_release%2Fcontinuous) | | -| Go | [protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go) | | | | -| PHP | [php](php) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-php_all.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fphp_all%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-32-bit.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2F32-bit%2Fcontinuous) | [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-php5.6_mac.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fphp5.6_mac%2Fcontinuous)
[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-php7.0_mac.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fphp7.0_mac%2Fcontinuous) | | -| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) | [![Build Status](https://travis-ci.org/dart-lang/protobuf.svg?branch=master)](https://travis-ci.org/dart-lang/protobuf) | | | +| Language | Source | +|--------------------------------------|-------------------------------------------------------------| +| C++ (include C++ runtime and protoc) | [src](src) | +| Java | [java](java) | +| Python | [python](python) | +| Objective-C | [objectivec](objectivec) | +| C# | [csharp](csharp) | +| Ruby | [ruby](ruby) | +| Go | [protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go)| +| PHP | [php](php) | +| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) | +| JavaScript | [protocolbuffers/protobuf-javascript](https://github.com/protocolbuffers/protobuf-javascript)| Quick Start ----------- -The best way to learn how to use protobuf is to follow the tutorials in our -developer guide: - -https://developers.google.com/protocol-buffers/docs/tutorials +The best way to learn how to use protobuf is to follow the [tutorials in our +developer guide](https://protobuf.dev/getting-started). If you want to learn from code examples, take a look at the examples in the [examples](examples) directory. @@ -79,7 +72,16 @@ If you want to learn from code examples, take a look at the examples in the Documentation ------------- -The complete documentation for Protocol Buffers is available via the -web at: +The complete documentation is available at the [Protocol Buffers doc site](https://protobuf.dev). + +Support Policy +-------------- + +Read about our [version support policy](https://protobuf.dev/version-support/) +to stay current on support timeframes for the language libraries. + +Developer Community +------------------- -https://developers.google.com/protocol-buffers/ +To be alerted to upcoming changes in Protocol Buffers and connect with protobuf developers and users, +[join the Google Group](https://groups.google.com/g/protobuf). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..76a40ee --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,4 @@ +To report security concerns or vulnerabilities within protobuf, please use +Google's official channel for reporting these. + +https://www.google.com/appserve/security-bugs/m2/new diff --git a/WORKSPACE b/WORKSPACE index cb16ae8..2c665be 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -7,86 +7,194 @@ local_repository( path = "examples", ) +# Load common dependencies first to ensure we use the correct version +load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") + +protobuf_deps() + +# Bazel platform rules. +http_archive( + name = "platforms", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz", + "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz", + ], + sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51", +) + http_archive( name = "com_google_googletest", - sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", - strip_prefix = "googletest-release-1.10.0", + sha256 = "730215d76eace9dd49bf74ce044e8daa065d175f1ac891cc1d6bb184ef94e565", + strip_prefix = "googletest-f53219cdcb7b084ef57414efea92ee5b71989558", urls = [ - "https://mirror.bazel.build/github.com/google/googletest/archive/release-1.10.0.tar.gz", - "https://github.com/google/googletest/archive/release-1.10.0.tar.gz", + "https://github.com/google/googletest/archive/f53219cdcb7b084ef57414efea92ee5b71989558.tar.gz" # 2023-03-16 ], ) -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:protobuf_deps.bzl", "protobuf_deps") +load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps") -# Load common dependencies. -protobuf_deps() -load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") +googletest_deps() -bind( - name = "python_headers", - actual = "//util/python:python_headers", -) +load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") -# TODO(yannic): Remove in 3.13.0. -bind( - name = "gtest", - actual = "@com_google_googletest//:gtest", -) +rules_jvm_external_deps() -# TODO(yannic): Remove in 3.13.0. -bind( - name = "gtest_main", - actual = "@com_google_googletest//:gtest_main", -) +load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") + +rules_jvm_external_setup() -jvm_maven_import_external( - name = "guava_maven", - artifact = "com.google.guava:guava:18.0", - artifact_sha256 = "d664fbfc03d2e5ce9cab2a44fb01f1d0bf9dfebeccc1a473b1f9ea31f79f6f99", - server_urls = [ - "https://jcenter.bintray.com/", +load("@rules_jvm_external//:defs.bzl", "maven_install") + +maven_install( + artifacts = PROTOBUF_MAVEN_ARTIFACTS, + # For updating instructions, see: + # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson + maven_install_json = "//:maven_install.json", + repositories = [ "https://repo1.maven.org/maven2", + "https://repo.maven.apache.org/maven2", ], ) -bind( - name = "guava", - actual = "@guava_maven//jar", +load("@maven//:defs.bzl", "pinned_maven_install") + +pinned_maven_install() + +# For `cc_proto_blacklist_test` and `build_test`. +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + +load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") + +rules_pkg_dependencies() + +load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") + +apple_rules_dependencies() + +# For `kt_jvm_library` +load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") + +kotlin_repositories() + +load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") + +kt_register_toolchains() + +load("@rules_ruby//ruby:defs.bzl", "ruby_runtime") + +ruby_runtime("system_ruby") + +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( + name = "protobuf_bundle", + srcs = ["//ruby:google-protobuf.gemspec"], + gemfile = "//ruby:Gemfile", ) -jvm_maven_import_external( - name = "gson_maven", - artifact = "com.google.code.gson:gson:2.7", - artifact_sha256 = "2d43eb5ea9e133d2ee2405cc14f5ee08951b8361302fdd93494a3a997b508d32", - server_urls = [ - "https://jcenter.bintray.com/", - "https://repo1.maven.org/maven2", +http_archive( + name = "lua", + build_file = "//bazel: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", ], ) -bind( - name = "gson", - actual = "@gson_maven//jar", +http_archive( + name = "com_github_google_benchmark", + urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"], + strip_prefix = "benchmark-0baacde3618ca617da95375e0af13ce1baadea47", + sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0", ) -jvm_maven_import_external( - name = "error_prone_annotations_maven", - artifact = "com.google.errorprone:error_prone_annotations:2.3.2", - artifact_sha256 = "357cd6cfb067c969226c442451502aee13800a24e950fdfde77bcdb4565a668d", - server_urls = [ - "https://jcenter.bintray.com/", - "https://repo1.maven.org/maven2", - ], +http_archive( + name = "com_google_googleapis", + urls = ["https://github.com/googleapis/googleapis/archive/30ed2662a85403cbdeb9ea38df1e414a2a276b83.zip"], + strip_prefix = "googleapis-30ed2662a85403cbdeb9ea38df1e414a2a276b83", + sha256 = "4dfc28101127d22abd6f0f6308d915d490c4594c0cfcf7643769c446d6763a46", + build_file = "//benchmarks:BUILD.googleapis", + patch_cmds = ["find google -type f -name BUILD.bazel -delete"], +) + +load("//bazel:system_python.bzl", "system_python") + +system_python( + name = "system_python", + minimum_python_version = "3.7", +) + +load("@system_python//:pip.bzl", "pip_parse") + +pip_parse( + name = "pip_deps", + requirements = "//python:requirements.txt", ) +load("@pip_deps//:requirements.bzl", "install_deps") + +install_deps() + +load("@utf8_range//:workspace_deps.bzl", "utf8_range_deps") + +utf8_range_deps() + +http_archive( + name = "rules_fuzzing", + sha256 = "d9002dd3cd6437017f08593124fdd1b13b3473c7b929ceb0e60d317cb9346118", + strip_prefix = "rules_fuzzing-0.3.2", + urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.3.2.zip"], +) + +load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies") + +rules_fuzzing_dependencies() + bind( - name = "error_prone_annotations", - actual = "@error_prone_annotations_maven//jar", + name = "python_headers", + actual = "@system_python//:python_headers", ) -# For `cc_proto_blacklist_test`. -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") +http_archive( + name = "rules_rust", + sha256 = "4a9cb4fda6ccd5b5ec393b2e944822a62e050c7c06f1ea41607f14c4fdec57a2", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/rules_rust-v0.25.1.tar.gz"], +) -bazel_skylib_workspace() +load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") + +rules_rust_dependencies() + +rust_register_toolchains(edition = "2021") +load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository") +# to repin, invoke `CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index` +crates_repository( + name = "crate_index", + cargo_lockfile = "//:Cargo.lock", + lockfile = "//:Cargo.bazel.lock", + packages = { + "googletest": crate.spec( + version = ">0.0.0", + ), + }, +) + +load("@crate_index//:defs.bzl", "crate_repositories") +crate_repositories() diff --git a/appveyor.bat b/appveyor.bat index 7a35ceb..c8c5199 100644 --- a/appveyor.bat +++ b/appveyor.bat @@ -38,8 +38,8 @@ dotnet restore dotnet build -c %configuration% || goto error echo Testing C# -dotnet test -c %configuration% -f netcoreapp2.1 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error -dotnet test -c %configuration% -f net451 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error +dotnet test -c %configuration% -f net6.0 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error +dotnet test -c %configuration% -f net462 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error goto :EOF diff --git a/appveyor.yml b/appveyor.yml index 91f737a..1e2834b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,16 +3,16 @@ configuration: environment: matrix: - # Only test few combinations: "Visual Studio 2015 (14) + Win64/MinGW + Debug + DLL". We can + # Only test few combinations: "Visual Studio 2017 (15) + Win64/MinGW + Debug + DLL". We can # test more combinations but AppVeyor just takes too long to finish (each # combination takes ~15mins). - platform: MinGW language: cpp - image: Visual Studio 2015 + image: Visual Studio 2017 - platform: Win64 language: cpp - image: Visual Studio 2015 + image: Visual Studio 2017 BUILD_DLL: ON UNICODE: ON @@ -35,8 +35,8 @@ install: before_build: - if %platform%==MinGW set generator=MinGW Makefiles - - if %platform%==Win32 set generator=Visual Studio 14 - - if %platform%==Win64 set generator=Visual Studio 14 Win64 + - if %platform%==Win32 set generator=Visual Studio 15 + - if %platform%==Win64 set generator=Visual Studio 15 Win64 - if %platform%==Win32 set vcplatform=Win32 - if %platform%==Win64 set vcplatform=x64 diff --git a/bazel/BUILD b/bazel/BUILD new file mode 100644 index 0000000..b08bf4e --- /dev/null +++ b/bazel/BUILD @@ -0,0 +1,59 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +load("@rules_python//python:defs.bzl", "py_binary") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + +# begin:google_only +# package(default_applicable_licenses = ["//upb:license"]) +# end:google_only + +licenses(["notice"]) + +py_binary( + name = "amalgamate", + srcs = ["amalgamate.py"], + visibility = ["//upb:__pkg__"], +) + +# py_proto_library() is private rule, only intended for internal use by upb. +# Hopefully py_proto_library() will eventually be availble in rules_proto or +# another upstream package. +bzl_library( + name = "py_proto_library_bzl", + srcs = ["py_proto_library.bzl"], +) + +bzl_library( + name = "upb_proto_library_internal_bzl", + srcs = [ + "upb_proto_library_internal/aspect.bzl", + "upb_proto_library_internal/cc_library_func.bzl", + "upb_proto_library_internal/copts.bzl", + "upb_proto_library_internal/rule.bzl", + ], + deps = [ + "@bazel_skylib//lib:paths", + "@rules_proto//proto:defs", + "@bazel_tools//tools/cpp:toolchain_utils.bzl", + ], +) + +bzl_library( + name = "upb_proto_library_bzl", + srcs = [ + "upb_c_proto_library.bzl", + "upb_minitable_proto_library.bzl", + "upb_proto_library.bzl", + "upb_proto_reflection_library.bzl", + ], + visibility = ["//visibility:public"], + deps = [ + ":upb_proto_library_internal_bzl", + "@rules_proto//proto:defs", + ], +) diff --git a/bazel/amalgamate.py b/bazel/amalgamate.py new file mode 100644 index 0000000..8dc14cb --- /dev/null +++ b/bazel/amalgamate.py @@ -0,0 +1,136 @@ +#!/usr/bin/python +# +# 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. + +import sys +import re +import os + +INCLUDE_RE = re.compile('^#include "([^"]*)"') + +def parse_include(line): + match = INCLUDE_RE.match(line) + return match.groups()[0] if match else None + +class Amalgamator: + def __init__(self, h_out, c_out): + self.include_paths = ["."] + self.included = set() + self.output_h = open(h_out, "w") + self.output_c = open(c_out, "w") + self.h_out = h_out.split("/")[-1] + + def amalgamate(self, h_files, c_files): + self.h_files = set(h_files) + self.output_c.write("/* Amalgamated source file */\n") + self.output_c.write('#include "%s"\n' % (self.h_out)) + if self.h_out == "ruby-upb.h": + self.output_h.write("// Ruby is still using proto3 enum semantics for proto2\n") + self.output_h.write("#define UPB_DISABLE_PROTO2_ENUM_CHECKING\n") + + self.output_h.write("/* Amalgamated source file */\n") + + port_def = self._find_include_file("upb/port/def.inc") + port_undef = self._find_include_file("upb/port/undef.inc") + self._process_file(port_def, self.output_h) + self._process_file(port_def, self.output_c) + + for file in c_files: + self._process_file(file, self.output_c) + + self._process_file(port_undef, self.output_h) + self._process_file(port_undef, self.output_c) + + def _process_file(self, infile_name, outfile): + lines = open(infile_name).readlines() + + has_copyright = lines[0].startswith( + "// Protocol Buffers - Google's data interchange format" + ) + if has_copyright: + while not lines[0].startswith( + "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH" + " DAMAGE" + ) and not lines[0].startswith( + "// https://developers.google.com/open-source/licenses/bsd" + ): + lines.pop(0) + lines.pop(0) + + for line in lines: + if not self._process_include(line): + outfile.write(line) + + def _find_include_file(self, name): + for h_file in self.h_files: + if h_file.endswith(name): + return h_file + + def _process_include(self, line): + include = parse_include(line) + if not include: + return False + if not (include.startswith("upb") or include.startswith("google")): + return False + if include and (include.endswith("port/def.inc") or include.endswith("port/undef.inc")): + # Skip, we handle this separately + return True + if include.endswith("hpp"): + # Skip, we don't support the amalgamation from C++. + return True + elif include in self.included: + return True + else: + # Include this upb header inline. + h_file = self._find_include_file(include) + if h_file: + self.h_files.remove(h_file) + self.included.add(include) + self._process_file(h_file, self.output_h) + return True + raise RuntimeError("Couldn't find include: " + include + ", h_files=" + repr(self.h_files)) + +# ---- main ---- + +c_out = sys.argv[1] +h_out = sys.argv[2] +amalgamator = Amalgamator(h_out, c_out) +c_files = [] +h_files = [] + +for arg in sys.argv[3:]: + arg = arg.strip() + if arg.endswith(".h") or arg.endswith(".inc"): + h_files.append(arg) + else: + c_files.append(arg) + +amalgamator.amalgamate(h_files, c_files) diff --git a/bazel/amalgamation.bzl b/bazel/amalgamation.bzl new file mode 100644 index 0000000..dd8ddf6 --- /dev/null +++ b/bazel/amalgamation.bzl @@ -0,0 +1,67 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +"""Internal rules for building upb.""" + +load(":upb_proto_library.bzl", "GeneratedSrcsInfo") + +# upb_amalgamation() rule, with file_list aspect. + +SrcList = provider( + fields = { + "srcs": "list of srcs", + }, +) + +def _file_list_aspect_impl(target, ctx): + if GeneratedSrcsInfo in target: + srcs = target[GeneratedSrcsInfo] + return [SrcList(srcs = srcs.srcs + srcs.hdrs)] + + srcs = [] + for src in ctx.rule.attr.srcs: + srcs += src.files.to_list() + for hdr in ctx.rule.attr.hdrs: + srcs += hdr.files.to_list() + for hdr in ctx.rule.attr.textual_hdrs: + srcs += hdr.files.to_list() + return [SrcList(srcs = srcs)] + +_file_list_aspect = aspect( + implementation = _file_list_aspect_impl, +) + +def _upb_amalgamation(ctx): + inputs = [] + for lib in ctx.attr.libs: + inputs += lib[SrcList].srcs + srcs = [src for src in inputs if not src.path.endswith("hpp")] + ctx.actions.run( + inputs = inputs, + outputs = ctx.outputs.outs, + arguments = [f.path for f in ctx.outputs.outs] + [f.path for f in srcs], + progress_message = "Making amalgamation", + executable = ctx.executable._amalgamator, + ) + return [] + +upb_amalgamation = rule( + attrs = { + "_amalgamator": attr.label( + executable = True, + cfg = "exec", + default = "//bazel:amalgamate", + ), + "prefix": attr.string( + default = "", + ), + "libs": attr.label_list(aspects = [_file_list_aspect]), + "outs": attr.output_list(), + "strip_import_prefix": attr.string_list(), + }, + implementation = _upb_amalgamation, +) diff --git a/bazel/build_defs.bzl b/bazel/build_defs.bzl new file mode 100644 index 0000000..64c877e --- /dev/null +++ b/bazel/build_defs.bzl @@ -0,0 +1,82 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +"""Internal rules for building upb.""" + +_DEFAULT_CPPOPTS = [] +_DEFAULT_COPTS = [] + +# begin:github_only +_DEFAULT_CPPOPTS.extend([ + "-Wextra", + # "-Wshorten-64-to-32", # not in GCC (and my Kokoro images doesn't have Clang) + "-Wno-unused-parameter", + "-Wno-long-long", +]) +_DEFAULT_COPTS.extend([ + "-std=c99", + "-Wall", + "-Wstrict-prototypes", + # GCC (at least) emits spurious warnings for this that cannot be fixed + # without introducing redundant initialization (with runtime cost): + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 + #"-Wno-maybe-uninitialized", +]) +# end:github_only + +UPB_DEFAULT_CPPOPTS = select({ + "//upb:windows": [], + "//conditions:default": _DEFAULT_CPPOPTS, +}) + +UPB_DEFAULT_COPTS = select({ + "//upb:windows": [], + "//upb:fasttable_enabled_setting": ["-std=gnu99", "-DUPB_ENABLE_FASTTABLE"], + "//conditions:default": _DEFAULT_COPTS, +}) + +runfiles_init = """\ +# --- begin runfiles.bash initialization v2 --- +# Copy-pasted from the Bazel Bash runfiles library v2. +set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v2 --- +""" + +def _get_real_short_path(file): + # For some reason, files from other archives have short paths that look like: + # ../com_google_protobuf/google/protobuf/descriptor.proto + short_path = file.short_path + if short_path.startswith("../"): + second_slash = short_path.index("/", 3) + short_path = short_path[second_slash + 1:] + return short_path + +def _get_real_root(file): + real_short_path = _get_real_short_path(file) + return file.path[:-len(real_short_path) - 1] + +def _get_real_roots(files): + roots = {} + for file in files: + real_root = _get_real_root(file) + if real_root: + roots[real_root] = True + return roots.keys() + +def make_shell_script(name, contents, out): + contents = contents.replace("$", "$$") + native.genrule( + name = "gen_" + name, + outs = [out], + cmd = "(cat <<'HEREDOC'\n%s\nHEREDOC\n) > $@" % contents, + ) diff --git a/bazel/lua.BUILD b/bazel/lua.BUILD new file mode 100644 index 0000000..55a449f --- /dev/null +++ b/bazel/lua.BUILD @@ -0,0 +1,109 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +package( + default_visibility = ["//visibility:public"], +) + +cc_library( + name = "liblua_headers", + hdrs = [ + "src/lauxlib.h", + "src/lua.h", + "src/lua.hpp", + "src/luaconf.h", + "src/lualib.h", + ], + defines = ["LUA_USE_LINUX"], + includes = ["src"], +) + +cc_library( + name = "liblua", + srcs = [ + "src/lapi.c", + "src/lapi.h", + "src/lauxlib.c", + "src/lauxlib.h", + "src/lbaselib.c", + "src/lbitlib.c", + "src/lcode.c", + "src/lcode.h", + "src/lcorolib.c", + "src/lctype.c", + "src/lctype.h", + "src/ldblib.c", + "src/ldebug.c", + "src/ldebug.h", + "src/ldo.c", + "src/ldo.h", + "src/ldump.c", + "src/lfunc.c", + "src/lfunc.h", + "src/lgc.c", + "src/lgc.h", + "src/linit.c", + "src/liolib.c", + "src/llex.c", + "src/llex.h", + "src/llimits.h", + "src/lmathlib.c", + "src/lmem.c", + "src/lmem.h", + "src/loadlib.c", + "src/lobject.c", + "src/lobject.h", + "src/lopcodes.c", + "src/lopcodes.h", + "src/loslib.c", + "src/lparser.c", + "src/lparser.h", + "src/lstate.c", + "src/lstate.h", + "src/lstring.c", + "src/lstring.h", + "src/lstrlib.c", + "src/ltable.c", + "src/ltable.h", + "src/ltablib.c", + "src/ltm.c", + "src/ltm.h", + "src/lundump.c", + "src/lundump.h", + "src/lvm.c", + "src/lvm.h", + "src/lzio.c", + "src/lzio.h", + ], + hdrs = [ + "src/lauxlib.h", + "src/lua.h", + "src/lua.hpp", + "src/luaconf.h", + "src/lualib.h", + ], + defines = ["LUA_USE_LINUX"], + includes = ["src"], + linkopts = [ + "-lm", + "-ldl", + ], +) + +cc_binary( + name = "lua", + srcs = [ + "src/lua.c", + ], + linkopts = [ + "-lreadline", + "-rdynamic", + ], + deps = [ + ":liblua", + ], +) diff --git a/bazel/py_proto_library.bzl b/bazel/py_proto_library.bzl new file mode 100644 index 0000000..08ff9a8 --- /dev/null +++ b/bazel/py_proto_library.bzl @@ -0,0 +1,139 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +"""An implementation of py_proto_library(). + +We have to implement this ourselves because there is currently no reasonable +py_proto_library() rule available for Bazel. + +Our py_proto_library() is similar to how a real py_proto_library() should work. +But it hasn't been deeply tested or reviewed, and upb should not be in the +business of vending py_proto_library(), so we keep it private to upb. +""" + +load("@bazel_skylib//lib:paths.bzl", "paths") + +# begin:github_only +load("@rules_proto//proto:defs.bzl", "ProtoInfo") +# end:github_only + +# Generic support code ######################################################### + +# begin:github_only +_is_google3 = False +# end:github_only + +# begin:google_only +# _is_google3 = True +# end:google_only + +def _get_real_short_path(file): + # For some reason, files from other archives have short paths that look like: + # ../com_google_protobuf/google/protobuf/descriptor.proto + short_path = file.short_path + if short_path.startswith("../"): + second_slash = short_path.index("/", 3) + short_path = short_path[second_slash + 1:] + + # Sometimes it has another few prefixes like: + # _virtual_imports/any_proto/google/protobuf/any.proto + # benchmarks/_virtual_imports/100_msgs_proto/benchmarks/100_msgs.proto + # We want just google/protobuf/any.proto. + virtual_imports = "_virtual_imports/" + if virtual_imports in short_path: + short_path = short_path.split(virtual_imports)[1].split("/", 1)[1] + return short_path + +def _get_real_root(ctx, file): + real_short_path = _get_real_short_path(file) + root = file.path[:-len(real_short_path) - 1] + + if not _is_google3 and ctx.rule.attr.strip_import_prefix: + root = paths.join(root, ctx.rule.attr.strip_import_prefix[1:]) + return root + +def _generate_output_file(ctx, src, extension): + package = ctx.label.package + if not _is_google3: + strip_import_prefix = ctx.rule.attr.strip_import_prefix + if strip_import_prefix and strip_import_prefix != "/": + if not package.startswith(strip_import_prefix[1:]): + fail("%s does not begin with prefix %s" % (package, strip_import_prefix)) + package = package[len(strip_import_prefix):] + + real_short_path = _get_real_short_path(src) + real_short_path = paths.relativize(real_short_path, package) + output_filename = paths.replace_extension(real_short_path, extension) + ret = ctx.actions.declare_file(output_filename) + return ret + +# py_proto_library() ########################################################### + +def _py_proto_library_rule_impl(ctx): + # A real py_proto_library() should enforce this constraint. + # We don't bother for now, since it saves us some effort not to. + # + # if len(ctx.attr.deps) != 1: + # fail("only one deps dependency allowed.") + + files = [] + for dep in ctx.attr.deps: + files += dep[PyInfo].transitive_sources.to_list() + return [ + DefaultInfo(files = depset(direct = files)), + ] + +def _py_proto_library_aspect_impl(target, ctx): + proto_info = target[ProtoInfo] + proto_sources = proto_info.direct_sources + srcs = [_generate_output_file(ctx, name, "_pb2.py") for name in proto_sources] + transitive_sets = proto_info.transitive_descriptor_sets.to_list() + ctx.actions.run( + inputs = depset( + direct = [proto_info.direct_descriptor_set], + transitive = [proto_info.transitive_descriptor_sets], + ), + outputs = srcs, + executable = ctx.executable._protoc, + arguments = [ + "--python_out=" + _get_real_root(ctx, srcs[0]), + "--descriptor_set_in=" + ctx.configuration.host_path_separator.join([f.path for f in transitive_sets]), + ] + + [_get_real_short_path(file) for file in proto_sources], + progress_message = "Generating Python protos for :" + ctx.label.name, + ) + outs_depset = depset(srcs) + return [ + PyInfo(transitive_sources = outs_depset), + ] + +_py_proto_library_aspect = aspect( + attrs = { + "_protoc": attr.label( + executable = True, + cfg = "exec", + default = "//:protoc", + ), + }, + implementation = _py_proto_library_aspect_impl, + provides = [ + PyInfo, + ], + attr_aspects = ["deps"], +) + +py_proto_library = rule( + output_to_genfiles = True, + implementation = _py_proto_library_rule_impl, + attrs = { + "deps": attr.label_list( + aspects = [_py_proto_library_aspect], + allow_rules = ["proto_library"], + providers = [ProtoInfo], + ), + }, +) diff --git a/bazel/python_downloads.bzl b/bazel/python_downloads.bzl new file mode 100644 index 0000000..5ddac20 --- /dev/null +++ b/bazel/python_downloads.bzl @@ -0,0 +1,84 @@ +"""Helper methods to download different python versions""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +limited_api_build_file = """ +cc_library( + name = "python_headers", + hdrs = glob(["**/Include/**/*.h"]), + strip_include_prefix = "Python-{}/Include", + visibility = ["//visibility:public"], +) +""" + +def python_source_archive(name, sha256): + """Helper method to create a python_headers target that will work for linux and macos. + + Args: + name: The name of the target, should be in the form python_{VERSION} + sha256: The sha256 of the python package for the specified version + """ + version = name.split("-")[1] + http_archive( + name = name, + urls = [ + "https://www.python.org/ftp/python/{0}/Python-{0}.tgz" + .format(version), + ], + sha256 = sha256, + build_file_content = limited_api_build_file.format(version), + patch_cmds = [ + "echo '#define SIZEOF_WCHAR_T 4' > Python-{}/Include/pyconfig.h" + .format(version), + ], + ) + +nuget_build_file = """ +cc_import( + name = "python_full_api", + hdrs = glob(["**/*.h"]), + shared_library = "python{0}.dll", + interface_library = "libs/python{0}.lib", + visibility = ["@com_google_protobuf//python:__pkg__"], +) + +cc_import( + name = "python_limited_api", + hdrs = glob(["**/*.h"]), + shared_library = "python{1}.dll", + interface_library = "libs/python{1}.lib", + visibility = ["@com_google_protobuf//python:__pkg__"], +) +""" + +def python_nuget_package(name, sha256): + """Helper method to create full and limited api dependencies for windows using nuget + + Args: + name: The name of the target, should be in the form nuget_python_{CPU}_{VERSION} + sha256: The sha256 of the nuget package for that version + """ + cpu = name.split("_")[2] + version = name.split("_")[3] + + full_api_lib_number = version.split(".")[0] + version.split(".")[1] + limited_api_lib_number = version.split(".")[0] + + folder_name_dict = { + "i686": "pythonx86", + "x86-64": "python", + } + + http_archive( + name = name, + urls = [ + "https://www.nuget.org/api/v2/package/{}/{}" + .format(folder_name_dict[cpu], version), + ], + sha256 = sha256, + strip_prefix = "tools", + build_file_content = + nuget_build_file.format(full_api_lib_number, limited_api_lib_number), + type = "zip", + patch_cmds = ["cp -r include/* ."], + ) diff --git a/bazel/system_python.bzl b/bazel/system_python.bzl new file mode 100644 index 0000000..29400be --- /dev/null +++ b/bazel/system_python.bzl @@ -0,0 +1,275 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +"""Repository rule for using Python 3.x headers from the system.""" + +# Mock out rules_python's pip.bzl for cases where no system python is found. +_mock_pip = """ +def _pip_install_impl(repository_ctx): + repository_ctx.file("BUILD.bazel", ''' +py_library( + name = "noop", + visibility = ["//visibility:public"], +) +''') + repository_ctx.file("requirements.bzl", ''' +def install_deps(*args, **kwargs): + print("WARNING: could not install pip dependencies") + +def requirement(*args, **kwargs): + return "@{}//:noop" +'''.format(repository_ctx.attr.name)) +pip_install = repository_rule( + implementation = _pip_install_impl, + attrs = { + "requirements": attr.string(), + "requirements_overrides": attr.string_dict(), + "python_interpreter_target": attr.string(), + }, +) +pip_parse = pip_install +""" + +# Alias rules_python's pip.bzl for cases where a system python is found. +_alias_pip = """ +load("@rules_python//python:pip.bzl", _pip_install = "pip_install", _pip_parse = "pip_parse") + +def _get_requirements(requirements, requirements_overrides): + for version, override in requirements_overrides.items(): + if version in "{python_version}": + requirements = override + break + return requirements + +def pip_install(requirements, requirements_overrides={{}}, **kwargs): + _pip_install( + python_interpreter_target = "@{repo}//:interpreter", + requirements = _get_requirements(requirements, requirements_overrides), + **kwargs, + ) +def pip_parse(requirements, requirements_overrides={{}}, **kwargs): + _pip_parse( + python_interpreter_target = "@{repo}//:interpreter", + requirements = _get_requirements(requirements, requirements_overrides), + **kwargs, + ) +""" + +_mock_fuzzing_py = """ +def fuzzing_py_install_deps(): + print("WARNING: could not install fuzzing_py dependencies") +""" + +# Alias rules_fuzzing's requirements.bzl for cases where a system python is found. +_alias_fuzzing_py = """ +load("@fuzzing_py_deps//:requirements.bzl", _fuzzing_py_install_deps = "install_deps") + +def fuzzing_py_install_deps(): + _fuzzing_py_install_deps() +""" + +_build_file = """ +load("@bazel_skylib//lib:selects.bzl", "selects") +load("@bazel_skylib//rules:common_settings.bzl", "string_flag") +load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair") + +cc_library( + name = "python_headers", + hdrs = glob(["python/**/*.h"], allow_empty = True), + includes = ["python"], + visibility = ["//visibility:public"], +) + +string_flag( + name = "internal_python_support", + build_setting_default = "{support}", + values = [ + "None", + "Supported", + "Unsupported", + ] +) + +config_setting( + name = "none", + flag_values = {{ + ":internal_python_support": "None", + }}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "supported", + flag_values = {{ + ":internal_python_support": "Supported", + }}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "unsupported", + flag_values = {{ + ":internal_python_support": "Unsupported", + }}, + visibility = ["//visibility:public"], +) + +selects.config_setting_group( + name = "exists", + match_any = [":supported", ":unsupported"], + visibility = ["//visibility:public"], +) + +sh_binary( + name = "interpreter", + srcs = ["interpreter"], + visibility = ["//visibility:public"], +) + +py_runtime( + name = "py3_runtime", + interpreter_path = "{interpreter}", + python_version = "PY3", +) + +py_runtime_pair( + name = "runtime_pair", + py3_runtime = ":py3_runtime", +) + +toolchain( + name = "python_toolchain", + toolchain = ":runtime_pair", + toolchain_type = "@rules_python//python:toolchain_type", +) +""" + +_register = """ +def register_system_python(): + native.register_toolchains("@{}//:python_toolchain") +""" + +_mock_register = """ +def register_system_python(): + pass +""" + +def _get_python_version(repository_ctx): + py_program = "import sys; print(str(sys.version_info.major) + '.' + str(sys.version_info.minor) + '.' + str(sys.version_info.micro))" + result = repository_ctx.execute(["python3", "-c", py_program]) + return (result.stdout).strip().split(".") + +def _get_python_path(repository_ctx): + py_program = "import sysconfig; print(sysconfig.get_config_var('%s'), end='')" + result = repository_ctx.execute(["python3", "-c", py_program % ("INCLUDEPY")]) + if result.return_code != 0: + return None + return result.stdout + +def _populate_package(ctx, path, python3, python_version): + ctx.symlink(path, "python") + supported = True + for idx, v in enumerate(ctx.attr.minimum_python_version.split(".")): + if int(python_version[idx]) < int(v): + supported = False + break + if "win" in ctx.os.name: + # buildifier: disable=print + print("WARNING: python is not supported on Windows") + supported = False + + build_file = _build_file.format( + interpreter = python3, + support = "Supported" if supported else "Unsupported", + ) + + ctx.file("interpreter", "#!/bin/sh\nexec {} \"$@\"".format(python3)) + ctx.file("BUILD.bazel", build_file) + ctx.file("version.bzl", "SYSTEM_PYTHON_VERSION = '{}{}'".format(python_version[0], python_version[1])) + ctx.file("register.bzl", _register.format(ctx.attr.name)) + if supported: + ctx.file("pip.bzl", _alias_pip.format( + python_version = ".".join(python_version), + repo = ctx.attr.name, + )) + ctx.file("fuzzing_py.bzl", _alias_fuzzing_py) + else: + # Dependencies are unlikely to be satisfiable for unsupported versions of python. + ctx.file("pip.bzl", _mock_pip) + ctx.file("fuzzing_py.bzl", _mock_fuzzing_py) + +def _populate_empty_package(ctx): + # Mock out all the entrypoints we need to run from WORKSPACE. Targets that + # actually need python should use `target_compatible_with` and the generated + # @system_python//:exists or @system_python//:supported constraints. + ctx.file( + "BUILD.bazel", + _build_file.format( + interpreter = "", + support = "None", + ), + ) + ctx.file("version.bzl", "SYSTEM_PYTHON_VERSION = 'None'") + ctx.file("register.bzl", _mock_register) + ctx.file("pip.bzl", _mock_pip) + ctx.file("fuzzing_py.bzl", _mock_fuzzing_py) + +def _system_python_impl(repository_ctx): + path = _get_python_path(repository_ctx) + python3 = repository_ctx.which("python3") + python_version = _get_python_version(repository_ctx) + + if path and python_version[0] == "3": + _populate_package(repository_ctx, path, python3, python_version) + else: + # buildifier: disable=print + print("WARNING: no system python available, builds against system python will fail") + _populate_empty_package(repository_ctx) + +# The system_python() repository rule exposes information from the version of python installed in the current system. +# +# In WORKSPACE: +# system_python( +# name = "system_python_repo", +# minimum_python_version = "3.7", +# ) +# +# This repository exposes some repository rules for configuring python in Bazel. The python toolchain +# *must* be registered in your WORKSPACE: +# load("@system_python_repo//:register.bzl", "register_system_python") +# register_system_python() +# +# Pip dependencies can optionally be specified using a wrapper around rules_python's repository rules: +# load("@system_python//:pip.bzl", "pip_install") +# pip_install( +# name="pip_deps", +# requirements = "@com_google_protobuf//python:requirements.txt", +# ) +# An optional argument `requirements_overrides` takes a dictionary mapping python versions to alternate +# requirements files. This works around the requirement for fully pinned dependencies in python_rules. +# +# Four config settings are exposed from this repository to help declare target compatibility in Bazel. +# For example, `@system_python_repo//:exists` will be true if a system python version has been found. +# The `none` setting will be true only if no python version was found, and `supported`/`unsupported` +# correspond to whether or not the system version is compatible with `minimum_python_version`. +# +# This repository also exposes a header rule that you can depend on from BUILD files: +# cc_library( +# name = "foobar", +# srcs = ["foobar.cc"], +# deps = ["@system_python_repo//:python_headers"], +# ) +# +# The headers should correspond to the version of python obtained by running +# the `python3` command on the system. +system_python = repository_rule( + implementation = _system_python_impl, + local = True, + attrs = { + "minimum_python_version": attr.string(default = "3.7"), + }, +) diff --git a/bazel/upb_c_proto_library.bzl b/bazel/upb_c_proto_library.bzl new file mode 100644 index 0000000..108582e --- /dev/null +++ b/bazel/upb_c_proto_library.bzl @@ -0,0 +1,70 @@ +"""upb_c_proto_library() exposes upb's generated C API for protobuf (foo.upb.h)""" + +load("//bazel:upb_minitable_proto_library.bzl", "UpbMinitableCcInfo", "upb_minitable_proto_library_aspect") +load("//bazel:upb_proto_library_internal/aspect.bzl", "upb_proto_aspect_impl") +load("//bazel:upb_proto_library_internal/cc_library_func.bzl", "upb_use_cpp_toolchain") +load("//bazel:upb_proto_library_internal/rule.bzl", "upb_proto_rule_impl") + +UpbWrappedCcInfo = provider( + "Provider for cc_info for protos", + fields = ["cc_info", "cc_info_with_thunks"], +) + +_UpbWrappedGeneratedSrcsInfo = provider( + "Provider for generated sources", + fields = ["srcs"], +) + +def _upb_c_proto_library_aspect_impl(target, ctx): + return upb_proto_aspect_impl( + target = target, + ctx = ctx, + generator = "upb", + cc_provider = UpbWrappedCcInfo, + dep_cc_provider = UpbMinitableCcInfo, + file_provider = _UpbWrappedGeneratedSrcsInfo, + provide_cc_shared_library_hints = False, + ) + +upb_c_proto_library_aspect = aspect( + attrs = { + "_copts": attr.label( + default = "//upb:upb_proto_library_copts__for_generated_code_only_do_not_use", + ), + "_upb_toolchain": attr.label( + default = Label("//upb_generator:protoc-gen-upb_toolchain"), + ), + "_cc_toolchain": attr.label( + default = "@bazel_tools//tools/cpp:current_cc_toolchain", + ), + }, + implementation = _upb_c_proto_library_aspect_impl, + requires = [upb_minitable_proto_library_aspect], + required_aspect_providers = [UpbMinitableCcInfo], + provides = [ + UpbWrappedCcInfo, + _UpbWrappedGeneratedSrcsInfo, + ], + attr_aspects = ["deps"], + fragments = ["cpp"], + toolchains = upb_use_cpp_toolchain(), + exec_groups = { + "proto_compiler": exec_group(), + }, +) + +def _upb_c_proto_library_rule_impl(ctx): + return upb_proto_rule_impl(ctx, UpbWrappedCcInfo, _UpbWrappedGeneratedSrcsInfo) + +upb_c_proto_library = rule( + output_to_genfiles = True, + implementation = _upb_c_proto_library_rule_impl, + attrs = { + "deps": attr.label_list( + aspects = [upb_c_proto_library_aspect], + allow_rules = ["proto_library"], + providers = [ProtoInfo], + ), + }, + provides = [CcInfo], +) diff --git a/bazel/upb_minitable_proto_library.bzl b/bazel/upb_minitable_proto_library.bzl new file mode 100644 index 0000000..c00d824 --- /dev/null +++ b/bazel/upb_minitable_proto_library.bzl @@ -0,0 +1,78 @@ +"""upb_minitable_proto_library() exposes upb's generated minitables (foo.upb_minitable.h)""" + +load("//bazel:upb_proto_library_internal/aspect.bzl", "upb_proto_aspect_impl") +load("//bazel:upb_proto_library_internal/cc_library_func.bzl", "upb_use_cpp_toolchain") +load("//bazel:upb_proto_library_internal/rule.bzl", "upb_proto_rule_impl") + +UpbMinitableCcInfo = provider( + "Provider for cc_info for protos", + fields = ["cc_info"], +) + +_UpbWrappedGeneratedSrcsInfo = provider( + "Provider for generated sources", + fields = ["srcs"], +) + +def _upb_minitable_proto_library_aspect_impl(target, ctx): + return upb_proto_aspect_impl( + target = target, + ctx = ctx, + generator = "upb_minitable", + cc_provider = UpbMinitableCcInfo, + dep_cc_provider = None, + file_provider = _UpbWrappedGeneratedSrcsInfo, + ) + +def _get_upb_minitable_proto_library_aspect_provides(): + provides = [ + UpbMinitableCcInfo, + _UpbWrappedGeneratedSrcsInfo, + ] + + if hasattr(cc_common, "CcSharedLibraryHintInfo"): + provides.append(cc_common.CcSharedLibraryHintInfo) + elif hasattr(cc_common, "CcSharedLibraryHintInfo_6_X_getter_do_not_use"): + # This branch can be deleted once 6.X is not supported by upb rules + provides.append(cc_common.CcSharedLibraryHintInfo_6_X_getter_do_not_use) + + return provides + +upb_minitable_proto_library_aspect = aspect( + attrs = { + "_copts": attr.label( + default = "//upb:upb_proto_library_copts__for_generated_code_only_do_not_use", + ), + "_upb_minitable_toolchain": attr.label( + default = Label("//upb_generator:protoc-gen-upb_minitable_toolchain"), + ), + "_cc_toolchain": attr.label( + default = "@bazel_tools//tools/cpp:current_cc_toolchain", + ), + "_fasttable_enabled": attr.label(default = "//upb:fasttable_enabled"), + }, + implementation = _upb_minitable_proto_library_aspect_impl, + provides = _get_upb_minitable_proto_library_aspect_provides(), + attr_aspects = ["deps"], + fragments = ["cpp"], + toolchains = upb_use_cpp_toolchain(), + exec_groups = { + "proto_compiler": exec_group(), + }, +) + +def _upb_minitable_proto_library_rule_impl(ctx): + return upb_proto_rule_impl(ctx, UpbMinitableCcInfo, _UpbWrappedGeneratedSrcsInfo) + +upb_minitable_proto_library = rule( + output_to_genfiles = True, + implementation = _upb_minitable_proto_library_rule_impl, + attrs = { + "deps": attr.label_list( + aspects = [upb_minitable_proto_library_aspect], + allow_rules = ["proto_library"], + providers = [ProtoInfo], + ), + }, + provides = [CcInfo], +) diff --git a/bazel/upb_proto_library.bzl b/bazel/upb_proto_library.bzl new file mode 100644 index 0000000..e38444e --- /dev/null +++ b/bazel/upb_proto_library.bzl @@ -0,0 +1,35 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +"""Public rules for using upb protos: + - upb_proto_library() + - upb_proto_reflection_library() +""" + +load( + "//bazel:upb_c_proto_library.bzl", + _UpbWrappedCcInfo = "UpbWrappedCcInfo", + _upb_c_proto_library = "upb_c_proto_library", + _upb_c_proto_library_aspect = "upb_c_proto_library_aspect", +) +load( + "//bazel:upb_proto_library_internal/aspect.bzl", + _GeneratedSrcsInfo = "GeneratedSrcsInfo", +) +load( + "//bazel:upb_proto_reflection_library.bzl", + _upb_proto_reflection_library = "upb_proto_reflection_library", +) + +# Temporary alias, see b/291827469. +upb_proto_library = _upb_c_proto_library + +upb_c_proto_library = _upb_c_proto_library +upb_proto_reflection_library = _upb_proto_reflection_library +GeneratedSrcsInfo = _GeneratedSrcsInfo +UpbWrappedCcInfo = _UpbWrappedCcInfo +upb_proto_library_aspect = _upb_c_proto_library_aspect diff --git a/bazel/upb_proto_library_internal/aspect.bzl b/bazel/upb_proto_library_internal/aspect.bzl new file mode 100644 index 0000000..9b929bd --- /dev/null +++ b/bazel/upb_proto_library_internal/aspect.bzl @@ -0,0 +1,239 @@ +"""Implementation of the aspect that powers the upb_*_proto_library() rules.""" + +load("//bazel:upb_proto_library_internal/cc_library_func.bzl", "cc_library_func") +load("//bazel:upb_proto_library_internal/copts.bzl", "UpbProtoLibraryCoptsInfo") +load("@rules_proto//proto:defs.bzl", "proto_common") + +# begin:github_only +_is_google3 = False +# end:github_only + +# begin:google_only +# _is_google3 = True +# end:google_only + +GeneratedSrcsInfo = provider( + "Provides generated headers and sources", + fields = { + "srcs": "list of srcs", + "hdrs": "list of hdrs", + "thunks": "Experimental, do not use. List of srcs defining C API. Incompatible with hdrs.", + }, +) + +def output_dir(ctx, proto_info): + """Returns the output directory where generated proto files will be placed. + + Args: + ctx: Rule context. + proto_info: ProtoInfo provider. + + Returns: + A string specifying the output directory + """ + proto_root = proto_info.proto_source_root + if proto_root.startswith(ctx.bin_dir.path): + path = proto_root + else: + path = ctx.bin_dir.path + "/" + proto_root + + if proto_root == ".": + path = ctx.bin_dir.path + return path + +def _concat_lists(lists): + ret = [] + for lst in lists: + ret = ret + lst + return ret + +def _merge_generated_srcs(srcs): + return GeneratedSrcsInfo( + srcs = _concat_lists([s.srcs for s in srcs]), + hdrs = _concat_lists([s.hdrs for s in srcs]), + thunks = _concat_lists([s.thunks for s in srcs]), + ) + +def _generate_upb_protos(ctx, generator, proto_info): + if len(proto_info.direct_sources) == 0: + return GeneratedSrcsInfo(srcs = [], hdrs = [], thunks = [], includes = []) + + ext = "." + generator + srcs = [] + thunks = [] + hdrs = proto_common.declare_generated_files( + ctx.actions, + extension = ext + ".h", + proto_info = proto_info, + ) + if not (generator == "upb" and _is_google3): + # TODO: The OSS build should also exclude this file for the upb generator, + # as it is empty and unnecessary. We only added it to make the OSS build happy on + # Windows and macOS. + srcs += proto_common.declare_generated_files( + ctx.actions, + extension = ext + ".c", + proto_info = proto_info, + ) + if generator == "upb": + thunks = proto_common.declare_generated_files( + ctx.actions, + extension = ext + ".thunks.c", + proto_info = proto_info, + ) + ctx.actions.run_shell( + inputs = hdrs, + outputs = thunks, + command = " && ".join([ + "sed 's/UPB_INLINE //' {} > {}".format(hdr.path, thunk.path) + for (hdr, thunk) in zip(hdrs, thunks) + ]), + progress_message = "Generating thunks for upb protos API for: " + ctx.label.name, + mnemonic = "GenUpbProtosThunks", + ) + + proto_common.compile( + actions = ctx.actions, + proto_info = proto_info, + proto_lang_toolchain_info = _get_lang_toolchain(ctx, generator), + generated_files = srcs + hdrs, + experimental_exec_group = "proto_compiler", + ) + + return GeneratedSrcsInfo( + srcs = srcs, + hdrs = hdrs, + thunks = thunks, + ) + +def _generate_name(ctx, generator, thunks = False): + if thunks: + return ctx.rule.attr.name + "." + generator + ".thunks" + return ctx.rule.attr.name + "." + generator + +def _get_dep_cc_infos(target, ctx, generator, cc_provider, dep_cc_provider): + rule_deps = ctx.rule.attr.deps + dep_ccinfos = [dep[cc_provider].cc_info for dep in rule_deps] + if dep_cc_provider: + # This gives access to our direct sibling. eg. foo.upb.h can #include "foo.upb_minitable.h" + dep_ccinfos.append(target[dep_cc_provider].cc_info) + + # This gives access to imports. eg. foo.upb.h can #include "import1.upb_minitable.h" + # But not transitive imports, eg. foo.upb.h cannot #include "transitive_import1.upb_minitable.h" + dep_ccinfos += [dep[dep_cc_provider].cc_info for dep in rule_deps] + + return dep_ccinfos + +def _get_lang_toolchain(ctx, generator): + lang_toolchain_name = "_" + generator + "_toolchain" + return getattr(ctx.attr, lang_toolchain_name)[proto_common.ProtoLangToolchainInfo] + +def _compile_upb_protos(ctx, files, generator, dep_ccinfos, cc_provider, proto_info): + cc_info = cc_library_func( + ctx = ctx, + name = _generate_name(ctx, generator), + hdrs = files.hdrs, + srcs = files.srcs, + includes = [output_dir(ctx, proto_info)], + copts = ctx.attr._copts[UpbProtoLibraryCoptsInfo].copts, + dep_ccinfos = dep_ccinfos, + ) + + if files.thunks: + cc_info_with_thunks = cc_library_func( + ctx = ctx, + name = _generate_name(ctx, generator, files.thunks), + hdrs = [], + srcs = files.thunks, + includes = [output_dir(ctx, proto_info)], + copts = ctx.attr._copts[UpbProtoLibraryCoptsInfo].copts, + dep_ccinfos = dep_ccinfos + [cc_info], + ) + return cc_provider( + cc_info = cc_info, + cc_info_with_thunks = cc_info_with_thunks, + ) + else: + return cc_provider( + cc_info = cc_info, + ) + +_GENERATORS = ["upb", "upbdefs", "upb_minitable"] + +def _get_hint_providers(ctx, generator): + if generator not in _GENERATORS: + fail("Please add new generator '{}' to _GENERATORS list".format(generator)) + + possible_owners = [] + for generator in _GENERATORS: + possible_owners.append(ctx.label.relative(_generate_name(ctx, generator))) + possible_owners.append(ctx.label.relative(_generate_name(ctx, generator, thunks = True))) + + if hasattr(cc_common, "CcSharedLibraryHintInfo"): + return [cc_common.CcSharedLibraryHintInfo(owners = possible_owners)] + elif hasattr(cc_common, "CcSharedLibraryHintInfo_6_X_constructor_do_not_use"): + # This branch can be deleted once 6.X is not supported by upb rules + return [cc_common.CcSharedLibraryHintInfo_6_X_constructor_do_not_use(owners = possible_owners)] + + return [] + +def upb_proto_aspect_impl( + target, + ctx, + generator, + cc_provider, + dep_cc_provider, + file_provider, + provide_cc_shared_library_hints = True): + """A shared aspect implementation for upb_*proto_library() rules. + + Args: + target: The `target` parameter from the aspect function. + ctx: The `ctx` parameter from the aspect function. + generator: A string describing which aspect we are generating. This triggers several special + behaviors, and ideally this will be refactored to be less magical. + cc_provider: The provider that this aspect will attach to the target. Should contain a + `cc_info` field. The aspect will ensure that each compilation action can compile and link + against this provider's cc_info for all proto_library() deps. + dep_cc_provider: For aspects that depend on other aspects, this is the provider of the aspect + that we depend on. The aspect wil be able to include the header files from this provider. + file_provider: A provider that this aspect will attach to the target to expose the source + files generated by this aspect. These files are primarily useful for returning in + DefaultInfo(), so users who build the upb_*proto_library() rule directly can view the + generated sources. + provide_cc_shared_library_hints: Whether shared library hints should be provided. + + Returns: + The `cc_provider` and `file_provider` providers as described above. + """ + dep_ccinfos = _get_dep_cc_infos(target, ctx, generator, cc_provider, dep_cc_provider) + if not getattr(ctx.rule.attr, "srcs", []): + # This target doesn't declare any sources, reexport all its deps instead. + # This is known as an "alias library": + # https://bazel.build/reference/be/protocol-buffer#proto_library.srcs + files = _merge_generated_srcs([dep[file_provider].srcs for dep in ctx.rule.attr.deps]) + wrapped_cc_info = cc_provider( + cc_info = cc_common.merge_cc_infos(direct_cc_infos = dep_ccinfos), + ) + else: + proto_info = target[ProtoInfo] + files = _generate_upb_protos( + ctx, + generator, + proto_info, + ) + wrapped_cc_info = _compile_upb_protos( + ctx, + files, + generator, + dep_ccinfos + [_get_lang_toolchain(ctx, generator).runtime[CcInfo]], + cc_provider, + proto_info, + ) + + hints = _get_hint_providers(ctx, generator) if provide_cc_shared_library_hints else [] + + return hints + [ + file_provider(srcs = files), + wrapped_cc_info, + ] diff --git a/bazel/upb_proto_library_internal/cc_library_func.bzl b/bazel/upb_proto_library_internal/cc_library_func.bzl new file mode 100644 index 0000000..31ebe90 --- /dev/null +++ b/bazel/upb_proto_library_internal/cc_library_func.bzl @@ -0,0 +1,71 @@ +"""A function to compile C/C++ code, like cc_library() but from Starlark.""" + +# begin:google_only +# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") +# +# def upb_use_cpp_toolchain(): +# return use_cpp_toolchain() +# +# end:google_only + +# begin:github_only +# Compatibility code for Bazel 4.x. Remove this when we drop support for Bazel 4.x. +load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") + +def upb_use_cpp_toolchain(): + return ["@bazel_tools//tools/cpp:toolchain_type"] +# end:github_only + +def cc_library_func(ctx, name, hdrs, srcs, copts, includes, dep_ccinfos): + """Like cc_library(), but callable from rules. + + Args: + ctx: Rule context. + name: Unique name used to generate output files. + hdrs: Public headers that can be #included from other rules. + srcs: C/C++ source files. + copts: Additional options for cc compilation. + includes: Additional include paths. + dep_ccinfos: CcInfo providers of dependencies we should build/link against. + + Returns: + CcInfo provider for this compilation. + """ + + compilation_contexts = [info.compilation_context for info in dep_ccinfos] + linking_contexts = [info.linking_context for info in dep_ccinfos] + toolchain = find_cpp_toolchain(ctx) + feature_configuration = cc_common.configure_features( + ctx = ctx, + cc_toolchain = toolchain, + requested_features = ctx.features, + unsupported_features = ctx.disabled_features, + ) + + (compilation_context, compilation_outputs) = cc_common.compile( + actions = ctx.actions, + feature_configuration = feature_configuration, + cc_toolchain = toolchain, + name = name, + srcs = srcs, + includes = includes, + public_hdrs = hdrs, + user_compile_flags = copts, + compilation_contexts = compilation_contexts, + ) + + # buildifier: disable=unused-variable + (linking_context, linking_outputs) = cc_common.create_linking_context_from_compilation_outputs( + actions = ctx.actions, + name = name, + feature_configuration = feature_configuration, + cc_toolchain = toolchain, + compilation_outputs = compilation_outputs, + linking_contexts = linking_contexts, + disallow_dynamic_library = cc_common.is_enabled(feature_configuration = feature_configuration, feature_name = "targets_windows") or not cc_common.is_enabled(feature_configuration = feature_configuration, feature_name = "supports_dynamic_linker"), + ) + + return CcInfo( + compilation_context = compilation_context, + linking_context = linking_context, + ) diff --git a/bazel/upb_proto_library_internal/copts.bzl b/bazel/upb_proto_library_internal/copts.bzl new file mode 100644 index 0000000..3005625 --- /dev/null +++ b/bazel/upb_proto_library_internal/copts.bzl @@ -0,0 +1,16 @@ +"""Dummy rule to expose select() copts to aspects.""" + +UpbProtoLibraryCoptsInfo = provider( + "Provides copts for upb proto targets", + fields = { + "copts": "copts for upb_proto_library()", + }, +) + +def upb_proto_library_copts_impl(ctx): + return UpbProtoLibraryCoptsInfo(copts = ctx.attr.copts) + +upb_proto_library_copts = rule( + implementation = upb_proto_library_copts_impl, + attrs = {"copts": attr.string_list(default = [])}, +) diff --git a/bazel/upb_proto_library_internal/rule.bzl b/bazel/upb_proto_library_internal/rule.bzl new file mode 100644 index 0000000..feb2929 --- /dev/null +++ b/bazel/upb_proto_library_internal/rule.bzl @@ -0,0 +1,39 @@ +"""Internal rule implementation for upb_*_proto_library() rules.""" + +def _filter_none(elems): + out = [] + for elem in elems: + if elem: + out.append(elem) + return out + +def upb_proto_rule_impl(ctx, cc_info_provider, srcs_provider): + """An implementation for upb_*proto_library() rules. + + Args: + ctx: The rule `ctx` argument + cc_info_provider: The provider containing a wrapped CcInfo that will be exposed to users who + depend on this rule. + srcs_provider: The provider containing the generated source files. This will be used to make + the DefaultInfo return the source files. + + Returns: + Providers for this rule. + """ + if len(ctx.attr.deps) != 1: + fail("only one deps dependency allowed.") + dep = ctx.attr.deps[0] + srcs = dep[srcs_provider].srcs + cc_info = dep[cc_info_provider].cc_info + + lib = cc_info.linking_context.linker_inputs.to_list()[0].libraries[0] + files = _filter_none([ + lib.static_library, + lib.pic_static_library, + lib.dynamic_library, + ]) + return [ + DefaultInfo(files = depset(files + srcs.hdrs + srcs.srcs)), + srcs, + cc_info, + ] diff --git a/bazel/upb_proto_reflection_library.bzl b/bazel/upb_proto_reflection_library.bzl new file mode 100644 index 0000000..4181f7b --- /dev/null +++ b/bazel/upb_proto_reflection_library.bzl @@ -0,0 +1,68 @@ +"""upb_c_proto_reflection_library() exposes upb reflection for protobuf (foo.upbdefs.h)""" + +load("//bazel:upb_minitable_proto_library.bzl", "UpbMinitableCcInfo", "upb_minitable_proto_library_aspect") +load("//bazel:upb_proto_library_internal/aspect.bzl", "upb_proto_aspect_impl") +load("//bazel:upb_proto_library_internal/cc_library_func.bzl", "upb_use_cpp_toolchain") +load("//bazel:upb_proto_library_internal/rule.bzl", "upb_proto_rule_impl") + +_UpbDefsWrappedCcInfo = provider("Provider for cc_info for protos", fields = ["cc_info"]) + +_WrappedDefsGeneratedSrcsInfo = provider( + "Provider for generated reflective sources", + fields = ["srcs"], +) + +def _upb_proto_reflection_library_aspect_impl(target, ctx): + return upb_proto_aspect_impl( + target = target, + ctx = ctx, + generator = "upbdefs", + cc_provider = _UpbDefsWrappedCcInfo, + dep_cc_provider = UpbMinitableCcInfo, + file_provider = _WrappedDefsGeneratedSrcsInfo, + provide_cc_shared_library_hints = False, + ) + +_upb_proto_reflection_library_aspect = aspect( + attrs = { + "_copts": attr.label( + default = "//upb:upb_proto_library_copts__for_generated_code_only_do_not_use", + ), + "_upbdefs_toolchain": attr.label( + default = Label("//upb_generator:protoc-gen-upbdefs_toolchain"), + cfg = getattr(proto_common, "proto_lang_toolchain_cfg", "target"), + ), + "_cc_toolchain": attr.label( + default = "@bazel_tools//tools/cpp:current_cc_toolchain", + ), + }, + implementation = _upb_proto_reflection_library_aspect_impl, + requires = [upb_minitable_proto_library_aspect], + required_aspect_providers = [UpbMinitableCcInfo], + provides = [ + _UpbDefsWrappedCcInfo, + _WrappedDefsGeneratedSrcsInfo, + ], + attr_aspects = ["deps"], + fragments = ["cpp"], + toolchains = upb_use_cpp_toolchain(), + exec_groups = { + "proto_compiler": exec_group(), + }, +) + +def _upb_proto_reflection_library_rule_impl(ctx): + return upb_proto_rule_impl(ctx, _UpbDefsWrappedCcInfo, _WrappedDefsGeneratedSrcsInfo) + +upb_proto_reflection_library = rule( + output_to_genfiles = True, + implementation = _upb_proto_reflection_library_rule_impl, + attrs = { + "deps": attr.label_list( + aspects = [_upb_proto_reflection_library_aspect], + allow_rules = ["proto_library"], + providers = [ProtoInfo], + ), + }, + provides = [CcInfo], +) diff --git a/benchmarks/BUILD b/benchmarks/BUILD new file mode 100644 index 0000000..07f87a9 --- /dev/null +++ b/benchmarks/BUILD @@ -0,0 +1,245 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +load("@rules_python//python:defs.bzl", "py_binary") + +# begin:google_only +# load("@rules_cc//cc:defs.bzl", "cc_proto_library") +# end:google_only + +load( + "//bazel:upb_proto_library.bzl", + "upb_proto_library", + "upb_proto_reflection_library", +) +load( + ":build_defs.bzl", + "cc_optimizefor_proto_library", + "expand_suffixes", + "proto_library", + "tmpl_cc_binary", +) + +# begin:google_only +# package(default_applicable_licenses = ["//upb:license"]) +# end:google_only + +licenses(["notice"]) + +proto_library( + name = "descriptor_proto", + srcs = ["descriptor.proto"], +) + +upb_proto_library( + name = "benchmark_descriptor_upb_proto", + deps = [":descriptor_proto"], +) + +upb_proto_reflection_library( + name = "benchmark_descriptor_upb_proto_reflection", + deps = [":descriptor_proto"], +) + +upb_proto_reflection_library( + name = "ads_upb_proto_reflection", + deps = ["@com_google_googleapis//:ads_proto"], +) + +cc_proto_library( + name = "benchmark_descriptor_cc_proto", + deps = [":descriptor_proto"], +) + +proto_library( + name = "benchmark_descriptor_sv_proto", + srcs = ["descriptor_sv.proto"], +) + +cc_proto_library( + name = "benchmark_descriptor_sv_cc_proto", + deps = [":benchmark_descriptor_sv_proto"], +) + +cc_test( + name = "benchmark", + testonly = 1, + srcs = ["benchmark.cc"], + deps = [ + ":ads_upb_proto_reflection", + ":benchmark_descriptor_cc_proto", + ":benchmark_descriptor_sv_cc_proto", + ":benchmark_descriptor_upb_proto", + ":benchmark_descriptor_upb_proto_reflection", + "//:protobuf", + "@com_google_googletest//:gtest_main", + "//upb:base", + "//upb:base_internal", + "//upb:descriptor_upb_proto", + "//upb:mem", + "//upb:reflection", + "@com_github_google_benchmark//:benchmark_main", + "@com_google_absl//absl/container:flat_hash_set", + ], +) + +# Size benchmarks. + +SIZE_BENCHMARKS = { + "empty": "Empty", + "descriptor": "FileDescriptorSet", + "100_msgs": "Message100", + "200_msgs": "Message200", + "100_fields": "Message", + "200_fields": "Message", +} + +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( + name = "do_gen_synthetic_protos", + outs = [ + "100_msgs.proto", + "200_msgs.proto", + "100_fields.proto", + "200_fields.proto", + ], + cmd = "$(execpath :gen_synthetic_protos) $(RULEDIR)", + tools = [":gen_synthetic_protos"], +) + +proto_library( + name = "100_msgs_proto", + srcs = ["100_msgs.proto"], +) + +proto_library( + name = "200_msgs_proto", + srcs = ["200_msgs.proto"], +) + +proto_library( + name = "100_fields_proto", + srcs = ["100_fields.proto"], +) + +proto_library( + name = "200_fields_proto", + srcs = ["200_fields.proto"], +) + +proto_library( + name = "empty_proto", + srcs = ["empty.proto"], +) + +[( + upb_proto_library( + name = k + "_upb_proto", + deps = [":" + k + "_proto"], + ), + cc_proto_library( + name = k + "_cc_proto", + deps = [":" + k + "_proto"], + ), + tmpl_cc_binary( + name = k + "_upb_binary", + testonly = 1, + args = [ + package_name() + "/" + k + ".upb.h", + "upb_benchmark_" + v, + ], + gen = ":gen_upb_binary_c", + deps = [ + ":" + k + "_upb_proto", + ], + ), + tmpl_cc_binary( + name = k + "_protobuf_binary", + testonly = 1, + args = [ + package_name() + "/" + k + ".pb.h", + "upb_benchmark::" + v, + ], + gen = ":gen_protobuf_binary_cc", + deps = [ + ":" + k + "_cc_proto", + ], + ), + cc_optimizefor_proto_library( + name = k + "_cc_lite_proto", + srcs = [k + ".proto"], + outs = [k + "_lite.proto"], + optimize_for = "LITE_RUNTIME", + ), + tmpl_cc_binary( + name = k + "_lite_protobuf_binary", + testonly = 1, + args = [ + package_name() + "/" + k + "_lite.pb.h", + "upb_benchmark::" + v, + ], + gen = ":gen_protobuf_binary_cc", + deps = [ + ":" + k + "_cc_lite_proto", + ], + ), + cc_optimizefor_proto_library( + name = k + "_cc_codesize_proto", + srcs = [k + ".proto"], + outs = [k + "_codesize.proto"], + optimize_for = "CODE_SIZE", + ), + tmpl_cc_binary( + name = k + "_codesize_protobuf_binary", + testonly = 1, + args = [ + package_name() + "/" + k + "_codesize.pb.h", + "upb_benchmark::" + v, + ], + gen = ":gen_protobuf_binary_cc", + deps = [ + ":" + k + "_cc_codesize_proto", + ], + ), +) for k, v in SIZE_BENCHMARKS.items()] + +genrule( + name = "size_data", + testonly = 1, + srcs = expand_suffixes( + SIZE_BENCHMARKS.keys(), + suffixes = [ + "_upb_binary", + "_protobuf_binary", + "_lite_protobuf_binary", + "_codesize_protobuf_binary", + ], + ), + outs = ["size_data.txt"], + # We want --format=GNU which counts rodata with data, not text. + cmd = "size $$($$OSTYPE == 'linux-gnu' ? '--format=GNU -d' : '') $(SRCS) > $@", + # "size" sometimes isn't available remotely. + local = 1, + tags = ["no-remote-exec"], +) diff --git a/benchmarks/BUILD.googleapis b/benchmarks/BUILD.googleapis new file mode 100644 index 0000000..4469678 --- /dev/null +++ b/benchmarks/BUILD.googleapis @@ -0,0 +1,59 @@ +# 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( + "@rules_proto//proto:defs.bzl", + "proto_library", +) + +proto_library( + name = "ads_proto", + srcs = glob([ + "google/ads/googleads/v13/**/*.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", + ], +) diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am deleted file mode 100644 index 2b2204d..0000000 --- a/benchmarks/Makefile.am +++ /dev/null @@ -1,664 +0,0 @@ -benchmarks_protoc_inputs_benchmark_wrapper = \ - benchmarks.proto - -benchmarks_protoc_inputs = \ - datasets/google_message1/proto3/benchmark_message1_proto3.proto - -benchmarks_protoc_inputs_proto2 = \ - datasets/google_message1/proto2/benchmark_message1_proto2.proto \ - datasets/google_message2/benchmark_message2.proto \ - datasets/google_message3/benchmark_message3.proto \ - datasets/google_message3/benchmark_message3_1.proto \ - datasets/google_message3/benchmark_message3_2.proto \ - datasets/google_message3/benchmark_message3_3.proto \ - datasets/google_message3/benchmark_message3_4.proto \ - datasets/google_message3/benchmark_message3_5.proto \ - datasets/google_message3/benchmark_message3_6.proto \ - datasets/google_message3/benchmark_message3_7.proto \ - datasets/google_message3/benchmark_message3_8.proto \ - datasets/google_message4/benchmark_message4.proto \ - datasets/google_message4/benchmark_message4_1.proto \ - datasets/google_message4/benchmark_message4_2.proto \ - datasets/google_message4/benchmark_message4_3.proto - -make_tmp_dir: - mkdir -p 'tmp/java/src/main/java' - touch make_tmp_dir - - -# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is -# relative to srcdir, which may not be the same as the current directory when -# building out-of-tree. -protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) ) - touch protoc_middleman - -protoc_middleman2: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2) ) - touch protoc_middleman2 - -all_data = $$(find $$(cd $(srcdir) && pwd) -type f -name "dataset.*.pb" -not -path "$$(cd $(srcdir) && pwd)/tmp/*") - -############# CPP RULES ############## - -benchmarks_protoc_outputs = \ - cpp/benchmarks.pb.cc \ - cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc - -benchmarks_protoc_outputs_header = \ - cpp/benchmarks.pb.h \ - cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h - -benchmarks_protoc_outputs_proto2_header = \ - cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \ - cpp/datasets/google_message2/benchmark_message2.pb.h \ - cpp/datasets/google_message3/benchmark_message3.pb.h \ - cpp/datasets/google_message3/benchmark_message3_1.pb.h \ - cpp/datasets/google_message3/benchmark_message3_2.pb.h \ - cpp/datasets/google_message3/benchmark_message3_3.pb.h \ - cpp/datasets/google_message3/benchmark_message3_4.pb.h \ - cpp/datasets/google_message3/benchmark_message3_5.pb.h \ - cpp/datasets/google_message3/benchmark_message3_6.pb.h \ - cpp/datasets/google_message3/benchmark_message3_7.pb.h \ - cpp/datasets/google_message3/benchmark_message3_8.pb.h \ - cpp/datasets/google_message4/benchmark_message4.pb.h \ - cpp/datasets/google_message4/benchmark_message4_1.pb.h \ - cpp/datasets/google_message4/benchmark_message4_2.pb.h \ - cpp/datasets/google_message4/benchmark_message4_3.pb.h - -benchmarks_protoc_outputs_proto2 = \ - cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \ - cpp/datasets/google_message2/benchmark_message2.pb.cc \ - cpp/datasets/google_message3/benchmark_message3.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_1.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_2.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_3.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_4.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_5.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_6.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_7.pb.cc \ - cpp/datasets/google_message3/benchmark_message3_8.pb.cc \ - cpp/datasets/google_message4/benchmark_message4.pb.cc \ - cpp/datasets/google_message4/benchmark_message4_1.pb.cc \ - cpp/datasets/google_message4/benchmark_message4_2.pb.cc \ - cpp/datasets/google_message4/benchmark_message4_3.pb.cc - - -$(benchmarks_protoc_outputs): protoc_middleman -$(benchmarks_protoc_outputs_header): protoc_middleman -$(benchmarks_protoc_outputs_proto2): protoc_middleman2 -$(benchmarks_protoc_outputs_proto2_header): protoc_middleman2 - -initialize_submodule: - oldpwd=`pwd` - cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && \ - cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make - cd $$oldpwd - touch initialize_submodule - -$(top_srcdir)/third_party/benchmark/src/libbenchmark.a: initialize_submodule - -AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare - -bin_PROGRAMS = cpp-benchmark - -cpp_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a -cpp_benchmark_SOURCES = cpp/cpp_benchmark.cc -cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(top_srcdir)/third_party/benchmark/include -# Explicit deps because BUILT_SOURCES are only done before a "make all/check" -# so a direct "make test_cpp" could fail if parallel enough. -# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually -cpp/cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a -cpp/benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a -nodist_cpp_benchmark_SOURCES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_proto2) \ - $(benchmarks_protoc_outputs_proto2_header) \ - $(benchmarks_protoc_outputs_header) - -cpp: protoc_middleman protoc_middleman2 cpp-benchmark initialize_submodule - ./cpp-benchmark $(all_data) - -############ CPP RULES END ############ - -############# JAVA RULES ############## - -java_benchmark_testing_files = \ - java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java - -javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2 - cp -r $(srcdir)/java tmp - mkdir -p tmp/java/lib - cp $(top_srcdir)/java/core/target/*.jar tmp/java/lib/protobuf-java.jar - cd tmp/java && mvn clean compile assembly:single -Dprotobuf.version=$(PACKAGE_VERSION) && cd ../.. - @touch javac_middleman - -java-benchmark: javac_middleman - @echo "Writing shortcut script java-benchmark..." - @echo '#! /bin/bash' > java-benchmark - @echo 'all_data=""' >> java-benchmark - @echo 'conf=()' >> java-benchmark - @echo 'data_files=""' >> java-benchmark - @echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+="$$arg,"; fi; done' >> java-benchmark - @echo 'java -cp '\"tmp/java/target/*:$(top_srcdir)/java/core/target/*:$(top_srcdir)/java/util/target/*\"" \\" >>java-benchmark - @echo ' com.google.caliper.runner.CaliperMain com.google.protobuf.ProtoCaliperBenchmark -i runtime '"\\" >> java-benchmark - @echo ' -b serializeToByteArray,serializeToMemoryStream,deserializeFromByteArray,deserializeFromMemoryStream '"\\" >> java-benchmark - @echo ' -DdataFile=$${data_files:0:-1} $${conf[*]}' >> java-benchmark - @chmod +x java-benchmark - -java: protoc_middleman protoc_middleman2 java-benchmark - ./java-benchmark $(all_data) - -############# JAVA RULES END ############## - - -############# PYTHON RULES ############## - -python_add_init: protoc_middleman protoc_middleman2 - all_file=`find tmp -type f -regex '.*\.py'` && \ - for file in $${all_file[@]}; do \ - path="$${file%/*}"; \ - while true; do \ - touch "$$path/__init__.py" && chmod +x "$$path/__init__.py"; \ - if [[ $$path != *"/"* ]]; then break; fi; \ - path=$${path%/*}; \ - done \ - done - -python_cpp_pkg_flags = `pkg-config --cflags --libs python` - -lib_LTLIBRARIES = libbenchmark_messages.la -libbenchmark_messages_la_SOURCES = python/python_benchmark_messages.cc -libbenchmark_messages_la_LIBADD = $(top_srcdir)/src/.libs/libprotobuf.la -libbenchmark_messages_la_LDFLAGS = -version-info 1:0:0 -export-dynamic -libbenchmark_messages_la_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp $(python_cpp_pkg_flags) -libbenchmark_messages_la-python_benchmark_messages.$(OBJEXT): $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) -nodist_libbenchmark_messages_la_SOURCES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_proto2) \ - $(benchmarks_protoc_outputs_proto2_header) \ - $(benchmarks_protoc_outputs_header) - -python-pure-python-benchmark: python_add_init - @echo "Writing shortcut script python-pure-python-benchmark..." - @echo '#! /bin/bash' > python-pure-python-benchmark - @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-pure-python-benchmark - @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-pure-python-benchmark - @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'python\' >> python-pure-python-benchmark - @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-pure-python-benchmark - @echo python tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark - @chmod +x python-pure-python-benchmark - -python-cpp-reflection-benchmark: python_add_init - @echo "Writing shortcut script python-cpp-reflection-benchmark..." - @echo '#! /bin/bash' > python-cpp-reflection-benchmark - @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-reflection-benchmark - @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-reflection-benchmark - @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-reflection-benchmark - @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-reflection-benchmark - @echo python tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark - @chmod +x python-cpp-reflection-benchmark - -python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la - @echo "Writing shortcut script python-cpp-generated-code-benchmark..." - @echo '#! /bin/bash' > python-cpp-generated-code-benchmark - @echo export LD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-generated-code-benchmark - @echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-generated-code-benchmark - @echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-generated-code-benchmark - @echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-generated-code-benchmark - @echo python tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark - @chmod +x python-cpp-generated-code-benchmark - -python-pure-python: python-pure-python-benchmark - ./python-pure-python-benchmark $(all_data) - -python-cpp-reflection: python-cpp-reflection-benchmark - ./python-cpp-reflection-benchmark $(all_data) - -python-cpp-generated-code: python-cpp-generated-code-benchmark - ./python-cpp-generated-code-benchmark $(all_data) - -############# PYTHON RULES END ############## - -############# GO RULES BEGIN ############## - -benchmarks_protoc_inputs_proto2_message1 = \ - datasets/google_message1/proto2/benchmark_message1_proto2.proto - -benchmarks_protoc_inputs_proto2_message2 = \ - datasets/google_message2/benchmark_message2.proto - -benchmarks_protoc_inputs_proto2_message3 = \ - datasets/google_message3/benchmark_message3.proto \ - datasets/google_message3/benchmark_message3_1.proto \ - datasets/google_message3/benchmark_message3_2.proto \ - datasets/google_message3/benchmark_message3_3.proto \ - datasets/google_message3/benchmark_message3_4.proto \ - datasets/google_message3/benchmark_message3_5.proto \ - datasets/google_message3/benchmark_message3_6.proto \ - datasets/google_message3/benchmark_message3_7.proto \ - datasets/google_message3/benchmark_message3_8.proto - -benchmarks_protoc_inputs_proto2_message4 = \ - datasets/google_message4/benchmark_message4.proto \ - datasets/google_message4/benchmark_message4_1.proto \ - datasets/google_message4/benchmark_message4_2.proto \ - datasets/google_message4/benchmark_message4_3.proto - -go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_proto2_message1) $(benchmarks_protoc_inputs_proto2_message2) $(benchmarks_protoc_inputs_proto2_message3) $(benchmarks_protoc_inputs_proto2_message4) $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_benchmark_wrapper) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message1) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message2) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message3) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) ) - touch go_protoc_middleman - -go-benchmark: go_protoc_middleman - @echo "Writing shortcut script go-benchmark..." - @echo '#! /bin/bash' > go-benchmark - @echo 'cd $(srcdir)/go' >> go-benchmark - @echo 'all_data=""' >> go-benchmark - @echo 'conf=()' >> go-benchmark - @echo 'data_files=()' >> go-benchmark - @echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+=("$$arg"); fi; done' >> go-benchmark - @echo 'go test -bench=. $${conf[*]} -- $${data_files[*]}' >> go-benchmark - @echo 'cd ..' >> go-benchmark - @chmod +x go-benchmark - -go: go_protoc_middleman go-benchmark - ./go-benchmark $(all_data) - -############# GO RULES END ############## - -############# GOGO RULES BEGIN ############ - -cpp_no_group_benchmarks_protoc_outputs_header = \ - gogo/cpp_no_group/benchmarks.pb.h \ - gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h - -cpp_no_group_benchmarks_protoc_outputs = \ - gogo/cpp_no_group/benchmarks.pb.cc \ - gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc - -cpp_no_group_benchmarks_protoc_outputs_proto2_header = \ - gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \ - gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.h \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.h \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.h \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.h \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.h \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.h - -cpp_no_group_benchmarks_protoc_outputs_proto2 = \ - gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \ - gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.cc \ - gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.cc \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.cc \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.cc \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.cc \ - gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.cc - -$(cpp_no_group_benchmarks_protoc_outputs): cpp_no_group_protoc_middleman -$(cpp_no_group_benchmarks_protoc_outputs_header): cpp_no_group_protoc_middleman -$(cpp_no_group_benchmarks_protoc_outputs_proto2): cpp_no_group_protoc_middleman -$(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_middleman - -generate_cpp_no_group_benchmark_code: - cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc - sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc - sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc - touch generate_cpp_no_group_benchmark_code - -bin_PROGRAMS += cpp-no-group-benchmark -cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a -cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc -cpp_no_group_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/gogo/cpp_no_group -I$(top_srcdir)/third_party/benchmark/include -# Explicit deps because BUILT_SOURCES are only done before a "make all/check" -# so a direct "make test_cpp" could fail if parallel enough. -# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually -gogo/cpp_no_group/cpp_no_group_benchmark-cpp_benchmark.$(OBJEXT): $(cpp_no_group_benchmarks_protoc_outputs) $(cpp_no_group_benchmarks_protoc_outputs_proto2) $(cpp_no_group_benchmarks_protoc_outputs_header) \ - $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/third_party/benchmark/src/libbenchmark.a generate_cpp_no_group_benchmark_code -gogo/cpp_no_group/cpp_benchmark.cc: generate_cpp_no_group_benchmark_code -nodist_cpp_no_group_benchmark_SOURCES = \ - $(cpp_no_group_benchmarks_protoc_outputs_proto2) \ - $(cpp_no_group_benchmarks_protoc_outputs) \ - $(cpp_no_group_benchmarks_protoc_outputs_header) \ - $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) - -cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark - ./cpp-no-group-benchmark $(gogo_data) - -gogo_proto_middleman: protoc-gen-gogoproto - mkdir -p "tmp/gogo_proto" - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) ) - touch gogo_proto_middleman - -gogo_data = $$(for data in $(all_data); do echo "tmp/gogo_data$${data\#$(srcdir)}"; done | xargs) - -generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber - mkdir -p `dirname $(gogo_data)` - ./gogo-data-scrubber $(all_data) $(gogo_data) - touch generate_gogo_data - -make_tmp_dir_gogo: - mkdir -p tmp/go_no_group/benchmark_code - mkdir -p tmp/gogofast/benchmark_code - mkdir -p tmp/gogofaster/benchmark_code - mkdir -p tmp/gogoslick/benchmark_code - touch make_tmp_dir_gogo - -go_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message1) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message2) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message3) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message4) ) - touch go_no_group_protoc_middleman - -cpp_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message1) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message2) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message3) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message4) ) - touch cpp_no_group_protoc_middleman - -gogofast_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_benchmark_wrapper) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message1) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message2) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message3) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message4) ) - touch gogofast_protoc_middleman - -gogofaster_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_benchmark_wrapper) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message1) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message2) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message3) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message4) ) - touch gogofaster_protoc_middleman - -gogoslick_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_benchmark_wrapper) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message1) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message2) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message3) ) - oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message4) ) - touch gogoslick_protoc_middleman - -generate-gogo-benchmark-code: - @echo '#! /bin/bash' > generate-gogo-benchmark-code - @echo 'cp $(srcdir)/go/go_benchmark_test.go tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code - @echo 'sed -i -e "s/\.\.\/tmp/../g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code - @echo 'sed -i -e "s/b\.Run(\"\(.*\)\"/b.Run(\"\1\_$$1\"/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code - @echo 'if [[ $$2 == 1 ]]; then sed -i -e "s/github\.com\/golang/github.com\/gogo/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go; fi ' >> generate-gogo-benchmark-code - @chmod +x generate-gogo-benchmark-code - -generate_all_gogo_benchmark_code: generate-gogo-benchmark-code make_tmp_dir_gogo - ./generate-gogo-benchmark-code go_no_group 0 - ./generate-gogo-benchmark-code gogofast 1 - ./generate-gogo-benchmark-code gogofaster 1 - ./generate-gogo-benchmark-code gogoslick 1 - -gogo-benchmark: - @echo "Writing shortcut script gogo-benchmark..." - @echo '#! /bin/bash' > gogo-benchmark - @echo 'cd tmp/$$1/benchmark_code' >> gogo-benchmark - @echo 'shift' >> gogo-benchmark - @echo 'all_data=""' >> gogo-benchmark - @echo 'for data_file in $$@; do all_data="$$all_data ../../../$$data_file"; done' >> gogo-benchmark - @echo 'go test -bench=. -- $$all_data' >> gogo-benchmark - @echo 'cd ../..' >> gogo-benchmark - @chmod +x gogo-benchmark - -go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark - ./gogo-benchmark go_no_group $(gogo_data) - -gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code - ./gogo-benchmark gogofast $(gogo_data) - -gogofaster: gogofaster_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code - ./gogo-benchmark gogofaster $(gogo_data) - -gogoslick: gogoslick_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code - ./gogo-benchmark gogoslick $(gogo_data) - - -############# GOGO RULES END ############ - - -############ UTIL RULES BEGIN ############ - -bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber protoc-gen-proto2_to_proto3 proto3-data-stripper - -protoc_gen_gogoproto_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/src/libprotoc.la -protoc_gen_gogoproto_SOURCES = util/protoc-gen-gogoproto.cc -protoc_gen_gogoproto_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util - -gogo_data_scrubber_LDADD = $(top_srcdir)/src/libprotobuf.la -gogo_data_scrubber_SOURCES = util/gogo_data_scrubber.cc -gogo_data_scrubber_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util -util/gogo_data_scrubber-gogo_data_scrubber.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) -nodist_gogo_data_scrubber_SOURCES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_proto2) \ - $(benchmarks_protoc_outputs_proto2_header) \ - $(benchmarks_protoc_outputs_header) - -protoc_gen_proto2_to_proto3_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/src/libprotoc.la -protoc_gen_proto2_to_proto3_SOURCES = util/protoc-gen-proto2_to_proto3.cc -protoc_gen_proto2_to_proto3_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util - -proto3_data_stripper_LDADD = $(top_srcdir)/src/libprotobuf.la -proto3_data_stripper_SOURCES = util/proto3_data_stripper.cc -proto3_data_stripper_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util -util/proto3_data_stripper-proto3_data_stripper.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) -nodist_proto3_data_stripper_SOURCES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_proto2) \ - $(benchmarks_protoc_outputs_proto2_header) \ - $(benchmarks_protoc_outputs_header) - - -############ UTIL RULES END ############ - -############ PROTO3 PREPARATION BEGIN ############# - -proto3_proto_middleman: protoc-gen-proto2_to_proto3 - mkdir -p "tmp/proto3_proto" - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-proto2_to_proto3 --proto2_to_proto3_out=$$oldpwd/tmp/proto3_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) ) - touch proto3_proto_middleman - -full_srcdir = $$(cd $(srcdir) && pwd) -proto3_data = $$(for data in $(all_data); do echo $(full_srcdir)"/tmp/proto3_data$${data\#$(full_srcdir)}"; done | xargs) - -generate_proto3_data: protoc_middleman protoc_middleman2 proto3-data-stripper - mkdir -p `dirname $(proto3_data)` - ./proto3-data-stripper $(all_data) $(proto3_data) - touch generate_proto3_data - -############ PROTO3 PREPARATION END ############# - -############ PHP RULES BEGIN ################# - -proto3_middleman_php: proto3_proto_middleman - mkdir -p "tmp/php" - oldpwd=`pwd` && ( cd tmp/proto3_proto && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --php_out=$$oldpwd/tmp/php $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) ) - touch proto3_middleman_php - -php-benchmark: proto3_middleman_php generate_proto3_data - mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark" - cp php/autoload.php "tmp/php" - @echo "Writing shortcut script php-benchmark..." - @echo '#! /bin/bash' > php-benchmark - @echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-benchmark - @echo 'cd tmp/php' >> php-benchmark - @echo 'export CURRENT_DIR=$$(pwd)' >> php-benchmark - @echo 'php -d auto_prepend_file="autoload.php" -d include_path="$$(pwd)" Google/Protobuf/Benchmark/PhpBenchmark.php $$@' >> php-benchmark - @echo 'cd ../..' >> php-benchmark - @chmod +x php-benchmark - -php: php-benchmark proto3_middleman_php - ./php-benchmark --behavior_prefix="php" $(proto3_data) - -php_c_extension: - cd $(top_srcdir)/php/ext/google/protobuf && phpize && ./configure CFLAGS='-O3' && make -j8 - -php-c-benchmark: proto3_middleman_php generate_proto3_data php_c_extension php_c_extension - mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark" - cp php/autoload.php "tmp/php" - @echo "Writing shortcut script php-c-benchmark..." - @echo '#! /bin/bash' > php-c-benchmark - @echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-c-benchmark - @echo 'export PROTOBUF_PHP_EXTDIR="$$PROTOBUF_PHP_SRCDIR/../ext/google/protobuf/modules"' >> php-c-benchmark - @echo 'cd tmp/php' >> php-c-benchmark - @echo 'export CURRENT_DIR=$$(pwd)' >> php-c-benchmark - @echo 'php -d auto_prepend_file="autoload.php" -d include_path="$$(pwd)" -d extension="$$PROTOBUF_PHP_EXTDIR/protobuf.so" Google/Protobuf/Benchmark/PhpBenchmark.php $$@' >> php-c-benchmark - @echo 'cd ../..' >> php-c-benchmark - @chmod +x php-c-benchmark - -php_c: php-c-benchmark proto3_middleman_php - ./php-c-benchmark --behavior_prefix="php_c" $(proto3_data) - - -############ PHP RULES END ################# - -############ protobuf.js RULE BEGIN ############# - -pbjs_preparation: - mkdir -p tmp/protobuf.js - cd tmp/protobuf.js && git clone https://github.com/dcodeIO/protobuf.js.git && \ - cd protobuf.js && npm install && npm run build - cd tmp/protobuf.js && npm install benchmark - cp protobuf.js/* tmp/protobuf.js - cp js/benchmark_suite.js tmp/protobuf.js - touch pbjs_preparation - -pbjs_middleman: pbjs_preparation - export OLDDIR=$$(pwd) && cd tmp/protobuf.js && node generate_pbjs_files.js --target static-module --include_path=$$OLDDIR -o generated_bundle_code.js $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) - touch pbjs_middleman - -pbjs-benchmark: pbjs_middleman - @echo '#! /bin/bash' > pbjs-benchmark - @echo 'cd tmp/protobuf.js' >> pbjs-benchmark - @echo 'sed -i "s/protobufjs/.\/protobuf.js/g" generated_bundle_code.js' >> pbjs-benchmark - @echo 'env NODE_PATH=".:./node_modules:$$NODE_PATH" node protobufjs_benchmark.js $$@' >> pbjs-benchmark - @chmod +x pbjs-benchmark - -pbjs: pbjs-benchmark - ./pbjs-benchmark $(all_data) - -############ protobuf.js RULE END ############# - -############ JS RULE BEGIN ############# - -js_preparation: - mkdir -p tmp/js - oldpwd=$$(pwd) && cd $(top_srcdir)/js && npm install && npm test - cd tmp/js && npm install benchmark - cp js/* tmp/js - touch js_preparation - -js_middleman: js_preparation - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --js_out=import_style=commonjs,binary:$$oldpwd/tmp/js $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2)) - touch js_middleman - -js-benchmark: js_middleman - @echo '#! /bin/bash' > js-benchmark - @echo 'export TOP_JS_SRCDIR=$$(cd $(top_srcdir)/js && pwd)' >> js-benchmark - @echo 'cd tmp/js' >> js-benchmark - @echo 'env NODE_PATH="$$TOP_JS_SRCDIR:.:./node_modules:$$NODE_PATH" node --max-old-space-size=4096 js_benchmark.js $$@' >> js-benchmark - @chmod +x js-benchmark - -js: js-benchmark - ./js-benchmark $(all_data) - -############ JS RULE END ############# - -EXTRA_DIST = \ - $(benchmarks_protoc_inputs_benchmark_wrapper) \ - $(benchmarks_protoc_inputs) \ - $(benchmarks_protoc_inputs_proto2) \ - google_size.proto - -MAINTAINERCLEANFILES = \ - Makefile.in - -CLEANFILES = \ - $(benchmarks_protoc_outputs) \ - $(benchmarks_protoc_outputs_header) \ - $(benchmarks_protoc_outputs_proto2) \ - $(benchmarks_protoc_outputs_proto2_header) \ - initialize_submodule \ - make_tmp_dir \ - protoc_middleman \ - protoc_middleman2 \ - javac_middleman \ - java-benchmark \ - python_cpp_proto_library \ - python-pure-python-benchmark \ - python-cpp-reflection-benchmark \ - python-cpp-generated-code-benchmark \ - go-benchmark \ - go_protoc_middleman \ - make_tmp_dir_gogo \ - gogo_proto_middleman \ - generate_gogo_data \ - go_no_group_protoc_middleman \ - go_no_group \ - go-no-group-benchmark \ - $(cpp_no_group_benchmarks_protoc_outputs_header) \ - $(cpp_no_group_benchmarks_protoc_outputs) \ - $(cpp_no_group_benchmarks_protoc_outputs_proto2_header) \ - $(cpp_no_group_benchmarks_protoc_outputs_proto2) \ - generate_all_gogo_benchmark_code \ - generate-gogo-benchmark-code \ - cpp_no_group_protoc_middleman \ - generate_cpp_no_group_benchmark_code \ - generate_gogo_benchmark_code \ - gogofast_protoc_middleman \ - gogofast \ - gogofaster_protoc_middleman \ - gogofaster \ - gogoslick_protoc_middleman \ - gogoslick \ - gogo-benchmark \ - gogo/cpp_no_group/cpp_benchmark.* \ - proto3_proto_middleman \ - generate_proto3_data \ - php-benchmark \ - php-c-benchmark \ - proto3_middleman_php \ - pbjs_preparation \ - pbjs_middleman \ - pbjs-benchmark \ - js_preparation \ - js_middleman \ - js-benchmark - -clean-local: - -rm -rf tmp/* - diff --git a/benchmarks/README.md b/benchmarks/README.md deleted file mode 100644 index 436c148..0000000 --- a/benchmarks/README.md +++ /dev/null @@ -1,243 +0,0 @@ - -# Protocol Buffers Benchmarks - -This directory contains benchmarking schemas and data sets that you -can use to test a variety of performance scenarios against your -protobuf language runtime. If you are looking for performance -numbers of officially support languages, see [here]( -https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md) - -## Prerequisite - -First, you need to follow the instruction in the root directory's README to -build your language's protobuf, then: - -### CPP -You need to install [cmake](https://cmake.org/) before building the benchmark. - -We are using [google/benchmark](https://github.com/google/benchmark) as the -benchmark tool for testing cpp. This will be automatically made during build the -cpp benchmark. - -The cpp protobuf performance can be improved by linking with [tcmalloc library]( -https://gperftools.github.io/gperftools/tcmalloc.html). For using tcmalloc, you -need to build [gpertools](https://github.com/gperftools/gperftools) to generate -libtcmallc.so library. - -### Java -We're using maven to build the java benchmarks, which is the same as to build -the Java protobuf. There're no other tools need to install. We're using -[google/caliper](https://github.com/google/caliper) as benchmark tool, which -can be automatically included by maven. - -### Python -We're using python C++ API for testing the generated -CPP proto version of python protobuf, which is also a prerequisite for Python -protobuf cpp implementation. You need to install the correct version of Python -C++ extension package before run generated CPP proto version of Python -protobuf's benchmark. e.g. under Ubuntu, you need to - -``` -$ sudo apt-get install python-dev -$ sudo apt-get install python3-dev -``` -And you also need to make sure `pkg-config` is installed. - -### Go -Go protobufs are maintained at [github.com/golang/protobuf]( -http://github.com/golang/protobuf). If not done already, you need to install the -toolchain and the Go protoc-gen-go plugin for protoc. - -To install protoc-gen-go, run: - -``` -$ go get -u github.com/golang/protobuf/protoc-gen-go -$ export PATH=$PATH:$(go env GOPATH)/bin -``` - -The first command installs `protoc-gen-go` into the `bin` directory in your local `GOPATH`. -The second command adds the `bin` directory to your `PATH` so that `protoc` can locate the plugin later. - -### PHP -PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automatically -include PHP protobuf's src and build the c extension if required. - -### Node.js -Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/master/js), which needn't to manually install either - -### C# -The C# benchmark code is built as part of the main Google.Protobuf -solution. It requires the .NET Core SDK, and depends on -[BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), which -will be downloaded automatically. - -### Big data - -There's some optional big testing data which is not included in the directory -initially, you need to run the following command to download the testing data: - -``` -$ ./download_data.sh -``` - -After doing this the big data file will automatically generated in the -benchmark directory. - -## Run instructions - -To run all the benchmark dataset: - -### Java: - -``` -$ make java -``` - -### CPP: - -``` -$ make cpp -``` - -For linking with tcmalloc: - -``` -$ env LD_PRELOAD={directory to libtcmalloc.so} make cpp -``` - -### Python: - -We have three versions of python protobuf implementation: pure python, cpp -reflection and cpp generated code. To run these version benchmark, you need to: - -#### Pure Python: - -``` -$ make python-pure-python -``` - -#### CPP reflection: - -``` -$ make python-cpp-reflection -``` - -#### CPP generated code: - -``` -$ make python-cpp-generated-code -``` - -### Go -``` -$ make go -``` - - -### PHP -We have two version of php protobuf implemention: pure php, php with c extension. To run these version benchmark, you need to: -#### Pure PHP -``` -$ make php -``` -#### PHP with c extension -``` -$ make php_c -``` - -### Node.js -``` -$ make js -``` - -To run a specific dataset or run with specific options: - -### Java: - -``` -$ make java-benchmark -$ ./java-benchmark $(specific generated dataset file name) [$(caliper options)] -``` - -### CPP: - -``` -$ make cpp-benchmark -$ ./cpp-benchmark $(specific generated dataset file name) [$(benchmark options)] -``` - -### Python: - -For Python benchmark we have `--json` for outputting the json result - -#### Pure Python: - -``` -$ make python-pure-python-benchmark -$ ./python-pure-python-benchmark [--json] $(specific generated dataset file name) -``` - -#### CPP reflection: - -``` -$ make python-cpp-reflection-benchmark -$ ./python-cpp-reflection-benchmark [--json] $(specific generated dataset file name) -``` - -#### CPP generated code: - -``` -$ make python-cpp-generated-code-benchmark -$ ./python-cpp-generated-code-benchmark [--json] $(specific generated dataset file name) -``` - -### Go: -``` -$ make go-benchmark -$ ./go-benchmark $(specific generated dataset file name) [go testing options] -``` - -### PHP -#### Pure PHP -``` -$ make php-benchmark -$ ./php-benchmark $(specific generated dataset file name) -``` -#### PHP with c extension -``` -$ make php-c-benchmark -$ ./php-c-benchmark $(specific generated dataset file name) -``` - -### Node.js -``` -$ make js-benchmark -$ ./js-benchmark $(specific generated dataset file name) -``` - -### C# -From `csharp/src/Google.Protobuf.Benchmarks`, run: - -``` -$ dotnet run -c Release -``` - -We intend to add support for this within the makefile in due course. - -## Benchmark datasets - -Each data set is in the format of benchmarks.proto: - -1. name is the benchmark dataset's name. -2. message_name is the benchmark's message type full name (including package and message name) -3. payload is the list of raw data. - -The schema for the datasets is described in `benchmarks.proto`. - -Benchmark likely want to run several benchmarks against each data set (parse, -serialize, possibly JSON, possibly using different APIs, etc). - -We would like to add more data sets. In general we will favor data sets -that make the overall suite diverse without being too large or having -too many similar tests. Ideally everyone can run through the entire -suite without the test run getting too long. diff --git a/benchmarks/benchmark.cc b/benchmarks/benchmark.cc new file mode 100644 index 0000000..a2e2cc2 --- /dev/null +++ b/benchmarks/benchmark.cc @@ -0,0 +1,390 @@ +// 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. + +#include + +#include + +#include + +#include "google/ads/googleads/v13/services/google_ads_service.upbdefs.h" +#include "google/protobuf/descriptor.pb.h" +#include "absl/container/flat_hash_set.h" +#include "google/protobuf/dynamic_message.h" +#include "benchmarks/descriptor.pb.h" +#include "benchmarks/descriptor.upb.h" +#include "benchmarks/descriptor.upbdefs.h" +#include "benchmarks/descriptor_sv.pb.h" +#include "upb/base/internal/log2.h" +#include "upb/mem/arena.h" +#include "upb/reflection/def.hpp" + +upb_StringView descriptor = benchmarks_descriptor_proto_upbdefinit.descriptor; +namespace protobuf = ::google::protobuf; + +// A buffer big enough to parse descriptor.proto without going to heap. +// We use 64-bit ints here to force alignment. +int64_t buf[8191]; + +void CollectFileDescriptors( + const _upb_DefPool_Init* file, + std::vector& serialized_files, + absl::flat_hash_set& seen) { + if (!seen.insert(file).second) return; + for (_upb_DefPool_Init** deps = file->deps; *deps; deps++) { + CollectFileDescriptors(*deps, serialized_files, seen); + } + serialized_files.push_back(file->descriptor); +} + +static void BM_ArenaOneAlloc(benchmark::State& state) { + for (auto _ : state) { + upb_Arena* arena = upb_Arena_New(); + upb_Arena_Malloc(arena, 1); + upb_Arena_Free(arena); + } +} +BENCHMARK(BM_ArenaOneAlloc); + +static void BM_ArenaInitialBlockOneAlloc(benchmark::State& state) { + for (auto _ : state) { + upb_Arena* arena = upb_Arena_Init(buf, sizeof(buf), nullptr); + upb_Arena_Malloc(arena, 1); + upb_Arena_Free(arena); + } +} +BENCHMARK(BM_ArenaInitialBlockOneAlloc); + +static void BM_ArenaFuseUnbalanced(benchmark::State& state) { + std::vector arenas(state.range(0)); + size_t n = 0; + for (auto _ : state) { + for (auto& arena : arenas) { + arena = upb_Arena_New(); + } + for (auto& arena : arenas) { + upb_Arena_Fuse(arenas[0], arena); + } + for (auto& arena : arenas) { + upb_Arena_Free(arena); + } + n += arenas.size(); + } + state.SetItemsProcessed(n); +} +BENCHMARK(BM_ArenaFuseUnbalanced)->Range(2, 128); + +static void BM_ArenaFuseBalanced(benchmark::State& state) { + std::vector arenas(state.range(0)); + size_t n = 0; + + for (auto _ : state) { + for (auto& arena : arenas) { + arena = upb_Arena_New(); + } + + // Perform a series of fuses that keeps the halves balanced. + size_t max = upb_Log2Ceiling(arenas.size()); + for (size_t n = 0; n <= max; n++) { + size_t step = 1 << n; + for (size_t i = 0; i + step < arenas.size(); i += (step * 2)) { + upb_Arena_Fuse(arenas[i], arenas[i + step]); + } + } + + for (auto& arena : arenas) { + upb_Arena_Free(arena); + } + n += arenas.size(); + } + state.SetItemsProcessed(n); +} +BENCHMARK(BM_ArenaFuseBalanced)->Range(2, 128); + +enum LoadDescriptorMode { + NoLayout, + WithLayout, +}; + +// This function is mostly copied from upb/def.c, but it is modified to avoid +// passing in the pre-generated mini-tables, in order to force upb to compute +// them dynamically. Generally you would never want to do this, but we want to +// simulate the cost we would pay if we were loading these types purely from +// descriptors, with no mini-tales available. +bool LoadDefInit_BuildLayout(upb_DefPool* s, const _upb_DefPool_Init* init, + size_t* bytes) { + _upb_DefPool_Init** deps = init->deps; + google_protobuf_FileDescriptorProto* file; + upb_Arena* arena; + upb_Status status; + + upb_Status_Clear(&status); + + if (upb_DefPool_FindFileByName(s, init->filename)) { + return true; + } + + arena = upb_Arena_New(); + + for (; *deps; deps++) { + if (!LoadDefInit_BuildLayout(s, *deps, bytes)) goto err; + } + + file = google_protobuf_FileDescriptorProto_parse_ex( + init->descriptor.data, init->descriptor.size, nullptr, + kUpb_DecodeOption_AliasString, arena); + *bytes += init->descriptor.size; + + if (!file) { + upb_Status_SetErrorFormat( + &status, + "Failed to parse compiled-in descriptor for file '%s'. This should " + "never happen.", + init->filename); + goto err; + } + + // KEY DIFFERENCE: Here we pass in only the descriptor, and not the + // pre-generated minitables. + if (!upb_DefPool_AddFile(s, file, &status)) { + goto err; + } + + upb_Arena_Free(arena); + return true; + +err: + fprintf(stderr, + "Error loading compiled-in descriptor for file '%s' (this should " + "never happen): %s\n", + init->filename, upb_Status_ErrorMessage(&status)); + exit(1); +} + +template +static void BM_LoadAdsDescriptor_Upb(benchmark::State& state) { + size_t bytes_per_iter = 0; + for (auto _ : state) { + upb::DefPool defpool; + if (Mode == NoLayout) { + google_ads_googleads_v13_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_v13_services_google_ads_service_proto_upbdefinit, + &bytes_per_iter); + } + } + state.SetBytesProcessed(state.iterations() * bytes_per_iter); +} +BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Upb, NoLayout); +BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Upb, WithLayout); + +template +static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) { + extern _upb_DefPool_Init + google_ads_googleads_v13_services_google_ads_service_proto_upbdefinit; + std::vector serialized_files; + absl::flat_hash_set seen_files; + CollectFileDescriptors( + &google_ads_googleads_v13_services_google_ads_service_proto_upbdefinit, + serialized_files, seen_files); + size_t bytes_per_iter = 0; + for (auto _ : state) { + bytes_per_iter = 0; + protobuf::Arena arena; + protobuf::DescriptorPool pool; + for (auto file : serialized_files) { + absl::string_view input(file.data, file.size); + auto proto = + protobuf::Arena::CreateMessage(&arena); + bool ok = proto->ParseFrom(input) && + pool.BuildFile(*proto) != nullptr; + if (!ok) { + printf("Failed to add file.\n"); + exit(1); + } + bytes_per_iter += input.size(); + } + + if (Mode == WithLayout) { + protobuf::DynamicMessageFactory factory; + const protobuf::Descriptor* d = pool.FindMessageTypeByName( + "google.ads.googleads.v13.services.SearchGoogleAdsResponse"); + if (!d) { + printf("Failed to find descriptor.\n"); + exit(1); + } + factory.GetPrototype(d); + } + } + state.SetBytesProcessed(state.iterations() * bytes_per_iter); +} +BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Proto2, NoLayout); +BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Proto2, WithLayout); + +enum CopyStrings { + Copy, + Alias, +}; + +enum ArenaMode { + NoArena, + UseArena, + InitBlock, +}; + +template +static void BM_Parse_Upb_FileDesc(benchmark::State& state) { + for (auto _ : state) { + upb_Arena* arena; + if (AMode == InitBlock) { + arena = upb_Arena_Init(buf, sizeof(buf), nullptr); + } else { + arena = upb_Arena_New(); + } + upb_benchmark_FileDescriptorProto* set = + upb_benchmark_FileDescriptorProto_parse_ex( + descriptor.data, descriptor.size, nullptr, + Copy == Alias ? kUpb_DecodeOption_AliasString : 0, arena); + if (!set) { + printf("Failed to parse.\n"); + exit(1); + } + upb_Arena_Free(arena); + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK_TEMPLATE(BM_Parse_Upb_FileDesc, UseArena, Copy); +BENCHMARK_TEMPLATE(BM_Parse_Upb_FileDesc, UseArena, Alias); +BENCHMARK_TEMPLATE(BM_Parse_Upb_FileDesc, InitBlock, Copy); +BENCHMARK_TEMPLATE(BM_Parse_Upb_FileDesc, InitBlock, Alias); + +template +struct Proto2Factory; + +template +struct Proto2Factory { + public: + P* GetProto() { return &proto; } + + private: + P proto; +}; + +template +struct Proto2Factory { + public: + P* GetProto() { return protobuf::Arena::CreateMessage

(&arena); } + + private: + protobuf::Arena arena; +}; + +template +struct Proto2Factory { + public: + Proto2Factory() : arena(GetOptions()) {} + P* GetProto() { return protobuf::Arena::CreateMessage

(&arena); } + + private: + protobuf::ArenaOptions GetOptions() { + protobuf::ArenaOptions opts; + opts.initial_block = (char*)buf; + opts.initial_block_size = sizeof(buf); + return opts; + } + + protobuf::Arena arena; +}; + +using FileDesc = ::upb_benchmark::FileDescriptorProto; +using FileDescSV = ::upb_benchmark::sv::FileDescriptorProto; + +template +void BM_Parse_Proto2(benchmark::State& state) { + constexpr protobuf::MessageLite::ParseFlags kParseFlags = + kCopy == Copy + ? protobuf::MessageLite::ParseFlags::kMergePartial + : protobuf::MessageLite::ParseFlags::kMergePartialWithAliasing; + for (auto _ : state) { + Proto2Factory proto_factory; + auto proto = proto_factory.GetProto(); + absl::string_view input(descriptor.data, descriptor.size); + bool ok = proto->template ParseFrom(input); + if (!ok) { + printf("Failed to parse.\n"); + exit(1); + } + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, NoArena, Copy); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, UseArena, Copy); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, InitBlock, Copy); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, InitBlock, Alias); + +static void BM_SerializeDescriptor_Proto2(benchmark::State& state) { + upb_benchmark::FileDescriptorProto proto; + proto.ParseFromArray(descriptor.data, descriptor.size); + for (auto _ : state) { + proto.SerializePartialToArray(buf, sizeof(buf)); + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK(BM_SerializeDescriptor_Proto2); + +static void BM_SerializeDescriptor_Upb(benchmark::State& state) { + int64_t total = 0; + upb_Arena* arena = upb_Arena_New(); + upb_benchmark_FileDescriptorProto* set = + upb_benchmark_FileDescriptorProto_parse(descriptor.data, descriptor.size, + arena); + if (!set) { + printf("Failed to parse.\n"); + exit(1); + } + for (auto _ : state) { + upb_Arena* enc_arena = upb_Arena_Init(buf, sizeof(buf), nullptr); + size_t size; + char* data = + upb_benchmark_FileDescriptorProto_serialize(set, enc_arena, &size); + if (!data) { + printf("Failed to serialize.\n"); + exit(1); + } + total += size; + } + state.SetBytesProcessed(total); +} +BENCHMARK(BM_SerializeDescriptor_Upb); diff --git a/benchmarks/benchmarks.proto b/benchmarks/benchmarks.proto deleted file mode 100644 index 51c0b54..0000000 --- a/benchmarks/benchmarks.proto +++ /dev/null @@ -1,63 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. 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 Inc. 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. - -syntax = "proto3"; -package benchmarks; -option java_package = "com.google.protobuf.benchmarks"; - -message BenchmarkDataset { - // Name of the benchmark dataset. This should be unique across all datasets. - // Should only contain word characters: [a-zA-Z0-9_] - string name = 1; - - // Fully-qualified name of the protobuf message for this dataset. - // It will be one of the messages defined benchmark_messages_proto2.proto - // or benchmark_messages_proto3.proto. - // - // Implementations that do not support reflection can implement this with - // an explicit "if/else" chain that lists every known message defined - // in those files. - string message_name = 2; - - // The payload(s) for this dataset. They should be parsed or serialized - // in sequence, in a loop, ie. - // - // while (!benchmarkDone) { // Benchmark runner decides when to exit. - // for (i = 0; i < benchmark.payload.length; i++) { - // parse(benchmark.payload[i]) - // } - // } - // - // This is intended to let datasets include a variety of data to provide - // potentially more realistic results than just parsing the same message - // over and over. A single message parsed repeatedly could yield unusually - // good branch prediction performance. - repeated bytes payload = 3; -} diff --git a/benchmarks/build_defs.bzl b/benchmarks/build_defs.bzl new file mode 100644 index 0000000..a689431 --- /dev/null +++ b/benchmarks/build_defs.bzl @@ -0,0 +1,70 @@ +# Copyright (c) 2009-2021, Google LLC +# 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 + +# begin:google_only +# load("@rules_cc//cc:defs.bzl", _cc_proto_library = "cc_proto_library") +# +# _is_google3 = True +# end:google_only + +# begin:github_only +_cc_proto_library = native.cc_proto_library +_is_google3 = False +# end:github_only + +def proto_library(**kwargs): + if _is_google3: + kwargs["cc_api_version"] = 2 + native.proto_library( + **kwargs + ) + +def tmpl_cc_binary(name, gen, args, replacements = [], **kwargs): + srcs = [name + ".cc"] + native.genrule( + name = name + "_gen_srcs", + tools = [gen], + outs = srcs, + cmd = "$(location " + gen + ") " + " ".join(args) + " > $@", + ) + + if _is_google3: + kwargs["malloc"] = "//base:system_malloc" + kwargs["features"] = ["-static_linking_mode"] + native.cc_binary( + name = name, + srcs = srcs, + **kwargs + ) + +def cc_optimizefor_proto_library(name, srcs, outs, optimize_for): + if len(srcs) != 1: + fail("Currently srcs must have exactly 1 element") + + native.genrule( + name = name + "_gen_proto", + srcs = srcs, + outs = outs, + cmd = "cp $< $@ && chmod a+w $@ && echo 'option optimize_for = " + optimize_for + ";' >> $@", + ) + + proto_library( + name = name + "_proto", + srcs = outs, + ) + + _cc_proto_library( + name = name, + deps = [":" + name + "_proto"], + ) + +def expand_suffixes(vals, suffixes): + ret = [] + for val in vals: + for suffix in suffixes: + ret.append(val + suffix) + return ret diff --git a/benchmarks/compare.py b/benchmarks/compare.py new file mode 100644 index 0000000..027d994 --- /dev/null +++ b/benchmarks/compare.py @@ -0,0 +1,123 @@ +#!/usr/bin/python3 +# +# 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. + +"""Benchmarks the current working directory against a given baseline. + +This script benchmarks both size and speed. Sample output: +""" + +import contextlib +import json +import os +import re +import subprocess +import sys +import tempfile + +@contextlib.contextmanager +def GitWorktree(commit): + tmpdir = tempfile.mkdtemp() + subprocess.run(['git', 'worktree', 'add', '-q', '-d', tmpdir, commit], check=True) + cwd = os.getcwd() + os.chdir(tmpdir) + try: + yield tmpdir + finally: + os.chdir(cwd) + subprocess.run(['git', 'worktree', 'remove', tmpdir], check=True) + +def Run(cmd): + subprocess.check_call(cmd, shell=True) + +def Benchmark(outbase, bench_cpu=True, runs=12, fasttable=False): + tmpfile = "/tmp/bench-output.json" + Run("rm -rf {}".format(tmpfile)) + #Run("CC=clang bazel test ...") + if fasttable: + extra_args = " --//:fasttable_enabled=true" + else: + extra_args = "" + + if bench_cpu: + Run("CC=clang bazel build -c opt --copt=-march=native benchmarks:benchmark" + extra_args) + Run("./bazel-bin/benchmarks/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={} --benchmark_min_time=0.05 --benchmark_enable_random_interleaving=true".format(tmpfile, runs)) + with open(tmpfile) as f: + bench_json = json.load(f) + + # Translate into the format expected by benchstat. + txt_filename = outbase + ".txt" + with open(txt_filename, "w") as f: + for run in bench_json["benchmarks"]: + if run["run_type"] == "aggregate": + continue + name = run["name"] + name = name.replace(" ", "") + name = re.sub(r'^BM_', 'Benchmark', name) + values = (name, run["iterations"], run["cpu_time"]) + print("{} {} {} ns/op".format(*values), file=f) + Run("sort {} -o {} ".format(txt_filename, txt_filename)) + + Run("CC=clang bazel build -c opt --copt=-g --copt=-march=native :conformance_upb" + + extra_args) + Run("cp -f bazel-bin/conformance_upb {}.bin".format(outbase)) + + +baseline = "main" +bench_cpu = True +fasttable = False + +if len(sys.argv) > 1: + baseline = sys.argv[1] + + # Quickly verify that the baseline exists. + with GitWorktree(baseline): + pass + +# Benchmark our current directory first, since it's more likely to be broken. +Benchmark("/tmp/new", bench_cpu, fasttable=fasttable) + +# Benchmark the baseline. +with GitWorktree(baseline): + Benchmark("/tmp/old", bench_cpu, fasttable=fasttable) + +print() +print() + +if bench_cpu: + Run("~/go/bin/benchstat /tmp/old.txt /tmp/new.txt") + +print() +print() + +Run("objcopy --strip-debug /tmp/old.bin /tmp/old.bin.stripped") +Run("objcopy --strip-debug /tmp/new.bin /tmp/new.bin.stripped") +Run("~/code/bloaty/bloaty /tmp/new.bin.stripped -- /tmp/old.bin.stripped --debug-file=/tmp/old.bin --debug-file=/tmp/new.bin -d compileunits,symbols") diff --git a/benchmarks/cpp/cpp_benchmark.cc b/benchmarks/cpp/cpp_benchmark.cc deleted file mode 100644 index 036d234..0000000 --- a/benchmarks/cpp/cpp_benchmark.cc +++ /dev/null @@ -1,254 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. 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 Inc. 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. - -#include -#include -#include "benchmark/benchmark.h" -#include "benchmarks.pb.h" -#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" -#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" -#include "datasets/google_message2/benchmark_message2.pb.h" -#include "datasets/google_message3/benchmark_message3.pb.h" -#include "datasets/google_message4/benchmark_message4.pb.h" - - -#define PREFIX "dataset." -#define SUFFIX ".pb" - -using benchmarks::BenchmarkDataset; -using google::protobuf::Arena; -using google::protobuf::Descriptor; -using google::protobuf::DescriptorPool; -using google::protobuf::Message; -using google::protobuf::MessageFactory; - -class Fixture : public benchmark::Fixture { - public: - Fixture(const BenchmarkDataset& dataset, const std::string& suffix) { - for (int i = 0; i < dataset.payload_size(); i++) { - payloads_.push_back(dataset.payload(i)); - } - - const Descriptor* d = - DescriptorPool::generated_pool()->FindMessageTypeByName( - dataset.message_name()); - - if (!d) { - std::cerr << "Couldn't find message named '" << dataset.message_name() - << "\n"; - } - - prototype_ = MessageFactory::generated_factory()->GetPrototype(d); - SetName((dataset.name() + suffix).c_str()); - } - - protected: - std::vector payloads_; - const Message* prototype_; -}; - -class WrappingCounter { - public: - WrappingCounter(size_t limit) : value_(0), limit_(limit) {} - - size_t Next() { - size_t ret = value_; - if (++value_ == limit_) { - value_ = 0; - } - return ret; - } - - private: - size_t value_; - size_t limit_; -}; - -template -class ParseNewFixture : public Fixture { - public: - ParseNewFixture(const BenchmarkDataset& dataset) - : Fixture(dataset, "_parse_new") {} - - virtual void BenchmarkCase(benchmark::State& state) { - WrappingCounter i(payloads_.size()); - size_t total = 0; - - while (state.KeepRunning()) { - T m; - const std::string& payload = payloads_[i.Next()]; - total += payload.size(); - m.ParseFromString(payload); - } - - state.SetBytesProcessed(total); - } -}; - -template -class ParseNewArenaFixture : public Fixture { - public: - ParseNewArenaFixture(const BenchmarkDataset& dataset) - : Fixture(dataset, "_parse_newarena") {} - - virtual void BenchmarkCase(benchmark::State& state) { - WrappingCounter i(payloads_.size()); - size_t total = 0; - Arena arena; - - while (state.KeepRunning()) { - arena.Reset(); - Message* m = Arena::CreateMessage(&arena); - const std::string& payload = payloads_[i.Next()]; - total += payload.size(); - m->ParseFromString(payload); - } - - state.SetBytesProcessed(total); - } -}; - -template -class ParseReuseFixture : public Fixture { - public: - ParseReuseFixture(const BenchmarkDataset& dataset) - : Fixture(dataset, "_parse_reuse") {} - - virtual void BenchmarkCase(benchmark::State& state) { - T m; - WrappingCounter i(payloads_.size()); - size_t total = 0; - - while (state.KeepRunning()) { - const std::string& payload = payloads_[i.Next()]; - total += payload.size(); - m.ParseFromString(payload); - } - - state.SetBytesProcessed(total); - } -}; - -template -class SerializeFixture : public Fixture { - public: - SerializeFixture(const BenchmarkDataset& dataset) - : Fixture(dataset, "_serialize") { - for (size_t i = 0; i < payloads_.size(); i++) { - message_.push_back(new T); - message_.back()->ParseFromString(payloads_[i]); - } - } - - ~SerializeFixture() { - for (size_t i = 0; i < message_.size(); i++) { - delete message_[i]; - } - } - - virtual void BenchmarkCase(benchmark::State& state) { - size_t total = 0; - std::string str; - WrappingCounter i(payloads_.size()); - - while (state.KeepRunning()) { - str.clear(); - message_[i.Next()]->SerializeToString(&str); - total += str.size(); - } - - state.SetBytesProcessed(total); - } - - private: - std::vector message_; -}; - -std::string ReadFile(const std::string& name) { - std::ifstream file(name.c_str()); - GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" << name << - "', please make sure you are running " - "this command from the benchmarks/ " - "directory.\n"; - return std::string((std::istreambuf_iterator(file)), - std::istreambuf_iterator()); -} - -template -void RegisterBenchmarksForType(const BenchmarkDataset& dataset) { - ::benchmark::internal::RegisterBenchmarkInternal( - new ParseNewFixture(dataset)); - ::benchmark::internal::RegisterBenchmarkInternal( - new ParseReuseFixture(dataset)); - ::benchmark::internal::RegisterBenchmarkInternal( - new ParseNewArenaFixture(dataset)); - ::benchmark::internal::RegisterBenchmarkInternal( - new SerializeFixture(dataset)); -} - -void RegisterBenchmarks(const std::string& dataset_bytes) { - BenchmarkDataset dataset; - GOOGLE_CHECK(dataset.ParseFromString(dataset_bytes)); - - if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") { - RegisterBenchmarksForType(dataset); - } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") { - RegisterBenchmarksForType(dataset); - } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { - RegisterBenchmarksForType(dataset); - } else if (dataset.message_name() == - "benchmarks.google_message3.GoogleMessage3") { - RegisterBenchmarksForType - (dataset); - } else if (dataset.message_name() == - "benchmarks.google_message4.GoogleMessage4") { - RegisterBenchmarksForType - (dataset); - } else { - std::cerr << "Unknown message type: " << dataset.message_name(); - exit(1); - } -} - -int main(int argc, char *argv[]) { - ::benchmark::Initialize(&argc, argv); - if (argc == 1) { - std::cerr << "Usage: ./cpp-benchmark " << std::endl; - std::cerr << "input data is in the format of \"benchmarks.proto\"" - << std::endl; - return 1; - } else { - for (int i = 1; i < argc; i++) { - RegisterBenchmarks(ReadFile(argv[i])); - } - } - - ::benchmark::RunSpecifiedBenchmarks(); -} diff --git a/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto b/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto deleted file mode 100644 index e404b9f..0000000 --- a/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. 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 Inc. 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. - -// Benchmark messages for proto2. - -syntax = "proto2"; - -package benchmarks.proto2; -option java_package = "com.google.protobuf.benchmarks"; - -// This is the default, but we specify it here explicitly. -option optimize_for = SPEED; - -option cc_enable_arenas = true; - -message GoogleMessage1 { - required string field1 = 1; - optional string field9 = 9; - optional string field18 = 18; - optional bool field80 = 80 [default = false]; - optional bool field81 = 81 [default = true]; - required int32 field2 = 2; - required int32 field3 = 3; - optional int32 field280 = 280; - optional int32 field6 = 6 [default = 0]; - optional int64 field22 = 22; - optional string field4 = 4; - repeated fixed64 field5 = 5; - optional bool field59 = 59 [default = false]; - optional string field7 = 7; - optional int32 field16 = 16; - optional int32 field130 = 130 [default = 0]; - optional bool field12 = 12 [default = true]; - optional bool field17 = 17 [default = true]; - optional bool field13 = 13 [default = true]; - optional bool field14 = 14 [default = true]; - optional int32 field104 = 104 [default = 0]; - optional int32 field100 = 100 [default = 0]; - optional int32 field101 = 101 [default = 0]; - optional string field102 = 102; - optional string field103 = 103; - optional int32 field29 = 29 [default = 0]; - optional bool field30 = 30 [default = false]; - optional int32 field60 = 60 [default = -1]; - optional int32 field271 = 271 [default = -1]; - optional int32 field272 = 272 [default = -1]; - optional int32 field150 = 150; - optional int32 field23 = 23 [default = 0]; - optional bool field24 = 24 [default = false]; - optional int32 field25 = 25 [default = 0]; - optional GoogleMessage1SubMessage field15 = 15; - optional bool field78 = 78; - optional int32 field67 = 67 [default = 0]; - optional int32 field68 = 68; - optional int32 field128 = 128 [default = 0]; - optional string field129 = 129 [default = "xxxxxxxxxxxxxxxxxxxxx"]; - optional int32 field131 = 131 [default = 0]; -} - -message GoogleMessage1SubMessage { - optional int32 field1 = 1 [default = 0]; - optional int32 field2 = 2 [default = 0]; - optional int32 field3 = 3 [default = 0]; - optional string field15 = 15; - optional bool field12 = 12 [default = true]; - optional int64 field13 = 13; - optional int64 field14 = 14; - optional int32 field16 = 16; - optional int32 field19 = 19 [default = 2]; - optional bool field20 = 20 [default = true]; - optional bool field28 = 28 [default = true]; - optional fixed64 field21 = 21; - optional int32 field22 = 22; - optional bool field23 = 23 [default = false]; - optional bool field206 = 206 [default = false]; - optional fixed32 field203 = 203; - optional int32 field204 = 204; - optional string field205 = 205; - optional uint64 field207 = 207; - optional uint64 field300 = 300; -} diff --git a/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb b/benchmarks/datasets/google_message1/proto2/dataset.google_message1_proto2.pb deleted file mode 100644 index f6fe7848cb889b65fb2c9465780c2e82b398639b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 289 zcmd-QOV7_w&qu8dj{HQ>|{A;GUn69Is(pqL3P_P+T4FX`ks_p6DLyqplTDYO0}D9&cq* zT^E(Wn88rMSQW`3DWFp2tYmK%5NQ(YW0Y)DTW4e)6B6bYUmh3j5Sfw*;%sf2nN*`y>=5MalvG+)6lk2Tk*(vmk}>4JGsitCF7*wJYC9MiI~W-z ZF>+Pg29~F#)+y&z&tU18n7DvV9suhNTo3>N diff --git a/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto b/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto deleted file mode 100644 index 8aee2f6..0000000 --- a/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. 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 Inc. 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. - -// Benchmark messages for proto3. - -syntax = "proto3"; - -package benchmarks.proto3; -option java_package = "com.google.protobuf.benchmarks"; - -// This is the default, but we specify it here explicitly. -option optimize_for = SPEED; - -option cc_enable_arenas = true; - -message GoogleMessage1 { - string field1 = 1; - string field9 = 9; - string field18 = 18; - bool field80 = 80; - bool field81 = 81; - int32 field2 = 2; - int32 field3 = 3; - int32 field280 = 280; - int32 field6 = 6; - int64 field22 = 22; - string field4 = 4; - repeated fixed64 field5 = 5; - bool field59 = 59; - string field7 = 7; - int32 field16 = 16; - int32 field130 = 130; - bool field12 = 12; - bool field17 = 17; - bool field13 = 13; - bool field14 = 14; - int32 field104 = 104; - int32 field100 = 100; - int32 field101 = 101; - string field102 = 102; - string field103 = 103; - int32 field29 = 29; - bool field30 = 30; - int32 field60 = 60; - int32 field271 = 271; - int32 field272 = 272; - int32 field150 = 150; - int32 field23 = 23; - bool field24 = 24; - int32 field25 = 25; - GoogleMessage1SubMessage field15 = 15; - bool field78 = 78; - int32 field67 = 67; - int32 field68 = 68; - int32 field128 = 128; - string field129 = 129; - int32 field131 = 131; -} - -message GoogleMessage1SubMessage { - int32 field1 = 1; - int32 field2 = 2; - int32 field3 = 3; - string field15 = 15; - bool field12 = 12; - int64 field13 = 13; - int64 field14 = 14; - int32 field16 = 16; - int32 field19 = 19; - bool field20 = 20; - bool field28 = 28; - fixed64 field21 = 21; - int32 field22 = 22; - bool field23 = 23; - bool field206 = 206; - fixed32 field203 = 203; - int32 field204 = 204; - string field205 = 205; - uint64 field207 = 207; - uint64 field300 = 300; -} diff --git a/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb b/benchmarks/datasets/google_message1/proto3/dataset.google_message1_proto3.pb deleted file mode 100644 index 4955bed31b5aee2a257a4979edd3c1b6291b335f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 289 zcmd-QOV7_w&qu8dj{HQ>|{A;GUn69Is(pqL3P_P+T4FX`ks_p6DLyqplTDYO0}D9&cq* zT^E(Wn88rMSQW`3DWFp2tYmK%5NQ(YW0Y)DTW4e)6B6bYUmh3j5Sfw*;%sf2nN*`y>=5MalvG+)6lk2Tk*(vmk}>4JGsitCF7*wJYC9MiI~W-z ZF>+Pg29~F#)+y&z&tU18n7DvV9sunQToM2P diff --git a/benchmarks/datasets/google_message2/benchmark_message2.proto b/benchmarks/datasets/google_message2/benchmark_message2.proto deleted file mode 100644 index 500c5d6..0000000 --- a/benchmarks/datasets/google_message2/benchmark_message2.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. 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 Inc. 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. - -// LINT: ALLOW_GROUPS - -// Benchmark messages for proto2. - -syntax = "proto2"; - -package benchmarks.proto2; -option java_package = "com.google.protobuf.benchmarks"; - -// This is the default, but we specify it here explicitly. -option optimize_for = SPEED; - -option cc_enable_arenas = true; - -message GoogleMessage2 { - optional string field1 = 1; - optional int64 field3 = 3; - optional int64 field4 = 4; - optional int64 field30 = 30; - optional bool field75 = 75 [default = false]; - optional string field6 = 6; - optional bytes field2 = 2; - optional int32 field21 = 21 [default = 0]; - optional int32 field71 = 71; - optional float field25 = 25; - optional int32 field109 = 109 [default = 0]; - optional int32 field210 = 210 [default = 0]; - optional int32 field211 = 211 [default = 0]; - optional int32 field212 = 212 [default = 0]; - optional int32 field213 = 213 [default = 0]; - optional int32 field216 = 216 [default = 0]; - optional int32 field217 = 217 [default = 0]; - optional int32 field218 = 218 [default = 0]; - optional int32 field220 = 220 [default = 0]; - optional int32 field221 = 221 [default = 0]; - optional float field222 = 222 [default = 0.0]; - optional int32 field63 = 63; - - repeated group Group1 = 10 { - required float field11 = 11; - optional float field26 = 26; - optional string field12 = 12; - optional string field13 = 13; - repeated string field14 = 14; - required uint64 field15 = 15; - optional int32 field5 = 5; - optional string field27 = 27; - optional int32 field28 = 28; - optional string field29 = 29; - optional string field16 = 16; - repeated string field22 = 22; - repeated int32 field73 = 73; - optional int32 field20 = 20 [default = 0]; - optional string field24 = 24; - optional GoogleMessage2GroupedMessage field31 = 31; - } - repeated string field128 = 128; - optional int64 field131 = 131; - repeated string field127 = 127; - optional int32 field129 = 129; - repeated int64 field130 = 130; - optional bool field205 = 205 [default = false]; - optional bool field206 = 206 [default = false]; -} - -message GoogleMessage2GroupedMessage { - optional float field1 = 1; - optional float field2 = 2; - optional float field3 = 3 [default = 0.0]; - optional bool field4 = 4; - optional bool field5 = 5; - optional bool field6 = 6 [default = true]; - optional bool field7 = 7 [default = false]; - optional float field8 = 8; - optional bool field9 = 9; - optional float field10 = 10; - optional int64 field11 = 11; -} diff --git a/benchmarks/datasets/google_message2/dataset.google_message2.pb b/benchmarks/datasets/google_message2/dataset.google_message2.pb deleted file mode 100644 index 3fa0e49e57db704a0f371d2b58a2d5b315acd554..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 84625 zcmXtfXMj`H*0zm{B6F|h+KnceNtyII={aeWK9f4>C&{Gu-pe?OB4ESbP>QHX7Zp)K zL5e6U*buOxq5`6#TtyM#+b8pW|FhRwd+pVpXRXZmPduNGXQF{@v|JvKM_HGlL(yC~ zksU9k%d|o%U&*s*n%+-F{_hvp9(Z8dWe;3Db7AVU1CO>vKfFfSeBTdSCHL2apMCb# zw{ySueEIsX500L{;+(gm*PfZCK3UNZ_f@~tx;9cIwfS|*YX^V7>D5hoOJ?xD_n~0y zgT?=S8++i%cA@i7l$*HpuIuJ5cusiXZFdMsf9*RIG?Gp|`tYusS6=e)_0e0;?{{8t z*!%cj7frr+_|6{_&xs%3@$e<|bo%iRhA+-Hrrr6;tXmS_UU5lB7gsJrXuL#N<(0b4K-({jY3d zUAq0lSI=9Zyw+CQe%)`*z3+V!?=!zee}Bnue-(e{-Sgd@@6Uf8hr4m>;nMzL(yO~g z7|yf56<1_Z-~2&;>mu^#w_EQLjD((EyKL)H+?PKeS$epClWEI63n~Z4al7fiJ73v2 z@W;(h+%cKuNGcL>`Y$@t7k+Xe4ajQ$KpS3+<*B^m#ld6y5eh>@~2nV zd|t~Iue@6}@5|E*gU=dIYJMjGfqP=H@dpnZ|9##s-+lbb6=QeAzZ~VxDjKfa z-Tg~7bL8%|%dh-$##-u%#rOTZps=MbTv=OWy>RV6pQEnT-*?q7)6aV;$R#Zq(tjpo zuX^giPd@WFmB#nef6qRk-=;QaVn|JJo|J*V1aE-kEs!z`MsI|~>;m1n^550PT z+f7ux)h8F8x_a5qyWYQO<=!RFeEa-q>xufBO7M+KEMpX|V-NkDJ*EctLirP(3YJOO z_3-h%g938ppB3jyzdHJsZOcP-L1*s=j#T@^C1WU&mHx2mm8j$5>z{u0Jlv?zaYIZ0 z=$Fe+uK0cXW9e1uYi~GMSo3eqGkrg$=6N4@^P`p1>9|iGoG}Z2mUqnbzg~{ zzO<0???x7;+f3oZm}~A6-(I-&a`>|8d%cdUF*i|ey$JXG$@uwK!NgVei(DU{Pdy-5 zy*D~-&h{mbIM!k8qBVqf+*=D+62EY{FLvRDYtC~HN)LZ9cEbfv9JB9U6%l__TKdgh zE!oBm|E|WY%di_CJ#6!yywdvR2P?*Kx4!4Sn zNVVz49hZEKyOw|Sg`=L!E0kxHwDZXMZ$Fi8aQ|R;zY5=;)QtUZxpd^N*ZrM$>`TS_pQO3Jm+6 z1v}qq9ewG{(>HjTJ2#d`e|{!a(?SRZ<3I)!?l|IrbvpmcLWc5NrM?zbIJFIkew z-gEkj$d4oJD*NMa=I*(C^PAsRXPx`r+?!RiZy|hn$MN%{n>U{qy7fr>m~4%`g7+k`3?5Mt>}Qi(a^A@d{;Y>zZ9B9;3~F`mrx>+xOn; z?YA{=o&U@Q-<q_nft$zgu>Jjd(5m{Jdq-&=rhwnrJb4?V7==+{qCSl>#Y>tueWC z$$M`cdEjX6)VcrZyYit42({|rOQ7NKcXh~aBRb%3-pD{96op}I3u-(%AJ$WC3a&}1 zavD+*zM;dzr-mAniynI5x%ulB7f+pgY2UJBPKvtzlHVl!bBB+jE=HtC;O{@(E)8AT zqIz|*fqs|P%1cVLUZ#pm)zr|9$%6-edSlMspU#|n>fD)q^}+!$>SV|X@y`KAtMDI( zH%mhljZ{2QF4(vU8YwpJ$Lc4<#ta`9^{Da2Ce7ulQ2dNRF0X2=3~PWsv-kYAW%cBP z_w)o_`P#cu)cUK1Qvy5iTcVjz2#>XONo0j<+?7$f33NNxgB`7N;%aog=o=kH%Q$Vf zW1xy@OfK8?=A6$CJfKEYTYZZOLS1&*c@Y0xpqdq4d-)DY=qjQ}${(+$LJ1rspmv%3 z=pf5!p!ph;n{WB})8Fo2w5g}XACF!Mp?Lapr?fD@+wT3JH1yw~CO9ar`E1IJi{sN* z1>#yQ*O+|w>BlzjS@|LE)VVYI>~B9ML7_CerQnNXSor50N$6T%6V3;i4i=XP!;Cz^ z9+rz;%4{gc76E;4-M)X@l4b9LkIv}(%lG;27E;7?Y`GBfvwRxPS4p#~w8x5_vS76m^5| zUx-94{PM@ArJ?IQ<*EzH$A|>!K*_Bvc_kCoSj2(XG346D=8Vdr3H=pd!7`0tZ!H*s63WF_v)y*7J z^5AH8#51gQBnPx{px68p@9ens(f=Z%*Ic|)ilQ}4Q|29jZ`@*mLe#n?TOEQmI0B~? z=;94l6~W(BV6+6@fZbvl)B7Y!Ur`%3(Q$Su+uNADXa3<2{+ir!H?ZBbzT_XXCE$`Y z_*(Bn($MuDbkr@=*N8EgNvzl`Nr~K}b(4I~(Moo_F?s9fcdT4>@QdpaRc5iim!cx@ zzoq;Ri8yOG7ASXuP1c3e=HIIYm)gdA4Duy=E3#D#PwUCV2b3 zcmKI)-S3-w4tF55U5fhY7T1(TropLeb^r-+UY?LIhhuq&NT&p05;tj9lr)Ssw$9*k z8k2`NeDKG%9e2Fcvp`_}b%+HxaB|TrlF)VC6gni81=vYFGd*O~T8C-)V$cHN%eXqo z0E@pqbaL)IFQU05{ihVQ@PnR@aN!>h0rOoK#8WGHlNmAZPWkvx$d7SE9@MLW?xuC3CWQjMP%?Czb}$?Z)K3 zeXs4`y8VlrkSCj6$wH`Ef*DhRt%2XewLpq6!vyBA%SXjI)$M>+9`BT>Xipqg-Ban?0;5K)zx&7In|9o{r&uI5+_9LO{fLDCART^UC^}(u6>EX2kVY?!Mj>u{) z7vCn5Xk6y9N2ZNPxiwa>F(AKtGx?3-u_66!mqp+5vhcC z9XTNlk%(k5T{&7PMSbp}i6Lqs)2}H8>D~_9&{k*~Hm=GWB6<2HdiF5zh>w2xPz-cI!;%LsghB%W37pKaxO$04WG$(9!Qn9t4vt#|Wq%c8Hk73N znhFM{{(8si9e1t2=+wE>`yRO9|Ex@bGtl>v5M4B`Z4DKjYBvGzVpZxXRfQpDH;b{h zpf%z46k52Z98Z$?(h^Tqm5$;Xi~f22rGrOLu9(#`_xqcEL2Q$S&znn!Lf61LTveV6 zcH31~y2~Y5dDcPz&sTO`jm=wL*|X@bcW2!Oj!o~w3x5aU2@c)>zf|@}L&SzP)?i!E z{pcZ`G*FFX>$Gup#^hmnR5-juB9F%79Xt+)aWy87e|_Y!yY6{kiR6gm4?B>rE8w5v z*Fzy3H|87>B*{{KzgkzbNwS7UG*k&YYIT32NF5BiJLpb1)0li@)tN_*9QjR;NLX{z z2;!_NIDHQU!USs!%WX7sj7@Qk-0jJAv1b013}6`tk1fZ@C6> zhr@ejNm23q&&UOE@Ta?@c|_OcSg{IuhKiHWaS{rTEC&y@?9`6g z4}SP^@2T%z)<*6{gf}zUQ0QthUKU|yS(1Xmsxz>ItY(pJsgYrQg6Ro&0WGx5!_4JZImri5qDyK0jNtX;*36sPz ziO1;Qks1?>P7ghq)r$v{}(Yq@wP z$4Gmm9E(hl8J;^D-~kA1@K&J4xaesuUm9T`dsn@ z8A4H#|JPxKVAuMUAh(oq5^upWE};k6#MEGt?dJ_Ccv+n)36XT5v3g+p#(ST5?$8}T zvuSatsYh=A zYXR_*nSFOTu9cv=5r(wal4Rkx)E7aa>vaN}ASTY6A+d5C=4*0Q@5ERw#|v?rKF~2Q z*m3{8Up~KJZcp4>%D2+gS#SFyREood60yl#xXKZ9h{ zM^?-^xpn`WNUfOBcj@WJq^QFysmRs+uzSP>GFXk|RAs_kVqz#a4An9vO9k(+k!;y+ zWAf`mkG?zinfHMo%}ioU%XEmx;8e3BS(mISw7D$DOk90wVJHjORt!Es&nC&e*an&x)!TTnj=-BnZ(8>Tj^AiE@tE^ zbUVaIG$z+B-*NYCAFZn*U){X|51~pg*rpDs!yQvr@Xp5@o(qP(%?l<-G*eN}l9i#Z_7{8n^mUPAk zJDt&lJdd6rN7X(8R52%r_O4@MVxTek=l^D%+WG84Buh@~yL3;lJ@LUiTcc1&j#G|~ zN*h*OT&HtSa6D?RuqidfZ5(ab+Ue@4J`%eTWq(@YN7^O9g?P&qe($Jc;S<6w?4MwX>fdIUj%cj6t&@k*;D=j!NnJ6gHnJ?m|K3K&c+>} z)LhxP25VQ*Ky@Ud+evAl!P42Wx%7Bc$pye^&5k_}pI&D}%yo^f2O<6Nr=7Wy5K4&V zLXPrKSSwe`n3`6|Oe%>B<8sGDDITU4A1-*gd#ELBF0R?TV9wZ z2}zVecdLz45M1>znkwO=evuU=?xY#6hwz-i|3eq`E&J_S4;kVr?{%7lw7{d`VFl zR=G;R#H&|rd+^tzOVG%*;F;e{NjCio+H!0&B^}nJ0-0n6AJj@qNtnJ{- z)j&&5>*P8Uws=w79JF&RGK|GHGSJjONJFq>=Nq#hdh;}Rwi$ibpZr9MI%m&1L@^Y+ zbbA{L(V4?0Y}jEfYAxL$qeRBaL^U5yAz;?jF`pUjU|C8-cDKdU%+QErlOhQ^g01W4 z-L~*WfR|_Vop*^>Iy}?y03y%~KchTH8j9-O^(;j~mgFmPZ8J?1dmY+rx}B>DY2!8@ zOUqRn;h zGC@*95xtY3H0qHC@5DWe?s@WT&y~+V@`x1GA6ht7A1;7Dc3ldEt`d2uDjy%$)b=|u zq8S3Lp_PVc+IGHoi!5#X`!1OPb>7rp3kBxIAyqDg5Iqnt2S z@~&>EjE~fnGH-}o#SF_Q;{1C`bL{9 zoNk1orp1~Q8L28_tVSD?zn;2#)|^jI_WFyPE+9xyf;UzoZKV|+d>VxR^<|b7KLFv{ z{lW@com1N>P`;~kRXS8|73B6g`%Z4(wRzJTp!tlx?{qgpsF%mCLhdbsJ*xrqyUNKJ zYT@O%@oviklB#c%Q4cW#Okk`9YmcAVfAcIN60E2A|AtUs2r{5F?7UzIoW2BpRk;2+KMF%|cxi=nJ`rfIny~`6(Z-bsc{WPMd5`N^^#Q?OF zsT@Bu;IIyKlWi8K?vx0sg9cTYOpf#YMn+I>%{zT$083Y_dv(oc_kGlpvu%D3LOo5% zBFbdohnIQ*uav9W$A?1f0*9>85>2{6n@(NBmn9ml+$%KtWgVW|o*C1b?FLWF-XO(^ zARoTH^2CvM4m}1$PU~w<+=}?zzu_lt`v=f1mS(Eyq6*4{y2_r?Ge(&`faV-QJNzRM zHWz3LZG{H9*)0ViH5oYX;cs?t+xpO%sZMh1?VF{j_qf@q*i*u&%fLGhb%!C2||&bY|01iO`4)@3^My!F^n?Y(DCZj#^ixd_pbP2(@R$& z-W@Xk0Vv2Xo}DU18u>jn@rVPMTK{|3liJ3cPWv4_1BZ-2c+s)VWom`t!frgcdT zutV&y^rvtJ5IP6v@BZfI*?;w3ed9I_gu3H=6Cy?kU;7uxgx6VJg1kjWREaTauc2(F z2qNZq44225%Y??}1qWZAedy-bdkt%M0^rr>zL8HE_Xc>u5Qsd<5KSs_5;_WjKuE7R zYc?o|6Nhsn369jq?{C_wbOI;B$_HT^@N9d$~mp{FH#lvL8xASL0OGXvyIYH}xF4tw_ukr5>BUz!+$3etyZ$Mf2`|^Hy+b zW}je&075-+b#TgQ{tZ7f2TYrocss>`#b@>QL&7)Z#}v0u`Z&@=<;59ng+uw_JGO4u)ofwda}iKLXFR81KA>$ zhDL`iD!_26hNR&!e}WY<>MIHiy&q6nfByWzC+kk$y{c!LQc(|~jz6eCZZ-k`_mvx^ zp#i$TrR!IZQ>=+FLFa`B3hIHOwoF4!ck{t=e;{Dv;sc=5T(aoS#~-}q8z5$S-_0ja zf?)}eL4`kMoDV>xqZwp~9JXPXNfl18vb+q8bD(*n!~rYE-VuV+Z+)`r_Dw5c#6*@6 z1BANX#hk)aOnBx|a4CMQZPJKDBCDvC>gQ?NBV#Euq<2yhiV2N0>BRJBG^PU8Cycb) z8Dfkfwo7?KH4dF3cK^G|#~XWoxJ&5le+AT%>ZX)( zG}(_~ju$5^a#Aj?m!Z|JZefBwNS|mKeQeOME_rCtiTl=p$DpWnTZtLm=0H-s~c4gQeA3ps)WH3W~fI+?|*mY?)Set)U));r>=oeH{VD{ zs;~K=1K(-0gHdG;(}~OQBLw^)x?3F;GeeEASCwIU#bm2m?XC?usU)SOZf$~r z!OAB;+IQf$M=wW=e!bu_DFZRO0p5%90|=b1B~t=Hht$R9WO|N`5HPY5>V&dUP7Wu^ zJin$^-fIhAg1SbQT$H(oE~6O7OZw)Tir9T*9i^8S8nzBXEB z55<&_1Q4700jhnp?h&bKVuFI5>`t&;B4Rq6PvCfJkTTBBdwt8FpY}4@b;mu3Xd8Un zG63QDx>1hS+LT4LJpBYKUBGr!5ZUd@`5|#y8)Q2ed<!pu@!ZZ71zW+d|fupZYF$R|brXvmV_W&m#j4^1P0bfHPh(^0oFP!HX zlRQyG2FQvJPo93}-c3LB&I?T*DT=;!|5PV@J^Y6#1<~Sz_6VAT!6Bnl z5_0OaT`a(H8xMcD@7t{@ z7+E|M#xyiQvE6ShJ9hGP2yywpw#9ns6~~C@X|Qx_N+^ z8%sFG3ucA2)+T_E*|ccYZ9mSM!VmUary-f8AD*|o4+;@N$!ddO>|j(1W=;`J)*=dy zmgMA93ghKWHSCoWBTki@1o*AbpL_nDPu`nHLvC~3$}1q$PsIN#yMyrGy9l5+9iIS1 zr`#wh=t!0%Vc5kW1){kaOjU_J{9;})+!&#c6Z{1QZD2@bEam&d360O}$~EQwL_EgP zqk*QA3tqhA*RK|T)(g)WUxVSM>FfIux2?b-9AHR!X0t%-Oqmn`i@|9h)J7^YKS!pm z61`0~mz@yW$!LC6!N&CKCb~mnnqTge=XkzxMPu@#lP_<1bkiGC#GvHN^@t6wf@ge2 z0qEVw6w+$En!%R0%7c(6Dbx8=Mj;O_GynuzyzQ&c?_SdDmPJ>kA=FCT0Yo7S{9uv* zDz=DeRTk+5!o+ZhY{sE!bxaN8Zw<5MpbtFw#JqWb{`3LD(9G=9S|699&idbPPdz>p$r*indJl?)H(pAYhNLxBrkN$Q`QkaH9fmu&lwxgV5EEzU$5;NB#d^+QzH|cWf0!GJ~^}LtCdtl^km+R+;t58GuQx_ zugfcsjSVsg{xmXrReHmU+YWK>9N|p?jW6MVc%xq(F+fVQR{^+qkRsv&9>-*_{F64oP zaN7SV0J-WRk-8N3WL#!yCEe{PVq$$RXk+6{Hc(p*E?@u36MNU~>RI`Qi3!!eylg7Bq~V`)XQd&gT2xZhRbhe?kCo8MTsM9&JV@YZqhlN$K4mrV z@HtkDpYpT|m1Y*t2@*iUTf6b$KPSI^4MfhgzPqirBNi3I&z-#!Tr8$#7Acuf%O}Qp zQbSO1R4yEe@tFco0L<*x9y_@1p>Jmc(qmfR%hmPBIZ*nQ2LLrA=ysrCbeY_(Vc4z; zThx&a7t!4b>&Q@@XVlYN^-{{0sWpObuGkU9xs+<9lGQGPRC4&$+50!{eWAAmaAH#j zLVfu_k1|TbH+X^=}ILQc&+0w;uM zW|BE<%vA^xAFrP^A;o|x%fWlMt$6zG#en*s(YNm9>mXEXXb|y%3cNyT07+d;8I)>5 zEqW>;NU4GzRZJf)sFdnKBFE`!;b|V?@W_Ces%8PGHj-3(U^OjAZ#E|Pe|UWTjt6g> zfrQ|z(mhhtZ66_Y01$i*{QKv5X=s#1QgFg!9maB85filmGqV|;;>5~rlFyd;0f zte!v%^F+>|0c(+Tv~Erd%WeZ2bKfUlFWxgpsS+46yi6_?Vr0btwEVH@@Sf*?**d$Y(KCs=q^RTEWr#P{;fH)>5EGGFaUjrO zXxaHt%9k?}bK{YK*=S?Q74nG!pVbUS{Z<0xw)(Q}31ZFG1#SG!(`%nweCYPxPQp?+ zB}J{9dnKaK2)vXu4=~J8z9JBkIGE0+FHWp6I+#%+vwyr~C+TuZHmlz))1lQ24YCe% z^8Q!nZd`~*F7@8LDk4JwzhkWeZ}TgloHv^R)m1YzpvsK#N7x-z4Xc5{)N}2E=a2pN z&D?K$ciM>?g-{nhc@1(n4UeXQyIse10KA*@uT9Gg{Q< zVRaNZ{DRx>T>aH62YUte-pm+;`YsJk6$d}O^eF&{t|is56sd%@wK?Eb^h;P^tUlN-NCxuwd`3%CVg({}wN->% z*=`j=W5V7Bm{QI8;nQ1Q-|+f_Jr|YeC#0y)7k@ETJZ{Vg!PplX&4w-Zs4+uG7J}oY zc$4ZBb(`IRtejo;cge2wSU^poX8MU{BA-jgHgFg)1(`SdmTm8^o&O)iB=7$1Ml`w_ zp1xZOg;*+cvcixRvbh!$N5U998OX*ODMqt?sUYi1U}CPUu%h7kLPO&M@c^k-cY{@s zci;MY{bw8RT;F@~+XPww>cPyvmtV2){P|#;1D$FO74ZEGd{b`_#m4yd@j^T0(k5+c zIhzL!Y2A$tJD+^`g{}Vsb#8j!jt3x!fnY;6yy&&-#UX6k%d)WKF4)T)pq7Zn{?VqK zIj#%m8__VP80#8}V060d=<3z)efY<3y>LXmHI5i*9DZyG;>E)RMm5Et4;ra$2R;+$ zN)|8&!e(;~yVp3H5P>&2G zz;}k;lZFO^4Xtai)^+5lt%$h5H*zguWhl-fSj{YS*+1xSlx&`&dOT`xOrH3B|Ln(p zc(2!}{SVrQ6vInkst6X88GUQg6QL^bAV_no8?5TV>mx3wb`r!pR-gT4>AIk0#07R z)qKXZFq9lL##%gftwRA6!NL1huekf6Unh_NJ#o|yp+5b|Je73pu&M(j^SdRSj^i=) z2ghX%V=*Sko2+C?rCbq=CzyB(et)N*-{Ndi$ zR)XE9X??#8QxJ9k3qQ%828AvwO4@XfD5y~71{}=+s>UO2EV}v8NB*9(bIbXND*sd7 zFGbyPk#H(kVBn_*)`GfMRtAGwrB2-)3DU|k#em0G40i() z)d^!2pxs3~?m9KO?wAz$KB?TRnNoPu;@71inXcRKq6Y?5RB^b*t8zmEH)VuamX1_e z!IlwQmvqJ9ia1$m*^G{0n*a~;*wnHOBOLROg*sho4KUS{x6Ix9+dVti_IzwnWEXO~ z8tj}`0&5#gXm~WjXnG|+bI$Gz3CjI|L!xm(>3r_c)~#EYJPEpwX?+jg*~`)`c#{)2 zQP8dzk5NHB&cJj9!Oz1Elr(A`JS6kB>)1iRHp8~zi%=_A2&4?$@^DpI14Nr?tX*Tb z8_Z-SL*vTnHs|p8Aj<)k2Qfx2&Q7kjxDpubcPKHVcu-^KzxmPbU*<3Pr>F9=ho3-H zo`6ZaKxrWiDN<&$8{NoBA}mvg%uUo-=mB$E8fEC} zI8b}F7g`MXpR^S?Fkh!HOB4kRp41(Q4$BiPi%4673yiU_#z3bYY#8H_0*eZ zkOjVJeP7HUMf6X=)B10egh=BGV?5qUHu?$FK|QHo0%3~bC{c|e(}(#4oGItydT>fD zzQX{7!Ls`n99eST*T{y`%)UJhFu(o9eZiEcT@EWA9fLv~`51>MBa7WFz0YO06uS@M{qz z>2Tkt7?7YP5`)u49I!_mU5|_k<=T>w^2DIQP_ouL1O}07E!&#dy0nf{5^DN^yupQZ zMjOr^e&wsb-$Ld}Gr^3}520}L&rW63Yhd$YH>f-42#$dtv5h2%2Dd8H-?eAGSUV;c zGAaR1zxBlG@9%x&z*wpWLwKj-`kGKHx*FzwJbCp)3ji_YF{a#3K}_B=ykiaG_r| zL`(OJtNkL&uvSoEIP2S2lw5% zcHV^j&q$1DboUs=ZMJQ7iF>xZ zHhF4J9(l8C*Pf7~bm1QnF6A=#pA$7nNZQ|G+MBe2M;d- zJm=MFSfpZS=uWPiE2pU)^nR>Ih?NA89f37>{`2?gZ+aUk?&CBFwe)^u$7|;WFi`D6 z_(cj13|A_KLG&omm9mz!roouA?&f)j0ACgcyJVwc`hNAUC`SHvae(pr(h28dqja3nfTga>rq}@@wWcg|BBgAgX4(%%)lWdA^w^ z(u61pupYEw@2hX^e&LfTzWtpSg@~Q6g4cfY7GR~5inPf|l5}An#;8HVl^WhDjfyd7 z50O7HY6ur-aUax}y!Yi5Tjsp-*}R@bKKY)FNYKKRz&y z8l-mtw0B??x+rcG0Po|EFT7>)tG`IdTg!JcrKrCsa}i7A;0w-+K_OAMoJ_kg1dS+D zN^_0i;J29HTVku80_r#%oM)yMx%0Y`~Km!wQ)LqYOubf@RA&BswQGh%*LlM&X3Y#l((r zN4!L|5>rT{6QiSgdnq|lg2$R;lJaP_Ixy%Mt~oN1D4CRI0}|=%y~{V9y$9^POzXRF z*JH?i{sn)_=R%=D77iOBd)yKwT3DBG%yv?GT&r-@eR(QeA?UrZ*&WoS7>&^maDYQM z|M<_syDvuGFLMl_iDxdp6!9JfT$LID9?;ZWLqw{_BlA*Jl}8WR`fBmETtPCN{D0~X!#!{5K$yP=7wHQ?*fW*E2{0~>NfZe~RlR+lOrG)E2mQF|K_%X_qip}yyIU^RbE+hsUiyI$bxPHrLe+dzhBkk3Q zeFxxt>Onx#6os`Y(WHoUJX8;kHB|7Tm7z|WJ0ak4I4W6JQ*NZA1~8e-SL1G|iXSrQ zIbgjUIR2f_+_vS5wae%99__cALWs|n;V)19C_C$kr7Z|X9zT}}(Up%;uhbYBpun?PR;B^Ns1ToWbF`Bs+9*%V*Jgkm47!a$} zqr|q(9L(iAJn-!~hwuMl^X4ae-)8S0M4nCtZ#onQcofF7xU@`ZB$ak3LOh8nO_9=k zWnWYWSh%(G_T7K#!_Ai>Z{?5zK>rh=*MUK>;u{ITTlOe9#i;3M4jWp`C{nu)>xh9= zPzVxQLmD0QWkq14?SXrjZ(ca}gIjvv?z;nv=&ghG13!Ve48 z(isnZKySz-SyBa3UB7zi*q48=Y9ZSF%3&f;d@X#wz6vH-bwxNCQsGQmRfj3)s_lwG zsMd_+C{aCy45n&qnwo&jrYGy7IPx=D)iU0IuIX0C#_O@gM1PVYDagIasQgC7CA z(6x+lP$tH(tj>NOFH^u#Lld2>t`mw26hg3CNdlJIxAN|fR()>ldkHJf^trMs3qfZV0uFRzjXs1^@WF9|{QrxN%!im{Zr$mb`7W7}9ki zk*$t5R5I=^hSQ+ax=>B2$;usSyU8igDAm1!wk5dDX7+K zt%BEI(bL1#c*{p6$A&#LVO6d+`*pBqv=a4>kP}inHC`SEZ1A67-TKR$XP^EP+;~Rc z-_(bts23|L#Hl;*<*Wz*ZWO0!ED8JS1Z>gi9?A!D46@Oz%CPuFfy=HTNrN^EwhPu* z^X#BFWT*OyK{6R{Rsoc<_TDX@ADcH9d8uiApHX{2fdFs44~*jE$^m7dZmr=WnekB$ z#U~D#OreM`Ru*@8bb68(#P)mAd9;e|Bi0AH-deLv=oe<(te9j}*$~F7O?zYWf$jGn z|7g{Mn|qp{dH1*!_4_w`L~{ka^;0Lvk8^BE;GyO};!L^BF1?X2;Z_ zMKyr$V;F5?SdTkY?121sc>TOhd)I$-xF^wUH397C?}g~4@aVd6FjkSl3JT7zXXsS7r+J{IlfhKK@1n|xNh<3$ zDyG0{(3_yrFM4eIGp9ayZV>s+q$t02^8*P;<=a@cAehC(K4M+9dZ z;=)8lP{mdwG{14kEEnW*ng+)=Mu%MDSS-VwpyEpH1kWkwj0fWkvI?y&(Tv=3*e}Z2 z18yO`)(JoipUUJwO#RN9BTsyMy2sJnH=l=mO9_9suMCL#>;#7`l9v3D1Ygb$HbV7y z!;(yy(;Q{L!oj7}8R3yUWRSE)d|s81(}o;nsWgQKME%Q))@^=y)_n*-n$~xM_ZQ-a zT=<^<0DAfAy3j;0xrq!DSR*v(IzwiwC#-5hz0S7=$|b_ZXrN z1I8}}lR?O;m(>iaV2T+RP52uoqq$hlCIh48u&3J!D_zOZL^~cgOyER%C?$ZLsByB zS&EyK7V&BRF@@Ee(cuP&9tx8(fVc4K?3T_G2Ek0j6`R_0n9=TJh;e(qjzwtCPak^n z^$joemeZCmd>#3S6aG7~25d@Ooi^nFi_`Q27%rS(QCTu$i#Qme)BR+#t2s7=!GnJ> z;^LMTMpD7Uf_${>2v?&Mx}u6bj0YfV*-L-lwS746uU;_;@>9bU&IU?km62nYMrX#Jj9L=cGPSLBP40%9|6=L(z8d{>E zR}3wyF)|V!FHPW8Njx7}vHNtvlh42U-LE~8_M6qczX;8Q3%da4jLsRAHDPB+UGvdW z`MS&93Gj{njJRFlCq`-nmJaCk%h}Dl{yuYiPp>Oqx(aDYP4MR1P69@a4t6Dt!j`<| zZqWSdrat23Vi{@-hMh3wb&*I;Ox9_JViQX62RR{tZhzkW=4%h1oNq#I_}RM_7JDU0!;6_@$(4? zjm+Gf@QtGcap-E%KqwO|WpyG~w7;a{CWJP(Et+m>80Wb=B8GUE`l$ZQIl zIG_<{6y9u3ZEVL<0ZziqSLT%Np@NlE>V&!!HZF??B-NkK%$d9W5>Wk^jP$yTD&PjO}tiO`I;Z z#RM6LJ8q|X_>F#_5rZp`uqlN>Ha4URb|ywibf%n4?~uv#1X*l0kQt+;j)avYxC*gU zCy#N`D6~WoEP-v9yXn_AcOCB0eUU$UL--l6^DkietGgxa5G^-I<}e2_jM^~haJ5XD zhz9c2{10~Q{%y`nQ~UnEY-LGN{~YaYExX|D2X6zELxqZ|xY$*ke7rth^yEe;tszC+ zLeN&nLXm=?V^9~N0V2g28XZtOK^1;+_Mg8$^8)gR;~9OiWoH4uA?L2fJ!2tF&Yp>wK?Xa1V&`MuKKa%ZZ*k_XD1=)3 zNd}3X^WY^{fJGU}Kup^n;8kjddRm>#HF-F^!b$L{@Zt$Cjzo>M=u$UH?JJn0@X#oh zhOLZQ+_^EGL#>eeabA$eHl986&7r?jh%?Nq^oThke8Fm|G=wV*8Myg^mRl(5hAaKF zPIS~|t*N4MR(zn7u2c$j3A641<~aMt&%6FU3#P9#`)oB4gwlNq8WUvfVuU~Ug3Y9> z9TfD4)J&|%*lB^m6v7hI23@=D8UYT!` z{sW+Eq{t;fx`!!<8p3G1kK7;Cl)P{`%7}Yx)~ZoBo^^_J?WBxQ$l@m=psu{PeBrL2 zK1RldGy1N$;v*@l^h9rxONHz7i@|OtDQg8JFTepdf?vsJV3=*$IKGWfrE;05KFxMA zfjIl{|k3mG(1p9T18=heiyzc-vHFMKoa+rcRE4+iPp2LaS{}a|VoUT!q&K4WO+{33c^@ zVo((~&-r})(X9sosW827@iWtXzDO-NVpXqCs<)+F=nJ zz=Zk#YJ^1;lic zO(`>2@{e%HfS+5m;nbeFZ+-+ec4zk8`_|dcmZ0NB|1|5*A8hC7RE>)zg`v?*`D z-rHO6TaLTCySw{y+}-`08)$J0!GZ)05Q;k#3l;(dw;)ABA$TcJoNqtpy+7d0nP+Ct z%$~K^TJxhUe6SL^>W({M!GsIs5UFixB#mZMiqWL?a@vJN;g2*^bW5Me6wKlU`GDVb zmO26{sbL3LW9$33Uhw^Edp1 _Dhvkbcqst!k~IF4a^29wPt znc{uYJa05BaBWdQ^$aur4CYnOa5JfUSLX(Aq7C{D%Y^$sp z8}q~(KDQ)jvDt&McwP-Qg4C#EpsMTe_)%)7a(B2@*p>TZl_qcwd2-FD4b11g_hh%us6Z z_Iu8LG*(QmuLRw}q5os*PEccgMse~=c8l@0;A3yNoo!hT@=7ZI` zz0l!D*DVt{{>N~!Hn+`X%*&Kg=?qOlyqTI!BYHbvkTRg{+7#-UFFZHJ*^a&_7%md|LW<|HoI zD?h#Y={tAc0!BNV)_%BVLWf+1y!P?^kmgASEWtckCiP1*df7hU+k~B^FCp|(BYlF9 zg$CB!pPhZ;omU&tnEm>1VDw|TZ?AIikL=Kf1^Jhx35Qa^+N4&hrl2&Ls1xzYk-HsF zN9p= z7)CrelGr2~Z>R?`d&AzX51o782K73A=&H66KyoKzVXaLll7+4sci}Rj_!zuFaz>4Y zY7B?8LMUlPi+bg}))?|r0uRF{N;lNfx{{qRsEK|cfNg*At~dVr@#pM{>|C6TWgL8)#s*Tl0=~;2Q|FL@RZ%7>QM)uy2IN(g3J_`N6yIf9cL|R#dIm z@BRTgBWy(S$^ve%gIRJYaZ@s^Dn&%16BccOnt%_}MqGYvS|Xb9AO@pUxdm4<$g#N; z?ct1WlXBEEWxG%yWEo?Mj+kqwXZ)lS7}@3&(4L?8_KrJWeE;p$?EklNmAAE#?*1hd zFcVQ$hc9J{2=+`Z8z+;k5sU~ktX0)C*MO^NW$FxtQ^50te0esnM)0)N;U(}VuYB|V zC;oBvrK?!wD_6WlKXU6q==`7Z4V{-#6%mWE)&kygqYWoI(ava!G5*{` z7y2r-96uoQlM@0qwvC6Z@q+ulyX}j!KDD5+edrq{;9cLSMyCRcJo{4|nh~?y9(oZ| zHS0X&C0&E(s4EOaHv@R`#@jAG{pv>^+2D}g9DQz;Afam_i=4BEpw9j;snm`5;|e~x zE-fdeIWn%0trxMwRk9ktU@$L`L z-G0oc{{TRK^V+|PKUc3WBP;P3AGwST@}0g{H;A;76|P#L5{?^HTsf|2x6)aLE<_fL zUCXXoMODQ4zA2d-(#V(TY>(F-YXTwoiAWL(h}%lrAewU-0~AdqNz=9TeZ8ibAbKlB zNuo2C8NA~>4v4G^V@=V7MU=ab~|1Yj@CCLur2i+VUS13&i0?EUIg*$a?Wk+wM#<2pcv{l)QL-gd{Udmo3k zHn08RYz}B5Mt7spKSx+ykhGEXT6{ZRa<@1UYyxZ~LVc&HBc9GX0BTN?<}x!e^jLiIJ$m@dt(MjIOX4I1Amt&n-2( zOI@OsvffT{mPYPCKl6vk2lvD2OS3jay-2bZ7B)jl9X%N(;fz(YJ82nY*xg!MZy6?rJxo{@ zr=T_Szu$WNXYW6-0p~oTU9mR{NON0Ql~rJ!EE0w_7xpLYI_P(1)qtI4%JZvHSE-Vb zREhCSI+M?*g|>8Qp65jk42FTtMCuBe-r+^LJ~!<7CGrc$yW7L^5KN6At;G)TyS3U@pz{8 z3ZXpi{d2#1;Ub@V@2jQRI=QJngtF9Y zH$L~_8<*UG#v7P?oB?&IV^8}LIwe*FQTzbv9uAiq=^(_0NX{4VSkVTd7v;vP7AK7m zNexVSe90YB`g5FsV{Yw%1Tv{`L)L^+d~Vrx*JZbzx?$1)ZWL&nKSj=OoukN7e08F6 z)CvMbA6CdTSwbGs`jzAF~74JY79 z7asNWXUA;NSaw{oN3|Y&Du^bmTI8G`p9`6ZZtAhf^^T&<=QhwgR<(flPM21Mw*Up(lkjbXj-;R+$%@ zc^HKt#WX0+p%_sCQf=Rt^78mm_OQc}bG0n7JEG)^gStjuWrv*WgqQYh-LwBKu$tMl z7Iv;EvN7auV-WdKoFS>uOQ|Tlp`;MB(Q%nI&5e4DDo&>k1knnIm1x8$qXHa~w;nwI z#9JTv?%*mA>pyIu=Oa|m&S63;Lq?EZX&EL2&<}AY#H4Hx2-lqCSZ(anWo6n(GiS!j zGgJWFuYL7jUtaa~j@1$A$OE5n7wLO+q+Lkj1Yip3+E!MFL?1h-JqvNFYALYd3RlIj zdvW?mErFeB?fr>M?@q8R^g?SnSL-BEe^_fZ<>rZ2*2id(N3dV)z476*_U(LnLznfl z^zmr>9ONkR^{T88w$pf-XNvm>c##k1G+?k!p{JM{$K-NkIMhoQ!!&N5PYaYsk8p((q z@5xjdC*IJmrJH0IN0AdK{RtPXPnbJc4A5?fQh}KWBBn7ML{A)d&37k0`vuBkJ#;NC-K|*v z!yjJTs2i4%EB_mCDo$Qhi(6w|ET69LFfBZ+iD+t4a;jpJF(eBD8B#!G_D7O3BTm@1 z&I?k{_<|3vKI656pI^UGdwb#hta|q(1JIm9F_ zr7E`G>Gmqru92jgD8oUVDemtqG9n8Pld@<%T1O}1;6X+5{qMKzdi}ejLHM|7?Q6|H z&;Y_A!?QS0+O;V2&OAL|>PKviZ^c<5UFRh)YLJkFCFFY9kR_HEPYEvmf{np1 z^fLNzUM$vZRCWRwUO;i)fA$mCqVOS9@eaKh%Gp)ungV&$ah)owQ%HitxhTL3TO=F| zre{rPJg#`c>7RRoF^r$1_cU@Sdp+3H8;Wv6o)xO-RbOUQ+$oit<}V7fmmu7q5y_` z;QCkoefb&xQlK0339RRo>nA_|J=$@&ru`N=jvtnoVy=a&FraJ~&4rUap z*`+zS*X}>|^rxhhtBDsuMlrEMmeADg5 z`THP3IpNw@Uwd@R*L1WS!>?QF^*-kR1aBndC#Ta?S%E2@wMO*3rNEt8(z|sIJ{1mV zBkV+aMlrCH)zX;JwGvu}*o+WcHt-f)o;@4@et6s4&maEK?PRn|jHA`+^}n9JDj$^) z)1yG=IgD6J$QsRHZcJP*^$ebD9#JgV&4iznT$Xw^s3~l}@4%NgowXCv37~3y6-Q%i zirn}DxCe>JB{fSxkoOiAoCcqZt683wLP(&VuB$qMF{y~j%KG-)U!;uiHR=!V>>@ZMTBClD{b!sh=${|{Z8QC zJbmNM_ndyo4I66LADsFm8ubdKumfrY_Lz6h8X+Vqzv>@P$R2xnW>MO*R!hBAwh^nk z8h3=x%6K8Xu}X5psG!3dkm7suXn((cEPfl9)r zwQmY|^kkVL)jSlYc-iREf;Wj8SPnf_XuDXI5*VCn1qDH?Q4EVIQhE__^?6Gyca(3B zc=r523^(qB58n6Zhwp+T1*{g+uwox|F3>jnh@}8%+V8Xm37;Q!iz<|kYste%!sSGF z8rL-dKKkN|6Q8^J!H-aa{-J9>J^XRydPezwcF%_*zbI(ID@?|(E2xP@)soIk%cQKs zJ6HypTEZfavvHfw${%7}{b1!P{aOm3J zzwA`4S0sUrYD*ruB6GPsOOUc0rlMq&m`-M)UQI#uC0$b@UMXZ?+p@8eGvTniKqq

oB%L*Mg0Sk{R_(+Bti6@IRC_a)aU`R{i6dzXz_o!zcIqisD zf8TiuG`?w#B+#J4=tF+~OEgjSo0(wdVyFaEeKn@!n@v2{8rRvZ8j);R=@%2s=^{5R zu*3L0d)X7GTzcmbC$3s~>(?uIvV#2dyj#HcOD`u^lG0FI*-;b2T9-vwcVI}Zp$e;! z6$pxq8F84Xq0tBr1&*LL9aZJ=1G%yx_v=e#<+2^dvPWj9xOS913*JW4&eg>!24gf* zo1AXG!HN;+_`K07g_PpigKz(3*Q0l>x`4FrN0$=~v4&(osEn9t2 z6G0w&=?K{BF=>6f!0VafRc+qS$je&<_9T;KE+AF^;OR$pzjfZ4cco3v&$1?hoN9U-g5kScG?50+VyXSKS!fYgUA*DWI8pPDMdJB z$plgpP8AUoCDIGljy5n#lyMk%nlPkPmf{b>0U?>BI8o$FDtf2#jWHp6hOmNUmMgxfxj49|0Z(b`b@G<^gJ=4h; z5}v*%OcDj@V`ZLi%yos5kOabR%Li}o`|9nxr07@cuUPrh{1CZw#}aZ!s=>fXS^T-B zC6%V;iT!ERJi;tvEo{glw-R~9o(<;bom0MlckfAGKEIm!=jajj`fleV8>K-Ff|D7b zG=>$-@I1QTqtmxF6e6`8U{Nt*DNt0Od+y+QH{SH2lVxGjt4ucuOQ|hVsuTCw}_Gu?H_eDLtFl zww<6+ud_~k6kT zexM!Axfv;`(pPV`I-R0kVM`5#ZIahi>rBWb9?r~#tnK3$&%XMU=bznxlCC+Vh(=!y zx#+S_L9(Tal-XWGL02%L#dEoO>E}^3b+yPIt(nuQw!^E^sO)J!GX*T54~~56fw!*S zwc4wymmY#Pqep&z*xis8lT?g0SDVXJy%JvzjO8-KAjw|W&U?xw!7_w8h0gDkHzC~4 z{oD4d4?KC_3gQ0rLp|C?1^M_7z$f@alQ^2kgSrB7?np@H?0Hw4lysYprbbU2@BZ`m zr$2no7uWnJ8frhk1N2v%Pk*^_%94;59)SYx@1)-0RHJi|xbdc_AagU?F(xepZhNSZ zUU;xW{=bfvMe__w(HFU~8AAt4O7vF@@57HtZT?VW` z+H7hXkJ*hL!>%LbJ^fm6$?cV;$w*$S%}seyM`B2?^l8(y6evFXUw`9~n@>EWgtqmk zDx~}-;;KfKLX02wAk|#bbuxQ0F3QRqf^eNW8gmEcx{)@t6Ff1e9n76*+HhplXkgN2 zC+vk=zq{ze_dY%og)KI(eR0y?RO^qYl4#$4g`CHQGn&;c6*QIz#?~}3u_aLm^s+XO z8ml9l7y$AFGYKm_JQu~%r7)9fN}-H~7xz7K`crQK8-4TIUcFSc&fi@|+gnF|{Tx(X z{?s=oaUC##SH$%(N!}ewAdzUIni=y(Q)<;c)seL$0c$#}N|SJz5s%KmLFk6wQbVFlm)azwpmbBb z)IL-P-Z^c{{--WId;`%qum0M`d3)}ypl@b|2X&kTNiY^8dcr5RCb{g6n!fOM6YizN zm1U*vQIl0d%xdyJW&;-J*7Hw!Z_Ag*uHeZ5kABT4woUiS?#7`Gn#3nC&(nS24%7&#_EK61vv---ZNvdaQD1p-|qb{ zzWJ9`1?4l@YPB7L+$0AtBei>JOZy{%P(;n`4%ww(nK$F%>@G7V@8G5RUaxo|76;Sm zYRNO}6ex4C)RtZjI|#vzOE>6RxVdjX=CU*Hx#!jm;Qe(9Fh!0(Y?a|Sk=r)cp(s4^ zEXf|O&FhM%M?DoR5Rv2{s7tnpvtVWfdfGB+U`cm@!0_6QSDv)x z(pC7s@KPB)3IB*7FMt;-HdnS&5HDdk3dL->KBqD!^yWOI%M;Z~^KrIx$s z-EsflAQ%o^`{20<9&?@HbTJ-pop3ltpge83G$7 zZk|G@h(wA)grsh$mdH@%*QgO^c~l6R$MU%th8nvdDF^6f2$Ko-Os zCYe4$iMFf?d#ZHL$}%AVCLhaEN*by*;*A7@5*}Gufrl!fwt3oT2T#~}`Qs}%Z|hAb ztJaU+vjR4LjXWgd0Lyf0R$xJ@xEQ!wGLc21k;Ii{b4J%rv?-!esyiSjbO2wgf*h$F zP_w-kA2|2%b1zy^EK0xs7G2{Oy!Dzxv_hx4{YRpUt(lwoCTTUr^C0$!bE~Ynzg}U8hf!p)T|9<(o19!fC(`wuv z`mF`sNx>}g46`CD(PMIBso3c?N(|j{ooooCQ|7!{p3BH+nUTgs!jcT0z=RX6=kozy zhmh0~W<`2O0UEn4C*5)Uw;#Q>Q8nFl04&q|l*15z7;Z@^W-UtSs5%*Quo-m|W6Nlf z+Z5R}U43%Gs%UC~4A+jOr!#zvR#X+}#6+>eI&YZE8CxOE)8~eyGAKGDk=~dvZ}#|s zB-Y#?IET%G%u)#&mTrK#Uw-K1ZTCI;4Y*HjT8pi(&aq!1%_}SNqgJHn z9FUV$SKZ2<1QPuw&OHt=eKw%9g`5^K(KP6%{qmF&D15tLx$)~WKD}h)QC0eaI4Ou}78cOi}dvDqI)s1(&xdGkJuU^qi=?F&+crZoF z4Yz7U8_uq&SgSEc)60$1+RB;KBp<~<6Wq#DrNxDB^|siq_xGN>=Zz)0I{%b~=dgxf zu5#Ta^6{mR3Mjj>sbuVRs)ZSXP-Ss5n^kLkTu5sS?S(8xx0+@%A7-Xgxy5d$S?EpD zOkH-|q1Q1Z(JmP-$?v~)+18h@z6*$eo7T>HYE>g%L!Q+E5cms3qU*akcKg_16-((| zIMSc^?AY%Pzv^+6p1gT&`bRWj{qYKFnIOWS0lw8s-7K|CqUIIMz1&vB;;7(#E4nyhy8|vKwV-dj!rt!Oae{w+9#em?z}&r z{_HB8|9IP@s1*tmxnu_@Wz0;DC)u9sU7ayit5grv{gB_9uTP}3-qNmZ%8UqJSk$v^ za%xT*DWBj4o<9ayAbb z%~F11GKhMzKD?SYF4X&8M$AdA>zUeQoysfg%hLrP2c^x4U1p$W9F@6UkZ918x?#%= zIn9^1+;-DrcW?0fNdMDCn=K+=P=S4?aF>%o(ZpNjiK;1F(=4;~drf4)2q21>g2&I$ z7=%j9N*A{5X`B&ni~C(cLRLF3dlHaXkGFh!&lOi+bn?q9-P4}WSGsQ-GK#@A{0D#9 zKPS{$sw6=_pB22k6uF*YEz4}V6!cQhobvrs*Pi(03by}$PkB}Ax5Q81D3SdM`CbiL z85O>x8zw=jSHLSHwZJf(mx|5PR$!#hR2y!(-pA~Zdu%y2OdDFJwjlWWmYg_glfhG1 zee+xoHrxAOc=M7A_wCr&efIqU-F9x*92Tr3Cpj)rnq>llTm$RxCY z35=K76}Tu}aLl(KY`gcJH2N3$nmM6L^{ zK$E$4=jH#{a`D4xwzO$&*Y196prtT*H{V`S+RjUxz5Wzqsvi4t<0zcgTnwT)ntj!%Nc;$Y6CO)08g zf5Nc_%e4_Z#K2d)t&FPe*HArjCV{7RcYW%KpouU#o|xPeDJlku@s>Sz?0ob30~enS-92Qj ztpZ9ss{Iin?<@gS=IhNxp;1JMhxPuhuD}$v8@f)<%hr49>3-2V@JwAJq>rhE8a@25 zTQG#mCP=q-o^j6i*IkdYOE#@7@BaZBjb?=M`@bl&nT|x4j|6#rCK&nj>TXR7SHokR zVo%jVqpQhbjL||ec;$Rde9^bI>YlQcLmVjt_Z6={t?qiV*68>#t7 z+mQwpimoneNNMnXKfn=t@4ey9t4=%jz18^VPFzF(zKk5RX&c=7h**|*?if)CRUUUP zp$X*fa6Sp#D3$=sT)unt-JS1#|14O*0#oBBDfD+XL=8xI7G70N!)Rc`O+#5VRxGFFyS2>#P6of3qTmcaS|~0Fr17f2xhC zLmbIV#GY0yD?Y?!G?q)D(S>wwWZaDZ5T3X+IqpYZ=$E|OP%rU?sc%VDnJSr7NFT*w z%Q2hXNej?%%4R%BQxj-$ykPE7Miu3FoLvxUMmz|pu6M+3fmPntGrs-n*Vi6IamP(- z{%?*$13HYTE)Rj0Kc$P?i=jGRu57XMuJKe(cIEV8c1lE};Tf~ICN`Q${4!UW#u9e? zxtc}N6GW?X2bnh&B<$sZD&vB?-4|!S{LMYjzm6gfo7W!w2%OFT=Mx(G4Sd9lfQgwt zl8*?rO1e*(sY;62K*HW5Mu;7yRy<%6*qA}s!N-#HqI@4#WO;#vQO!@dA;^k_@S| zSO&RBt%Fb55_Ff97~*$&1_m;vA$|c9kf4vZJ^$VpXWaJpRliRq1AFI(gOx^Zj8L`$ zm>;$*iQZ7CC~Kx-{*phEA=kxyCZ#UWTf+JBIOgU=u_SL=u1K^Sau>Ch3Ph5)KB=hY zwOGt0&O0E`^(>#4ZS+jU3aKYAO$<34Sp>*pC+<o)35bUrpyQ&C13;gajT<0fL_P zLYYZ566^B_6K9clCk-1hP49UqZB5MPk;&VLv!_cW=30q1umnoNxkp{GZU1%qH@FjQ z?JD*8AySN;smvltnJLB#CK7`3LRstBv~vB#z*2IZIWX||sB)2r9+bdBNG0-??t)-< zQ4wdQj*PUF@vvG`G6qCr&VsQ!h$9@++E=+!Q<<>a9#^M!_h1S}9s6%MaNK1(E`Dw` zC057483MSDy|e$q7v9@* zq8E)-Rp1X`5A@>BY#qwCHZ?HCnFgM;@l1!ra<8MT}4e(TYwS(FK5XfEJR_L*7YksC!>os%n_0mGJpiHM&dO|!TajXg~%jz1{ZQhh(3B5k* zn&ZB{?Te@2{W}nd7gzVJLy&j&egrZdyIh;1s+E-z-`D`SY~CQcCB;B*>MN+KQ%?^Y zuG*@NGB49g6?5ie{IyS?zUJ^t&tD-u=f1ra!1`t{~mGo@_14FnTS!|H~FH9bNRb;TrSsIT=+t&+a7 zXvH&WB4yR(;_>R^E$?nU?!qUIdh(c6q)2~s9y)Orr1dsD@MtufZOnkK#4FC2ZOW`| zYtfm!q|{uo>&snPxj~r0s9V`Ql5DDzvBxH_wm6%x^-~rmo#90L!#R`MD^A8+|NX@Y z7u@#X+gnzD@#_c^{gxnNI{>tt!^p$jfEn}7L|%Wr*NYgt?XnYVHxP^r5+N0ayVUl_ zA2@LRmsdjKym{@cD^F9c?;CAF8~7O#;{i2wT_ouc*?hfT$B_u-S~6SA8^*jT4<_JH zARM@g?b-dvy*K;?Fy&2a{Qvq-bnj~*eAbo()zA zUD{leNpH+p0)<0GsmnJiS0zx#O*Dgz?~=FeQ()yjcIMf)y>-WvzeYQG z+Amh@<`Po+?GWUU{-8>UPp}kAq12{ZPLOdgO%!BxhpGW}LHCxs-(bz+HD=EVFpr)%P6>g>IgB`ch2eFQ33Op~X?F&B_Nz1{Ylg(}#0 zoqXJ#cYgK6J1`KN*B<!xt6QS5iQf$WK~qP*aY23!9@-BLmED51dq(d2QrTklKpG{ecIDU-hSCxtI^Kh zVn?IoH%RGMn?Qle6ecANihdZ*F|>9yb2_rkz%x&8WvSgmAt7b*&t@8-%1h5+qEKGk z_VF`2wjO@jp=iRo<+QCE6`Kii#s7kOk|`6HL>ODLBc!?__KY82sJq~eiRifPBK0hq zZr|^pLQ3uPDx6CJn9g4C(vdG8{^C`7bmB5=VBmtj@7aFu2xXQt&^o8#U;t?vyoRc! zCyEe9#Uec@os-lBLtiZ^HhfFtWV$f1s8tNZ3vk6p7k~2l=jUxZdG(3p|5(}2iouQv zHon7@VO6EdpL<13$(Sfj%s}6pq>eQaTvgf%$l#Q{VE4W=PCDYijjJF3_URSMSx0U; z0G^dfwyVtN&aK68pPetd11uqoLlG9qjrO*N#p>Y=L9T40FV1ozbE95&KW#3Yas zTH~M&E8v@*uU`DzWnZnBi<`d%cOTjjm!Zx539$+S;MV2HbfO+FpD;)kD)ERB!xsrv z_F#+VW-1r_j!jNuPFUH+IIB+8M3HbsY4S?KRIv2eviG~I9=rC_kI(|xrZq!rGMZ<$C<( zv(PS$k)4~9pf3tK>CF<3HBuzm0=z6Znb9R8K1P5*E_mO+jymG3bAN@#tNB0P+=$o1 zkO!CW{JV-Ao9MJfVt0xS=@ul7$q@+0#nuramkLT8DP?A86A%QQjNe1T(9%7@xF^c= z%W)x+86X)>4bFnU@4We@gO_aFX`eb`E83+f;=Usbpr*~=R`6n7Je^}{=vub8LA0=p z<${n_C0Ocn>4Fhn521t!WNh9;5cYg^vER&6$YyMnY|=FXtgv_M-@kh7F9$bJAd-1i z#8xBcn;>Mc=8(DUuki*ZewCwjR87UE!fTof%eL}NPKb@6hbJ8<(me70?MHul;Fa6q_lK-m&%h~G zuE=y`aS0y0)bK7}0$xaS@@r-ji{U3IsC9aU(hKHL2J{v8zxeR}i#9afT9B_Pv(In5 z<>N#SH?rXM7Db!Jkq|k4M^>*3=PY%V5u^gb&LlP)BWktY4qLJkr>}}fQUpM=IS8%b zxy`H+%C&nh-~Z}G`|e#`(zq|L>X&BZmrtDzXFT1bSunB~g>voSQ$f zD>%+^GfBvpLiI6|R*U*ccuQFq2xG)SepTqB4Yj<$ z63(DoFMRZ)y~n=`4;pP++f&A)Np2Q77CTpG|3}3nVaz3hs1vI7<`SvTC1k)UaLf@O z-~Q0nEw8Tr_UV6P(ZKpIWP5=I^%h@JAfJ?s)Y(|W@o1z9e9lL1Ll@##v^ z;zsUH{{h55X^uS{lNRuJHJ$GyiiR$OXC6yL#Q8+2=EE?Sis-Ohta+EAN^xcg_xa$< zjSnSZC;97NPd)C*r&jTB)wRDx2g!=4?+5}@p|kLeJ$N2t&}BL}*{;{v?#DaKlAr1m zK<*mraeWiNGa=1YBpED8*rc!t5)gOYd(YD^op!=X6ri;K&&GC^zZtX|g1l%B#?~M? zmPqADSxqR1xt*xJ;OyoYW4+N)5OD=ccU|63`7Pzzgrja@+(F3DFMEB*hj$(~Luc_! z!S!edlgKwVxb22sko2=v zNW-t)`rz~1|9l%90-M&}dE+PO1Y?o>KA2#3KP~b%@r52#)Vh@cJ}eB-Wt3dUv9REq zSouJQP$i|Dlv9_fOrkIi_$9l)|N8uQzJ3+u(ZC}BpRMqY-y#0@e+j4S(6kJ3o0WhO zYO7UJOqfc@x-)}nSy9A$-3gx6$StQyUk091wmQoBTCkQ+tn5eU7Ki-8^Smk>u)FDr zz9CG~8Hs(P+#w>kV;obYHI`GggkX;>vbN(6uS!fT&zdHl$Y(qX5)1)Y2$a_Mmw!o$#3z@A#P;G_d8ltL9=Hjw`QCIaD*TX`a`ec&x)6zywhm$H$-i`JSWBT%aGUqyGYp zz&f(|#lOP+ix|Sw0t5v^-L~P#lVFobD$4_$Lb2Phh#VDueiEa5^%JQ+oo4YuR&&%= z;0Tm3 zErb;#eN&VsXZ@uZHWKJ)XH~O|OfyYK9VNUJT9c0Enp!R%fxFk0M|^YShudDeW;LeI z9|}b|sdZJ7_aaY{p}Z+*TjolV6|c8@xL(UpubcD*GYus!AR=lWVVLTaXC#ZJS?ZVi z4m(RK%L$ff8TPT$Prmq*E5F=?p5lK#g0*5Dq@c$|GN?tuEW!6C9nP z;@jeEQcWM56P?TkS*eVNL+a`&Y;ED!?~xz2)eq z_uhUxyn(Q3O^R6o{08JVsTEVFAoJ)#O&$;P5vMm3Q(F*6)tMB=95hEhYl02niBrG)_T(K8p|pX`YvnBz z_4+69@Eo+3MBWX9)q}vs3{fac4~1zMN;v|n&Be8l%vwgbs}*{Lg(kej*O!wG85fh` zB=dLy=Zv6-)A5)OcisKq$9wGP$N%H3)ka!E=7&HTtBJ`9ie*gK95kt_YL=ernv7*V zLMl}+`N8xDn29yHo-@re0MxH_%gjbvwm^zL{uJjQV;vcyz)2AJy34U&P{THSy*eS9 zca!xpA0eXF#<96n7^6@&15uzdS*=qqR4Fg`T4(x0m zv)fRl6tKv}1*z8T&XZtu07=pZe_U zi%z=g)iYN;>YM(A4$TM> zo2N{XlHYKuKxs5D5W?bQDd_dP`FvyEODnY0bBL+aUi;$ciw@s&_v)*D-aH&#Fcd_3 z)-Qp$+Y#k$oVWyPsO3D}Q>5d1wlRL_l^KgvR$$)YhDAZVZ)8WFuXGG=l3m+tWND(yfrZM3bsCtau!bq1)ph@M)8p#}BvSbN_kiC2t>l3tH^m zycW3p7hoW8*ordVLQJ=TGFas>PU?aXTaV*XvNpe|MyKg!N}>m1P3kKbTEQ+?LGz`u zBQ2+k#fdd@=8SJQ4lU*$hQ(9@i1*Hx7tgx>s3$g{wimBmd5klVFA)HL01y$$C3dqd z#^kz&=7QW<_Zm2}a$n^02BZ04DCIVj3+-%)Fpz%71gUVSpCo3bMA>3od^no z&1;6Q5y+sVt5PEa*>px4BD*kdw+5kD)3ihaep*>0OgWQnYn2som8&^cAZ&m)=Xo?^ zE*4A|%l1qL7pL=a8NM8NqkFHt=;HhTf~v)!61anho_U8MdtQAS?oEv*O>85wO8_v? zrDeRV1h8z4RHooH!Av-nc6Anmn$0TD%Ex}PV>y;2M}Df37Aq2Qe5%{Yc1n{Hc~{(m zG-dm_FFkYn>n}j{d-K|R+u$X<|IgA}IL=jFUBk7sebfHh!qb-LrA<5T?(XjHcii25 z=1qYVhX4VBlmrh13B`gG2n2Vx;=zKG0zv!jJNf>AIdksOeb!!kt#cM3^q(5YS_gE8 znduma8sbw7Fmlqd3l<@d*Qk&hjUr++Qv}+WtRyg)*%`jot;skbarVN?|32mESKj_& zHHSBy1+0*dul@<-vcEOa}GVsD6m8(eFd6rR8N-0EREqs+z?UAUs#Q3gD&prOYRZl$#7xelyt{m#{ z9*y|WMj6P4*A53;VHK|JsF9o&@}d`0%oDk6Cqict`KDaLp-RPYdXg40ydPe9_k(Xd zcRB{0o;N=kpa%~QQI6e!B>J_{EN>_&(~V|mGSWghdX-uvmWMLKXl^8efC(R7f1AGA^z@G1Xn?bB?L6wrw0(?x zas%2)QW1x(^N6(tlhk9^u&tobtuECDs^_ql_<(>1Q?+2nX{^FLe1G#DkH2^4 zfmKVtz^>-BgBU*h5C|=CEW+Z(iBfhv+a?tkQhGunEzZl$+1Md9*4%YcDpMnN#h6yL zXTt$E(oIiFB=I~VX+WLW#%G?m%GUt9)H%JpkI_ur`6@cTlCS%QgrdP+JZLN zOQiV?OQ%1vIeoFNF6VVna{W2q5D4;gGKp;-H9AN&RjHmvx=3x|=rLT)ejlJJ{Lj2k+l><%^FUdVeWDTQTgs$Q!2{m091gqQNa9xR8T0b$cUH504lw3)@N= zOVUe*%kk!v!(=K3L)*mSbMc3P$kgZ7mAg%%oz%_eb<1pk9?;t80y&e>tf?AgaSl$& z-QT=%!wXNJ8b=p+WS0mHX>iC*TY&dQAd$6{vYAjnqCxwc(n77C}EC56$=y)@Mfp%e1sCx@8rSP8PGI zaK=KXOjQji;`u_MbL;6PfjC8$i&GgKON7^g%EpH;-*@GAuim(-lyjZ99zB=R$ZP)# z1TS`s;$=8W91pg{A4xkRuZauSvy)3Avy+5=$Xkwj%6K8AG8|R`&7lHzdew8sKKH~w z|Akh#u3sC|9qJA5e;PnrTq2JQfr_H@LjlOZMpRPiF{{X?EK~Ukm5Gc~i)7)sOeP_Q zMS^NP&Zy!YjT*b2Ce-M%h%eo9R0I8ZmyBz4;jOU!jw=uT?Q>L55{Nd}{sko&Y(Sp< z9&Qf`(@FBkCsGmH8u4@4n51{8EiTCg&v0s6jvXo~{sdZ8egT9D}F9o_9X^ zLzMrybj8ik7Bk<%7Ut=HG|<9B@*Kd9ON0ROm^h8q>%`t zqzoHz-5|~f*WID6T{aHA91t4!GayoW@3xD!?0pqj-s{%R*H#YQ;5Z4f2KX*b9Cfbh<^*9t9+R~u*92q0^YI! zSFNvOD@2j@)v!5_p=9gpBX{cI$0BU%CIqU!dDGv>trF zFS@~oentY>yQu`=pnotkUw=fjwWgXBP+T%K@R(uDiw+1V@f-5#Mgs*tM@kVf9d+aKY576^7vr&UOF7v zwO_LF* ztzoo~D$O8t#T(JNI%I>oVYrz@ZgGsGp)pf(;!MvcvoP+kE>Q(2zn>l|&H74%Gyv`I z34yMKcx2diM6?PTGlTL#NO~oz2T!3(Kd=abQlzO(q)|_ zDPbAgco9Y1!Ha0Msa(`AVmH9~rrc+#D)fXCk%L`^|^GT+Q+3pM}sru_9mp;!CJzm&uk1lHRP9 zMAFM#)>BgR!psJxN`OFf>r+pCbo*&%ezf{ogj7P8h7Q3NKr~sS?+!>Uti&H}(~NCC zQOI-F0t}=Ohw3=@#2|3=v%P$E+)YdPd5yC)?-v?GJ$3HOGo^8Es~izRmh6&KU%Kg% zZ%_qEkRQ2%fVQqi-q!sY9w}jjlTlRY>b7pgVTC=4blVkk=bGY1(5SDK z7pZ8iM4z~POGh7e$4O7!{>|%~4^af0A3|htp=TLpo?v-u!?2ZiZXuq~p*3aNh&3uf9`q z=HY0MjL3Iiy#;P+wpev;b~46Irp@YSE=WsEv|uqvi;Z_el$;#|~1*GabM9H2E<r*=x=3{ROhTGJXfXM`Ix zExbmpEtPWU1!IcA7txzD>M~e|r`5l1{QA20cCL~z_x=M!`kt*g&Kxn5>!z(6ARazkK|In_fJGa1{D0?g!i< zZ-I?+V;WBpin0uY0|qqlSlZWJi~{<&StJ-)TyA-Xp=d3YB0-PHs_~UryVp<4G2=uo zQ^mJ78y$WEnBcxzOs`1Ny2h}XCM=nH`Wh4TWHTvh%|PT$S!xSuoF5gxRxWWT8{fU3S|Kd4sKZ=%zu3!86V-xj;6GWe(TfT=3_Y{Fn?eJ=t4HHpRz;Ydw z(UP>_O2$)@O+|A94|?m-yN|o*oV!*Jx3e;kHL0XdLXYAF@-c8>vls_(m@)Hd)I%N$ zCM|cHXN%Va3mK7&#VcLZF}xrjf9{4)zq;X4RM&j{8uG-wiVb@$2hkd+0J6&h^^?jt z2`fa*UANF6#gNJ!8+Ynr@xWF&K{tau*09y&gaBg;22H_sqO7#2Nx~M%>vd`G8H~kV!`D7siIX!1Z0ycw2gCr9ZZjK;w$6}*;h3*Y@Tumi@7KwXO@Cw;{!xOiB zyZz|Z&i(^ybz=M)Is07D=N61H-kc-O@Ff+MnT6Hm<4B80--C~3@yZl|T^xHV%evS^ zoD^nktYpb{Bpe+$gC4m5hAZy8{gOk~HGk=>z=#R5L;Wn&j?af!i_-3N2imqIi!_a4 z37xS9tIc-X_^?u~!8F1xjWHgVIa7AC9}ufuo3A_eoTHCl)zdt=WtFzlAZPrzrON6} zei)J|NJu)&1Fq0*YlTEHp}`FDU%?4W=W~$Aqnfq`o#xF zWAP?apgo=W(eqDU`u-g!uO{e?t5=|71lgwBqs+z#By9@{7Ykjk3P;RVnH`_lJEE>iFOe{4gb+TQkpdm%5ZdN^sH{$BeStlj55}J&fu}&b<7WP)*Qf+h$!4G+(MzlEb)^*x&-WkAfA_^MUl~nY|xy7QI ztg&hpLr;daSABgB)b#xO#A80Y|CQ}*bgb7syh4VC2^5`p*Sr7cGCZO4-b(^7#cjFD;zqWtd2ZsQOt*@^tKop1}3R*qf zaYfi0U@1%uzX{c~Oer?R%oQgKt-9+cTUV~+>DScJ%l=Rh9%&t=b|+V$fcn0zNdB@SBt{M0M0lWO8-0O0t$9)9P6H(tKM zjZSyzI~fRTUAC%&2qM?NSqBpJLY$8@QeK>KFqLzyc>$$i=?)xI8_!Qz$l5X+S49JS zFHf+zxqjp{Gl}iESc<cwwQ0Nu(^krfi zNXp7ZnLI2IC%jAyF(qFD!0?|v-+g@fslP*~=<+wn=pV|EmyY}~n7S4z*lb#<3FtFC zZ$pYWxHh+eQ;HPJ`38~9=q+4?A-4oLp*Y!_sN>uku31m9$m*qA1{|j+-n`6HUAB|qzH)AdjJj)QJs&gfT}#B<7IlfNfXnD!%I~BrYSc}gI$1Y%1tmB5tB7Q zOEnUcCZpZ0S?prLC}N0{tW_~ifP;6$RhJ#O>!W|3OG7*Ue-DW;X%VUERLIf$=@BOr zF>>v_YAdP|;B&LQuQ=B%D;*>nE4v4vTcqez$WlI!%}oO7cjLi_ZaVM%=WmFiZH4Y) zqEO8Oxgh(wDl5}@7QRq5ngeV5P}b1*U`a#HxNlbn8Z1pyFp0$FOoN7)_DV=KsVQc! zmo4!GrQvrF;RSKrSsVA?wCiuH)W7-0RnEqZ-240EAv@nA5qW^3c{o#pVbrB^M-#0! zWQ-_1jZ#XLA&&+NZk{hl5rbk$TAUrE^xXp9B+WP>$NS!S55Io>t1qU|&R({Ti_X|# z$Po`hKqw1wT|I|uoY60GQbkS091`n8io!M}fahCI?11;{f>fzh1oOqRk1Nw0I!!R$ z7lfn*KOFdbcWgW9;=LfFxNhyr{VOV91Hrc8TolgfUT$H~km%|1$b_m4j$}sm7|I_L z$|m?d&Kg<`rmJt^1xeb>W>m-=GfpfJf`jqdi_g4o$3Ir1y7}DI?sp=;zWY^3))fP0 z5_QaEImJ<`l}8qH-A$9&pvLP;te9DZB#hRCJjM)i8VXoR$DVlODgSz5RYdpOR1Q6` zgUFZn+yc&1-i1$Tp`qt<~ilZ=-9~jhyHQB||2Q4|Q&NV)?@CRfy0+*~gd!!ZN}TD?71DBY|w3o9=H8~|^ygD>BI_T8`5(bM5+(=*Bqe^7sg z_Lzkzf3zFs-PES>`*Vrb#}0h32W~m}j>Jm&t$n^{+JiE)8%}%TKj)nIw@X*w{f%VB()(Ye_yX)9 zZF9&=%aXMUvCdAJd@-`fmhKCwj9Cd&ERqs)y+anRCTI+u%n&O8;vX!VcEN z>sSS8-oS-R;XS&fH=gE;^#PF9O4@=M9d1Bw;NfW5_sm`QpLN+Llrg<-t-;QsJAjA0 zd>s*v7P*_}@#Xq`UaaQA#S)!HRT>n<1$0bhmQ@!Z&?iiL+OE%D4(LfiU(dne(lfE< zC@Cj-$|YXV9wI<`=&pyKdi<1sZ~1=p2VCZ=04JZYXT;2)qwn^yVmgK$ z_JmAZ$%a4})T0`J029Yr$HBvQ>uGy7Uwi!VLbQ`l-T4Rf<24BNLM)I9x{{=+%^#II zdbS|qqzQ9sC|_7+X-?}{W$E{973Ba(1$UkH@MHT#%+Po*7fcbtm$_-_<3OxTT0Z_F)tTtjk#EU=$;HX5?4Qa*<4x(e~G; zu9(uU?P}DRP$bTnW6DZ8h&APDd7$d={`8oKKRNnxpz5z*JMVYjsy4VkoS~nbLVoRo zOt{R};`;`?ZeU87>W1^2CLBv+n~*n^Ror27Q%?yo=p}Q6+~}7$#JIA-#AYYGU;&>u z1Fo_6!{eUWw(q{}tASXj`z6|L82Mf0G)M$8=;>~?(w>bMzAl3t)JJDiZ7>IO)1sI( z7R`hnjS&nbA6`zZfYViU#>N}u98KOV;;1KS2vCmO{QUd(ZbYl~*RA=ctNT`s{1^)u zDLYc~+C7W5bqJ~S5xXU1h!q54x!UK~1(q<#am!T23B`jDd~J!0?^KRA@7jCT#=l*B z0~)l!lyCR}?PnZ${~f^CNPLwo+?>b7*@~qT5Rg+*GgJ{p#2&uelgYdIqizGCHG$W% z1C%MxyZhbMVR!h!(V^@3N8U}q2%5-f%N&u>fLgoII0}l7D*MF854o4c(7fGokJH-Z z+{CZh0>f%lE$`uReO(0LwttkLv5VOpIpz51U-2)3NK9bgW&6yGM5Knyf-Vg8YyZ;cj^x2cETz&xgR|iss5(Qu$$$2@|@Txj@jglNI#xa?CvhH zA+rp505RXS_o%avzGTblqTTaBPPJC54k5}C;Tf2|GhfX-@rkzit-el|6 zZv0`TmhxNVcM$+kp!_+bAtoDoe@{whbwxsSW>?bb)`|LB%CZeP`XVes3~weu_FSEgNxEQVxL86Ck? zGvOH(thx@rh4bfRdV$a-UN%`BpA_PkV{d)n!8@P0XEn*L!}92_gUG+)u#7E6UB_1T zq_e`Jm_%Y{s%3pKE2Inrp?12uNb&?3Vcp55PAeHNri2-lmh7UN<(iumcBDIO^>ZOV zUf^5eoT+2kRB$$F;hJ zKMM>K6M8f6nPmkEtDwP@In8b*f@|}sR^#}tE5AJYtY`kY4G0GyV{m^I?RF3OpBEsM z*)RoeDtd_mj-Qpv|% z^x;GIZhjMsHaOS-rVFFjR*EKvBTpSR1hpz6e?*Opbgh((#nE*_O*+FL^OqC39FDEP zrYQ5aYsRQc6*ECcoT}*fY%_>TTVP&aKlt_cSKs$|6eT_0d&`zX1^h=M;hQ12V24V? z#*)WXbq7{#yBRX2J@bjSf$2qk!ho`t3PyW*0gE7ZhVdHd!U$>Id+&T|;}zeXv1v60 z_u*DW1BW5M(VnKr!fKY_N+qtqF-u@b!k&3f)rk`lw@&3O4ESPhmRlLjH0`;4)~tG_ zI9N6Nx9+?9@%t`ZWmj;|0Qc=4`wAJOAc9w0z;br=3?AwrC&S4x!s@sQ*6d_DV<4|P z7bZDBT@{YSe1*}_wKB7oR3lix^5%K|fLDj(2~TsGNw6)Sxogw+7jL?1)m!Dut3xA; zginGJ35~Dd8%*$th1C&T3?)XYXc|@*tg&oUTbks-m4qPW$&=(NTf*1V=V2&4RJ9C4 zTYySy0??P00>rc9xHHbW?(VJEty+(>-bGi>2>JB^Fa=_gs8$xoLiUo}1+j3@GS#x; zXpYKhVtBpaBvkMwoS<5o7P#~{T#O1Gec{4KFW7tX{#8@=e{vJr6bD&5ECKxCE+)g% zjOU{$bME(s-DQ5XL~nWN&ax;&3Klpmca|I^032T@%Y5QV+Xm3wdk^lu|Jld(uBuM1 zW8{I`xw`}K@Z_Xez+>=~iAyAe?VG-Cr`*W?SNR%$5 z+kGCyzdQbU$E!D=e&7(rWdA8E4I4gk>(74&k_EH@ei~+CM#ia>s+h;}7+n&N?KhZZ zNf!e}!}u1CKGMji!4^b&2ai7Gjn}q)x(ZEcGr-L+_@Bqo4|OA-zjP79h{QT`hjY-j(c9r8Gj@REXA!J2DW?N`#@e(qj#cWq3M`mPbe`3zIpq0r(+?|B{_l~a z0wDgTK=`hq-AL88-Aq9+SM%o`)*LYn&TnAPR@EwqP`3matDKr?u%q#!B314S z=I|I&X_tf{yu|e^JW_O#ZSpiuFJ(%|5dXgZ?Z!7Yy?X2s=#es+24NYTzN(O&Aul){ zf)Kk_kz>7GjL{IorK+|FHONid#_~~~zy%Aw0-^y=ArR!43v2_0NfXsIoP{Wo@HyO_ z;9OlHL!B1<#fRVA`qtaep@IzS*Wz-ByPk5p(7pqtjNbwAQL!y>U~o&X!Pbyjo%Cf6 z@pMeJVgg_%#FC^1@*sp`W&3O%4cF&&C$ir8ye$`vCe$!40c-EyU*GoZi;upxbG0#! z4(~#*=s0rv&G6{pNCPsbF6gI`G^Ch-KFMPlwv0sL5)o4!W}nHHIC$czPQW%>3c`Lz z-3QsR*Us3v=Zk;5h!Sqrubn`zt2aDEJsn+wMAf;P9tJGDj}{oQ27V-xk;DDB4H_n+go2f=aQQ~d(?y8 zMSr31M!(dET=k#Fz-ule61X~!jipzwSEv zx_5s#_c*jp4OlnP3(+=u$fNQwXfZ4Xuzjc`d`~*|4wQQLB4f-%mE>Sqht21h12QdT zoHgB+xlmPOFRbI&KYr|z?O%R*$x*Ae?th_z4wC@+>iKIFS%IaJ7NAynB0WW`F6i54 z(a4l`Ni7bUXB1Lts>*bpVeDISEJz~sdrM-KfrGvC`lf4+`|9dX$!O=UeVL4MXX!}6 z04F`&Eh){|gVG46z#~|(&0FV7xI%$HBDXQD@}N_psm7U1M?g~4Kr&_P&NI)y=EW;l z9P{tLSg|7M$PqtLLXoB~<6clpteia0PUXtVxT9HA2;)kF23cAG@P7TX6Q2I>$5n$)tXpkN1E zeH)L)QuIy!x_i9&vB&@Z;iuo-@Duc-wtcWNQuiV^b`0>;Mh20LAw3yaonm1sMDnY< z{iJFzPR3k$YC@7t*+b=K&cS6(Jm$m@s;-<8HdDIj7GYbxu=|+nUb*+;5!!0)XXl~w z*g+m#gEX?VE%#MI6-qShYLx=UURNc%AZC1`SjnsL=A=TU{djz-SFiY*G8ABtqs zTwk0dgq+JsAN~El_ujinine-&B!SN8ACNzOwiVEMW6eNtz%x4>vzjE#u6|mjL2jwc ziFA{UuF{IImjxj}ECdYVOo%JM(fHu#vp;|F0zBGOeE-*IQ~!%3UxoYXud^goNh#y` z_Gr;qlyRyeDOBl%ro>KwMISZbMR3OzZ=e3&!&joIkzcI+G}JysJ7FNdEPx^v$=?~w zxyg}G86EN+4nKzM*BNpIyDthf2u#pk92vz19c-7Ao_=Ka7hB(k`mgnC+fD}a;=Map z;9(s3atNY4e-b0pq+J$)Jv1k}O?sV7CleN#92rT#f{k+X`!8?0?O`AKNXcY%!NEa71Dw_^rY?i9k%*AtNq=qS~Txm(c)Cn+CY5csPUy#W`hM7mfD!|`kD1rLme&DWm1@zk&PLjl9OH8-+K?8cG9xeis<-!dTO+Pr9NM|FcHu{2?0 z&BSbC(vaFPecuRFT+6d&s^;T@kVi=9O!u&qsv(ea^K31b2K?~GQQ?3{8Ab^*zC(X6&4#+eM z`=EB0!_5OEtPPd|h>otm?{tyR1-r9$LZ4mkG zhoG>js4FmSe!`9f6)d(~G0f8Po-W(KgL0fX&m*Ww1g3}zH=_{~U{k1dhB8$M`zQ6H znM%gSVY>F+xBu~rZhB@lUFV;>N{1YdTzVpexl+$y+Ruhlte8zGbFo5NtlUJ`>Qv?= zM=+f@jru~sXY-{OynL?d3fadKcQU5$;+Cv1gwc<_b<|lOpKnCRSF$LmHoSA#FVH>6 zLOdi1__y*IaHx&rjHX)2Hzs_oHi*;O8hU2;6Ql)RnNXfW1R?1>! zRM|*^)3)?tNweEF7#S@SLm{4$?BN+q#m47%T)S~M#O*-(U%N!P;oNVW=qRO;_o`ng zvqXiBQz(ROMlC5uqGQYgsZdx2v3OADvOAZ&ie4 zMBZAvA7BkkMHKH%ZJc7bJ)c*K1!mYwuc$i;TX^AE`eVVAQB!rABx0;f1q}G@Fa7s| z51#zKk2WOH+R(0Okey7BDALxlej?KvOM|Akd_L#$XL4oOG8Gq8QmPy?F^I{rv>X!v z!R%DmFPzH=O8OMay(cYOz1Y*JQgZ-P7rc<$&`KH|Rc`Dim7 zgyIK{1H4RAT~x!ww4Hzrt2vr7FDHnSl)g=0;o{v{}1M&8}FVSCS}$oQri1tvcHmy z7}^Yy#iFE2ja-!sPP4Y#k!59>41I6ZOr+y6IWbkOH}jf!)wJjgaj8*GgjdXLncOlH z@VFe2N(c}5_?-`YblSJ~e0XTuKfh0jc3X%XfB12V?1n0Xq?fa#_O^I1vV~RZ*n(VV zvRe#gLm-DZa@QH3KXUNg)81Wm^N8wi&~75g|NIytDWyQd?vspxf-onE1ejcLHp-yJ zpj>4_bdKj?e1;Pjs#!LF*hd=LL;i9K4>VPCBCSEX6D-7NyDs?R@-IF|T?f{!y*60Y zgn5wzX*wwH1uf%IhbkckLjD;$54Lgrv8g5XO?qjW+XwL2=G(8__qR8m?xCm0ccBYa z8;<$lc=V%k$ctNkugEIttrB-KVs?oPgOe4=QwvRTQ{G?TIgPTfml9?SIhmc9Tez|& zXC2PAX+6Yo;ifrJJCCJ9%(VNl>vx}V;CvU_vy&=I^qV;d5&{~m8+59r5(2hWX7o*5 z-z?L}E8WGEWr>e!vK=+WL>V+_nRLL*N=lo}W{OL&YWkTz8<(;Pk(_F7!8?_*d_Uw?7=d8+}o9l25w{2wHA7*GN&mL)&WFIIsTKWMblt*XXrv~w-I z+`vzclVsRjAPFwzWvYK-DQBc}k15z_W&;`LvgT^0k}TcK!jo_qrWu^?yI#8Nv#*}I zag`xC>|hlAA|28ZKq)Xe>9&pVDU!sdVs*FyL^HPbs-(J<3?=sLj!2ee=QVNyYA>~8 z=Vz~7`O*o8SOK!lx1iVO8glc^KUHVFG(2brlw!zyUd(hvIzi4b1ji+N#v#xt@b!LX zDrXavnk?a2= zSczxquV2Y9F_0e}1!tW=<^k0;N3@~AfR0!~rx?t2)xaq2OKaLzN}Q6D$m#)SWYJax zv~CF!rVN=aD3iGC$uIA@{)8L1!AP%PJAZaK)Ztva16?&tBx3i&lQ^#^fevGC#Lsn_ zjfQgJbz(wX8NOWdO==}aW@^iqGF5Ys^`KuY5?O2aCQAVEM4G|MFL>%X( z6qQe#r>Lt5n`F^V)Q0Q=Zm6e_utkN23y~fb@3O|E#v;5Awtw;EOW$8{^J)v6{p>3F zwI11;x&Yp1crby1oQ!JN=wl?FsHMbg)4^wDXj_nNa0R13{t%>8eNmd)&Skzq|iXO6e_r7hQWT8aKu_v*t%+2H#F8sRif1&8w}{=VNB^Wl1U^vgF_9v z!fGKTo(^91>aE+~{TzK)ty_~@S0@)2`B?_AZ{E}~m{g>o>0Gw9#Cm&To`d2xNqjB{ zb_7P2u$@UITXCDBrpH#z$-G$5h0VR=icVlb_J0huj+|JwJP2B|DUoPne;#n5Af`=k&Yt-HS1|IEgnhb-2g`uQ0B zMhkMnl}m^a0!a==kcbI;6(*@6RR+DKxT>b|5}X5-c!V%%VrDL8Ary50M<28AwF|dy z|3Qs*=`VM#=+O@3KRZ>BE+AH7Wh|>06WhRc+NVzS{!~%ynyI;UCcz_($a3uMP*F(zqGdOfr{#t<(YK zef6q1$2QTH9YUVPu;DRc(S)^d8io;53%Kn1pr%?<_ax@ZI1yaX+?aq{gB98-c36fR z@4e;A<99rAJ#=#Y+Pl4LR2!Iwy^o%d8D!62;Dz#sq->O8HME&5ec5CSG$T`;Vubwh zr*Ce#_QbO<`+D_p(aoz0gaLwlc{s>I(Znjt*w0MzWm-fz%_O@uA-Y18M!rLER z*}ne;XNKl7*>z+5Rf9%AQE?9m1neW`K+HmyYXQ0!RMCKm=&5M)QfVqKa zu5Xf6LY2%ivqNTQ;4zr}O!^}1WM`**DqdCL)76}^Mdrsrq;>Gy>-OLJ+Nn>k#^pHn zM`&wVB$0eUncehbW~e2YT8b3fvZfivq;#$!ks;w)`Qns`p}{jgOAH$HeaZkw$Epox zZ&ErWNt+Zrtw3`wWyQHDl|tIYen~DbBqvypT4i+=_zj{winAppW(v@Zs;OKh71gsV zbBdKh6;@cm8m3~78VJp($lc}BbafH%DmTA=&(mLRykK>D-~P<6&}EfIp88`BQlUCL z9^%}w*5Z_STQZ%Fs4ldZ%+#Q=Aj`W3RN&zL| z!mE(N7>ocm?s(=OPd<6kM=SHs%d_j%8yJ86GddJ??Pau6>tQW= zv0zq}lq=cURAXxlM9kTo+0TRg1GVP1*gNeJUy@hzNa;mz3c3^l97Ugpb8XjKdw=-h z+{+HJAI>-_g?@+u`PC~#2tiC3xWuIz5tV8d1v$g%K+aN^y+nq;Y$6u%6GAGgQWf=r zydW_tHi^SFkr|mEwvU4}Rv31Y2C*F7bYDRy2{A=iEtRcVg zij-N49Bg(K&d7|WQrq)ZgIVb5jD_r8xa1-Af=0iL+KP;rL$e|4o3#m4p_yM*gu8 zzI(Mr?Ay))m4@Vsr6xwi*`Yd%Y2idlwMR&mTfQM>DO&U5dyeTv~ZZaVx0f@Gxj@$1`*|kMRd#gwK2GPU1(sDEP9EAvp*u5)d_l!hy(HFLQwDIXcXKa$R=di~ld4n(zKcm5)@PetVF7XWh%7;z16*`}-|LkX`l zWo5YBSs&3xabVpn4ftHDn*1qtp+~}XkxX71@Kp>mm=(x;ld;w#Rm?*mot~BD%}iRG zR%o#6IhwpF0OImj~s5jD&ISES0*f7&Dqvd&G{`fLZs*hB|@A?_BVf6X9&>FxA1f^VqAtdT#gY>(Qo( z(^XZb5@B6=7|xpuSO@) z#FsUHGfSD9hA9h1}Ca=xNr}zRHJ!)9ttMN_9P zrR0o;&%&0sh8i$Jt&2PDPQAn$vLlo!B<)^5=Ay4Zx^(j)+-P{E7V_eIVrX)VjclAi zi6eMk)8cw0N+x16(WJ`14B6%$@6xNE3vG^K4(ZR#AzCKpHO#qAd<>ssI~eUA}U#xQ@9>$N(0Lx%MjJMVTZ!B zMW!tb1EiO6)i$ZbzIFK;fZ3l%&>AAbME zJ6?I@vDLEVzq`5!gUGhqfZr9sNLey6R;m`Urt^s-x}+~c)u{`^O%bEHIZMXHmx|Q| z-$V*?5+My3Tj^B-O1E$INaj(TDWD~HD-&*^fgOe2yh_K~YAod%1a6L-|9i^iw|;vF zetck`1)V=Ka@pgs5r`_04-?U+@XbIrIP8XlO1WE?Ng`0$fu{+w%#^*>ammNq4{Sc> zk#mo|aFzT^oOuP>!jVW-2SpcB_EcGr4d}Uw27xznDxB-qG=V1Fgrm{16dAlaeZHKA z(isd*R-Jp{(ej2NroSuGz`^{$^?NS3`TP^n$YcH5feVD{4gWE()ID>^(f`?}%-UjZ zP~kL>W}-NDU}YLg145+S;AYttiNE6OZLDg9sTNUcN>5msQ!*wQ!YVBFo^;MG zfbzeplF-_%6o(sbfi1_p_~AttGSC&`E3P=6TI8^I;7vluSC=$V&61;2-8zOf5FKY& z-E6H}tGW{-2$%9BV%xbOxaE2uA4YTgzdv~Es5e7sJEwJ5m&pRD{r+-Q_Q<8b8$`?q zUNqvVi)@dVV5!(h5mF45N8Eb$3HM!n%ag!*`1P9NSKq5PIDW-CBxZdC63S441XSZ7 zdbJ0qkYc03TE4{SVA*1=Ut)5K)3yMsixhmmkcY|ho17ft(%t0PiV2o=q7V;719CGA z2*8;i9edOj@89uTv}eng|9=@voFSynS|wa=EZ>Z^dpe$ZZgykp-khK+lqF>%TCR~N z4e`m)Qovh69R;I`TN#A#pN{I`=2k%8Qv z6|p6ZY&hSkhP!)WQ(6t8io>alfskL#8iUX~Y_Z3hjh1XlQ0au8aE~MNR`snqF{`v- zy6mz$=Bs;_*;vTrc32l;WtcUTXbkdxDQ1KdcJn_kI{5D9GY)O+AH8-zy7H<>g#vy+o+v4 z6A+Ff6D&8XdBJF6m{!L0Qpy}pC8erRJdETalH7XNgYVq-w?|fz4T(?hM)y9DY~% zR)^DXF1`c(hQkp2FKYlO3iMQ_)R@cDeI06&HcYE~8YNiTr*QKwD;S`5FqAC4n6^9I zO0V6a(E4U{8XMPSK@}fO?hUX*)+IG)s*RJDUIQwdV4dx_`_8v-J^i}`x(Mz)bw#tK zBWpn;Xf|1G;}&N;t}BD=$%Hw%m5jT}ML6$m z32>4nFU^J*02$=B!vDSoDK@$br}7fC>k7P9f9KrhB^0 zncBfrI!gw9&p!qas2+!C6s1G$Ogv}DwI%bQB2^d9()^aMB2(Zjd1431pRZr`;{G#k zdgu^1^6}o4dggDCD;#S_I9{ItO$LDdmPz|YAJ75)@|32Fh6p)Kh#m$>X` zqb6jV2(?(I9_E0JB_u9s%2+(egBk`{P%l0H-xHqv9@R@*xAwC?t?ujzlBfeyj#*TT zi-R<;rf>$5@o`ba!ULu#F?jswX^mxTq0!(xvelW!LZCj@p&Y1!U(XPZ$5qJ`p1vG8GTx>Tl>kUee||;BUf(&`hm7t5E5(Z zX0OkSchwm(F{;2Yn;uG&i!FA7Zm8;`_^L8T1?ptu18_JR&%28W#)(%V#%?t{QyM@n z`qMKnzw3-^Z-LUo^=p;4|D@g!*gi!k^Y_T#j@|+*y~^}f43<839H7+uSubBvAqp71 z$P%ehM4d1$Q%O@=W)U@NaX=Ov$P%}2yXNdSzx`}=we9_SCD7JDPKm)a!N9h76V@=` zV?;EFO6xV@`LRrml(yAUCaI#Ea~N2)QFs(QdnTTO!*hllaXofvxCAy~xlr3^le0mRJU zZL1x|054Q#EEfMCOYh-uS6O8b>o`%2yv{c|I%9eD_TGE%z4v}@@4feX4K4I027(}6 ziWDKVgqDPwP$Ym#=%KeDhynoueEZz@_XphPo~Q3;?X}kSGiQRDkcl@DlpHzBlPDQQ z41XQ!q+nwqq;G2{hyp*!A%Km0=!9)AY`f&z=T={FMtoJ5e2!ds`A1-6?`Lzw_&`HH zXj_X(g`^q{8oW`vPdJ{1BAm?TbC;rE(nKoH6a_5{&*_uwG+(a+iKx5J z{@dx#f5}Ey#oFSg1D$gSHPE#JsSj)*p2{e+o7)r>9y{J$dA%w_frfe!R;|+vPqB4*s z!>U%hz_OdbB6Q1TR~|m={R>~)pwg3NW;T!Uu%Z(L zU*fgL$^r;kI%bNs${rKZr1Qf^FTC&8H&BC*&1*kB_LoqLJiAABRceT+s1sMwwMb#L zkb?T{b$2{-+Ws9IX`xetD=&v%BIjno4OqJ&bY})X7{DP=tss;mt z0s%Jzc9Pt1)S&(_MHTY7vlN@~l>283a_r3Gh$Jab~$BGGY7wdR*{n(KE z(!lMc_lKB;NL5E>`0#>j#m@VDu80lgS~MMF5vz?VN|UfnRn>EF+8k_zfzMp|`{@#a9efY!cGibACUGgh*aKDcvegpw4zK;0D78$)ZVm%X`v*EQGwGfVW%nx)EMwU&=cSk0KK+M8-%e39x($-6x^sVwRp&B6+jK0=vMa&V^5?219 zN8Ww!xcfGAcaL37L`O7*?EVDYRai+!#FKLe%%xn3WVMB-F~-nqY36KRncT$algn`d z)rPP0nf`E$Ool`LlyB~S?ZG3joVQy4kKTb=dgcV^#l%96zYOTjEJsnuYnGWyE1xCr zCYCm#hB>N_%8QmDt}oKn#_x^`pSv7dz@i)N)`J$CX zg^Dmff;^EZ-n9k&P<}YZsEAd)vR8|n6Zj+>a95fUzk?$;^Riymltf@9lL30rMvPaC z78=m*cYgNBm-pVi`^DAryy}@_(OwIY%MblkmA&EHAp;X>u%^x?og?O(W}|`MJQ!MX zm06iw;xHX7>Oh|!xZCbXqNwT_LJJ31&tZ5y%(Om3AoCUJB#x=T%W$UbNFmJ_`XL@w zzO2Y`A)|2VtJf?>4X|^?vI&F?z11L&=vg&;TCi`Kt19NAWgp( z6mb#jU`DhKoF-1vkKwcIA}XOhrNu_eXcCZ}$Ikxj=--a+{62bK?UiWN>z@`^=amdW zz6LI^h^7?TW67RL!;#WV&6ql_q_F#BXLB*LRdnX0n>XkWMwpnDZHtaIjYyTiw_3w6 zZ`ba+^0iwZy=dj!iFxQf#rp1903BjJ^6^<9K29YCG{V?h9=gYQb3BV+tWLj^txFYH zbHQl9>XJOZnUH8qnZg5VTU~1uCvs&#K2pm4hWfzR`Hs12Y=UXp-_whSVSuGq% zScdk>gFL+NuaHygfGN9#s5O}BL$;`pF_uF?UQIC&VMl|gE6MLneR&^4ZXE@>Hl4N; zYy%hZk?VK-;l39)tlb}3tQ;P`gAg`<0T(3OstlB5NiYcRmqtWE4$GE0n2E%w?eDX- z1p7FV&v*swYCAzK*XLQA9O*O{ilEj9A9=%pOST?5{*#S|*!J>@NdI%>n(Ki5q;W53 z@)@0{&$>E#OAFs^O<9zv*Cli$$a+@3X%E>M^rQz95)UW3S*({=rl!^ay}EGqnrcE* zIEM)A^QV6Q+x=&6us_)co=~m3G7fYcrpU`b20WcP;;Sd2RyIVJbjn(yt85t9)2w(U zod#ysEE{YLaYlRGJ(rP9;42P`<>0nmd+xt+Ln(P@6ntJEy~qd_R|quubA&563nZm( zjoh!WAX2;;8?|KdZ8hw%{usE*5_XQ-LM9~($pIB`adY9gL#jglt zv-xE*#6~+W{%rS^ukZQ|x+pHPuavfCBoBU#SwcIA;Ut$z-&8588k~Mn2Jcpk(!>&; zRG=;hSd9>4UR_RrA6&XUdQ$IUWf! zA`$qp+KIV8gJq^1*-9-{t}nxOndK#$%GD5TCAumRZyBhCL0P2KCj@Y9zW&A=r(be) z8T~}b@hiNRhMajm__Y1nFHwm#MzOZ4%El&SJTFqGW5!@*CQdXB+KC)uwHI$Z^tU%Z z0LXFk+LNCO73&f9suE!j`RD(A187&BtPq89Dl?xc7pZMAj8!ceQ76k>umd>;Qk25+ z8@%ANG*lEhG);ssP|JAf=mK`NwL_-+umW=n-Q>+FBswU<){xf#Ktm zYDB6lFw(@e<(_U{r@D*1v5N~-ywP~e^LN~H-u~NPM9f_{LN=u_D=*5V@gskUCj>0U@j>S}c|%@^S#4()m9z1L2wgA>Tx;6qGWrqb_(*mK5YO34OQRf94x z*ZY#J5msO`l&W+{<6ZW`ZI7Mz{QoQZ{af~9=+H_K!`GlC5ni5qrF7nd-eVHz@Iz89A4K=5ccaT|YLLB?m0QQZ|HA5Rbm|+^7U$&oTL7^ zdi}&Fn&=MGA$NZP@?{;pY6`iGS|huXX{K9+DACr;P;311($nC2^1Y}nt~at2gcx{w zR|*AEr;Qo2Y0Zi%goNfHPS4thyv%`94}P@ui46<5t0@t5xMj!{&)onuo9!hdUtQ~2 za3D_AcxriftV3wJ^JF~N>g*$0tkE6dlm~7oVG7KRSWAzv!2`3|JY^8?qBVO)r!Osio z!6Q{KY3$*${61ins%+H(37oV^p$x505SC3*jlrI*DJ3Sj8P4DL)XO{eqNEt`gjYVK zTECLSQLjoljgSxHAd;aE1XH@aG#&T3VL@|-x6h1>u_{7I0_`PfqB_K2-khS+fbMMu z==7Wme|Ot!`z|M-TRZg2?aK8x`9DEBtVGD>--9WPK4Fokv0ep3?r6~EzG_Y#o|SaE z&e$azQtM&TQX?;?xWTx3=x-ztpSB0%_wl_~ynVrkE60k5clLEE{Tw&1C8My+ zId305eEhBwI*6zK{eRG=i^$o9D}ZX=R%@4eDK=*$4Hyy2+|CaT>-;V*LZ+e&VG0v| zeDBj&Jo?^wD{A4sBR^8DfA8rPL8pgYLHH2x@^YdRQiT_bP(-ee;Y4XnZ=oy?V=gIF z0xgN`Y|_#;0bphO6W^S@=iQ_0=r>$XNu%FDKz7PG;G7k8dz?BNt?lSb<kYQ)63{(Ll@u?fn!v?H6yVvOi*3D14TmHo^ctI$fr18GE_?jb?H|2*+as&Bc>;1F zdbFyMyUqh83lFy_L>lUd$}}UWXs{E7WW8_3uq-E-ZgMdf^rm_v%@HVcR1?F1>>##i z14u@FdGLe3zx>FC7vle3`fs$o0rK8+@W5d<`hjAyZXatbMUK8OvUAc}FCSa<4INXw zpG+@K=Rr@PFc=w)(HT6J_nq+eYdbF93FPg~YsX5TQLb|S@5}5bpxeQae z#>6$bZHqyoTndaF^UzkY&>QBe9;1&l`npNX&xcIc&QIQX^VaJhxoOo&v06*F-S*iIC^tv-9Ssw?23R`Zn6McFtoi zbX1Q)wryDhA&Wo-n~O#94J8sirb`)i(jL34g7p<`VAri>FjWGZ8z{q?ddq1Z;|N|G z)8&8#dG}jiJoNmnB(!tbX91!UFjx1z1o_4PfV(y{dJ~@83cP|G$vCWKgV$ zXM*|0R%hgS#xBuVEQTV@pAgjbstQQ=%}tk}P@c9u&Sg5JO9`8yL^BPH@N>Sr`uU>= z?|gdI?F%kE9c{0RC~Xkos*2HyzAQsTNfux14Ld?T39U(2sf$*17hdyo1s)SN+J;m* zJTjAbe`?wjCZjs4fW%0et9efzt0en#1&T*MUF5|fI0^P`x$}a(Cx+2K`P2SYklsN~ z0Ifn6>S)p}`pLNFk=EQQBb}hvOqWw3*!m)R{mgBjdTI4?6qfhS`#yj4!GED%bDP)J zzSmZ-zyF(+Glv7|=Bhxi5;St%L?p`NsY`=gW@=>SL%}Ad(O&Q)I$PD$G!ig#tQlJ^ zgN+Ce3bw)%{;oY&y?Ee+RREgSt>_n0F}>lM7u)Ac=>^-(R_SME=)LI?C0h;a5j z;OxfSSr4Um`uu9qG=axBu7TexxDGAJEAkJuNCr`DzhcvOM5>2 z;-zzs{=JGexD)7;&>#W1>&HKUT(Mj(mfJaYBr9-JVMi?>qkJ57FU#XIECW{(|#<^iy-lWB0%|Qd#5()rc*OuW*RfKqZ)hfa2ztUVi(y_di*QAGrITMtkW)^pBMRo|7tAR6dR} z%Z0K`X*6uem<+$3T|i^$mvSzzFC6O>rYc+Ur4ym#W^ zl@xl@+As2-pv}sVSKzqJx|F5_KWiKSpI+lcYJ)5k0WpU4CH!*SFd4x|c(y1fr>sd| zTCaJ7xQ@i6;s^1h$pne=%VAeFqP2QccySSN2N;zQT;^vSK78WKhu%`6!+yorD^4?hOAnwE$N9` z$3W9^(}{*z&mI-!U2q!ic>ay|wmtL5)#-BeX{)-SWaOW`^Ho{(IM@qfM!ar895OAm zm2wpjjVgzmDwPtfMQcj3k?GZlS~FBg)J%iZDYj3u@i^5}Ht-u_IUa(XomX9c(=At? zwgHb)e{}&mP#R?CUi6q92p4Rdx;XT;2{Nh7kijujHf=~}GI%L*sovV|c|%xdO|0l~ z7bDHsKOeyDa`Tff+Hiu%?0H-3B{Y@{}P)q%ccz5Em7R(;i1h_I^-g)b@2Y0V>$9I_?N53?I zy!0k`l6mv$P|MDTd79PZu{_6##rt277SVaRM+6u8?#A6-7qT`nflBXF%~6) zNpWBj>&6aXZ17fN>NUN!wmjSkzoQP zZq9{!o!*c>6E6)qr`09UEu=T%4-mGgB->w!1A>%jk)6i+J2E) z0s8ZSyDq==w|_f*MUi>n+&`nkP(vzL1VHMpvBm~PZ(3!sEF5mHhBhciHiLCo)(~9Af+}ZR zMzC0*vKQU8NQQF+t!~`q)f%kjfNpXIE0vM>?iEe*DH=3-S5+X=svW#?{PV^}u zIkDxGxAx!j%FTb-u>KmiZbAPcj%ZHkL$InZrG)dWVyPTt%MphJSW8R_fz1+TRdiLF zK&zzL;MNJt^n&LfzWMH_ZihW^?Aq3~k!qdsX=6jH96?g|g1YIKRT_8^6Z{wpKfx13 ztX?EMS4pZPvc<%P={&OSu8W`f^HabYJa+B%-R~&ZzxSK?%7udtA45aF%eoIxVVb5x zkTUS;AYs<_BnA`BEmu7_{4jJ=kC{u?fZ8fWC-$sd zkspmTJ%T)EN!rG$s4c06(CwVRe}2=cw>+^y9Js;MxEOe=CyAIDov}RAmsZ(p=!`GV_UU`#jJ!l)3!ujWtuvP z(`Ju}b&!Ry*FXCDwHpq7dclTcO5*GPLPu7P{O*o4*al9`x}s@dv1RlurQ2rm^cgWI z36&<}EPZ7uJf&dlE}=HGBod=id!gyYrt+>7oXQ6-JNv+=Cw{Ryj=qy#nGZl&uRnos zUoFcou=EVoOj6>f9JY!P#4|KPAXoJgc&eP4n6uoZHWoh~vhhi;lL)AWPp{EoJYye; z;Y?zHeR|moyI=X|b6>6e&(t@p5(3{xylC|(c8cnt`=|mAHJ|~rgAc{ zOIX8V+azwe+}o2_VZHx^3_2XI_2!id)5ekBXi_n~^6vkPPCp4E9ud2GyC6 z8BR8Bf(0^8s2vd<%GA)VjL<1$U)V7TG2MQlFwChFWcVnEzYd&w>p9;%zWs#N-hXcM zX4N|9yQ^2vcaZPzgp*CJTIeu@Y!C12O^P}#1;h5G=^3ZO9gmx{9m-VT(Xyrjrmd~z z5fokJDDBC2qMSjXo#_}XG7blhtX-!+d(V?EY%q`y4_1x?airC$gYW{&XV!3(R@rS? zCX~4%k0H_$qBVs?Tfzpp*r<30+tVSJD_{f7V}z7% zj%2KMy)a`ruu5g5A~AR@b$oTa<*nPd+`r?d6V6$U%faUXM1Sw28_>~?As=s#sk43~ zGU6!QrnbIFphw7V1wY8)%u;nWkuA*-YT*WBs#Xc*xyGPq^r(%kyx%osuziDkyF_P* z^7SxVxIju=(x|PI3Z#lwQtgNL^|j~TcEzoyU2Z{LEUuxa)tqm^Kl%~cSw92sabnEj z0)v@NYyBrzncgr`JNYpHY~wy`w3Td#u~@EY8RhYlj0&|C%o7BQDgg?| zIKny=U*yj-)p16PHD{}IZd$1wk&@tyyX51;2R`|Ks#WicD{nt8lKm+hJhEF=)(mW_2VPinP1PVHrO_@!lJ|)>Sh)`>f~XXT}R1L(rOmVN)uOW zC1lM~oK&1wkup0CBnG-?mUkC$S~In%wD`C>OvqcR=0g*5KSRw$Qt+>bez))0Z~nOV zp4DA7|L)4Y911&y{s^x%5?MVIJ2hUF#V>IfSyW~TF;1|FC}D&&tfY3Q+fj_gF^|GP zh$pocR8!~6k0b_y6;R|;o_+tut9HJ$0r<10*P!dDf_!iGU09bCaX4*=QUx8KScB~w z7m}DNz^HJc}rYpXQn5m2snW-2Y~aIkIvry`QfkkYyg)Jy|(hBR3X>j3+Rj9 z=8)iBEJ4mutT5VnO_kVXk8z_&P(o+20|}jO5y2DO%tf}CjE!tdOV zyXx;0XbsB9-H00`0w@z0)x(=;`-`VMa{H?fRnVrc`2Ek&rea9vn`42qUzBla&Y-N~ z>iFok1k%iz^KAr|lg}(ujLMScHsRF#WY_6$T=yg@0^GcI@8=8k`uRUuU2Go2K$`&g zYn}KzeN%=qsm%OAQ?KjF1^Y~5Oll)>wemuu&MVBT${JG{?K(MxYFDb931zY(w0!vD zv+sE6tPdSNjFAY4KI_q>M|UVNPP5Vq%XF2EgF|I=duZH!4jPg7c}0R@au8V z{+8W)j{EAf6ISBGSFZUP+Ws-f(-%Mm9V(t8#O8R3Fjhg6v7s0#uEt~{!EsO@8@Y`6 zyb7tBm;ygx1ncL-XHI?YtnE*%zB2myN=lVN*1iRXNqCV%)^tVYm@(1GN+DDkiz^2^ zTz%W5au$V2HI^HPyX?@816OZ3{{+~WpuW=()a&5&icV}FIrxJw;c-+_<_e>we=tp` z8Db7AO0}5TbYWFmaLfswX~HGtG#w*kWUhp3VKu*uary`XaS7w|S(kQr`#*Tz(UZ4b z{Oa!2q%Y5TP__QdiN8VH{}v)?1DbB^k~Qg!&Al}Et^A2EHwTMai^#)KOq__rB;(aW zE_FItYen-Cy@RT9J4%F+krIw-hlC=(hL2D+iMX9N-t(8;I}ZK(=y~Y1w`uJd)ykSO zhy3R5pF-k7nO!im{Mdq<(`xJ4Wp7c55fb%GQcAaH@zO$pDX#Y7e13}|jH*N>|2Q5J zNU{Zw8>{Mti=)YK5fcPPz?6UE!c(uh<}drP=wFndFrmFLBQAy!{9Z;Tp3dS8dr1zW z18*wGJ4$t&%9m%x}=+Q zZdpLZ1ayO%u<%tuS-#cjTU7#cgFnQ3hL#Y)E}k}1ajQXVQ%WP)sMG1CF+_8`ybIUK zdAlEf_Ya@1=nIcGSLMHciR^${klBc3m?j!Zq^O-Bu(-*+0aM6T2Jr@!t?uHdrehD^ zGWI3-e5tRCbqun_KFd(>j)x|rPZteKyAuyRDXmtC|C&$eOC$|C^a{hk=Ms29Z#yBlx687VobZ# z7)G?RCn%H}J7TtV7-B2f26d69?ns3QIT)qeXm&aUJM9wk5qcx&ZUar>=2s8x`{uN* z53d$=;2$g1TN?RY{2ibv%u=93lelFgX0}$W5f(KkQ=?GFSWB;>Vrcv7?WD`rX}Qbx zFeB7glghR(h7>om5(Jx!JSz;~sz31e=iYtowkMugwSMJIMYKC(g#6%DAU0A)>C?Hs zpX1{tDVtyIX*;-9@Z>WGE%khcIA0hRwsw&~5qoVG3>OM|nG6CZC^_srKpwZ;zyIKe zXFtwEx5@2Ck42lcBC#3^UP)LcNhY^bot3(NJS19-qG{crQns7Yu6cprlKzy|BA*OY zY}F`gE?1*oeBEgU9$`))!k7s(P}Q`g!8p^djwgsF(AvMV{fiHFJ^a*)Xny4772#Ql zynEFtKqMSY+5th$>CP>({UJ?2?tr5mzCX~i8Z@R2+vWIJEcTK&#@C2LR>_+8wpA@Q zVV+1$>X%?&t*$t6Mj8_ga3JPK5HM?r9<~ZDI_@r~NX+)Sf7r@g`JoV@M z51+Bhn0@%Kx?nNEwA5BFE&QvSZkTXAuK9k1y?D z<>5mQ{r<+kUHtcV7wDeb^R-dE-uv>$0J5S!o^|B;1CUphkZ6b=E00MEJ*w8!6jDfJ zeuu;*6Kn9`O?oUgnvw79CYhBn36v@H#*4)6X8>dh_o8L`UJ1yH~kO zE26lM3{j@66A{>wVoaY{Lh{9(5!Wv3LuIK}IX zQu_^vNed9DUb-PGw(B++2Awe1@(W`Nl zXh_V-gbK%?7Vw1a-eJu@B5fE^y>rEZ-S?l5nkK@POFf`kAD{6RdMF1F=AXg6&uoBt zQ{(u^Go*5`gpqwbb|c|ZS{m*I#X>n=!3t>LSSy5Qe#|nf8)Dgk3jPZCEY^*HD0emQlM1*=;s!md2R}Q+=nnlo=DveRDP&ZG5A`XYNmkL) zGz^>}#@lD-AS!zKnm@eu!M*RDyK1X(G>wKudgMPp2*Df4S%*r_cY5i!y-<1PQ(y6f~)@7xFZicM<^-H*|>#K`@70Rm&N z4VXZiic8hWY9}!*>jGyvA@UY8a!jUY(FAaQL%M@!sDU<@gpqvbo|AVz`qteWdbUlk zuP)_pA%O=Wg2tESB(4rPm#D zMEP#sL_N=#y&_>nTpiQf&5WLybh>yWQ1i3O#vnXbZ+`E#+fI4rYA|*B-rB9#Csdqo z!?!Dt|N0ZyI+=>(inJb`dnB?bHr1o}1K4cIjCCpX&ZfXl&(Za)i9&9GQV8bk$jtzM zH8G8+$V>8J`#@bO5g0+xI#1wF&Nz6^gYWJ+X+tXT^S}yxpd-sCJ;0RpVN}6}NUtmk zu-+!p7v`Ey4baebGCRf@zTZGRnkB-cv0khdh(dBoV^1_Q+`195`)o?BYu1ScBprCw-gMokXMFbP zj{iodOo&^FaJ)$3fFGjn)`(S@M)3xvZ_zi1dr?A^rtI4!t*$NIXapgi?P&U16y1PA^3Pw-}kE@fHmXfT=*o#^;mc>GEn<;|T<R>8`1)f%9cAEi}SY`th zP{|HkDI!1(w_SAPt}9*uTF9|$2d}?IwZ3EQ*igxdklg?G4^=jrvxdhIy))wivYw{G zFXpNuebA?{U4sM%*Ja5T_*{!d56KM^Qwse0G}yehCr}0(T8q_NS<*|SnvoRc_c|qe zVd^s5ryK=K;gylnkZM2Y`9GfX)qxwk=m+2Pt0U+}3n6byS+H0MUSku94w=bfqwQjp zLs9j3=F~b{4NkFQUXBWdBJ%t!K7chhxfUXhl2k$s=q+1M z{^-^}?c9Qz5N%rf0p(NlKh($%J_J<=!;)%^+&X^38ZWTe&N*gKp;;C>qunpA=L?RG zfoPHYI&@-^&n?yAzP#(xw@&-}tu(Zu9c%<0-2t+=LpvcP4L)u2+6QHwYW*qZ z%KNH~v|ih)%6izvVOwKQi*u7PEn?QIskRv>g&XTU-e!nE9dGEG_{Xofk)oZ@9x zlQN(Ne|Y@oAN~9MeQW6Ogm^i$WiE1RzO-XFm1Vkqr-Xa&={WM?)T{ zLY9b@jBxl0QL7TR%Q(})2}e~~ugu^mw>z|{TB8j$s3SZh8{uNiW+K#;YSpkUa$(W+ zNi)NCk1eCo!(o!0$jLKv&d%KAlq94ql}FZY3XNrJt*C4RdYi?-2HST1$M^r~xeYGz z;;U8S8$sTF30|=rkPW#pU^JBEM={e#t59l_TU^-dZn znELvX7oO_`b%A{{_Ed8Xj1=12dG4W0A3gmz9Xe}IZChb8-$zb63ILltO(I6YW0+E$ zViRT`BSu?fGV_eGm#5&<-lnxu;CMa5a+4v|@#Zejt9FwS@6ga*lsS;{zh~E3C%^O9 zzkoyoP75*|x>+#D{I@>>@y5t29*D8=td<=xN8K7@uvThxgu{+jqqdVz8 z={@y2tGvQA{sW=jvJOe|AUWJ>XBc(;vYb~0EmB_`>}7h59I?k~Tm9Hc%-Sv_2#R<# z#T^Qo{3cSVtNdbqTH345y)s>E(WG_qnYdGJU>CE%rMmXnSKq$lt~2jj?W1qUn&@f| zAb*a4D=3$jEM!bN5!+Fgs;O$Fc4W+HX;YSJ$)?!hbO|Uqlq^kdDaHcAt^gxzSphS8 zcHg!a?s@2jRdc)Unxez?17!2N{|Rbul}O|#EHHMwt|wfaahBDzxyt?F=Pf1a4e zEsW*>vF09dqLm27o8wZoHK%&MIUrXOGv1*+pKC+dcIc98_n-gi z-VIZMW3oR|te;O?B{LexZw@=*u^ulF?Ht~m*i`e>Wg^pFo|k);e8J*QvgTx0vlx!6 z63nTAqQ-Q%dHOV&9X9a8MP-0V%shC^T;sNtm=K#ExqI8ey{}x4nuu&(GZrpYt(Rk~ zT6Q+1)_??@+z;huvih7`#!1(jk+vo7S@wu(oHs4iH%8nD#wNBxVsjj>`wR6{F3yrG zd-Y~6CNOFM3b^gLPwzPIvD@!l4f#iZ{j(H?yo0>m_#Z&5DWSAB#D;=!Arr|P5q9PY zp*O0maS93HG#hb;hqHuese{M!I43kC)ELJ#s8#gyY6X~^`(F6?!hHO(Dd znMxz;ltvu}m0?I0=RF43&ct%H5MRFe%I;78^z}ydsD~an9$oh~gniSes_aiFjRnqD zHyf;sV%?q3MkkU00)86%KKS_XorllgFtof}{vYU*#fcP7hZ$6P)g0|;NW{-!>qe=%(bY&1-DXYALw3npGQn~l z1$_IIYp=X}@17r_L%-%xqeCA-1h)$yu~qcri5;DNB4jy4L~TIVA9J-=anBfEK( z3y~sUC*f6M(!1F>N}(E2HB>Aj)B&0XiP&-8NOFWRQfWI27CLqzBcu$JRr07HB4ps@ z=K0V%PEx4>Pr<8l(ucM|i#)#Uq4TeQ_`2JkTdDXsU+hI^_t!}0Du@om;;5wtW(Hm1 z+*0sJ1$8SK9m{Z zsQFm8UF%U0&w^2@)JTHtv?7=yeL>W%q9*xx#;EAR!s5Q-wzGbJ-W6?h9{>4+l~z@U zJjwtVV5A}m%q0^Si(~Z)%sPuyKt%Gua-p1H+BgM4!?c+CJ&sV1S=M(syMt%5;RA~ ztwOWV5<-N0`A3&taO&|;VrSFZ#b2zHF>6Tnq;;qTu659*4ns55tQz7KFP%~#2gf)j zKg?bsub*729ZX9KUKzxu9%v`00@)j3YtdKYC4}zN-Ybh)k+T-@l%|q zzBCy1#aS}UK*(y`9Km&6GDM?tQ<5o6vgc;m;if%u!v5zTy>#E>t1b7vSRGyMX5@vp z_ko&UxyWNOa*a*nWDRv}d#U3{_Z2zv6q8H1VloSXoB$RvlEkqQ6&J`AAD#E&8GpX? z)fC#d2Zt-zg@!!eqh@9 zT1lq$%BF--9#soP_go#FS^3y>v8p9P7%sPP6Ix4vAvHCbWtGMpB3S4%=)+4_zP|Uv zKm2~x2Yviibe*purMVWMjR<8pz==n4ozn#d|0FYC9f*>|I+Lz~b++r|CAkk4a3T?V z*fF&`O&6lgmb-mdMpN+kBtok#XmoktG~WK))?2pkza5GIfPc@4D|4JIa{aI1-7laR zvx2rK;Fs$eOuT>^=9wdm>|*RRwd^{j91|Ub2?`*Pg4tpYCB3{{;|K%mVC&XDUUBoy z*KS0S^KY%>$ymfodP$j0*oAcrktoE(zVhLW3Wa-E@<{`wpfG5Ml*L?HV zt@jksu6+C1yV0>SA-~)OG+2gYkY@)LA`tTV0q$-fX+%m0=jmE%i95^?6P-35#A$7} zf2=9OF}dU8M~*-ByxqTBjrwg*t+;e-uPygY51nv6l^A*ObMqWDUhd{EB2Zlmj%(Gw{n2^!oGNSweG8imK$$%%r zvUVMUnQ~DswA)3q2~!N#g3_uOuEPCW{&n-?C$6C3)JD1cI`aDM;OfLOhT0*ZD8XHo z=IO+IT^H6bNUc;rMYZU;8ka6VG>=$>;wYSUk{}4Xc>Ajlzq0q#je2D}T9=_6J_fnr z@q>`N)N{s@azE^K64)k(pTlh;>Z&cTR4oThkGKF@vPqpCu*|ScV|p3#&=`uIzp{`m zk}%i*_~gd7{&mxbt0{Wk>%gj~6Z0~?P-mX)$Tg13l`o6^b|0k14NYZ<-b}g|UH7Nk+u37;`R<7#E(Bo{R74S=Jz(fW^x@&bc5}7Y&7ZqSzkqY29i9 zXJMf$IssAI>kkNRD!E$;B&Z|rKJ)TZPhPTGq@`P==)d8SDiVQR#d6FOLvMf|%gv$C ziZ-pI2LpyQyIE&y3ouW5Vp-sV56}-xZbc@6%Jt8$6xy3{pTLJ zd}GJ{e_L1Lv^9kD@GHu!Z_Z(7wM=K*LMp3+LWWChqAtbkbWO)LbihO0QeZ_|8LOMlqlju#R4Q|5>lReeOCs5!ZdV za;DpaykYw**z@7y@~TEfrO-Y0mRqOi%(XpQj4jen1k!1AZnRrm$~mJob!G81P-ES@ zbIZZ^9$=&Gj3h_V2;n=(PZY2?xOuFp(VLHJUBj@=Ah4V)+R}_An(z#h(G(_hHA8D) z!ee=z?u;!gST?Lci#%}fpYNRZ(3u-&%iH@_z8F~Kq;G#8waWt6QXR0%y#j!tCSWck zTZX+ORjkougr^-GC90Gsd+Mfx(4RZvB!oyGYoznECu<|r{DFQv#mf&R2tL-gdjSeO z>+bEJe|T^MVpN=sLD%63IZqLV7s;Z;A=`1D5^Y?I2wFb*h%Hsh25h5=qO>>ctbRE{ zBwii z8LL2Xu|ksFmUAZ>hz^q7s+WPE+d+tVVAm^uyzq%H^XN#vUR%{C?jZCN?^R~Q?kUeN z}HFAkj(aooghvcU-$)u@t&7IfBe;dJ@NK;(f|AiDnY^L{t)@P3EH$!RUEb| ztqvKdCmZJz8qt7g)6g_wk2caYibMm4RF>c-Vp=c^PG?G*ftJ5$E}RvTHAy1pq9np( zQBPVi?5Hfu9jjA=5;o)HN=yKYUHj@APd@SLNHsO zhYJCMabnU$c*PQUh~d4QCC<(9`vNet+wZya$epj=y-H_ad(n5%iB%wjSD%6MDwz7H zWx;9_L@vct%@93^+Z5*;b5)0lhjqpIvW|;8Y0atGbe~qAP>mfYfiB8-1~DpAhiyVU zJ8$^qZdy8R$^jy`<(z$cPCR+~|u6OVVh1t@%JNE8dO~@Db ztX}8;2len~s;pU;P4TFJ+J{;6nY1V^w?o~c4)OS7Q3l00(KxfYa+~Bek|r1?O*4wm zC{4a2656N2?cl8E?)vz|@wz%zJt%%qcb*fKO4El$;`)M<8#qcH&Y&xI)$M8!f>%U#Sp zKC4&npZG_NXpo*!=%*dC9wLNKUpwhff4<6&cs;yc7M)&B)+}t3l9@F#U9l ztCG=nU20Q+>*|nQ@XD=X5n;{NYHIC{w$r8Q&Rrz6Mc0v44LWzc)s4Uda?dRvT(jkj z_cu_%+NM>ktVgyXpTIV$X4M_97vBw#v#ccz?CbItmdz8mj+;eo?xpaRlDQ-%q_Q1ug}h%wYq0uvL2L=l1{A%yNAGw6X%|FzO_*Jx(1>C6`93ef$6H2%yotbvw8>erX*;*mjVg!~i|2;mi~?FSVx1rGqgXeN6IDEnSOU=i5jd zH{_^DU=un7-JCB|u(!rV8eL;xOF&#cAFCufK#zL#ol{R8J^axt+pvuU;DKvJZ6 zl4P<%Tk+7TOFnq#!+jWxxp574U#ubim$$)3ZpM1XP$oVlu^28wqf~Vy301y$GO+Z&$xmbB zqeh}DS#-e|@#nw#@9Qr;a^x*o!gJTOPZqW7$nWEuQUL~}^y(Zc)`XxQ_cBIpXGvmi zE9V)3V`(l^f?hg8(-X)xidUVM%*GKSy*yG%qyx|+&RGU53Caul^ucS69e4!eOkQ|C z=0B=KcG5w_%!m&)ENWig7cUe5uclmaW%6!$=pE|ud>H3N)7ApsKl3ao24k3MvHPbT zsl|v#7)+hBRX%kX%He%G>tp?Aj60ON8 zHc}R5v%CbkehWQ7l&=Ia7P0|kPCZ@hNX*&oSfAEP>U!#)Moyc$I*X<#;LgAy@Qa__ zfAHR4-FYi^VO@93xtee zPED(|YmG}j!O+c?yCrsLMjklj!?2ZZF_A5Ur7}#g*8_|8fFh9xibItFYS1gU9e!ln z&ChT4!Z|cddy$45-wjQETh?c<;3e}IGvVr6crCRKzYwj=#3UgrWDsIjc`7>a;)uRd zPdSU%Q`&-)%$z6bS(Uq9)DpX4pHL`nC^c#zdi?x>)1UqD-ivkU7r*5YwxO8FdEXX8 ztIBR|8w{@G!nKhMj-q&>N|3`BY?g@KXXlg~PIG11rOb_skT^;#g))PjijGtJwJSVc zI%yMK;>=1?pFp(V^2^=FKV9?I3KVCbDbBkTQwc!M z9^LW!`~Uv^PqA{MF8FWsbQmE2I)_S|?Ilng+9 zEK7!Df$U(Ba)wnBjd{wlysZkEV5J^}2|w~DK!jzh!?&2pu&Z;Eh9 z8<0%ZAPTQ}_SO3jy#2;q*w*__R<2rK?T~JU;n$FpLI8{K2xGdam>Mqx?Y!OwcC}@$ zrq+r=$JaZZB((O{&}7u{Ih;a@-$_uzP6&e!9)9PAZSNkz>`ILSOzIhjBrR*&+{RG1 zvN5NC#9!%q=D`MO=2*sXQ6}&`s2-9lWup!zLDN($!A)`L_EIchSiLP#DxebSGm{>u z=V`|^?|hiTiBapK0}owx^QUjTbO{#XSMR`NROQHHUxZVMU6~C`iA7sv($ zR&^smK`g3xqE50aUkQwsOIbkX&KtNu@PG8Jt8TmHp&Nl-a?YCIs~A`&g^Z{jXr36w zAjv-rOH#a^Q&KYYMq#&JZDL5g9br2-OtC8|TAL4kDY~+TnyEuiYu97Hd1%LF*JD;M z%>5Wfn}WP@-+yUx$|cK`STe{ed9IkL_+TQP@@4Up4n9O71Pf6~Tk1;VjnJHDMvb!= zB@~*`(rQ=SLQ)#hwYufsx4yjN43?jL&vO^r;L#ycJ&fmcnT?@M*~x2zL1^QJ1{Sy1 z83VOdLz0pxtY%OE;@*>)$S$h&~+B6W> zR!9$AGKpkH?Wu)+Qq1a0h+1Aj$tXxgYJD}!Zg=D&5nHd3V~~TapqtYPIf>1NA+K~f zW5@=jQtVe~I(&;>wlK|Xz9b24t%sif+rHN>KDjyiec;75`a!8koCqy5H9el7tyGM; zoGT?MTe6y^(JC4g*6cjQkhJU~UwNF6v2glAf$fGQv}0IyDoIAz)e=sbHUa#I2QEJK z$^F-Dnhbt^J|-GbMa~?A6HZrD8U?tN*}=ez>fC0$P?jw+5i8%`APM>te+QpZu_-R@ zLSW#pLUJOJ<;^=1T#ivqpO|JFUSDLg^~`gBeDSi6e~21JoU``-E0~JJKOz@zhmcjL z1CofMsxe#Ryeghz6w^e2UTe<-HGHX)wwlO8-p1V7)tOq0p&JOVX13BZ)5oXnNUkm; z0&V*C{U5)0*W;U%r+co(^!Ls}_G|@qUXsyk1Fl-!cV)oUw8o?A^2U)puM{VYRWePd zmkwk|kzOnM71aJ@Ib@6y{A@)}uUjJVC2<8hq1rr2#I`R&%T7|?)=P`>u6=|=2lWjp z2h#3cr{DbShKnBDBym2W#Y_^6NM`2=b&jtr#pInqg)d~)JRA0q#3-w<3Vm0pDXR>X z?ut_FqtHr=fsroF`5GoI9#liG{N&d!UGdn*1N0Nk{O@m0gb&}|00ky!@yUAtZ0`>9 z1`mH~bh^z(Gr`51O>C2r*k}|PMyyn;=Tk{x6W{mKyY}30?_V&2I1oxBdiBXH0dV>Qv8pc209*pV~|~aJY{wrL$3&w@7R-92thy=`OXQ z#VN4Dk$1!QUpw=cW1EqA?>m?wRSWr-+o2yp?kLoM0+vTGPooeWE%f$AghZE zu6m17TpH^IExC+#oF07q)dzoh73Nm+;0FoxZ3M{VP!Y^ZdSV@*wvFC#P%g%IWv+nO zBK5Nq6&OD(<8DY?R_0JoFp6vh8+Lj)?`kN-f(FM}j765kpm}IVW@&;m7t^bo^@UcD zjx%|DxT>z-ckL5z?R{qRp8xz!?D&F=cHc9aTq=>8DMfq&)H^lyD1&2UdIP}Mn5`pY z+$0L~rVhEeQPQxP^`d5G@#XA1O3K{y5yi5Au^mRbRAD=dC(`Ms$@5LAnxP|b)0d!bqIou|5fa#wiYb>0mf5kQ1^E_*z zVr3vat4&C%K=V5Ya#i*?q&?d&zv8|74jo6Y?k#JtJ_R%Iuh@cUM129-e-TiN`KcL; zo99xrUAQJR{=TFGW_(P#J!lXrf+}=6JoY-3L|v?Eh`1K3(Gbuv$B(}GAFuq|16cjD z?JHSyC71|trvYY3g;)r)b#X1sOU7!v~(-z;KO8e3Ld(`?ktz{agpkZFxj zG(7*yXP&$4**~GC5ReaCcs{yk^hjBf)8qP2|bOtMqh)N^wZSRJ8)^ zA=26^T)ud-MBo}(a*c#2oR2!C8}?=|*VeU%<`GXzx8r&2O3r4Ea!LNGgPtn}#@4{@3xwuSyV4>9CzVGTlmuymbR?o{ z1I7qKpnJJZE?G8Eb93Bi(?e)Q8Qc`jnp|$U>AkK%2A}=s+b-R<{nq_3x!ke_=v?i( z;L>ZHl#lfx!;RwFie9DUT_k2 zrkv_f+F}?@Ln&p7w5*!S-FS#vm5MCc0f%f67v?QJI-1^p<1b%$@q;HV=sSlZcrg0? z=D(tA>p`}E4L~+dkz|-3hKThBWi|?DDLPr+Rq1nVp{zK8*n|@2BpSkNa&-+;9^+QY z(lj}t9A$b@5Oct1rY69Kxt9wTnE>XA2sGbL@44vK4?o&zMgLl_dbwtO=-fc#(uXAS zQ^*GA(Z*O)qu@NkWrk@g4sjYKMd4pX3oD;!>GcPUxkW9M@#O%o(INKH;`Yvc2lu>m zPach=@4bo{03{H$641<|nKzWPM}-27yhB)J9BQj&s?`AhSv6pXI{cDKJ`WQbIN;;D z1$Oc*$%}?fFz3AHu}ANI`OmxHig<@_@GLB5XsVGkVYbc;E#k<_t$!3vQM z@aBGb-imSPdf8$whZ~_^v@tBPRk6SZsPplYM}EEM)N3DNan7+|eUtN$;%}jOCZO=B z3%AH>4pdbnr7J_xvP6AVT1{*A3DQhZ9N{3tx}ZH^Zs_`2dN3y=L5h0Ei`(}c+xajU zKY+@w!meHa^gc|ajf$+FbtBA(&AlZjCg9~)!NL#;_xm0R%{H$uR&riN5O3L)9j$jP z%qS;{#GqzMkuzKYKwVEib=%gDU%3qe;GDI;-HaJIc983z1z;gDHdqbpwk4els*-BT zJl&dc*`UH7i!*2hYkWwZEr*k%FI@ZM9alWN7aA~I)*j!R)T|%%V@ujVj+D*@G`-4S z$joBpxX@>glFFbIX_9MnvusePr)zlA4FWv{jiRG}I`hz5H~by5b?}Rr|BwMW_A^Mv zh&Y3*H4v)_!i7NF_W8NG4$m3$*z7Wj!EGK2eY_%cXP)1E^AAqEaoMIS%-+wEXi)tl z^7OL~Xd7yWnt^T+OL)U>?;J-ac_+kBtJ_MdDrqiV7EuXF?T{i4L;Yv2yythvx9!-J z47qY26@7>d2@ipG&mE1-QXeBz#<#)?Cp8<1s2x7(imw`RJ(WQxJTl@&#gUIgvUx%- zP~e5b{KbP;-*@%x4`Yk}*XJ>3fiEC;+TfeeIpB3QF3`0go!;ZgQc)*wo*{EBw30oa zYSr<)p3atYSe7^l@YmkB=%tgl{}@FdZCTUUK|t!Zmye+Fs7J1EgC>U7Bwn~j>ZH!G zYP7p`aQ!U%pkclx4Gh&rklx zsXLy-sE{ZA0w=)k{TR~;hcLqcP@y~g6>h38a!o8`zb`ZQ@)_)g(?w6MNYM@n%ro>g z@h@8hd_j_GKNwwWjl8N`pNfTk=W? z&oJfXOVu4lj#uQcsbjfm=%Eq3fc^Vq|L(hA`P~~ByTJ5KI=UL?BX6Amhy@dGT7V0g zkW$2ZgbRkoyy~+>`m8o4m-wB)yYQ2utwPbyhNe6pGOJ@(Z`*bGuhA=g%i1fPymo#1 zdqCNsf~47_aO!aKfFSWL4O+6ns8bX(R@Z`KRK`-yQeCO@QVJn(_Lk4>IEuuRGIHu* z+40!^t6uoQ6JJ5M%x%B3psT?^f(8>*IJI$*lchWRhC-ImS|N=@eqr4p&1vj9NMBEj zbX-YU$A@~U292sT2{Y+}o~sv+)kUDE!2aHS)7D@A@vj&=;loF9=ySh`G|vTdQI&NW z#Z&X08l|m{8y1=Tl%WXCtHvJ97VHE=3va@gQq=^}SuaHQj@8qOqD-mvW3gncFaemw zi61|D=8q3txH(t%h7X`qLl-)k&8YU8-%0|s)sH>g=7UUKll zyMD9l3P9&=S?gZF)2{#N>Fwx+i9@^@$R~-7t~Q1+G<3l7X=K5Xa8asocm{`UmF6ub zs%+OCfhqHquWsG>`=j4$pq;n_$G@*$|EX@98Y6erkOP;!1(-#US)B7HR7RdORnaS8 z@ex~0^<1`S*~$Xe1?VTvP$Qq=40;-|Fz-e=Irir;jMTkY3dY98hY9^UF-l~^w7Sk(I zOs-ypMplM3mSyN`rnr2rDK|3eDoeJpQ~(J?wZN%8rg4Zeu@G$HrqD%3NA-sv-}~CZ zA7R}1RBsQuV&6g3gzp0Jbvz5SRU5W;)HrOKY7|DFRLS-f3K;lHJtCRQK`v1B^FW-Q zq&HGNs|{|aOd%XJAsNA>E1bk36+M09iA(q<3ONsx%Tg0611>F3-{0QlzRY z-g4vHG)1J`^XlxGN*v??UCs(QUCHNaI_1a{sW%-GhI*-?o`PBaxV6`c~-t+ZrJ zvs>z%!?17bGap@a=(+o@CZO^B#&@y#fdENeA%7&Ub*(!OE-((yEdli zHxeP=>h48_)<;=Rf1wst!ud+S)iQENIKjd`BlRfC4Z%|C&iGeDu3YSJ=|cIuU(1+0 zdg#>4FF*0&o_|1J^(*gT=TsPBD*(4nmWmkGc~aTPbO|+$hzjmw!eKU8Nc5#TU5V!~ zsESgj4a&bi{OrLk`uHX`o|WvsF|${E>f zNx7nn_*k~ejO8`DiqY!;;oy$Tw_bnm;jKrp=aetRk}wYP244$jvTqbxOhI3OV33K@ z%DS&bA<(AX;Lyakb?jtyoH&|iA#)T~?SqkjkZe-56o`#RN}r0B6Gk}o554~E?jwIY zi8Z-cVFkMBe24}Cgm12_rPKM;mfAZ{8a)9>ke7*ag`w7#N#d|2G3gERefL7rj}hm} zY+gYV;bXZ4@E;LERmbi~M}1<|T}w0TJq96PZ^q-!89r2>%p5DF*eMv4%5^f-ZkN3A z_A|fQ^&Cu<&RN@X8k<)a5#x{0S~M_dw0mZLqHW>y`0Wg1M$>rQ_EdCfkdI21c_xE6 zGfNs3;7exM9#35NUt4c~^~>mU_TmWW&-e#~_}*6`{~0r;8=<(W!4L~OUY2}dx4Q&> z0}d?F=OG*+M= 128 are escaped. + // TODO: Base-64 encode? + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; + + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must be belong to a oneof to + // signal to old proto3 clients that presence is tracked for this field. This + // oneof is known as a "synthetic" oneof, and this field must be its sole + // member (each proto3 optional field gets its own synthetic oneof). Synthetic + // oneofs exist in the descriptor only, and do not generate any API. Synthetic + // oneofs must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + optional bool proto3_optional = 17; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default = false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default = false]; +} + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + +message FileOptions { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default = false]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default = false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default = SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default = false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default = true]; + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41; + + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. + optional string php_metadata_namespace = 44; + + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + optional string ruby_package = 45; + + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default = false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default = false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default = false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementations still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default = false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default = false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype +} + +message OneofOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default = false]; + + reserved 5; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default = false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = 34 + [default = IDEMPOTENCY_UNKNOWN]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + optional string name_part = 1; + optional bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed = true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed = true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed = true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/benchmarks/descriptor_sv.proto b/benchmarks/descriptor_sv.proto new file mode 100644 index 0000000..434971e --- /dev/null +++ b/benchmarks/descriptor_sv.proto @@ -0,0 +1,867 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 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 + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + +syntax = "proto2"; + +package upb_benchmark.sv; + +option go_package = "google.golang.org/protobuf/types/descriptorpb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1 + [ctype = STRING_PIECE]; // file name, relative to root of source tree + optional string package = 2 + [ctype = STRING_PIECE]; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3 [ctype = STRING_PIECE]; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + optional string syntax = 12 [ctype = STRING_PIECE]; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1 [ctype = STRING_PIECE]; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + + optional ExtensionRangeOptions options = 3; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10 [ctype = STRING_PIECE]; +} + +message ExtensionRangeOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + TYPE_GROUP = 10; + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + } + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + } + + optional string name = 1 [ctype = STRING_PIECE]; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6 [ctype = STRING_PIECE]; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2 [ctype = STRING_PIECE]; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO: Base-64 encode? + optional string default_value = 7 [ctype = STRING_PIECE]; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10 [ctype = STRING_PIECE]; + + optional FieldOptions options = 8; + + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must be belong to a oneof to + // signal to old proto3 clients that presence is tracked for this field. This + // oneof is known as a "synthetic" oneof, and this field must be its sole + // member (each proto3 optional field gets its own synthetic oneof). Synthetic + // oneofs exist in the descriptor only, and do not generate any API. Synthetic + // oneofs must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + optional bool proto3_optional = 17; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1 [ctype = STRING_PIECE]; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1 [ctype = STRING_PIECE]; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; + + // Range of reserved numeric values. Reserved values may not be used by + // entries in the same enum. Reserved ranges may not overlap. + // + // Note that this is distinct from DescriptorProto.ReservedRange in that it + // is inclusive such that it can appropriately represent the entire int32 + // domain. + message EnumReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Inclusive. + } + + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + repeated EnumReservedRange reserved_range = 4; + + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + repeated string reserved_name = 5 [ctype = STRING_PIECE]; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1 [ctype = STRING_PIECE]; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1 [ctype = STRING_PIECE]; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1 [ctype = STRING_PIECE]; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2 [ctype = STRING_PIECE]; + optional string output_type = 3 [ctype = STRING_PIECE]; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default = false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default = false]; +} + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + +message FileOptions { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1 [ctype = STRING_PIECE]; + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8 [ctype = STRING_PIECE]; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default = false]; + + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated = true]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default = false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default = SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11 [ctype = STRING_PIECE]; + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default = false]; + optional bool java_generic_services = 17 [default = false]; + optional bool py_generic_services = 18 [default = false]; + optional bool php_generic_services = 42 [default = false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default = false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default = true]; + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36 [ctype = STRING_PIECE]; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37 [ctype = STRING_PIECE]; + + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39 [ctype = STRING_PIECE]; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40 [ctype = STRING_PIECE]; + + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + optional string php_namespace = 41 [ctype = STRING_PIECE]; + + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. + optional string php_metadata_namespace = 44 [ctype = STRING_PIECE]; + + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + optional string ruby_package = 45 [ctype = STRING_PIECE]; + + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. + // See the documentation for the "Options" section above. + extensions 1000 to max; + + reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default = false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default = false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default = false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementations still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default = false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default = false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + reserved 4; // removed jtype +} + +message OneofOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default = false]; + + reserved 5; // javanano_as_lite + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default = false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default = false]; + + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = 34 + [default = IDEMPOTENCY_UNKNOWN]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + optional string name_part = 1 [ctype = STRING_PIECE]; + optional bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3 [ctype = STRING_PIECE]; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8 [ctype = STRING_PIECE]; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1 [ctype = STRING_PIECE]; + // } + // Let's look at just the field definition: + // optional string foo = 1 [ctype = STRING_PIECE]; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1 [ctype = STRING_PIECE]; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed = true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed = true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3 [ctype = STRING_PIECE]; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5 [ctype = STRING_PIECE]; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3 [ctype = STRING_PIECE]; + optional string trailing_comments = 4 [ctype = STRING_PIECE]; + repeated string leading_detached_comments = 6 [ctype = STRING_PIECE]; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed = true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2 [ctype = STRING_PIECE]; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/benchmarks/download_data.sh b/benchmarks/download_data.sh deleted file mode 100755 index fa0729e..0000000 --- a/benchmarks/download_data.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh - -curl -O https://storage.googleapis.com/protobuf_opensource_benchmark_data/datasets.tar.gz -tar -zvxf datasets.tar.gz - diff --git a/benchmarks/empty.proto b/benchmarks/empty.proto new file mode 100644 index 0000000..3c32ccc --- /dev/null +++ b/benchmarks/empty.proto @@ -0,0 +1,35 @@ +// 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. + +syntax = "proto3"; + +package upb_benchmark; + +message Empty {} diff --git a/benchmarks/gen_protobuf_binary_cc.py b/benchmarks/gen_protobuf_binary_cc.py new file mode 100644 index 0000000..ece5b23 --- /dev/null +++ b/benchmarks/gen_protobuf_binary_cc.py @@ -0,0 +1,69 @@ +#!/usr/bin/python3 +# +# 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. + +import sys +import re + +include = sys.argv[1] +msg_basename = sys.argv[2] +count = 1 + +m = re.search(r'(.*\D)(\d+)$', sys.argv[2]) +if m: + msg_basename = m.group(1) + count = int(m.group(2)) + +print(''' +#include "{include}" + +char buf[1]; + +int main() {{ +'''.format(include=include)) + +def RefMessage(name): + print(''' + {{ + {name} proto; + proto.ParseFromArray(buf, 0); + proto.SerializePartialToArray(&buf[0], 0); + }} + '''.format(name=name)) + +RefMessage(msg_basename) + +for i in range(2, count + 1): + RefMessage(msg_basename + str(i)) + +print(''' + return 0; +}''') diff --git a/benchmarks/gen_synthetic_protos.py b/benchmarks/gen_synthetic_protos.py new file mode 100644 index 0000000..3b4e37e --- /dev/null +++ b/benchmarks/gen_synthetic_protos.py @@ -0,0 +1,123 @@ +#!/usr/bin/python3 +# +# 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. + +import sys +import random + +base = sys.argv[1] + +field_freqs = [ + (('bool', 'optional'), 8.321), + (('bool', 'repeated'), 0.033), + (('bytes', 'optional'), 0.809), + (('bytes', 'repeated'), 0.065), + (('double', 'optional'), 2.845), + (('double', 'repeated'), 0.143), + (('fixed32', 'optional'), 0.084), + (('fixed32', 'repeated'), 0.012), + (('fixed64', 'optional'), 0.204), + (('fixed64', 'repeated'), 0.027), + (('float', 'optional'), 2.355), + (('float', 'repeated'), 0.132), + (('int32', 'optional'), 6.717), + (('int32', 'repeated'), 0.366), + (('int64', 'optional'), 9.678), + (('int64', 'repeated'), 0.425), + (('sfixed32', 'optional'), 0.018), + (('sfixed32', 'repeated'), 0.005), + (('sfixed64', 'optional'), 0.022), + (('sfixed64', 'repeated'), 0.005), + (('sint32', 'optional'), 0.026), + (('sint32', 'repeated'), 0.009), + (('sint64', 'optional'), 0.018), + (('sint64', 'repeated'), 0.006), + (('string', 'optional'), 25.461), + (('string', 'repeated'), 2.606), + (('Enum', 'optional'), 6.16), + (('Enum', 'repeated'), 0.576), + (('Message', 'optional'), 22.472), + (('Message', 'repeated'), 7.766), + (('uint32', 'optional'), 1.289), + (('uint32', 'repeated'), 0.051), + (('uint64', 'optional'), 1.044), + (('uint64', 'repeated'), 0.079), +] + +population = [item[0] for item in field_freqs] +weights = [item[1] for item in field_freqs] + +def choices(k): + if sys.version_info >= (3, 6): + return random.choices(population=population, weights=weights, k=k) + else: + print("WARNING: old Python version, field types are not properly weighted!") + return [random.choice(population) for _ in range(k)] + +with open(base + "/100_msgs.proto", "w") as f: + f.write('syntax = "proto3";\n') + f.write('package upb_benchmark;\n') + f.write('message Message {}\n') + for i in range(2, 101): + f.write('message Message{i} {{}}\n'.format(i=i)) + +with open(base + "/200_msgs.proto", "w") as f: + f.write('syntax = "proto3";\n') + f.write('package upb_benchmark;\n') + f.write('message Message {}\n') + for i in range(2, 501): + f.write('message Message{i} {{}}\n'.format(i=i)) + +with open(base + "/100_fields.proto", "w") as f: + f.write('syntax = "proto2";\n') + f.write('package upb_benchmark;\n') + f.write('enum Enum { ZERO = 0; }\n') + f.write('message Message {\n') + i = 1 + random.seed(a=0, version=2) + for field in choices(100): + field_type, label = field + f.write(' {label} {field_type} field{i} = {i};\n'.format(i=i, label=label, field_type=field_type)) + i += 1 + f.write('}\n') + +with open(base + "/200_fields.proto", "w") as f: + f.write('syntax = "proto2";\n') + f.write('package upb_benchmark;\n') + f.write('enum Enum { ZERO = 0; }\n') + f.write('message Message {\n') + i = 1 + random.seed(a=0, version=2) + for field in choices(200): + field_type, label = field + f.write(' {label} {field_type} field{i} = {i};\n'.format(i=i, label=label,field_type=field_type)) + i += 1 + f.write('}\n') diff --git a/benchmarks/gen_upb_binary_c.py b/benchmarks/gen_upb_binary_c.py new file mode 100644 index 0000000..a68a779 --- /dev/null +++ b/benchmarks/gen_upb_binary_c.py @@ -0,0 +1,70 @@ +#!/usr/bin/python3 +# +# 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. + +import sys +import re + +include = sys.argv[1] +msg_basename = sys.argv[2] +count = 1 + +m = re.search(r'(.*\D)(\d+)$', sys.argv[2]) +if m: + msg_basename = m.group(1) + count = int(m.group(2)) + +print(''' +#include "{include}" + +char buf[1]; + +int main() {{ + upb_Arena *arena = upb_Arena_New(); + size_t size; +'''.format(include=include)) + +def RefMessage(name): + print(''' + {{ + {name} *proto = {name}_parse(buf, 1, arena); + {name}_serialize(proto, arena, &size); + }} + '''.format(name=name)) + +RefMessage(msg_basename) + +for i in range(2, count + 1): + RefMessage(msg_basename + str(i)) + +print(''' + return 0; +}''') diff --git a/benchmarks/go/go_benchmark_test.go b/benchmarks/go/go_benchmark_test.go deleted file mode 100644 index 8c741b7..0000000 --- a/benchmarks/go/go_benchmark_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package main - -import ( - benchmarkWrapper "../tmp" - googleMessage1Proto2 "../tmp/datasets/google_message1/proto2" - googleMessage1Proto3 "../tmp/datasets/google_message1/proto3" - googleMessage2 "../tmp/datasets/google_message2" - googleMessage3 "../tmp/datasets/google_message3" - googleMessage4 "../tmp/datasets/google_message4" - "flag" - "github.com/golang/protobuf/proto" - "io/ioutil" - "testing" -) - -// Data is returned by the Load function. -type Dataset struct { - name string - newMessage func() proto.Message - marshaled [][]byte - unmarshaled []proto.Message -} - -var datasets []Dataset - -// This is used to getDefaultInstance for a message type. -func generateNewMessageFunction(dataset benchmarkWrapper.BenchmarkDataset) func() proto.Message { - switch dataset.MessageName { - case "benchmarks.proto3.GoogleMessage1": - return func() proto.Message { return new(googleMessage1Proto3.GoogleMessage1) } - case "benchmarks.proto2.GoogleMessage1": - return func() proto.Message { return new(googleMessage1Proto2.GoogleMessage1) } - case "benchmarks.proto2.GoogleMessage2": - return func() proto.Message { return new(googleMessage2.GoogleMessage2) } - case "benchmarks.google_message3.GoogleMessage3": - return func() proto.Message { return new(googleMessage3.GoogleMessage3) } - case "benchmarks.google_message4.GoogleMessage4": - return func() proto.Message { return new(googleMessage4.GoogleMessage4) } - default: - panic("Unknown message type: " + dataset.MessageName) - } -} - -func init() { - flag.Parse() - for _, f := range flag.Args() { - // Load the benchmark. - b, err := ioutil.ReadFile(f) - if err != nil { - panic(err) - } - - // Parse the benchmark. - var dm benchmarkWrapper.BenchmarkDataset - if err := proto.Unmarshal(b, &dm); err != nil { - panic(err) - } - - // Determine the concrete protobuf message type to use. - var ds Dataset - ds.newMessage = generateNewMessageFunction(dm) - - // Unmarshal each test message. - for _, payload := range dm.Payload { - ds.marshaled = append(ds.marshaled, payload) - m := ds.newMessage() - if err := proto.Unmarshal(payload, m); err != nil { - panic(err) - } - ds.unmarshaled = append(ds.unmarshaled, m) - } - ds.name = f - - datasets = append(datasets, ds) - } -} - -func Benchmark(b *testing.B) { - for _, ds := range datasets { - b.Run(ds.name, func(b *testing.B) { - b.Run("Unmarshal", func(b *testing.B) { - for i := 0; i < b.N; i++ { - for j, payload := range ds.marshaled { - out := ds.newMessage() - if err := proto.Unmarshal(payload, out); err != nil { - b.Fatalf("can't unmarshal message %d %v", j, err) - } - } - } - }) - b.Run("Marshal", func(b *testing.B) { - for i := 0; i < b.N; i++ { - for j, m := range ds.unmarshaled { - if _, err := proto.Marshal(m); err != nil { - b.Fatalf("can't marshal message %d %+v: %v", j, m, err) - } - } - } - }) - b.Run("Size", func(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, m := range ds.unmarshaled { - proto.Size(m) - } - } - }) - b.Run("Clone", func(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, m := range ds.unmarshaled { - proto.Clone(m) - } - } - }) - b.Run("Merge", func(b *testing.B) { - for i := 0; i < b.N; i++ { - for _, m := range ds.unmarshaled { - out := ds.newMessage() - proto.Merge(out, m) - } - } - }) - }) - } -} diff --git a/benchmarks/google_size.proto b/benchmarks/google_size.proto deleted file mode 100644 index d2d319f..0000000 --- a/benchmarks/google_size.proto +++ /dev/null @@ -1,138 +0,0 @@ -syntax = "proto2"; - -package benchmarks; - -option java_outer_classname = "GoogleSize"; -option optimize_for = CODE_SIZE; - -message SizeMessage1 { - required string field1 = 1; - optional string field9 = 9; - optional string field18 = 18; - optional bool field80 = 80 [default=false]; - optional bool field81 = 81 [default=true]; - required int32 field2 = 2; - required int32 field3 = 3; - optional int32 field280 = 280; - optional int32 field6 = 6 [default=0]; - optional int64 field22 = 22; - optional string field4 = 4; - repeated fixed64 field5 = 5; - optional bool field59 = 59 [default=false]; - optional string field7 = 7; - optional int32 field16 = 16; - optional int32 field130 = 130 [default=0]; - optional bool field12 = 12 [default=true]; - optional bool field17 = 17 [default=true]; - optional bool field13 = 13 [default=true]; - optional bool field14 = 14 [default=true]; - optional int32 field104 = 104 [default=0]; - optional int32 field100 = 100 [default=0]; - optional int32 field101 = 101 [default=0]; - optional string field102 = 102; - optional string field103 = 103; - optional int32 field29 = 29 [default=0]; - optional bool field30 = 30 [default=false]; - optional int32 field60 = 60 [default=-1]; - optional int32 field271 = 271 [default=-1]; - optional int32 field272 = 272 [default=-1]; - optional int32 field150 = 150; - optional int32 field23 = 23 [default=0]; - optional bool field24 = 24 [default=false]; - optional int32 field25 = 25 [default=0]; - optional SizeMessage1SubMessage field15 = 15; - optional bool field78 = 78; - optional int32 field67 = 67 [default=0]; - optional int32 field68 = 68; - optional int32 field128 = 128 [default=0]; - optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"]; - optional int32 field131 = 131 [default=0]; -} - -message SizeMessage1SubMessage { - optional int32 field1 = 1 [default=0]; - optional int32 field2 = 2 [default=0]; - optional int32 field3 = 3 [default=0]; - optional string field15 = 15; - optional bool field12 = 12 [default=true]; - optional int64 field13 = 13; - optional int64 field14 = 14; - optional int32 field16 = 16; - optional int32 field19 = 19 [default=2]; - optional bool field20 = 20 [default=true]; - optional bool field28 = 28 [default=true]; - optional fixed64 field21 = 21; - optional int32 field22 = 22; - optional bool field23 = 23 [ default=false ]; - optional bool field206 = 206 [default=false]; - optional fixed32 field203 = 203; - optional int32 field204 = 204; - optional string field205 = 205; - optional uint64 field207 = 207; - optional uint64 field300 = 300; -} - -message SizeMessage2 { - optional string field1 = 1; - optional int64 field3 = 3; - optional int64 field4 = 4; - optional int64 field30 = 30; - optional bool field75 = 75 [default=false]; - optional string field6 = 6; - optional bytes field2 = 2; - optional int32 field21 = 21 [default=0]; - optional int32 field71 = 71; - optional float field25 = 25; - optional int32 field109 = 109 [default=0]; - optional int32 field210 = 210 [default=0]; - optional int32 field211 = 211 [default=0]; - optional int32 field212 = 212 [default=0]; - optional int32 field213 = 213 [default=0]; - optional int32 field216 = 216 [default=0]; - optional int32 field217 = 217 [default=0]; - optional int32 field218 = 218 [default=0]; - optional int32 field220 = 220 [default=0]; - optional int32 field221 = 221 [default=0]; - optional float field222 = 222 [default=0.0]; - optional int32 field63 = 63; - - repeated group Group1 = 10 { - required float field11 = 11; - optional float field26 = 26; - optional string field12 = 12; - optional string field13 = 13; - repeated string field14 = 14; - required uint64 field15 = 15; - optional int32 field5 = 5; - optional string field27 = 27; - optional int32 field28 = 28; - optional string field29 = 29; - optional string field16 = 16; - repeated string field22 = 22; - repeated int32 field73 = 73; - optional int32 field20 = 20 [default=0]; - optional string field24 = 24; - optional SizeMessage2GroupedMessage field31 = 31; - } - repeated string field128 = 128; - optional int64 field131 = 131; - repeated string field127 = 127; - optional int32 field129 = 129; - repeated int64 field130 = 130; - optional bool field205 = 205 [default=false]; - optional bool field206 = 206 [default=false]; -} - -message SizeMessage2GroupedMessage { - optional float field1 = 1; - optional float field2 = 2; - optional float field3 = 3 [default=0.0]; - optional bool field4 = 4; - optional bool field5 = 5; - optional bool field6 = 6 [default=true]; - optional bool field7 = 7 [default=false]; - optional float field8 = 8; - optional bool field9 = 9; - optional float field10 = 10; - optional int64 field11 = 11; -} diff --git a/benchmarks/java/pom.xml b/benchmarks/java/pom.xml deleted file mode 100644 index 570bd66..0000000 --- a/benchmarks/java/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - 4.0.0 - protobuf-java-benchmark - com.google.protobuf - 1.0.0 - Protocol Buffers [Benchmark] - The benchmark tools for Protobuf Java. - - - - com.google.protobuf - protobuf-java - ${protobuf.version} - jar - system - ${project.basedir}/lib/protobuf-java.jar - - - com.google.caliper - caliper - 1.0-beta-2 - - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.4.1 - - - - jar-with-dependencies - - - - - com.mkyong.core.utils.App - - - - - - make-assembly - - package - - single - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-jar-plugin - 2.5 - - - - true - com.google.protocolbuffers.ProtoBench - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.4 - - - attach-sources - - jar-no-fork - - - - - - - - - diff --git a/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java b/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java deleted file mode 100644 index a440248..0000000 --- a/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java +++ /dev/null @@ -1,214 +0,0 @@ - -package com.google.protobuf; - -import com.google.caliper.BeforeExperiment; -import com.google.caliper.AfterExperiment; -import com.google.caliper.Benchmark; -import com.google.caliper.Param; -import com.google.caliper.api.VmOptions; -import com.google.protobuf.ByteString; -import com.google.protobuf.CodedOutputStream; -import com.google.protobuf.ExtensionRegistry; -import com.google.protobuf.Message; -import com.google.protobuf.benchmarks.Benchmarks.BenchmarkDataset; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.ArrayList; -import java.util.List; - -// Caliper set CICompilerCount to 1 for making sure compilation doesn't run in parallel with itself, -// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master -// branch this has been disabled by default in caliper: -// https://github.com/google/caliper/blob/master/caliper-runner/src/main/java/com/google/caliper/runner/target/Jvm.java#L38:14 -// But this haven't been added into most recent release. -@VmOptions("-XX:-TieredCompilation") -public class ProtoCaliperBenchmark { - public enum BenchmarkMessageType { - GOOGLE_MESSAGE1_PROTO3 { - @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } - @Override - Message getDefaultInstance() { - return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1 - .getDefaultInstance(); - } - }, - GOOGLE_MESSAGE1_PROTO2 { - @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } - @Override - Message getDefaultInstance() { - return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1 - .getDefaultInstance(); - } - }, - GOOGLE_MESSAGE2 { - @Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } - @Override - Message getDefaultInstance() { - return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance(); - } - }, - GOOGLE_MESSAGE3 { - @Override - ExtensionRegistry getExtensionRegistry() { - ExtensionRegistry extensions = ExtensionRegistry.newInstance(); - com.google.protobuf.benchmarks.BenchmarkMessage38.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage37.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage36.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage35.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage34.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage33.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage32.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage31.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage3.registerAllExtensions(extensions); - return extensions; - } - @Override - Message getDefaultInstance() { - return com.google.protobuf.benchmarks.BenchmarkMessage3.GoogleMessage3.getDefaultInstance(); - } - }, - GOOGLE_MESSAGE4 { - @Override - ExtensionRegistry getExtensionRegistry() { - ExtensionRegistry extensions = ExtensionRegistry.newInstance(); - com.google.protobuf.benchmarks.BenchmarkMessage43.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage42.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage41.registerAllExtensions(extensions); - com.google.protobuf.benchmarks.BenchmarkMessage4.registerAllExtensions(extensions); - return extensions; - } - @Override - Message getDefaultInstance() { - return com.google.protobuf.benchmarks.BenchmarkMessage4.GoogleMessage4.getDefaultInstance(); - } - }; - - abstract ExtensionRegistry getExtensionRegistry(); - abstract Message getDefaultInstance(); - } - - private BenchmarkMessageType benchmarkMessageType; - @Param("") - private String dataFile; - - private byte[] inputData; - private BenchmarkDataset benchmarkDataset; - private Message defaultMessage; - private ExtensionRegistry extensions; - private List inputDataList; - private List inputStreamList; - private List inputStringList; - private List sampleMessageList; - - private BenchmarkMessageType getMessageType() throws IOException { - if (benchmarkDataset.getMessageName().equals("benchmarks.proto3.GoogleMessage1")) { - return BenchmarkMessageType.GOOGLE_MESSAGE1_PROTO3; - } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage1")) { - return BenchmarkMessageType.GOOGLE_MESSAGE1_PROTO2; - } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage2")) { - return BenchmarkMessageType.GOOGLE_MESSAGE2; - } else if (benchmarkDataset.getMessageName(). - equals("benchmarks.google_message3.GoogleMessage3")) { - return BenchmarkMessageType.GOOGLE_MESSAGE3; - } else if (benchmarkDataset.getMessageName(). - equals("benchmarks.google_message4.GoogleMessage4")) { - return BenchmarkMessageType.GOOGLE_MESSAGE4; - } else { - throw new IllegalStateException("Invalid DataFile! There's no testing message named " - + benchmarkDataset.getMessageName()); - } - } - - @BeforeExperiment - void setUp() throws IOException { - if (!dataFile.equals("")) { - RandomAccessFile file = new RandomAccessFile(new File(dataFile), "r"); - inputData = new byte[(int) file.length()]; - file.readFully(inputData); - benchmarkDataset = BenchmarkDataset.parseFrom(inputData); - benchmarkMessageType = getMessageType(); - } else { - inputData = new byte[0]; - benchmarkDataset = BenchmarkDataset.parseFrom(inputData); - benchmarkMessageType = BenchmarkMessageType.GOOGLE_MESSAGE2; - } - defaultMessage = benchmarkMessageType.getDefaultInstance(); - extensions = benchmarkMessageType.getExtensionRegistry(); - inputDataList = new ArrayList(); - inputStreamList = new ArrayList(); - inputStringList = new ArrayList(); - sampleMessageList = new ArrayList(); - - for (int i = 0; i < benchmarkDataset.getPayloadCount(); i++) { - byte[] singleInputData = benchmarkDataset.getPayload(i).toByteArray(); - inputDataList.add(benchmarkDataset.getPayload(i).toByteArray()); - inputStreamList.add(new ByteArrayInputStream( - benchmarkDataset.getPayload(i).toByteArray())); - inputStringList.add(benchmarkDataset.getPayload(i)); - sampleMessageList.add( - defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build()); - } - } - - - @Benchmark - void serializeToByteArray(int reps) throws IOException { - if (sampleMessageList.size() == 0) { - return; - } - for (int i = 0; i < reps; i++) { - for (int j = 0; j < sampleMessageList.size(); j++) { - sampleMessageList.get(j).toByteArray(); - } - } - } - - @Benchmark - void serializeToMemoryStream(int reps) throws IOException { - if (sampleMessageList.size() == 0) { - return; - } - for (int i = 0; i < reps; i++) { - for (int j = 0; j < sampleMessageList.size(); j++) { - ByteArrayOutputStream output = new ByteArrayOutputStream(); - sampleMessageList.get(j).writeTo(output); - } - } - } - - @Benchmark - void deserializeFromByteArray(int reps) throws IOException { - if (inputDataList.size() == 0) { - return; - } - for (int i = 0; i < reps; i++) { - for (int j = 0; j < inputDataList.size(); j++) { - benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom( - inputDataList.get(j), extensions); - } - } - } - - @Benchmark - void deserializeFromMemoryStream(int reps) throws IOException { - if (inputStreamList.size() == 0) { - return; - } - for (int i = 0; i < reps; i++) { - for (int j = 0; j < inputStreamList.size(); j++) { - benchmarkMessageType.getDefaultInstance().getParserForType().parseFrom( - inputStreamList.get(j), extensions); - inputStreamList.get(j).reset(); - } - } - } -} - - diff --git a/benchmarks/js/benchmark_suite.js b/benchmarks/js/benchmark_suite.js deleted file mode 100644 index c5c3e51..0000000 --- a/benchmarks/js/benchmark_suite.js +++ /dev/null @@ -1,33 +0,0 @@ -var benchmark = require("benchmark"); - -function newBenchmark(messageName, filename, language) { - var benches = []; - return { - suite: new benchmark.Suite(messageName + filename + language ) - .on("add", function(event) { - benches.push(event.target); - }) - .on("start", function() { - process.stdout.write( - "benchmarking message " + messageName - + " of dataset file " + filename - + "'s performance ..." + "\n\n"); - }) - .on("cycle", function(event) { - process.stdout.write(String(event.target) + "\n"); - }) - .on("complete", function() { - var getHz = function(bench) { - return 1 / (bench.stats.mean + bench.stats.moe); - } - benches.forEach(function(val, index) { - benches[index] = getHz(val); - }); - }), - benches: benches - } -} - -module.exports = { - newBenchmark: newBenchmark -} diff --git a/benchmarks/js/js_benchmark.js b/benchmarks/js/js_benchmark.js deleted file mode 100644 index c44fee0..0000000 --- a/benchmarks/js/js_benchmark.js +++ /dev/null @@ -1,82 +0,0 @@ -require('./datasets/google_message1/proto2/benchmark_message1_proto2_pb.js'); -require('./datasets/google_message1/proto3/benchmark_message1_proto3_pb.js'); -require('./datasets/google_message2/benchmark_message2_pb.js'); -require('./datasets/google_message3/benchmark_message3_pb.js'); -require('./datasets/google_message4/benchmark_message4_pb.js'); -require('./benchmarks_pb.js'); - -var fs = require('fs'); -var benchmarkSuite = require("./benchmark_suite.js"); - - -function getNewPrototype(name) { - var message = eval("proto." + name); - if (typeof(message) == "undefined") { - throw "type " + name + " is undefined"; - } - return message; -} - -var results = []; -var json_file = ""; - -console.log("#####################################################"); -console.log("Js Benchmark: "); -process.argv.forEach(function(filename, index) { - if (index < 2) { - return; - } - if (filename.indexOf("--json_output") != -1) { - json_file = filename.replace(/^--json_output=/, ''); - return; - } - - var benchmarkDataset = - proto.benchmarks.BenchmarkDataset.deserializeBinary(fs.readFileSync(filename)); - var messageList = []; - var totalBytes = 0; - benchmarkDataset.getPayloadList().forEach(function(onePayload) { - var message = getNewPrototype(benchmarkDataset.getMessageName()); - messageList.push(message.deserializeBinary(onePayload)); - totalBytes += onePayload.length; - }); - - var senarios = benchmarkSuite.newBenchmark( - benchmarkDataset.getMessageName(), filename, "js"); - senarios.suite - .add("js deserialize", function() { - benchmarkDataset.getPayloadList().forEach(function(onePayload) { - var protoType = getNewPrototype(benchmarkDataset.getMessageName()); - protoType.deserializeBinary(onePayload); - }); - }) - .add("js serialize", function() { - var protoType = getNewPrototype(benchmarkDataset.getMessageName()); - messageList.forEach(function(message) { - message.serializeBinary(); - }); - }) - .run({"Async": false}); - - results.push({ - filename: filename, - benchmarks: { - protobufjs_decoding: senarios.benches[0] * totalBytes / 1024 / 1024, - protobufjs_encoding: senarios.benches[1] * totalBytes / 1024 / 1024 - } - }) - - console.log("Throughput for deserialize: " - + senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" ); - console.log("Throughput for serialize: " - + senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" ); - console.log(""); -}); -console.log("#####################################################"); - -if (json_file != "") { - fs.writeFile(json_file, JSON.stringify(results), (err) => { - if (err) throw err; - }); -} - diff --git a/benchmarks/php/PhpBenchmark.php b/benchmarks/php/PhpBenchmark.php deleted file mode 100644 index d3db61d..0000000 --- a/benchmarks/php/PhpBenchmark.php +++ /dev/null @@ -1,170 +0,0 @@ -getPayload(); - for ($i = $payloads->count() - 1; $i >= 0; $i--) { - (new $args[1]())->mergeFromString($payloads->offsetGet($i)); - } - } - - // $args: array of message - static function serialize(&$args) { - foreach ($args as &$temp_message) { - $temp_message->serializeToString(); - } - } -} - -class Benchmark -{ - private $benchmark_name; - private $args; - private $benchmark_time; - private $total_bytes; - private $coefficient; - - public function __construct($benchmark_name, $args, $total_bytes, - $benchmark_time = 5.0) { - $this->args = $args; - $this->benchmark_name = $benchmark_name; - $this->benchmark_time = $benchmark_time; - $this->total_bytes = $total_bytes; - $this->coefficient = pow (10, 0) / pow(2, 20); - } - - public function runBenchmark() { - $t = $this->runBenchmarkWithTimes(1); - $times = ceil($this->benchmark_time / $t); - return $this->total_bytes * $times / - ($times == 1 ? $t : $this->runBenchmarkWithTimes($times)) * - $this->coefficient; - } - - private function runBenchmarkWithTimes($times) { - $st = microtime(true); - for ($i = 0; $i < $times; $i++) { - call_user_func_array($this->benchmark_name, array(&$this->args)); - } - $en = microtime(true); - return $en - $st; - } -} - -function getMessageName(&$dataset) { - switch ($dataset->getMessageName()) { - case "benchmarks.proto3.GoogleMessage1": - return "\Benchmarks\Proto3\GoogleMessage1"; - case "benchmarks.proto2.GoogleMessage1": - return "\Benchmarks\Proto2\GoogleMessage1"; - case "benchmarks.proto2.GoogleMessage2": - return "\Benchmarks\Proto2\GoogleMessage2"; - case "benchmarks.google_message3.GoogleMessage3": - return "\Benchmarks\Google_message3\GoogleMessage3"; - case "benchmarks.google_message4.GoogleMessage4": - return "\Benchmarks\Google_message4\GoogleMessage4"; - default: - exit("Message " . $dataset->getMessageName() . " not found !"); - } -} - -function runBenchmark($file, $behavior_prefix) { - $datafile = fopen($file, "r") or die("Unable to open file " . $file); - $bytes = fread($datafile, filesize($file)); - $dataset = new BenchmarkDataset(NULL); - $dataset->mergeFromString($bytes); - $message_name = getMessageName($dataset); - $message_list = array(); - $total_bytes = 0; - $payloads = $dataset->getPayload(); - for ($i = $payloads->count() - 1; $i >= 0; $i--) { - $new_message = new $message_name(); - $new_message->mergeFromString($payloads->offsetGet($i)); - array_push($message_list, $new_message); - $total_bytes += strlen($payloads->offsetGet($i)); - } - - $parse_benchmark = new Benchmark( - "\Google\Protobuf\Benchmark\BenchmarkMethod::parse", - array($dataset, $message_name), $total_bytes); - $serialize_benchmark = new Benchmark( - "\Google\Protobuf\Benchmark\BenchmarkMethod::serialize", - $message_list, $total_bytes); - - return array( - "filename" => $file, - "benchmarks" => array( - $behavior_prefix . "_parse" => $parse_benchmark->runBenchmark(), - $behavior_prefix . "_serailize" => $serialize_benchmark->runBenchmark() - ), - "message_name" => $dataset->getMessageName() - ); -} - -// main -$json_output = false; -$results = array(); -$behavior_prefix = ""; - -foreach ($argv as $index => $arg) { - if ($index == 0) { - continue; - } - if ($arg == "--json") { - $json_output = true; - } else if (strpos($arg, "--behavior_prefix") == 0) { - $behavior_prefix = str_replace("--behavior_prefix=", "", $arg); - } -} - -foreach ($argv as $index => $arg) { - if ($index == 0) { - continue; - } - if (substr($arg, 0, 2) == "--") { - continue; - } else { - array_push($results, runBenchmark($arg, $behavior_prefix)); - } -} - -if ($json_output) { - print json_encode($results); -} else { - print "PHP protobuf benchmark result:\n\n"; - foreach ($results as $result) { - printf("result for test data file: %s\n", $result["filename"]); - foreach ($result["benchmarks"] as $benchmark => $throughput) { - printf(" Throughput for benchmark %s: %.2f MB/s\n", - $benchmark, $throughput); - } - } -} - -?> diff --git a/benchmarks/php/autoload.php b/benchmarks/php/autoload.php deleted file mode 100644 index 52a8741..0000000 --- a/benchmarks/php/autoload.php +++ /dev/null @@ -1,25 +0,0 @@ - 6 && arg.substring(arg.length - 6) == ".proto") { - protoFiles.push(arg); - } else if (arg.length > 15 && arg.substring(0, 15) == "--include_path=") { - prefix = arg.substring(15); - } else if (index >= 2) { - argv.push(arg); - } -}); -protoFiles.forEach(function(val) { - argv.push(prefix + "/" + val); -}); - -pbjs.main(argv, function(err, output){ - if (err) { - console.log(err); - } -}); - diff --git a/benchmarks/protobuf.js/protobufjs_benchmark.js b/benchmarks/protobuf.js/protobufjs_benchmark.js deleted file mode 100644 index 19e5497..0000000 --- a/benchmarks/protobuf.js/protobufjs_benchmark.js +++ /dev/null @@ -1,66 +0,0 @@ -var root = require("./generated_bundle_code.js"); -var fs = require('fs'); -var benchmark = require("./node_modules/benchmark"); -var benchmarkSuite = require("./benchmark_suite.js"); - - -function getNewPrototype(name) { - var message = eval("root." + name); - if (typeof(message) == "undefined") { - throw "type " + name + " is undefined"; - } - return message; -} - - -var results = []; - -console.log("#####################################################"); -console.log("ProtobufJs Benchmark: "); -process.argv.forEach(function(filename, index) { - if (index < 2) { - return; - } - var benchmarkDataset = - root.benchmarks.BenchmarkDataset.decode(fs.readFileSync(filename)); - var messageList = []; - var totalBytes = 0; - benchmarkDataset.payload.forEach(function(onePayload) { - var message = getNewPrototype(benchmarkDataset.messageName); - messageList.push(message.decode(onePayload)); - totalBytes += onePayload.length; - }); - - var senarios = benchmarkSuite.newBenchmark( - benchmarkDataset.messageName, filename, "protobufjs"); - senarios.suite - .add("protobuf.js static decoding", function() { - benchmarkDataset.payload.forEach(function(onePayload) { - var protoType = getNewPrototype(benchmarkDataset.messageName); - protoType.decode(onePayload); - }); - }) - .add("protobuf.js static encoding", function() { - var protoType = getNewPrototype(benchmarkDataset.messageName); - messageList.forEach(function(message) { - protoType.encode(message).finish(); - }); - }) - .run({"Async": false}); - - results.push({ - filename: filename, - benchmarks: { - protobufjs_decoding: senarios.benches[0] * totalBytes, - protobufjs_encoding: senarios.benches[1] * totalBytes - } - }) - - console.log("Throughput for decoding: " - + senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" ); - console.log("Throughput for encoding: " - + senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" ); - console.log(""); -}); -console.log("#####################################################"); - diff --git a/benchmarks/python/py_benchmark.py b/benchmarks/python/py_benchmark.py deleted file mode 100644 index 60e377e..0000000 --- a/benchmarks/python/py_benchmark.py +++ /dev/null @@ -1,161 +0,0 @@ -from __future__ import print_function -import sys -import os -import timeit -import math -import argparse -import fnmatch -import json - -parser = argparse.ArgumentParser(description="Python protobuf benchmark") -parser.add_argument("data_files", metavar="dataFile", nargs="+", - help="testing data files.") -parser.add_argument("--json", action="store_const", dest="json", - const="yes", default="no", - help="Whether to output json results") -parser.add_argument("--behavior_prefix", dest="behavior_prefix", - help="The output json format's behavior's name's prefix", - default="") -# BEGIN CPP GENERATED MESSAGE -parser.add_argument("--cpp_generated", action="store_const", - dest="cpp_generated", const="yes", default="no", - help="Whether to link generated code library") -# END CPP GENERATED MESSAGE -args = parser.parse_args() -# BEGIN CPP GENERATED MESSAGE -# CPP generated code must be linked before importing the generated Python code -# for the descriptor can be found in the pool -if args.cpp_generated != "no": - sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) + "/.libs" ) - import libbenchmark_messages - sys.path.append( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) + "/tmp" ) -# END CPP GENERATED MESSAGE - - -import datasets.google_message1.proto2.benchmark_message1_proto2_pb2 as benchmark_message1_proto2_pb2 -import datasets.google_message1.proto3.benchmark_message1_proto3_pb2 as benchmark_message1_proto3_pb2 -import datasets.google_message2.benchmark_message2_pb2 as benchmark_message2_pb2 -import datasets.google_message3.benchmark_message3_pb2 as benchmark_message3_pb2 -import datasets.google_message4.benchmark_message4_pb2 as benchmark_message4_pb2 -import benchmarks_pb2 as benchmarks_pb2 - - -def run_one_test(filename): - data = open(filename, "rb").read() - benchmark_dataset = benchmarks_pb2.BenchmarkDataset() - benchmark_dataset.ParseFromString(data) - total_bytes = 0 - for payload in benchmark_dataset.payload: - total_bytes += len(payload) - benchmark_util = Benchmark(full_iteration=len(benchmark_dataset.payload), - module="py_benchmark", - setup_method="init", - total_bytes=total_bytes) - result={} - result["filename"] = filename - result["message_name"] = benchmark_dataset.message_name - result["benchmarks"] = {} - benchmark_util.set_test_method("parse_from_benchmark") - result["benchmarks"][args.behavior_prefix + "_parse_from_benchmark"] = \ - benchmark_util.run_benchmark(setup_method_args='"%s"' % (filename)) - benchmark_util.set_test_method("serialize_to_benchmark") - result["benchmarks"][args.behavior_prefix + "_serialize_to_benchmark"] = \ - benchmark_util.run_benchmark(setup_method_args='"%s"' % (filename)) - return result - - -def init(filename): - global benchmark_dataset, message_class, message_list, counter, total_bytes - message_list=[] - counter = 0 - total_bytes = 0 - data = open(filename, "rb").read() - benchmark_dataset = benchmarks_pb2.BenchmarkDataset() - benchmark_dataset.ParseFromString(data) - - if benchmark_dataset.message_name == "benchmarks.proto3.GoogleMessage1": - message_class = benchmark_message1_proto3_pb2.GoogleMessage1 - elif benchmark_dataset.message_name == "benchmarks.proto2.GoogleMessage1": - message_class = benchmark_message1_proto2_pb2.GoogleMessage1 - elif benchmark_dataset.message_name == "benchmarks.proto2.GoogleMessage2": - message_class = benchmark_message2_pb2.GoogleMessage2 - elif benchmark_dataset.message_name == "benchmarks.google_message3.GoogleMessage3": - message_class = benchmark_message3_pb2.GoogleMessage3 - elif benchmark_dataset.message_name == "benchmarks.google_message4.GoogleMessage4": - message_class = benchmark_message4_pb2.GoogleMessage4 - else: - raise IOError("Message %s not found!" % (benchmark_dataset.message_name)) - - for one_payload in benchmark_dataset.payload: - temp = message_class() - temp.ParseFromString(one_payload) - message_list.append(temp) - total_bytes += len(one_payload) - - -def parse_from_benchmark(): - global counter, message_class, benchmark_dataset - m = message_class().ParseFromString(benchmark_dataset.payload[counter % len(benchmark_dataset.payload)]) - counter = counter + 1 - - -def serialize_to_benchmark(): - global counter, message_list, message_class - s = message_list[counter % len(benchmark_dataset.payload)].SerializeToString() - counter = counter + 1 - - -class Benchmark: - def __init__(self, module=None, test_method=None, - setup_method=None, total_bytes=None, full_iteration = 1): - self.full_iteration = full_iteration - self.module = module - self.test_method = test_method - self.setup_method = setup_method - self.total_bytes = total_bytes - - def set_test_method(self, test_method): - self.test_method = test_method - - def full_setup_code(self, setup_method_args=''): - setup_code = "" - setup_code += "from %s import %s\n" % (self.module, self.test_method) - setup_code += "from %s import %s\n" % (self.module, self.setup_method) - setup_code += "%s(%s)\n" % (self.setup_method, setup_method_args) - return setup_code - - def dry_run(self, test_method_args='', setup_method_args=''): - return timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args), - setup=self.full_setup_code(setup_method_args), - number=self.full_iteration); - - def run_benchmark(self, test_method_args='', setup_method_args=''): - reps = self.full_iteration; - t = self.dry_run(test_method_args, setup_method_args); - if t < 3 : - reps = int(math.ceil(3 / t)) * self.full_iteration - if reps != self.full_iteration: - t = timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args), - setup=self.full_setup_code(setup_method_args), - number=reps); - return self.total_bytes * 1.0 / 2 ** 20 / (1.0 * t / reps * self.full_iteration) - - -if __name__ == "__main__": - results = [] - for file in args.data_files: - results.append(run_one_test(file)) - - if args.json != "no": - print(json.dumps(results)) - else: - for result in results: - print("Message %s of dataset file %s" % \ - (result["message_name"], result["filename"])) - print("Average throughput for parse_from_benchmark: %.2f MB/s" % \ - (result["benchmarks"][ \ - args.behavior_prefix + "_parse_from_benchmark"])) - print("Average throughput for serialize_to_benchmark: %.2f MB/s" % \ - (result["benchmarks"][ \ - args.behavior_prefix + "_serialize_to_benchmark"])) - print("") diff --git a/benchmarks/python/python_benchmark_messages.cc b/benchmarks/python/python_benchmark_messages.cc deleted file mode 100644 index ded16fe..0000000 --- a/benchmarks/python/python_benchmark_messages.cc +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#include "benchmarks.pb.h" -#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" -#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" -#include "datasets/google_message2/benchmark_message2.pb.h" -#include "datasets/google_message3/benchmark_message3.pb.h" -#include "datasets/google_message4/benchmark_message4.pb.h" - -static PyMethodDef python_benchmark_methods[] = { - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - - -PyMODINIT_FUNC -initlibbenchmark_messages() { - benchmarks::BenchmarkDataset().descriptor(); - benchmarks::proto3::GoogleMessage1().descriptor(); - benchmarks::proto2::GoogleMessage1().descriptor(); - benchmarks::proto2::GoogleMessage2().descriptor(); - benchmarks::google_message3::GoogleMessage3().descriptor(); - benchmarks::google_message4::GoogleMessage4().descriptor(); - - PyObject *m; - - m = Py_InitModule("libbenchmark_messages", python_benchmark_methods); - if (m == NULL) - return; -} diff --git a/benchmarks/util/big_query_utils.py b/benchmarks/util/big_query_utils.py deleted file mode 100755 index aea55bb..0000000 --- a/benchmarks/util/big_query_utils.py +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env python2.7 - -from __future__ import print_function -import argparse -import json -import uuid -import httplib2 - -from apiclient import discovery -from apiclient.errors import HttpError -from oauth2client.client import GoogleCredentials - -# 30 days in milliseconds -_EXPIRATION_MS = 30 * 24 * 60 * 60 * 1000 -NUM_RETRIES = 3 - - -def create_big_query(): - """Authenticates with cloud platform and gets a BiqQuery service object - """ - creds = GoogleCredentials.get_application_default() - return discovery.build( - 'bigquery', 'v2', credentials=creds, cache_discovery=False) - - -def create_dataset(biq_query, project_id, dataset_id): - is_success = True - body = { - 'datasetReference': { - 'projectId': project_id, - 'datasetId': dataset_id - } - } - - try: - dataset_req = biq_query.datasets().insert( - projectId=project_id, body=body) - dataset_req.execute(num_retries=NUM_RETRIES) - except HttpError as http_error: - if http_error.resp.status == 409: - print('Warning: The dataset %s already exists' % dataset_id) - else: - # Note: For more debugging info, print "http_error.content" - print('Error in creating dataset: %s. Err: %s' % (dataset_id, - http_error)) - is_success = False - return is_success - - -def create_table(big_query, project_id, dataset_id, table_id, table_schema, - description): - fields = [{ - 'name': field_name, - 'type': field_type, - 'description': field_description - } for (field_name, field_type, field_description) in table_schema] - return create_table2(big_query, project_id, dataset_id, table_id, fields, - description) - - -def create_partitioned_table(big_query, - project_id, - dataset_id, - table_id, - table_schema, - description, - partition_type='DAY', - expiration_ms=_EXPIRATION_MS): - """Creates a partitioned table. By default, a date-paritioned table is created with - each partition lasting 30 days after it was last modified. - """ - fields = [{ - 'name': field_name, - 'type': field_type, - 'description': field_description - } for (field_name, field_type, field_description) in table_schema] - return create_table2(big_query, project_id, dataset_id, table_id, fields, - description, partition_type, expiration_ms) - - -def create_table2(big_query, - project_id, - dataset_id, - table_id, - fields_schema, - description, - partition_type=None, - expiration_ms=None): - is_success = True - - body = { - 'description': description, - 'schema': { - 'fields': fields_schema - }, - 'tableReference': { - 'datasetId': dataset_id, - 'projectId': project_id, - 'tableId': table_id - } - } - - if partition_type and expiration_ms: - body["timePartitioning"] = { - "type": partition_type, - "expirationMs": expiration_ms - } - - try: - table_req = big_query.tables().insert( - projectId=project_id, datasetId=dataset_id, body=body) - res = table_req.execute(num_retries=NUM_RETRIES) - print('Successfully created %s "%s"' % (res['kind'], res['id'])) - except HttpError as http_error: - if http_error.resp.status == 409: - print('Warning: Table %s already exists' % table_id) - else: - print('Error in creating table: %s. Err: %s' % (table_id, - http_error)) - is_success = False - return is_success - - -def patch_table(big_query, project_id, dataset_id, table_id, fields_schema): - is_success = True - - body = { - 'schema': { - 'fields': fields_schema - }, - 'tableReference': { - 'datasetId': dataset_id, - 'projectId': project_id, - 'tableId': table_id - } - } - - try: - table_req = big_query.tables().patch( - projectId=project_id, - datasetId=dataset_id, - tableId=table_id, - body=body) - res = table_req.execute(num_retries=NUM_RETRIES) - print('Successfully patched %s "%s"' % (res['kind'], res['id'])) - except HttpError as http_error: - print('Error in creating table: %s. Err: %s' % (table_id, http_error)) - is_success = False - return is_success - - -def insert_rows(big_query, project_id, dataset_id, table_id, rows_list): - is_success = True - body = {'rows': rows_list} - try: - insert_req = big_query.tabledata().insertAll( - projectId=project_id, - datasetId=dataset_id, - tableId=table_id, - body=body) - res = insert_req.execute(num_retries=NUM_RETRIES) - if res.get('insertErrors', None): - print('Error inserting rows! Response: %s' % res) - is_success = False - except HttpError as http_error: - print('Error inserting rows to the table %s' % table_id) - is_success = False - - return is_success - - -def sync_query_job(big_query, project_id, query, timeout=5000): - query_data = {'query': query, 'timeoutMs': timeout} - query_job = None - try: - query_job = big_query.jobs().query( - projectId=project_id, - body=query_data).execute(num_retries=NUM_RETRIES) - except HttpError as http_error: - print('Query execute job failed with error: %s' % http_error) - print(http_error.content) - return query_job - - - # List of (column name, column type, description) tuples -def make_row(unique_row_id, row_values_dict): - """row_values_dict is a dictionary of column name and column value. - """ - return {'insertId': unique_row_id, 'json': row_values_dict} diff --git a/benchmarks/util/data_proto2_to_proto3_util.h b/benchmarks/util/data_proto2_to_proto3_util.h deleted file mode 100644 index 5eea850..0000000 --- a/benchmarks/util/data_proto2_to_proto3_util.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef PROTOBUF_BENCHMARKS_UTIL_DATA_PROTO2_TO_PROTO3_UTIL_H_ -#define PROTOBUF_BENCHMARKS_UTIL_DATA_PROTO2_TO_PROTO3_UTIL_H_ - -#include "google/protobuf/message.h" -#include "google/protobuf/descriptor.h" - -using google::protobuf::FieldDescriptor; -using google::protobuf::Message; -using google::protobuf::Reflection; - -namespace google { -namespace protobuf { -namespace util { - -class DataStripper { - public: - void StripMessage(Message *message) { - std::vector set_fields; - const Reflection* reflection = message->GetReflection(); - reflection->ListFields(*message, &set_fields); - - for (size_t i = 0; i < set_fields.size(); i++) { - const FieldDescriptor* field = set_fields[i]; - if (ShouldBeClear(field)) { - reflection->ClearField(message, field); - continue; - } - if (field->type() == FieldDescriptor::TYPE_MESSAGE) { - if (field->is_repeated()) { - for (int j = 0; j < reflection->FieldSize(*message, field); j++) { - StripMessage(reflection->MutableRepeatedMessage(message, field, j)); - } - } else { - StripMessage(reflection->MutableMessage(message, field)); - } - } - } - - reflection->MutableUnknownFields(message)->Clear(); - } - private: - virtual bool ShouldBeClear(const FieldDescriptor *field) = 0; -}; - -class GogoDataStripper : public DataStripper { - private: - virtual bool ShouldBeClear(const FieldDescriptor *field) { - return field->type() == FieldDescriptor::TYPE_GROUP; - } -}; - -class Proto3DataStripper : public DataStripper { - private: - virtual bool ShouldBeClear(const FieldDescriptor *field) { - return field->type() == FieldDescriptor::TYPE_GROUP || - field->is_extension(); - } -}; - -} // namespace util -} // namespace protobuf -} // namespace google - -#endif // PROTOBUF_BENCHMARKS_UTIL_DATA_PROTO2_TO_PROTO3_UTIL_H_ diff --git a/benchmarks/util/gogo_data_scrubber.cc b/benchmarks/util/gogo_data_scrubber.cc deleted file mode 100644 index 9ef57b0..0000000 --- a/benchmarks/util/gogo_data_scrubber.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "benchmarks.pb.h" -#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" -#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" -#include "datasets/google_message2/benchmark_message2.pb.h" -#include "datasets/google_message3/benchmark_message3.pb.h" -#include "datasets/google_message4/benchmark_message4.pb.h" -#include "data_proto2_to_proto3_util.h" - -#include - -using google::protobuf::util::GogoDataStripper; - -std::string ReadFile(const std::string& name) { - std::ifstream file(name.c_str()); - GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" - << name - << "', please make sure you are running this command from the benchmarks" - << " directory.\n"; - return std::string((std::istreambuf_iterator(file)), - std::istreambuf_iterator()); -} - -int main(int argc, char *argv[]) { - if (argc % 2 == 0 || argc == 1) { - std::cerr << "Usage: [input_files] [output_file_names] where " << - "input_files are one to one mapping to output_file_names." << - std::endl; - return 1; - } - - for (int i = argc / 2; i > 0; i--) { - const std::string &input_file = argv[i]; - const std::string &output_file = argv[i + argc / 2]; - - std::cerr << "Generating " << input_file - << " to " << output_file << std::endl; - benchmarks::BenchmarkDataset dataset; - Message* message; - std::string dataset_payload = ReadFile(input_file); - GOOGLE_CHECK(dataset.ParseFromString(dataset_payload)) - << "Can' t parse data file " << input_file; - - if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") { - message = new benchmarks::proto3::GoogleMessage1; - } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") { - message = new benchmarks::proto2::GoogleMessage1; - } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { - message = new benchmarks::proto2::GoogleMessage2; - } else if (dataset.message_name() == - "benchmarks.google_message3.GoogleMessage3") { - message = new benchmarks::google_message3::GoogleMessage3; - } else if (dataset.message_name() == - "benchmarks.google_message4.GoogleMessage4") { - message = new benchmarks::google_message4::GoogleMessage4; - } else { - std::cerr << "Unknown message type: " << dataset.message_name(); - exit(1); - } - - for (int i = 0; i < dataset.payload_size(); i++) { - message->ParseFromString(dataset.payload(i)); - GogoDataStripper stripper; - stripper.StripMessage(message); - dataset.set_payload(i, message->SerializeAsString()); - } - - std::ofstream ofs(output_file); - ofs << dataset.SerializeAsString(); - ofs.close(); - } - - - return 0; -} diff --git a/benchmarks/util/proto3_data_stripper.cc b/benchmarks/util/proto3_data_stripper.cc deleted file mode 100644 index 3096c4c..0000000 --- a/benchmarks/util/proto3_data_stripper.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "benchmarks.pb.h" -#include "datasets/google_message1/proto2/benchmark_message1_proto2.pb.h" -#include "datasets/google_message1/proto3/benchmark_message1_proto3.pb.h" -#include "datasets/google_message2/benchmark_message2.pb.h" -#include "datasets/google_message3/benchmark_message3.pb.h" -#include "datasets/google_message4/benchmark_message4.pb.h" -#include "data_proto2_to_proto3_util.h" - -#include - -using google::protobuf::util::Proto3DataStripper; - -std::string ReadFile(const std::string& name) { - std::ifstream file(name.c_str()); - GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" - << name - << "', please make sure you are running this command from the benchmarks" - << " directory.\n"; - return std::string((std::istreambuf_iterator(file)), - std::istreambuf_iterator()); -} - -int main(int argc, char *argv[]) { - if (argc % 2 == 0 || argc == 1) { - std::cerr << "Usage: [input_files] [output_file_names] where " << - "input_files are one to one mapping to output_file_names." << - std::endl; - return 1; - } - - for (int i = argc / 2; i > 0; i--) { - const std::string &input_file = argv[i]; - const std::string &output_file = argv[i + argc / 2]; - - std::cerr << "Generating " << input_file - << " to " << output_file << std::endl; - benchmarks::BenchmarkDataset dataset; - Message* message; - std::string dataset_payload = ReadFile(input_file); - GOOGLE_CHECK(dataset.ParseFromString(dataset_payload)) - << "Can' t parse data file " << input_file; - - if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") { - message = new benchmarks::proto3::GoogleMessage1; - } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") { - message = new benchmarks::proto2::GoogleMessage1; - } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { - message = new benchmarks::proto2::GoogleMessage2; - } else if (dataset.message_name() == - "benchmarks.google_message3.GoogleMessage3") { - message = new benchmarks::google_message3::GoogleMessage3; - } else if (dataset.message_name() == - "benchmarks.google_message4.GoogleMessage4") { - message = new benchmarks::google_message4::GoogleMessage4; - } else { - std::cerr << "Unknown message type: " << dataset.message_name(); - exit(1); - } - - for (int i = 0; i < dataset.payload_size(); i++) { - message->ParseFromString(dataset.payload(i)); - Proto3DataStripper stripper; - stripper.StripMessage(message); - dataset.set_payload(i, message->SerializeAsString()); - } - - std::ofstream ofs(output_file); - ofs << dataset.SerializeAsString(); - ofs.close(); - } - - - return 0; -} diff --git a/benchmarks/util/protoc-gen-gogoproto.cc b/benchmarks/util/protoc-gen-gogoproto.cc deleted file mode 100644 index 9c1b3d0..0000000 --- a/benchmarks/util/protoc-gen-gogoproto.cc +++ /dev/null @@ -1,103 +0,0 @@ -#include "google/protobuf/compiler/code_generator.h" -#include "google/protobuf/io/zero_copy_stream.h" -#include "google/protobuf/io/printer.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/descriptor.pb.h" -#include "schema_proto2_to_proto3_util.h" - -#include "google/protobuf/compiler/plugin.h" - -using google::protobuf::FileDescriptorProto; -using google::protobuf::FileDescriptor; -using google::protobuf::DescriptorPool; -using google::protobuf::io::Printer; -using google::protobuf::util::SchemaGroupStripper; -using google::protobuf::util::EnumScrubber; - -namespace google { -namespace protobuf { -namespace compiler { - -namespace { - -string StripProto(string filename) { - if (filename.substr(filename.size() - 11) == ".protodevel") { - // .protodevel - return filename.substr(0, filename.size() - 11); - } else { - // .proto - return filename.substr(0, filename.size() - 6); - } -} - -DescriptorPool new_pool_; - -} // namespace - -class GoGoProtoGenerator : public CodeGenerator { - public: - virtual bool GenerateAll(const std::vector& files, - const string& parameter, - GeneratorContext* context, - string* error) const { - for (int i = 0; i < files.size(); i++) { - for (auto file : files) { - bool can_generate = - (new_pool_.FindFileByName(file->name()) == nullptr); - for (int j = 0; j < file->dependency_count(); j++) { - can_generate &= (new_pool_.FindFileByName( - file->dependency(j)->name()) != nullptr); - } - for (int j = 0; j < file->public_dependency_count(); j++) { - can_generate &= (new_pool_.FindFileByName( - file->public_dependency(j)->name()) != nullptr); - } - for (int j = 0; j < file->weak_dependency_count(); j++) { - can_generate &= (new_pool_.FindFileByName( - file->weak_dependency(j)->name()) != nullptr); - } - if (can_generate) { - Generate(file, parameter, context, error); - break; - } - } - } - - return true; - } - - virtual bool Generate(const FileDescriptor* file, - const string& parameter, - GeneratorContext* context, - string* error) const { - FileDescriptorProto new_file; - file->CopyTo(&new_file); - SchemaGroupStripper::StripFile(file, &new_file); - - EnumScrubber enum_scrubber; - enum_scrubber.ScrubFile(&new_file); - - string filename = file->name(); - string basename = StripProto(filename); - - std::vector> option_pairs; - ParseGeneratorParameter(parameter, &option_pairs); - - std::unique_ptr output( - context->Open(basename + ".proto")); - string content = new_pool_.BuildFile(new_file)->DebugString(); - Printer printer(output.get(), '$'); - printer.WriteRaw(content.c_str(), content.size()); - - return true; - } -}; - -} // namespace compiler -} // namespace protobuf -} // namespace google - -int main(int argc, char* argv[]) { - google::protobuf::compiler::GoGoProtoGenerator generator; - return google::protobuf::compiler::PluginMain(argc, argv, &generator); -} diff --git a/benchmarks/util/protoc-gen-proto2_to_proto3.cc b/benchmarks/util/protoc-gen-proto2_to_proto3.cc deleted file mode 100644 index d0a8902..0000000 --- a/benchmarks/util/protoc-gen-proto2_to_proto3.cc +++ /dev/null @@ -1,115 +0,0 @@ -#include "google/protobuf/compiler/code_generator.h" -#include "google/protobuf/io/zero_copy_stream.h" -#include "google/protobuf/io/printer.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/descriptor.pb.h" -#include "schema_proto2_to_proto3_util.h" - -#include "google/protobuf/compiler/plugin.h" - -using google::protobuf::FileDescriptorProto; -using google::protobuf::FileDescriptor; -using google::protobuf::DescriptorPool; -using google::protobuf::io::Printer; -using google::protobuf::util::SchemaGroupStripper; -using google::protobuf::util::EnumScrubber; -using google::protobuf::util::ExtensionStripper; -using google::protobuf::util::FieldScrubber; - -namespace google { -namespace protobuf { -namespace compiler { - -namespace { - -string StripProto(string filename) { - return filename.substr(0, filename.rfind(".proto")); -} - -DescriptorPool* GetPool() { - static DescriptorPool *pool = new DescriptorPool(); - return pool; -} - -} // namespace - -class Proto2ToProto3Generator final : public CodeGenerator { - public: - bool GenerateAll(const std::vector& files, - const string& parameter, - GeneratorContext* context, - string* error) const { - for (int i = 0; i < files.size(); i++) { - for (auto file : files) { - if (CanGenerate(file)) { - Generate(file, parameter, context, error); - break; - } - } - } - - return true; - } - - bool Generate(const FileDescriptor* file, - const string& parameter, - GeneratorContext* context, - string* error) const { - FileDescriptorProto new_file; - file->CopyTo(&new_file); - SchemaGroupStripper::StripFile(file, &new_file); - - EnumScrubber enum_scrubber; - enum_scrubber.ScrubFile(&new_file); - ExtensionStripper::StripFile(&new_file); - FieldScrubber::ScrubFile(&new_file); - new_file.set_syntax("proto3"); - - string filename = file->name(); - string basename = StripProto(filename); - - std::vector> option_pairs; - ParseGeneratorParameter(parameter, &option_pairs); - - std::unique_ptr output( - context->Open(basename + ".proto")); - string content = GetPool()->BuildFile(new_file)->DebugString(); - Printer printer(output.get(), '$'); - printer.WriteRaw(content.c_str(), content.size()); - - return true; - } - private: - bool CanGenerate(const FileDescriptor* file) const { - if (GetPool()->FindFileByName(file->name()) != nullptr) { - return false; - } - for (int j = 0; j < file->dependency_count(); j++) { - if (GetPool()->FindFileByName(file->dependency(j)->name()) == nullptr) { - return false; - } - } - for (int j = 0; j < file->public_dependency_count(); j++) { - if (GetPool()->FindFileByName( - file->public_dependency(j)->name()) == nullptr) { - return false; - } - } - for (int j = 0; j < file->weak_dependency_count(); j++) { - if (GetPool()->FindFileByName( - file->weak_dependency(j)->name()) == nullptr) { - return false; - } - } - return true; - } -}; - -} // namespace compiler -} // namespace protobuf -} // namespace google - -int main(int argc, char* argv[]) { - google::protobuf::compiler::Proto2ToProto3Generator generator; - return google::protobuf::compiler::PluginMain(argc, argv, &generator); -} diff --git a/benchmarks/util/result_parser.py b/benchmarks/util/result_parser.py deleted file mode 100644 index b09f387..0000000 --- a/benchmarks/util/result_parser.py +++ /dev/null @@ -1,300 +0,0 @@ -# This import depends on the automake rule protoc_middleman, please make sure -# protoc_middleman has been built before run this file. -import json -import re -import os.path -# BEGIN OPENSOURCE -import sys -sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) -# END OPENSOURCE -import tmp.benchmarks_pb2 as benchmarks_pb2 - -__file_size_map = {} - -def __get_data_size(filename): - if filename[0] != '/': - filename = os.path.dirname(os.path.abspath(__file__)) + "/../" + filename - if filename in __file_size_map: - return __file_size_map[filename] - benchmark_dataset = benchmarks_pb2.BenchmarkDataset() - benchmark_dataset.ParseFromString( - open(filename, "rb").read()) - size = 0 - count = 0 - for payload in benchmark_dataset.payload: - size += len(payload) - count += 1 - __file_size_map[filename] = (size, 1.0 * size / count) - return size, 1.0 * size / count - - -def __extract_file_name(file_name): - name_list = re.split(r"[/\.]", file_name) - short_file_name = "" - for name in name_list: - if name[:14] == "google_message": - short_file_name = name - return short_file_name - - -__results = [] - - -# CPP results example: -# [ -# "benchmarks": [ -# { -# "bytes_per_second": int, -# "cpu_time_ns": double, -# "iterations": int, -# "name: string, -# "real_time_ns: double, -# ... -# }, -# ... -# ], -# ... -# ] -def __parse_cpp_result(filename): - if filename == "": - return - if filename[0] != '/': - filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename - with open(filename, "rb") as f: - results = json.loads(f.read()) - for benchmark in results["benchmarks"]: - data_filename = "".join( - re.split("(_parse_|_serialize)", benchmark["name"])[0]) - behavior = benchmark["name"][len(data_filename) + 1:] - if data_filename[:2] == "BM": - data_filename = data_filename[3:] - __results.append({ - "language": "cpp", - "dataFilename": data_filename, - "behavior": behavior, - "throughput": benchmark["bytes_per_second"] / 2.0 ** 20 - }) - - -# Synthetic benchmark results example: -# [ -# "benchmarks": [ -# { -# "cpu_time_ns": double, -# "iterations": int, -# "name: string, -# "real_time_ns: double, -# ... -# }, -# ... -# ], -# ... -# ] -def __parse_synthetic_result(filename): - if filename == "": - return - if filename[0] != "/": - filename = os.path.dirname(os.path.abspath(__file__)) + "/" + filename - with open(filename, "rb") as f: - results = json.loads(f.read()) - for benchmark in results["benchmarks"]: - __results.append({ - "language": "cpp", - "dataFilename": "", - "behavior": "synthetic", - "throughput": 10.0**9 / benchmark["cpu_time_ns"] - }) - - -# Python results example: -# [ -# [ -# { -# "filename": string, -# "benchmarks": { -# behavior: results, -# ... -# }, -# }, -# ... -# ], #pure-python -# ... -# ] -def __parse_python_result(filename): - if filename == "": - return - if filename[0] != '/': - filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename - with open(filename, "rb") as f: - results_list = json.loads(f.read()) - for results in results_list: - for result in results: - _, avg_size = __get_data_size(result["filename"]) - for behavior in result["benchmarks"]: - __results.append({ - "language": "python", - "dataFilename": __extract_file_name(result["filename"]), - "behavior": behavior, - "throughput": result["benchmarks"][behavior] - }) - - -# Java results example: -# [ -# { -# "id": string, -# "instrumentSpec": {...}, -# "measurements": [ -# { -# "weight": float, -# "value": { -# "magnitude": float, -# "unit": string -# }, -# ... -# }, -# ... -# ], -# "run": {...}, -# "scenario": { -# "benchmarkSpec": { -# "methodName": string, -# "parameters": { -# defined parameters in the benchmark: parameters value -# }, -# ... -# }, -# ... -# } -# -# }, -# ... -# ] -def __parse_java_result(filename): - if filename == "": - return - if filename[0] != '/': - filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename - with open(filename, "rb") as f: - results = json.loads(f.read()) - for result in results: - total_weight = 0 - total_value = 0 - for measurement in result["measurements"]: - total_weight += measurement["weight"] - total_value += measurement["value"]["magnitude"] - avg_time = total_value * 1.0 / total_weight - total_size, _ = __get_data_size( - result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"]) - __results.append({ - "language": "java", - "throughput": total_size / avg_time * 1e9 / 2 ** 20, - "behavior": result["scenario"]["benchmarkSpec"]["methodName"], - "dataFilename": __extract_file_name( - result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"]) - }) - - -# Go benchmark results: -# -# goos: linux -# goarch: amd64 -# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Unmarshal-12 3000 705784 ns/op -# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Marshal-12 2000 634648 ns/op -# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Size-12 5000 244174 ns/op -# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Clone-12 300 4120954 ns/op -# Benchmark/.././datasets/google_message2/dataset.google_message2.pb/Merge-12 300 4108632 ns/op -# PASS -# ok _/usr/local/google/home/yilunchong/mygit/protobuf/benchmarks 124.173s -def __parse_go_result(filename): - if filename == "": - return - if filename[0] != '/': - filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename - with open(filename, "rb") as f: - for line in f: - result_list = re.split(r"[\ \t]+", line) - if result_list[0][:9] != "Benchmark": - continue - first_slash_index = result_list[0].find('/') - last_slash_index = result_list[0].rfind('/') - full_filename = result_list[0][first_slash_index+1:last_slash_index] - total_bytes, _ = __get_data_size(full_filename) - behavior_with_suffix = result_list[0][last_slash_index+1:] - last_dash = behavior_with_suffix.rfind("-") - if last_dash == -1: - behavior = behavior_with_suffix - else: - behavior = behavior_with_suffix[:last_dash] - __results.append({ - "dataFilename": __extract_file_name(full_filename), - "throughput": total_bytes / float(result_list[2]) * 1e9 / 2 ** 20, - "behavior": behavior, - "language": "go" - }) - - -# Self built json results example: -# -# [ -# { -# "filename": string, -# "benchmarks": { -# behavior: results, -# ... -# }, -# }, -# ... -# ] -def __parse_custom_result(filename, language): - if filename == "": - return - if filename[0] != '/': - filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename - with open(filename, "rb") as f: - results = json.loads(f.read()) - for result in results: - _, avg_size = __get_data_size(result["filename"]) - for behavior in result["benchmarks"]: - __results.append({ - "language": language, - "dataFilename": __extract_file_name(result["filename"]), - "behavior": behavior, - "throughput": result["benchmarks"][behavior] - }) - - -def __parse_js_result(filename, language): - return __parse_custom_result(filename, language) - -def __parse_php_result(filename, language): - return __parse_custom_result(filename, language) - - -def get_result_from_file(cpp_file="", - java_file="", - python_file="", - go_file="", - synthetic_file="", - node_file="", - php_c_file="", - php_file=""): - results = {} - if cpp_file != "": - __parse_cpp_result(cpp_file) - if java_file != "": - __parse_java_result(java_file) - if python_file != "": - __parse_python_result(python_file) - if go_file != "": - __parse_go_result(go_file) - if synthetic_file != "": - __parse_synthetic_result(synthetic_file) - if node_file != "": - __parse_js_result(node_file, "node") - if php_file != "": - __parse_php_result(php_file, "php") - if php_c_file != "": - __parse_php_result(php_c_file, "php") - - return __results diff --git a/benchmarks/util/result_uploader.py b/benchmarks/util/result_uploader.py deleted file mode 100644 index 2a35d96..0000000 --- a/benchmarks/util/result_uploader.py +++ /dev/null @@ -1,107 +0,0 @@ -from __future__ import print_function -from __future__ import absolute_import -import argparse -import os -import re -import copy -import uuid -import calendar -import time -import datetime - -from util import big_query_utils -from util import result_parser - -_PROJECT_ID = 'grpc-testing' -_DATASET = 'protobuf_benchmark_result' -_TABLE = 'opensource_result_v2' -_NOW = "%d%02d%02d" % (datetime.datetime.now().year, - datetime.datetime.now().month, - datetime.datetime.now().day) - -_INITIAL_TIME = calendar.timegm(time.gmtime()) - -def get_metadata(): - build_number = os.getenv('BUILD_NUMBER') - build_url = os.getenv('BUILD_URL') - job_name = os.getenv('JOB_NAME') - git_commit = os.getenv('GIT_COMMIT') - # actual commit is the actual head of PR that is getting tested - git_actual_commit = os.getenv('ghprbActualCommit') - - utc_timestamp = str(calendar.timegm(time.gmtime())) - metadata = {'created': utc_timestamp} - - if build_number: - metadata['buildNumber'] = build_number - if build_url: - metadata['buildUrl'] = build_url - if job_name: - metadata['jobName'] = job_name - if git_commit: - metadata['gitCommit'] = git_commit - if git_actual_commit: - metadata['gitActualCommit'] = git_actual_commit - - return metadata - - -def upload_result(result_list, metadata): - for result in result_list: - new_result = {} - new_result["metric"] = "throughput" - new_result["value"] = result["throughput"] - new_result["unit"] = "MB/s" - new_result["test"] = "protobuf_benchmark" - new_result["product_name"] = "protobuf" - labels_string = "" - for key in result: - labels_string += ",|%s:%s|" % (key, result[key]) - new_result["labels"] = labels_string[1:] - new_result["timestamp"] = _INITIAL_TIME - print(labels_string) - - bq = big_query_utils.create_big_query() - row = big_query_utils.make_row(str(uuid.uuid4()), new_result) - if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET, - _TABLE + "$" + _NOW, - [row]): - print('Error when uploading result', new_result) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("-cpp", "--cpp_input_file", - help="The CPP benchmark result file's name", - default="") - parser.add_argument("-java", "--java_input_file", - help="The Java benchmark result file's name", - default="") - parser.add_argument("-python", "--python_input_file", - help="The Python benchmark result file's name", - default="") - parser.add_argument("-go", "--go_input_file", - help="The golang benchmark result file's name", - default="") - parser.add_argument("-node", "--node_input_file", - help="The node.js benchmark result file's name", - default="") - parser.add_argument("-php", "--php_input_file", - help="The pure php benchmark result file's name", - default="") - parser.add_argument("-php_c", "--php_c_input_file", - help="The php with c ext benchmark result file's name", - default="") - args = parser.parse_args() - - metadata = get_metadata() - print("uploading results...") - upload_result(result_parser.get_result_from_file( - cpp_file=args.cpp_input_file, - java_file=args.java_input_file, - python_file=args.python_input_file, - go_file=args.go_input_file, - node_file=args.node_input_file, - php_file=args.php_input_file, - php_c_file=args.php_c_input_file, - ), metadata) diff --git a/benchmarks/util/schema_proto2_to_proto3_util.h b/benchmarks/util/schema_proto2_to_proto3_util.h deleted file mode 100644 index 0079f6f..0000000 --- a/benchmarks/util/schema_proto2_to_proto3_util.h +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_ -#define PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_ - -#include "google/protobuf/message.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/descriptor.pb.h" - -#include -#include - -using google::protobuf::Descriptor; -using google::protobuf::DescriptorProto; -using google::protobuf::FileDescriptorProto; -using google::protobuf::FieldDescriptorProto; -using google::protobuf::Message; -using google::protobuf::EnumValueDescriptorProto; - -namespace google { -namespace protobuf { -namespace util { - -class SchemaGroupStripper { - - public: - static void StripFile(const FileDescriptor* old_file, - FileDescriptorProto *file) { - for (int i = file->mutable_message_type()->size() - 1; i >= 0; i--) { - if (IsMessageSet(old_file->message_type(i))) { - file->mutable_message_type()->DeleteSubrange(i, 1); - continue; - } - StripMessage(old_file->message_type(i), file->mutable_message_type(i)); - } - for (int i = file->mutable_extension()->size() - 1; i >= 0; i--) { - auto field = old_file->extension(i); - if (field->type() == FieldDescriptor::TYPE_GROUP || - IsMessageSet(field->message_type()) || - IsMessageSet(field->containing_type())) { - file->mutable_extension()->DeleteSubrange(i, 1); - } - } - } - - private: - static bool IsMessageSet(const Descriptor *descriptor) { - if (descriptor != nullptr - && descriptor->options().message_set_wire_format()) { - return true; - } - return false; - } - - static void StripMessage(const Descriptor *old_message, - DescriptorProto *new_message) { - for (int i = new_message->mutable_field()->size() - 1; i >= 0; i--) { - if (old_message->field(i)->type() == FieldDescriptor::TYPE_GROUP || - IsMessageSet(old_message->field(i)->message_type())) { - new_message->mutable_field()->DeleteSubrange(i, 1); - } - } - for (int i = new_message->mutable_extension()->size() - 1; i >= 0; i--) { - auto field_type_name = new_message->mutable_extension(i)->type_name(); - if (old_message->extension(i)->type() == FieldDescriptor::TYPE_GROUP || - IsMessageSet(old_message->extension(i)->containing_type()) || - IsMessageSet(old_message->extension(i)->message_type())) { - new_message->mutable_extension()->DeleteSubrange(i, 1); - } - } - for (int i = 0; i < new_message->mutable_nested_type()->size(); i++) { - StripMessage(old_message->nested_type(i), - new_message->mutable_nested_type(i)); - } - } - -}; - -class EnumScrubber { - - public: - EnumScrubber() - : total_added_(0) { - } - - void ScrubFile(FileDescriptorProto *file) { - for (int i = 0; i < file->enum_type_size(); i++) { - ScrubEnum(file->mutable_enum_type(i)); - } - for (int i = 0; i < file->mutable_message_type()->size(); i++) { - ScrubMessage(file->mutable_message_type(i)); - } - } - - private: - void ScrubEnum(EnumDescriptorProto *enum_type) { - if (enum_type->value(0).number() != 0) { - bool has_zero = false; - for (int j = 0; j < enum_type->value().size(); j++) { - if (enum_type->value(j).number() == 0) { - EnumValueDescriptorProto temp_enum_value; - temp_enum_value.CopyFrom(enum_type->value(j)); - enum_type->mutable_value(j)->CopyFrom(enum_type->value(0)); - enum_type->mutable_value(0)->CopyFrom(temp_enum_value); - has_zero = true; - break; - } - } - if (!has_zero) { - enum_type->mutable_value()->Add(); - for (int i = enum_type->mutable_value()->size() - 1; i > 0; i--) { - enum_type->mutable_value(i)->CopyFrom( - *enum_type->mutable_value(i - 1)); - } - enum_type->mutable_value(0)->set_number(0); - enum_type->mutable_value(0)->set_name("ADDED_ZERO_VALUE_" + - std::to_string(total_added_++)); - } - } - - } - - void ScrubMessage(DescriptorProto *message_type) { - for (int i = 0; i < message_type->mutable_enum_type()->size(); i++) { - ScrubEnum(message_type->mutable_enum_type(i)); - } - for (int i = 0; i < message_type->mutable_nested_type()->size(); i++) { - ScrubMessage(message_type->mutable_nested_type(i)); - } - } - - int total_added_; -}; - -class ExtensionStripper { - public: - static void StripFile(FileDescriptorProto *file) { - for (int i = 0; i < file->mutable_message_type()->size(); i++) { - StripMessage(file->mutable_message_type(i)); - } - file->mutable_extension()->Clear(); - } - private: - static void StripMessage(DescriptorProto *message_type) { - message_type->mutable_extension()->Clear(); - message_type->clear_extension_range(); - for (int i = 0; i < message_type->mutable_nested_type()->size(); i++) { - StripMessage(message_type->mutable_nested_type(i)); - } - } -}; - - -class FieldScrubber { - public: - static void ScrubFile(FileDescriptorProto *file) { - for (int i = 0; i < file->mutable_message_type()->size(); i++) { - ScrubMessage(file->mutable_message_type(i)); - } - for (int i = 0; i < file->mutable_extension()->size(); i++) { - file->mutable_extension(i)->clear_default_value(); - if (ShouldClearLabel(file->mutable_extension(i))) { - file->mutable_extension(i)->clear_label(); - } - } - } - private: - static bool ShouldClearLabel(const FieldDescriptorProto *field) { - return field->label() == FieldDescriptorProto::LABEL_REQUIRED; - } - - static void ScrubMessage(DescriptorProto *message_type) { - message_type->mutable_extension()->Clear(); - for (int i = 0; i < message_type->mutable_extension()->size(); i++) { - message_type->mutable_extension(i)->clear_default_value(); - if (ShouldClearLabel(message_type->mutable_extension(i))) { - message_type->mutable_extension(i)->clear_label(); - } - } - for (int i = 0; i < message_type->mutable_field()->size(); i++) { - message_type->mutable_field(i)->clear_default_value(); - if (ShouldClearLabel(message_type->mutable_field(i))) { - message_type->mutable_field(i)->clear_label(); - } - } - for (int i = 0; i < message_type->mutable_nested_type()->size(); i++) { - ScrubMessage(message_type->mutable_nested_type(i)); - } - } -}; - -} // namespace util -} // namespace protobuf -} // namespace google - -#endif // PROTOBUF_BENCHMARKS_UTIL_SCHEMA_PROTO2_TO_PROTO3_UTIL_H_ diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel new file mode 100644 index 0000000..ea8fa18 --- /dev/null +++ b/build_defs/BUILD.bazel @@ -0,0 +1,210 @@ +# Internal Starlark definitions for Protobuf. + +load("@bazel_skylib//lib:selects.bzl", "selects") +load("@rules_cc//cc:defs.bzl", starlark_cc_proto_library = "cc_proto_library") +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test") +load(":compiler_config_setting.bzl", "create_compiler_config_setting") + +package( + default_visibility = [ + # Public, but Protobuf only visibility. + "//:__subpackages__", + ], +) + +create_compiler_config_setting( + name = "config_msvc", + value = "msvc-cl", +) + +config_setting( + name = "aarch64", + values = {"cpu": "linux-aarch_64"}, +) + +config_setting( + name = "x86_64", + values = {"cpu": "linux-x86_64"}, +) + +# Android NDK builds can specify different crosstool_top flags to choose which +# STL they use for C++. We need these multiple variants to catch all of those +# versions of crosstool_top and reliably detect Android. +# +# For more info on the various crosstool_tops used by NDK Bazel builds, see: +# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl + +config_setting( + name = "config_android", + values = { + "crosstool_top": "//external:android/crosstool", + }, +) + +config_setting( + name = "config_android-stlport", + values = { + "crosstool_top": "@androidndk//:toolchain-stlport", + }, +) + +config_setting( + name = "config_android-libcpp", + values = { + "crosstool_top": "@androidndk//:toolchain-libcpp", + }, +) + +config_setting( + name = "config_android-gnu-libstdcpp", + values = { + "crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp", + }, +) + +config_setting( + name = "config_android-default", + values = { + "crosstool_top": "@androidndk//:default_crosstool", + }, +) + +config_setting( + name = "config_win32", + values = { + "cpu": "win32", + }, +) + +config_setting( + name = "config_win64", + values = { + "cpu": "win64", + }, +) + +selects.config_setting_group( + name = "config_win", + match_any = [ + ":config_win32", + ":config_win64", + ], +) + +config_setting( + name = "config_osx_aarch64", + values = {"cpu": "osx-aarch_64"}, +) + +config_setting( + name = "config_osx_x86_64", + values = {"cpu": "osx-x86_64"}, +) + +selects.config_setting_group( + name = "config_osx", + match_any = [ + ":config_osx_aarch64", + ":config_osx_x86_64", + ], +) + +# Internal testing: + +starlark_cc_proto_library( + name = "any_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:any_proto"], +) + +starlark_cc_proto_library( + name = "api_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:api_proto"], +) + +starlark_cc_proto_library( + name = "compiler_plugin_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:compiler_plugin_proto"], +) + +starlark_cc_proto_library( + name = "descriptor_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:descriptor_proto"], +) + +starlark_cc_proto_library( + name = "duration_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:duration_proto"], +) + +starlark_cc_proto_library( + name = "empty_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:empty_proto"], +) + +starlark_cc_proto_library( + name = "field_mask_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:field_mask_proto"], +) + +starlark_cc_proto_library( + name = "source_context_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:source_context_proto"], +) + +starlark_cc_proto_library( + name = "struct_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:struct_proto"], +) + +starlark_cc_proto_library( + name = "timestamp_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:timestamp_proto"], +) + +starlark_cc_proto_library( + name = "type_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:type_proto"], +) + +starlark_cc_proto_library( + name = "wrappers_cc_proto", + visibility = ["//visibility:private"], + deps = ["//:wrappers_proto"], +) + +cc_proto_blacklist_test( + name = "cc_proto_blacklist_test", + deps = [ + ":any_cc_proto", + ":api_cc_proto", + ":compiler_plugin_cc_proto", + ":descriptor_cc_proto", + ":duration_cc_proto", + ":empty_cc_proto", + ":field_mask_cc_proto", + ":source_context_cc_proto", + ":struct_cc_proto", + ":timestamp_cc_proto", + ":type_cc_proto", + ":wrappers_cc_proto", + ], +) + +pkg_files( + name = "dist_files", + srcs = glob(["*"]), + strip_prefix = strip_prefix.from_root(""), + visibility = ["//pkg:__pkg__"], +) diff --git a/build_defs/arch_tests.bzl b/build_defs/arch_tests.bzl new file mode 100644 index 0000000..ba67cc6 --- /dev/null +++ b/build_defs/arch_tests.bzl @@ -0,0 +1,55 @@ +"""Generated unittests to verify that a binary is built for the expected architecture.""" + +load("//build_defs:internal_shell.bzl", "inline_sh_test") + +def _arch_test_impl( + name, + platform, + file_platform, + bazel_binaries = [], + system_binaries = [], + **kwargs): + """Bazel rule to verify that a Bazel or system binary is built for the aarch64 architecture. + + Args: + name: the name of the test. + platform: a diagnostic name for this architecture. + file_platform: the expected output of `file`. + bazel_binaries: a set of binary targets to inspect. + system_binaries: a set of paths to system executables to inspect. + **kwargs: other keyword arguments that are passed to the test. + """ + + inline_sh_test( + name = name, + tools = bazel_binaries, + cmd = """ + for binary in "%s"; do + (file -L $$binary | grep -q "%s") \ + || (echo "Test binary is not an %s binary: "; file -L $$binary; exit 1) + done + """ % ( + " ".join(["$(rootpaths %s)" % b for b in bazel_binaries] + system_binaries), + file_platform, + platform, + ), + target_compatible_with = select({ + "//build_defs:" + platform: [], + "//conditions:default": ["@platforms//:incompatible"], + }), + **kwargs + ) + +def aarch64_test(**kwargs): + _arch_test_impl( + platform = "aarch64", + file_platform = "ELF 64-bit LSB.* ARM aarch64", + **kwargs + ) + +def x86_64_test(**kwargs): + _arch_test_impl( + platform = "x86_64", + file_platform = "ELF 64-bit LSB.*, ARM x86_64", + **kwargs + ) diff --git a/cc_proto_blacklist_test.bzl b/build_defs/cc_proto_blacklist_test.bzl similarity index 92% rename from cc_proto_blacklist_test.bzl rename to build_defs/cc_proto_blacklist_test.bzl index df54293..260abde 100644 --- a/cc_proto_blacklist_test.bzl +++ b/build_defs/cc_proto_blacklist_test.bzl @@ -14,14 +14,14 @@ def _cc_proto_blacklist_test_impl(ctx): env = unittest.begin(ctx) for dep in ctx.attr.deps: - files = len(dep.files.to_list()) + files = dep.files.to_list() asserts.equals( env, - 0, + [], files, "Expected that target '{}' does not provide files, got {}".format( dep.label, - files, + len(files), ), ) diff --git a/compiler_config_setting.bzl b/build_defs/compiler_config_setting.bzl similarity index 100% rename from compiler_config_setting.bzl rename to build_defs/compiler_config_setting.bzl diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl new file mode 100644 index 0000000..03106df --- /dev/null +++ b/build_defs/cpp_opts.bzl @@ -0,0 +1,49 @@ +"""C++ compile/link options for Protobuf libraries.""" + +COPTS = select({ + "//build_defs:config_msvc": [ + "/wd4065", # switch statement contains 'default' but no 'case' labels + "/wd4146", # unary minus operator applied to unsigned type + "/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data + "/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' + "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data + "/wd4305", # 'identifier' : truncation from 'type1' to 'type2' + "/wd4307", # 'operator' : integral constant overflow + "/wd4309", # 'conversion' : truncation of constant value + "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) + "/wd4355", # 'this' : used in base member initializer list + "/wd4506", # no definition for inline function 'function' + "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) + "/wd4996", # The compiler encountered a deprecated declaration. + ], + "//conditions:default": [ + "-DHAVE_ZLIB", + "-Woverloaded-virtual", + "-Wno-sign-compare", + "-Wno-nonnull", + "-Werror", + ], +}) + +# Android and MSVC builds do not need to link in a separate pthread library. +LINK_OPTS = select({ + "//build_defs:config_android": [], + "//build_defs:config_android-stlport": [], + "//build_defs:config_android-libcpp": [], + "//build_defs:config_android-gnu-libstdcpp": [], + "//build_defs:config_android-default": [], + "//build_defs:config_msvc": [ + # Suppress linker warnings about files with no symbols defined. + "-ignore:4221", + "/utf-8", + ], + "@platforms//os:macos": [ + "-lpthread", + "-lm", + "-framework CoreFoundation", + ], + "//conditions:default": [ + "-lpthread", + "-lm", + ], +}) diff --git a/build_defs/internal_shell.bzl b/build_defs/internal_shell.bzl new file mode 100644 index 0000000..91628a5 --- /dev/null +++ b/build_defs/internal_shell.bzl @@ -0,0 +1,94 @@ +""" +Internal tools to migrate shell commands to Bazel as an intermediate step +to wider Bazelification. +""" + +def inline_sh_binary( + name, + srcs = [], + tools = [], + deps = [], + cmd = "", + **kwargs): + """Bazel rule to wrap up an inline bash script in a binary. + + This is most useful as a stop-gap solution for migrating off Autotools. + These binaries are likely to be non-hermetic, with implicit system + dependencies. + + NOTE: the rule is only an internal workaround. The interface may change and + the rule may be removed when everything is properly "Bazelified". + + Args: + name: the name of the inline_sh_binary. + srcs: the files used directly by the script. + tools: the executable tools used directly by the script. Any target used + with rootpath/execpath/location must be declared here or in `srcs`. + deps: a list of dependency labels that are required to run this binary. + cmd: the inline sh command to run. + **kwargs: other keyword arguments that are passed to sh_binary. + """ + + native.genrule( + name = name + "_genrule", + srcs = srcs, + tools = tools, + outs = [name + ".sh"], + cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd, + visibility = ["//visibility:private"], + tags = kwargs["tags"] if "tags" in kwargs else None, + target_compatible_with = kwargs["target_compatible_with"] if "target_compatible_with" in kwargs else None, + testonly = kwargs["testonly"] if "testonly" in kwargs else None, + ) + + native.sh_binary( + name = name, + srcs = [name + "_genrule"], + data = srcs + tools + deps, + **kwargs + ) + +def inline_sh_test( + name, + srcs = [], + tools = [], + deps = [], + cmd = "", + **kwargs): + """Bazel rule to wrap up an inline bash script in a test. + + This is most useful as a stop-gap solution for migrating off Autotools. + These tests are likely to be non-hermetic, with implicit system dependencies. + + NOTE: the rule is only an internal workaround. The interface may change and + the rule may be removed when everything is properly "Bazelified". + + Args: + name: the name of the inline_sh_binary. + srcs: the files used directly by the script. + tools: the executable tools used directly by the script. Any target used + with rootpath/execpath/location must be declared here or in `srcs`. + deps: a list of dependency labels that are required to run this binary. + cmd: the inline sh command to run. + **kwargs: other keyword arguments that are passed to sh_binary. + https://bazel.build/reference/be/common-definitions#common-attributes) + """ + + native.genrule( + name = name + "_genrule", + srcs = srcs, + tools = tools, + outs = [name + ".sh"], + cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd, + visibility = ["//visibility:private"], + tags = kwargs["tags"] if "tags" in kwargs else None, + target_compatible_with = kwargs["target_compatible_with"] if "target_compatible_with" in kwargs else None, + testonly = kwargs["testonly"] if "testonly" in kwargs else None, + ) + + native.sh_test( + name = name, + srcs = [name + "_genrule"], + data = srcs + tools + deps, + **kwargs + ) diff --git a/build_defs/java_opts.bzl b/build_defs/java_opts.bzl new file mode 100644 index 0000000..e9c0407 --- /dev/null +++ b/build_defs/java_opts.bzl @@ -0,0 +1,77 @@ +"""Java options and protobuf-specific java build rules with those options.""" + +load("@rules_java//java:defs.bzl", "java_library") +load("@rules_jvm_external//:defs.bzl", "java_export") +load("//java/osgi:osgi.bzl", "osgi_java_library") +load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") + +JAVA_OPTS = [ + "-source 8", + "-target 8", + "-Xep:Java8ApiChecker:ERROR", +] + +BUNDLE_DOC_URL = "https://developers.google.com/protocol-buffers/" +BUNDLE_LICENSE = "https://opensource.org/licenses/BSD-3-Clause" + +def protobuf_java_export(**kwargs): + java_export( + javacopts = JAVA_OPTS, + **kwargs + ) + +def protobuf_java_library(**kwargs): + java_library( + javacopts = JAVA_OPTS, + **kwargs + ) + +def protobuf_versioned_java_library( + bundle_description, + bundle_name, + bundle_symbolic_name, + bundle_additional_imports = [], + bundle_additional_exports = [], + **kwargs): + """Extends `java_library` to add OSGi headers to the MANIFEST.MF using bndlib + + This macro should be usable as a drop-in replacement for java_library. + + The additional arguments are given the bndlib tool to generate an OSGi-compliant manifest file. + See [bnd documentation](https://bnd.bndtools.org/chapters/110-introduction.html) + + Takes all the args that are standard for a java_library target plus the following. + Args: + bundle_description: (required) The Bundle-Description header defines a short + description of this bundle. + bundle_name: (required) The Bundle-Name header defines a readable name for this + bundle. This should be a short, human-readable name that can + contain spaces. + bundle_symbolic_name: (required) The Bundle-SymbolicName header specifies a + non-localizable name for this bundle. The bundle symbolic name + together with a version must identify a unique bundle though it can + be installed multiple times in a framework. The bundle symbolic + name should be based on the reverse domain name convention. + bundle_additional_exports: The Export-Package header contains a + declaration of exported packages. These are additional export + package statements to be added before the default wildcard export + "*;version={$Bundle-Version}". + bundle_additional_imports: The Import-Package header declares the + imported packages for this bundle. These are additional import + package statements to be added before the default wildcard import + "*". + **kwargs: Additional key-word arguments that are passed to the internal + java_library target. + """ + osgi_java_library( + javacopts = JAVA_OPTS, + bundle_doc_url = BUNDLE_DOC_URL, + bundle_license = BUNDLE_LICENSE, + bundle_version = PROTOBUF_JAVA_VERSION, + bundle_description = bundle_description, + bundle_name = bundle_name, + bundle_symbolic_name = bundle_symbolic_name, + bundle_additional_exports = bundle_additional_exports, + bundle_additional_imports = bundle_additional_imports + ["sun.misc;resolution:=optional"], + **kwargs + ) diff --git a/bundle.json b/bundle.json index 2394287..3056a87 100644 --- a/bundle.json +++ b/bundle.json @@ -21,7 +21,8 @@ "ram": "", "deps": { "components": [ - "hilog" + "hilog", + "abseil-cpp" ], "third_party": [] }, diff --git a/ci/Linux.bazelrc b/ci/Linux.bazelrc new file mode 100644 index 0000000..d5dcf5d --- /dev/null +++ b/ci/Linux.bazelrc @@ -0,0 +1,3 @@ +import common.bazelrc + +build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 diff --git a/ci/README.md b/ci/README.md new file mode 100644 index 0000000..01c8373 --- /dev/null +++ b/ci/README.md @@ -0,0 +1,17 @@ +This directory contains CI-specific tooling. + +# Clang wrappers + +CMake allows for compiler wrappers to be injected such as ccache, which +intercepts compiler calls and short-circuits on cache-hits. This can be done +by specifying `CMAKE_C_COMPILER_LAUNCHER` and `CMAKE_CXX_COMPILER_LAUNCHER` +during CMake's configure step. Unfortunately, X-Code doesn't provide anything +like this, so we use basic wrapper scripts to invoke ccache + clang. + +# Bazelrc files + +In order to allow platform-specific `.bazelrc` flags during testing, we keep +3 different versions here along with a shared `common.bazelrc` that they all +include. Our GHA infrastructure will select the appropriate file for any test +and overwrite the default `.bazelrc` in our workspace, which is intended for +development only. diff --git a/ci/Windows.bazelrc b/ci/Windows.bazelrc new file mode 100644 index 0000000..427e923 --- /dev/null +++ b/ci/Windows.bazelrc @@ -0,0 +1,2 @@ +import common.bazelrc + diff --git a/ci/clang_wrapper b/ci/clang_wrapper new file mode 100644 index 0000000..9f6962f --- /dev/null +++ b/ci/clang_wrapper @@ -0,0 +1,3 @@ +#!/bin/sh +# This file wraps clang with ccache to enable faster runs of xcodebuild +ccache clang "$@" diff --git a/ci/clang_wrapper++ b/ci/clang_wrapper++ new file mode 100644 index 0000000..0c08c68 --- /dev/null +++ b/ci/clang_wrapper++ @@ -0,0 +1,3 @@ +#!/bin/sh +# This file wraps clang with ccache to enable faster runs of xcodebuild +ccache clang++ "$@" diff --git a/ci/common.bazelrc b/ci/common.bazelrc new file mode 100644 index 0000000..e5345cf --- /dev/null +++ b/ci/common.bazelrc @@ -0,0 +1,36 @@ +# Fail if a glob doesn't match anything (https://github.com/bazelbuild/bazel/issues/8195) +build --incompatible_disallow_empty_glob + +build:dbg --compilation_mode=dbg + +build:opt --compilation_mode=opt + +build:san-common --config=dbg --strip=never --copt=-O0 --copt=-fno-omit-frame-pointer + +build:asan --config=san-common --copt=-fsanitize=address --linkopt=-fsanitize=address +build:asan --copt=-DADDRESS_SANITIZER=1 +# ASAN hits ODR violations with shared linkage due to rules_proto. +build:asan --dynamic_mode=off + +build:msan --config=san-common --copt=-fsanitize=memory --linkopt=-fsanitize=memory +build:msan --copt=-fsanitize-memory-track-origins +build:msan --copt=-fsanitize-memory-use-after-dtor +build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1 +build:msan --copt=-DMEMORY_SANITIZER=1 + +# Use our instrumented LLVM libc++ in Kokoro. +build:docker-msan --config=msan +build:docker-msan --linkopt=-L/opt/libcxx_msan/lib --linkopt=-lc++abi +build:docker-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib +build:docker-msan --cxxopt=-stdlib=libc++ --linkopt=-stdlib=libc++ + + +build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread +build:tsan --copt=-DTHREAD_SANITIZER=1 + +build:ubsan --config=san-common --copt=-fsanitize=undefined --linkopt=-fsanitize=undefined +build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 +build:ubsan --copt=-DUNDEFINED_SANITIZER=1 +# Workaround for the fact that Bazel links with $CC, not $CXX +# https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748 +build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr diff --git a/ci/macOS.bazelrc b/ci/macOS.bazelrc new file mode 100644 index 0000000..d5dcf5d --- /dev/null +++ b/ci/macOS.bazelrc @@ -0,0 +1,3 @@ +import common.bazelrc + +build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 diff --git a/ci/push_auto_update.sh b/ci/push_auto_update.sh new file mode 100644 index 0000000..3ee0ec0 --- /dev/null +++ b/ci/push_auto_update.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# This script updates src/file_lists.cmake and the checked-in generated code +# for the well-known types, commits the resulting changes, and pushes them. +# This does not do anything useful when run manually, but should be run by our +# GitHub action instead. + +set -ex + +# Cd to the repo root. +cd $(dirname -- "$0")/.. + +previous_commit_title=$(git log -1 --pretty='%s') + +# Exit early if the previous commit was auto-generated. This reduces the risk +# of a bug causing an infinite loop of auto-generated commits. +if (echo "$previous_commit_title" | grep -q "^Auto-generate files"); then + echo "Previous commit was auto-generated" + exit 0 +fi + +./regenerate_stale_files.sh + +# Try to determine the most recent CL or pull request. +pr_from_merge=$(echo "$previous_commit_title" | sed -n 's/^Merge pull request #\([0-9]\+\).*/\1/p') +pr_from_squash=$(echo "$previous_commit_title" | sed -n 's/^.*(#\([0-9]\+\))$/\1/p') +cl=$(git log -1 --pretty='%b' | sed -n 's/^PiperOrigin-RevId: \([0-9]*\)$/\1/p') + +if [ ! -z "$pr_from_merge" ]; then + commit_message="Auto-generate files after PR #$pr_from_merge" +elif [ ! -z "$pr_from_squash" ]; then + commit_message="Auto-generate files after PR #$pr_from_squash" +elif [ ! -z "$cl" ]; then + commit_message="Auto-generate files after cl/$cl" +else + # If we are unable to determine the CL or pull request number, we fall back + # on this default commit message. Typically this should not occur, but could + # happen if a pull request was merged via a rebase. + commit_message="Auto-generate files" +fi + +git add -A +git diff --staged --quiet || git commit -am "$commit_message" +git pull --rebase +git push --force-with-lease || echo "Conflicting commit hit, retrying in next job..." diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt deleted file mode 100644 index 9ca31ac..0000000 --- a/cmake/CMakeLists.txt +++ /dev/null @@ -1,293 +0,0 @@ -# Minimum CMake required -cmake_minimum_required(VERSION 3.1.3) - -if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Configuring...") -endif() - -# CMake policies -cmake_policy(SET CMP0022 NEW) -# On MacOS use @rpath/ for target's install name prefix path -if (POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif () -# Clear VERSION variables when no VERSION is given to project() -if(POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif() - -# Project -project(protobuf C CXX) - -# Add c++11 flags -if (CYGWIN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") -else() - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) -endif() - -# The Intel compiler isn't able to deal with noinline member functions of -# template classses defined in headers. As such it spams the output with -# warning #2196: routine is both "inline" and "noinline" -# This silences that warning. -if (CMAKE_CXX_COMPILER_ID MATCHES Intel) - string(APPEND CMAKE_CXX_FLAGS " -diag-disable=2196") -endif() - -# Options -if(WITH_PROTOC) - set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE) -endif() -option(protobuf_BUILD_TESTS "Build tests" ON) -option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF) -option(protobuf_BUILD_EXAMPLES "Build examples" OFF) -option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON) -if (BUILD_SHARED_LIBS) - set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON) -else (BUILD_SHARED_LIBS) - set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF) -endif (BUILD_SHARED_LIBS) -option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT}) -include(CMakeDependentOption) -cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON - "NOT protobuf_BUILD_SHARED_LIBS" OFF) -set(protobuf_WITH_ZLIB_DEFAULT ON) -option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT}) -set(protobuf_DEBUG_POSTFIX "d" - CACHE STRING "Default debug postfix") -mark_as_advanced(protobuf_DEBUG_POSTFIX) -# User options -include(protobuf-options.cmake) - -# Overrides for option dependencies -if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS) - set(protobuf_BUILD_LIBPROTOC ON) -else() - set(protobuf_BUILD_LIBPROTOC OFF) -endif () -# Path to main configure script -set(protobuf_CONFIGURE_SCRIPT "../configure.ac") - -# Parse configure script -set(protobuf_AC_INIT_REGEX - "^AC_INIT\\(\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\],\\[([^]]+)\\]\\)$") -file(STRINGS "${protobuf_CONFIGURE_SCRIPT}" protobuf_AC_INIT_LINE - LIMIT_COUNT 1 REGEX "^AC_INIT") -# Description -string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\1" - protobuf_DESCRIPTION "${protobuf_AC_INIT_LINE}") -# Version -string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2" - protobuf_VERSION_STRING "${protobuf_AC_INIT_LINE}") -# Contact -string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3" - protobuf_CONTACT "${protobuf_AC_INIT_LINE}") -# Parse version tweaks -set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1" - protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2" - protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3" - protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}") -string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5" - protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}") - -message(STATUS "${protobuf_VERSION_PRERELEASE}") - -# Package version -set(protobuf_VERSION - "${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") - -if(protobuf_VERSION_PRERELEASE) - set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}") -else() - set(protobuf_VERSION "${protobuf_VERSION}.0") -endif() -message(STATUS "${protobuf_VERSION}") - -if(protobuf_VERBOSE) - message(STATUS "Configuration script parsing status [") - message(STATUS " Description : ${protobuf_DESCRIPTION}") - message(STATUS " Version : ${protobuf_VERSION} (${protobuf_VERSION_STRING})") - message(STATUS " Contact : ${protobuf_CONTACT}") - message(STATUS "]") -endif() - -add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD) - -find_package(Threads REQUIRED) -if (CMAKE_USE_PTHREADS_INIT) - add_definitions(-DHAVE_PTHREAD) -endif (CMAKE_USE_PTHREADS_INIT) - -set(_protobuf_FIND_ZLIB) -if (protobuf_WITH_ZLIB) - find_package(ZLIB) - if (ZLIB_FOUND) - set(HAVE_ZLIB 1) - # FindZLIB module define ZLIB_INCLUDE_DIRS variable - # Set ZLIB_INCLUDE_DIRECTORIES for compatible - set(ZLIB_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRECTORIES} ${ZLIB_INCLUDE_DIRS}) - # Using imported target if exists - if (TARGET ZLIB::ZLIB) - set(ZLIB_LIBRARIES ZLIB::ZLIB) - set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()") - endif (TARGET ZLIB::ZLIB) - else (ZLIB_FOUND) - set(HAVE_ZLIB 0) - # Explicitly set these to empty (override NOT_FOUND) so cmake doesn't - # complain when we use them later. - set(ZLIB_INCLUDE_DIRECTORIES) - set(ZLIB_LIBRARIES) - endif (ZLIB_FOUND) -endif (protobuf_WITH_ZLIB) - -if (HAVE_ZLIB) - add_definitions(-DHAVE_ZLIB) -endif (HAVE_ZLIB) - -# We need to link with libatomic on systems that do not have builtin atomics, or -# don't have builtin support for 8 byte atomics -set(protobuf_LINK_LIBATOMIC false) -if (NOT MSVC) - include(CheckCXXSourceCompiles) - set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11) - check_cxx_source_compiles(" - #include - int main() { - return std::atomic{}; - } - " protobuf_HAVE_BUILTIN_ATOMICS) - if (NOT protobuf_HAVE_BUILTIN_ATOMICS) - set(protobuf_LINK_LIBATOMIC true) - endif (NOT protobuf_HAVE_BUILTIN_ATOMICS) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) -endif (NOT MSVC) - -if (protobuf_BUILD_SHARED_LIBS) - set(protobuf_SHARED_OR_STATIC "SHARED") -else (protobuf_BUILD_SHARED_LIBS) - set(protobuf_SHARED_OR_STATIC "STATIC") - # In case we are building static libraries, link also the runtime library statically - # so that MSVCR*.DLL is not required at runtime. - # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx - # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd - # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F - if (MSVC AND protobuf_MSVC_STATIC_RUNTIME) - foreach(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME) -endif (protobuf_BUILD_SHARED_LIBS) - -if (MSVC) - # Build with multiple processes - add_definitions(/MP) - # MSVC warning suppressions - add_definitions( - /wd4018 # 'expression' : signed/unsigned mismatch - /wd4065 # switch statement contains 'default' but no 'case' labels - /wd4146 # unary minus operator applied to unsigned type, result still unsigned - /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data - /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' - /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data - /wd4305 # 'identifier' : truncation from 'type1' to 'type2' - /wd4307 # 'operator' : integral constant overflow - /wd4309 # 'conversion' : truncation of constant value - /wd4334 # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) - /wd4355 # 'this' : used in base member initializer list - /wd4506 # no definition for inline function 'function' - /wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning) - /wd4996 # The compiler encountered a deprecated declaration. - ) - # Allow big object - add_definitions(/bigobj) - string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) - string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR}) - string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}") - configure_file(extract_includes.bat.in extract_includes.bat) - - # Suppress linker warnings about files with no symbols defined. - set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") - - # Configure Resource Compiler - enable_language(RC) - # use English language (0x409) in resource compiler - set(rc_flags "/l0x409") - # fix rc.exe invocations because of usage of add_definitions() - set(CMAKE_RC_COMPILE_OBJECT " ${rc_flags} /fo ") - - configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) -endif (MSVC) - - -get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH) - -include_directories( - ${ZLIB_INCLUDE_DIRECTORIES} - ${protobuf_BINARY_DIR} - ${protobuf_source_dir}/src) - -if (MSVC) - # Add the "lib" prefix for generated .lib outputs. - set(LIB_PREFIX lib) -else (MSVC) - # When building with "make", "lib" prefix will be added automatically by - # the build tool. - set(LIB_PREFIX) -endif (MSVC) - -if (protobuf_UNICODE) - add_definitions(-DUNICODE -D_UNICODE) -endif (protobuf_UNICODE) - -include(libprotobuf-lite.cmake) -include(libprotobuf.cmake) -if (protobuf_BUILD_LIBPROTOC) - include(libprotoc.cmake) -endif (protobuf_BUILD_LIBPROTOC) -if (protobuf_BUILD_PROTOC_BINARIES) - include(protoc.cmake) - if (NOT DEFINED protobuf_PROTOC_EXE) - set(protobuf_PROTOC_EXE protoc) - endif (NOT DEFINED protobuf_PROTOC_EXE) -endif (protobuf_BUILD_PROTOC_BINARIES) - -# Ensure we have a protoc executable if we need one -if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES) - if (NOT DEFINED protobuf_PROTOC_EXE) - find_program(protobuf_PROTOC_EXE protoc) - if (NOT protobuf_PROTOC_EXE) - message(FATAL "Build requires 'protoc' but binary not found and not building protoc.") - endif () - endif () - if(protobuf_VERBOSE) - message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}") - endif(protobuf_VERBOSE) -endif () - -if (protobuf_BUILD_TESTS) - include(tests.cmake) -endif (protobuf_BUILD_TESTS) - -if (protobuf_BUILD_CONFORMANCE) - include(conformance.cmake) -endif (protobuf_BUILD_CONFORMANCE) - -include(install.cmake) - -if (protobuf_BUILD_EXAMPLES) - include(examples.cmake) -endif (protobuf_BUILD_EXAMPLES) - -if(protobuf_VERBOSE) - message(STATUS "Protocol Buffers Configuring done") -endif(protobuf_VERBOSE) diff --git a/cmake/README.md b/cmake/README.md index a780722..00532ec 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -1,15 +1,36 @@ -This directory contains *CMake* files that can be used to build protobuf -with *MSVC* on *Windows*. You can build the project from *Command Prompt* -and using an *Visual Studio* IDE. +This directory contains *CMake* files that can be used to build protobuf. -You need to have [CMake](http://www.cmake.org), [Visual Studio](https://www.visualstudio.com) -and optionally [Git](http://git-scm.com) installed on your computer before proceeding. +You need to have [CMake](http://www.cmake.org), +[Git](http://git-scm.com), and [Abseil](https://github.com/abseil/abseil-cpp) +installed on your computer before proceeding. We currently support CMake 3.5 +and newer on both [Windows](#windows-builds) and [Linux](#linux-builds). -Most of the instructions will be given to the *Сommand Prompt*, but the same -actions can be performed using appropriate GUI tools. +Most of the instructions will be given using CMake's command-line interface, but +the same actions can be performed using appropriate GUI tools. -Environment Setup -================= +# CMake Flags + +## C++ Version + +By default, CMake will use whatever C++ version is the system default. Since +protobuf requires C++14 or newer, sometimes you will need to explicitly override +this. For example, the following: + +``` +cmake . -DCMAKE_CXX_STANDARD=14 +cmake --build . +``` + +will build protobuf using C++14 (see [CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external} for all available options). + +# Windows Builds + +On Windows, you can build the project from *Command Prompt* and using an +*Visual Studio* IDE. You will also need to have +[Visual Studio](https://www.visualstudio.com) installed on your computer before +proceeding. + +## Environment Setup Open the appropriate *Command Prompt* from the *Start* menu. @@ -36,117 +57,153 @@ If *git* command is not available from *Command Prompt*, add it to system *PATH* C:\Path\to>set PATH=%PATH%;C:\Program Files\Git\cmd +Optionally, you will want to download [ninja](https://ninja-build.org/) and add it to your *PATH* variable. + + C:\Path\to>set PATH=%PATH%;C:\tools\ninja + Good. Now you are ready to continue. -Getting Sources -=============== +## Getting Sources You can get the latest stable source packages from the release page: https://github.com/protocolbuffers/protobuf/releases/latest -For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if -you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package -contains C++ source already); if you need C++ and multiple other languages, -download `protobuf-all-[VERSION].tar.gz`. - Or you can use git to clone from protobuf git repository. - C:\Path\to> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git + C:\Path\to> mkdir src & cd src + C:\Path\to\src> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git -Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *master* +Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *main* if you want to get the latest code. Go to the project folder: - C:\Path\to>cd protobuf - C:\Path\to\protobuf> + C:\Path\to\src> cd protobuf + C:\Path\to\src\protobuf> Remember to update any submodules if you are using git clone (you can skip this step if you are using a release .tar.gz or .zip package): ```console -C:\Path\to\protobuf> git submodule update --init --recursive +C:\Path\to\src\protobuf> git submodule update --init --recursive ``` -Now go to *cmake* folder in protobuf sources: - - C:\Path\to\protobuf>cd cmake - C:\Path\to\protobuf\cmake> - -Good. Now you are ready to *CMake* configuration. +Good. Now you are ready for *CMake* configuration. -CMake Configuration -=================== +## CMake Configuration *CMake* supports a lot of different [generators](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html) for various native build systems. -We are only interested in -[Makefile](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators) -and -[Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators) -generators. -We will use shadow building to separate the temporary files from the protobuf source code. +Of most interest to Windows programmers are the following: + +* [Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators) + This generates a Visual Studio solution for the project. + +* [Ninja](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#ninja-generator) + This uses the external tool [Ninja](https://ninja-build.org/) to build. It is the fastest solution available. + +Note that as of Visual Studio 2015, Visual Studio includes +[support for opening directly CMake-based projects](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio). + +It is considered good practice not to build CMake projects in the source tree but in a separate folder. Create a temporary *build* folder and change your working directory to it: - C:\Path\to\protobuf\cmake>mkdir build & cd build - C:\Path\to\protobuf\cmake\build> + mkdir C:\Path\to\build\protobuf + cd C:\Path\to\build\protobuf + C:\Path\to\build\protobuf> -The *Makefile* generator can build the project in only one configuration, so you need to build -a separate folder for each configuration. +During configuration you will also be specifying where CMake should expect to +find your Abseil installation. To do so, first set `-Dprotobuf_ABSL_PROVIDER=package` +and then set `-DCMAKE_PREFIX_PATH` to the path where you installed Abseil. -To start using a *Release* configuration: +For example: - C:\Path\to\protobuf\cmake\build>mkdir release & cd release - C:\Path\to\protobuf\cmake\build\release>cmake -G "NMake Makefiles" ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_INSTALL_PREFIX=../../../../install ^ - ../.. +```console +C:\Path\to\build\protobuf> cmake -S. -Bcmake-out \ + -DCMAKE_INSTALL_PREFIX=/tmp/protobuf \ + -DCMAKE_CXX_STANDARD=14 \ + -Dprotobuf_ABSL_PROVIDER=package \ + -DCMAKE_PREFIX_PATH=/tmp/absl # Path to where I installed Abseil +``` -It will generate *nmake* *Makefile* in current directory. +The *Makefile* and *Ninja* generators can build the project in only one configuration, so you need to build +a separate folder for each configuration. -To use *Debug* configuration: +To use *Debug* configuration using *Ninja*: - C:\Path\to\protobuf\cmake\build>mkdir debug & cd debug - C:\Path\to\protobuf\cmake\build\debug>cmake -G "NMake Makefiles" ^ + C:\Path\to\build\protobuf>mkdir debug & cd debug + C:\Path\to\build\protobuf\debug>cmake -G "Ninja" ^ -DCMAKE_BUILD_TYPE=Debug ^ - -DCMAKE_INSTALL_PREFIX=../../../../install ^ - ../.. + -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ + C:\Path\to\src\protobuf -It will generate *nmake* *Makefile* in current directory. +It will generate *Ninja* build scripts in current directory. -To create *Visual Studio* solution file: +The *Visual Studio* generator is multi-configuration: it will generate a single *.sln* file that can be used for both *Debug* and *Release*: - C:\Path\to\protobuf\cmake\build>mkdir solution & cd solution - C:\Path\to\protobuf\cmake\build\solution>cmake -G "Visual Studio 16 2019" ^ - -DCMAKE_INSTALL_PREFIX=../../../../install ^ - ../.. + C:\Path\to\build\protobuf>mkdir solution & cd solution + C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^ + -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ + C:\Path\to\src\protobuf It will generate *Visual Studio* solution file *protobuf.sln* in current directory. -If the *gmock* directory does not exist, and you do not want to build protobuf unit tests, -you need to add *cmake* command argument `-Dprotobuf_BUILD_TESTS=OFF` to disable testing. +### Unit Tests -To make a *Visual Studio* file for Visual Studio 16 2019, create the *Visual Studio* -solution file above and edit the CMakeCache file. +Unit tests are being built along with the rest of protobuf. The unit tests require Google Mock (now a part of Google Test). - C:Path\to\protobuf\cmake\build\solution\CMakeCache +A copy of [Google Test](https://github.com/google/googletest) is included as a Git submodule in the `third-party/googletest` folder. +(You do need to initialize the Git submodules as explained above.) -Then create the *Visual Studio* solution file again +Alternately, you may want to use protobuf in a larger set-up, you may want to use that standard CMake approach where +you build and install a shared copy of Google Test. -Compiling -========= +After you've built and installed your Google Test copy, you need add the following definition to your *cmake* command line +during the configuration step: `-Dprotobuf_USE_EXTERNAL_GTEST=ON`. +This will cause the standard CMake `find_package(GTest REQUIRED)` to be used. -To compile protobuf: +[find_package](https://cmake.org/cmake/help/latest/command/find_package.html) will search in a default location, +which on Windows is *C:\Program Files*. This is most likely not what you want. You will want instead to search for +Google Test in your project's root directory (i.e. the same directory you've passed to `CMAKE_INSTALL_PREFIX` when +building Google Test). For this, you need to set the `CMAKE_PREFIX_PATH` CMake variable. (There are other ways in CMake, +see the [manual](https://cmake.org/cmake/help/latest/command/find_package.html) for details.) - C:\Path\to\protobuf\cmake\build\release>nmake +For example: -or + C:\Path\to\build\protobuf>mkdir solution & cd solution + C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^ + -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ + -DCMAKE_PREFIX_PATH=C:\Path\to\my_big_project ^ + -Dprotobuf_USE_EXTERNAL_GTEST=ON ^ + C:\Path\to\src\protobuf + +In most cases, `CMAKE_PREFIX_PATH` and `CMAKE_INSTALL_PREFIX` will point to the same directory. + +To disable testing completely, you need to add the following argument to you *cmake* command line: `-Dprotobuf_BUILD_TESTS=OFF`. + +For example: + + C:\Path\to\build\protobuf\solution>cmake -G "Visual Studio 16 2019" ^ + -DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^ + -Dprotobuf_BUILD_TESTS=OFF ^ + C:\Path\to\src\protobuf + +## Compiling + +The standard way to compile a *CMake* project is `cmake --build `. + + +Note that if your generator supports multiple configurations, you will probably want to specify which one to build: + + cmake --build C:\Path\to\build\protobuf\solution --config Release + +You can also run directly the build tool you've configured: - C:\Path\to\protobuf\cmake\build\debug>nmake + C:\Path\to\build\protobuf\debug>ninja And wait for the compilation to finish. @@ -158,17 +215,20 @@ If you prefer to use the IDE: And wait for the compilation to finish. -Testing -======= +## Testing To run unit-tests, first you must compile protobuf as described above. Then run: - C:\Path\to\protobuf\cmake\build\release>nmake check + C:\Path\to\protobuf\cmake\build\release>ctest --progress --output-on-failure + +You can also build the `check` target (not idiomatic CMake usage, though): + + C:\Path\to\protobuf\cmake\build\release>cmake --build . --target check or - C:\Path\to\protobuf\cmake\build\debug>nmake check + C:\Path\to\build\protobuf\release>ninja check You can also build project *check* from Visual Studio solution. Yes, it may sound strange, but it works. @@ -183,9 +243,9 @@ You should see output similar to: [==========] 1546 tests from 165 test cases ran. (2529 ms total) [ PASSED ] 1546 tests. -To run specific tests: +To run specific tests, you need to pass some command line arguments to the test program itself: - C:\Path\to\protobuf>cmake\build\release\tests.exe --gtest_filter=AnyTest* + C:\Path\to\build\protobuf\release>tests.exe --gtest_filter=AnyTest* Running main() from gmock_main.cc Note: Google Test filter = AnyTest* [==========] Running 3 tests from 1 test case. @@ -207,16 +267,15 @@ Note that the tests must be run from the source folder. If all tests are passed, safely continue. -Installing -========== +## Installing -To install protobuf to the specified *install* folder: +To install protobuf to the *install* folder you've specified in the configuration step, you need to build the `install` target: - C:\Path\to\protobuf\cmake\build\release>nmake install + cmake --build C:\Path\to\build\protobuf\solution --config Release --target install -or +Or if you prefer: - C:\Path\to\protobuf\cmake\build\debug>nmake install + C:\Path\to\build\protobuf\debug>ninja install You can also build project *INSTALL* from Visual Studio solution. It sounds not so strange and it works. @@ -236,8 +295,7 @@ compiling a debug build of your application, you may need to link against a debug build of libprotobufd.lib with "d" postfix. Similarly, release builds should link against release libprotobuf.lib library. -DLLs vs. static linking -======================= +## DLLs vs. static linking Static linking is now the default for the Protocol Buffer libraries. Due to issues with Win32's use of a separate heap for each DLL, as well as binary @@ -262,8 +320,7 @@ recommend that you do NOT expose protocol buffer objects in your library's public interface, and that you statically link protocol buffers into your library. -ZLib support -============ +## ZLib support If you want to include GzipInputStream and GzipOutputStream (google/protobuf/io/gzip_stream.h) in libprotobuf, you will need to do a few @@ -280,16 +337,16 @@ You can also compile it from source by yourself. Getting sources: - C:\Path\to>git clone -b v1.2.8 https://github.com/madler/zlib.git - C:\Path\to>cd zlib + C:\Path\to\src>git clone -b v1.2.8 https://github.com/madler/zlib.git + C:\Path\to\src>cd zlib Compiling and Installing: - C:\Path\to\zlib>mkdir build & cd build - C:\Path\to\zlib\build>mkdir release & cd release - C:\Path\to\zlib\build\release>cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_INSTALL_PREFIX=../../../install ../.. - C:\Path\to\zlib\build\release>nmake & nmake install + C:\Path\to\src\zlib>mkdir C:\Path\to\build\zlib & cd C:\Path\to\build\zlib + C:\Path\to\build\zlib>mkdir release & cd release + C:\Path\to\build\zlib\release>cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_INSTALL_PREFIX=C:\Path\to\install C:\Path\to\src\zlib + C:\Path\to\src\zlib\build\release>cmake --build . --target install You can make *debug* version or use *Visual Studio* generator also as before for the protobuf project. @@ -308,20 +365,17 @@ the headers or the .lib file in the right directory. If you already have ZLIB library and headers at some other location on your system then alternatively you can define following configuration flags to locate them: - -DZLIB_INCLUDE_DIR= - -DZLIB_LIB= + -DZLIB_INCLUDE_DIR= + -DZLIB_LIB= Build and testing protobuf as usual. -Notes on Compiler Warnings -========================== +## Notes on Compiler Warnings The following warnings have been disabled while building the protobuf libraries and compiler. You may have to disable some of them in your own project as well, or live with them. -* C4018 - 'expression' : signed/unsigned mismatch -* C4146 - unary minus operator applied to unsigned type, result still unsigned * C4244 - Conversion from 'type1' to 'type2', possible loss of data. * C4251 - 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' @@ -343,3 +397,23 @@ unique, so there should be no problem with this, but MSVC prints warning nevertheless. So, we disable it. Unfortunately, this warning will also be produced when compiling code which merely uses protocol buffers, meaning you may have to disable it in your code too. + +# Linux Builds + +Building with CMake works very similarly on Linux. Instead of Visual Studio, +you will need to have gcc or clang installed to handle the C++ builds. CMake +will generate Makefiles by default, but can also be configured to use Ninja. To +build Protobuf, you will need to run (from the source directory): + + cmake . + cmake --build . --parallel 10 + +Protobuf can be tested and installed with CMake: + + ctest --verbose + sudo cmake --install . + +or directly with the generated Makefiles: + + make VERBOSE=1 test + sudo make install diff --git a/cmake/abseil-cpp.cmake b/cmake/abseil-cpp.cmake new file mode 100644 index 0000000..b50fb89 --- /dev/null +++ b/cmake/abseil-cpp.cmake @@ -0,0 +1,95 @@ +# Setup our dependency on Abseil. + +if(protobuf_BUILD_TESTS) + # Tell Abseil to build test-only helpers. + set(ABSL_BUILD_TEST_HELPERS ON) + + # We depend on googletest too, so just tell Abseil to use the same one we've + # already setup. + set(ABSL_USE_EXTERNAL_GOOGLETEST ON) + set(ABSL_FIND_GOOGLETEST OFF) +endif() + +if(TARGET absl::strings) + # If Abseil is included already, skip including it. + # (https://github.com/protocolbuffers/protobuf/issues/10435) +elseif(protobuf_ABSL_PROVIDER STREQUAL "module") + if(NOT ABSL_ROOT_DIR) + set(ABSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp) + endif() + if(EXISTS "${ABSL_ROOT_DIR}/CMakeLists.txt") + if(protobuf_INSTALL) + # When protobuf_INSTALL is enabled and Abseil will be built as a module, + # Abseil will be installed along with protobuf for convenience. + set(ABSL_ENABLE_INSTALL ON) + endif() + add_subdirectory(${ABSL_ROOT_DIR} third_party/abseil-cpp) + else() + message(WARNING "protobuf_ABSL_PROVIDER is \"module\" but ABSL_ROOT_DIR is wrong") + endif() + if(protobuf_INSTALL AND NOT _protobuf_INSTALL_SUPPORTED_FROM_MODULE) + message(WARNING "protobuf_INSTALL will be forced to FALSE because protobuf_ABSL_PROVIDER is \"module\" and CMake version (${CMAKE_VERSION}) is less than 3.13.") + set(protobuf_INSTALL FALSE) + endif() +elseif(protobuf_ABSL_PROVIDER STREQUAL "package") + # Use "CONFIG" as there is no built-in cmake module for absl. + find_package(absl REQUIRED CONFIG) +endif() +set(_protobuf_FIND_ABSL "if(NOT TARGET absl::strings)\n find_package(absl CONFIG)\nendif()") + +if (BUILD_SHARED_LIBS AND MSVC) + # On MSVC Abseil is bundled into a single DLL. + # This condition is necessary as of abseil 20230125.3 when abseil is consumed via add_subdirectory, + # the abseil_dll target is named abseil_dll, while if abseil is consumed via find_package, the target + # is called absl::abseil_dll + # Once https://github.com/abseil/abseil-cpp/pull/1466 is merged and released in the minimum version of + # abseil required by protobuf, it is possible to always link absl::abseil_dll and absl::abseil_test_dll + # and remove the if + if(protobuf_ABSL_PROVIDER STREQUAL "package") + set(protobuf_ABSL_USED_TARGETS absl::abseil_dll) + set(protobuf_ABSL_USED_TEST_TARGETS absl::abseil_test_dll) + else() + set(protobuf_ABSL_USED_TARGETS abseil_dll) + set(protobuf_ABSL_USED_TEST_TARGETS abseil_test_dll) + endif() +else() + set(protobuf_ABSL_USED_TARGETS + absl::absl_check + absl::absl_log + absl::algorithm + absl::base + absl::bind_front + absl::bits + absl::btree + absl::cleanup + absl::cord + absl::core_headers + absl::debugging + absl::die_if_null + absl::dynamic_annotations + absl::flags + absl::flat_hash_map + absl::flat_hash_set + absl::function_ref + absl::hash + absl::layout + absl::log_initialize + absl::log_severity + absl::memory + absl::node_hash_map + absl::node_hash_set + absl::optional + absl::span + absl::status + absl::statusor + absl::strings + absl::synchronization + absl::time + absl::type_traits + absl::utility + absl::variant + ) + set(protobuf_ABSL_USED_TEST_TARGETS + absl::scoped_mock_log + ) +endif () diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake index 76eae8a..7bebade 100644 --- a/cmake/conformance.cmake +++ b/cmake/conformance.cmake @@ -1,50 +1,117 @@ +if (protobuf_JSONCPP_PROVIDER STREQUAL "module") + if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/jsoncpp/CMakeLists.txt") + message(FATAL_ERROR + "Cannot find third_party/jsoncpp directory that's needed to " + "build conformance tests. If you use git, make sure you have cloned " + "submodules:\n" + " git submodule update --init --recursive\n" + "If instead you want to skip them, run cmake with:\n" + " cmake -Dprotobuf_BUILD_CONFORMANCE=OFF\n") + endif() +elseif(protobuf_JSONCPP_PROVIDER STREQUAL "package") + find_package(jsoncpp REQUIRED) +endif() + +set(protoc_cpp_args) +if (protobuf_BUILD_SHARED_LIBS) + set(protoc_cpp_args "dllexport_decl=PROTOBUF_TEST_EXPORTS:") +endif () add_custom_command( - OUTPUT ${protobuf_source_dir}/conformance/conformance.pb.cc - DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto - COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/conformance/conformance.proto - --proto_path=${protobuf_source_dir}/conformance - --cpp_out=${protobuf_source_dir}/conformance + OUTPUT + ${protobuf_SOURCE_DIR}/conformance/conformance.pb.h + ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc + DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto + COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto + --proto_path=${protobuf_SOURCE_DIR}/conformance + --cpp_out=${protoc_cpp_args}${protobuf_SOURCE_DIR}/conformance ) add_custom_command( - OUTPUT ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc - DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto - ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto - COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto - --proto_path=${protobuf_source_dir}/src - --cpp_out=${protobuf_source_dir}/src + OUTPUT + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc + DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto + ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto + COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto + --proto_path=${protobuf_SOURCE_DIR}/src + --cpp_out=${protoc_cpp_args}${protobuf_SOURCE_DIR}/src ) +add_library(libconformance_common ${protobuf_SHARED_OR_STATIC} + ${protobuf_SOURCE_DIR}/conformance/conformance.pb.h + ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc +) +target_link_libraries(libconformance_common + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} +) +if(protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libconformance_common + PUBLIC PROTOBUF_USE_DLLS + PRIVATE LIBPROTOBUF_TEST_EXPORTS) +endif() + add_executable(conformance_test_runner - ${protobuf_source_dir}/conformance/conformance.pb.cc - ${protobuf_source_dir}/conformance/conformance_test.cc - ${protobuf_source_dir}/conformance/binary_json_conformance_main.cc - ${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc - ${protobuf_source_dir}/conformance/binary_json_conformance_suite.h - ${protobuf_source_dir}/conformance/conformance_test_runner.cc - ${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h - ${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc + ${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.cc + ${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.h + ${protobuf_SOURCE_DIR}/conformance/conformance_test.cc + ${protobuf_SOURCE_DIR}/conformance/conformance_test_runner.cc + ${protobuf_SOURCE_DIR}/conformance/conformance_test_main.cc + ${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.cc + ${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.h ) add_executable(conformance_cpp - ${protobuf_source_dir}/conformance/conformance.pb.cc - ${protobuf_source_dir}/conformance/conformance_cpp.cc - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc - ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc + ${protobuf_SOURCE_DIR}/conformance/conformance_cpp.cc ) target_include_directories( conformance_test_runner - PUBLIC ${protobuf_source_dir}/conformance) + PUBLIC ${protobuf_SOURCE_DIR} ${protobuf_SOURCE_DIR}/conformance) target_include_directories( conformance_cpp - PUBLIC ${protobuf_source_dir}/conformance) + PUBLIC ${protobuf_SOURCE_DIR}) + +target_include_directories(conformance_test_runner PRIVATE ${ABSL_ROOT_DIR}) +target_include_directories(conformance_cpp PRIVATE ${ABSL_ROOT_DIR}) + +target_link_libraries(conformance_test_runner + libconformance_common + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} +) +target_link_libraries(conformance_cpp + libconformance_common + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} +) + +add_test(NAME conformance_cpp_test + COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/conformance_test_runner + --failure_list ${protobuf_SOURCE_DIR}/conformance/failure_list_cpp.txt + --text_format_failure_list ${protobuf_SOURCE_DIR}/conformance/text_format_failure_list_cpp.txt + --output_dir ${protobuf_TEST_XML_OUTDIR} + ${CMAKE_CURRENT_BINARY_DIR}/conformance_cpp + DEPENDS conformance_test_runner conformance_cpp) -target_link_libraries(conformance_test_runner libprotobuf) -target_link_libraries(conformance_cpp libprotobuf) +set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Disable tests") +if(protobuf_JSONCPP_PROVIDER STREQUAL "module") + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp third_party/jsoncpp) + target_include_directories(conformance_test_runner PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp/include) + if(BUILD_SHARED_LIBS) + target_link_libraries(conformance_test_runner jsoncpp_lib) + else() + target_link_libraries(conformance_test_runner jsoncpp_static) + endif() +else() + target_link_libraries(conformance_test_runner jsoncpp) +endif() diff --git a/cmake/examples.cmake b/cmake/examples.cmake index e5cad63..07cfad2 100644 --- a/cmake/examples.cmake +++ b/cmake/examples.cmake @@ -2,7 +2,7 @@ if(protobuf_VERBOSE) message(STATUS "Protocol Buffers Examples Configuring...") endif() -get_filename_component(examples_dir "../examples" ABSOLUTE) +get_filename_component(examples_dir "${protobuf_SOURCE_DIR}/examples" ABSOLUTE) if(protobuf_VERBOSE) message(STATUS "Protocol Buffers Examples Configuring done") @@ -30,7 +30,7 @@ endfunction() # Add examples as an external project. # sub_directory cannot be used because the find_package(protobuf) call would cause failures with redefined targets. add_examples_build(examples "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}") -add_dependencies(examples libprotobuf protoc) +add_dependencies(examples ${protobuf_LIB_PROTOBUF} ${protobuf_PROTOC_EXE}) option(protobuf_BUILD_EXAMPLES_MULTITEST "Build Examples in multiple configurations. Useful for testing." OFF) mark_as_advanced(protobuf_BUILD_EXAMPLES_MULTITEST) @@ -42,7 +42,7 @@ if(protobuf_BUILD_EXAMPLES_MULTITEST) "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}" "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE" ) - add_dependencies(examples-legacy libprotobuf protoc) + add_dependencies(examples-legacy ${protobuf_LIB_PROTOBUF} ${protobuf_PROTOC_EXE}) #Build using the installed library. add_examples_build(examples-installed diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in deleted file mode 100644 index 007cc80..0000000 --- a/cmake/extract_includes.bat.in +++ /dev/null @@ -1,131 +0,0 @@ -mkdir include -mkdir include\google -mkdir include\google\protobuf -mkdir include\google\protobuf\compiler -mkdir include\google\protobuf\compiler\cpp -mkdir include\google\protobuf\compiler\csharp -mkdir include\google\protobuf\compiler\java -mkdir include\google\protobuf\compiler\js -mkdir include\google\protobuf\compiler\objectivec -mkdir include\google\protobuf\compiler\php -mkdir include\google\protobuf\compiler\python -mkdir include\google\protobuf\compiler\ruby -mkdir include\google\protobuf\io -mkdir include\google\protobuf\stubs -mkdir include\google\protobuf\util -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h" include\google\protobuf\any.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h" include\google\protobuf\any.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h" include\google\protobuf\api.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h" include\google\protobuf\arena.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena_impl.h" include\google\protobuf\arena_impl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h" include\google\protobuf\descriptor.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h" include\google\protobuf\descriptor_database.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\inlined_string_field.h" include\google\protobuf\inlined_string_field.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\io_win32.h" include\google\protobuf\io\io_win32.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h" include\google\protobuf\io\strtod.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h" include\google\protobuf\io\tokenizer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h" include\google\protobuf\io\zero_copy_stream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h" include\google\protobuf\io\zero_copy_stream_impl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h" include\google\protobuf\io\zero_copy_stream_impl_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h" include\google\protobuf\map.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h" include\google\protobuf\map_entry.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h" include\google\protobuf\map_entry_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h" include\google\protobuf\map_field.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h" include\google\protobuf\map_field_inl.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h" include\google\protobuf\map_field_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h" include\google\protobuf\map_type_handler.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\google\protobuf\message.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\parse_context.h" include\google\protobuf\parse_context.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port.h" include\google\protobuf\port.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_def.inc" include\google\protobuf\port_def.inc -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" include\google\protobuf\port_undef.inc -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h" include\google\protobuf\stubs\fastmem.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h" include\google\protobuf\stubs\hash.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\map_util.h" include\google\protobuf\stubs\map_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\strutil.h" include\google\protobuf\stubs\strutil.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h" include\google\protobuf\type.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h" include\google\protobuf\unknown_field_set.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\delimited_message_util.h" include\google\protobuf\util\delimited_message_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_comparator.h" include\google\protobuf\util\field_comparator.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_mask_util.h" include\google\protobuf\util\field_mask_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\json_util.h" include\google\protobuf\util\json_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\message_differencer.h" include\google\protobuf\util\message_differencer.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\time_util.h" include\google\protobuf\util\time_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h" include\google\protobuf\util\type_resolver.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h" include\google\protobuf\util\type_resolver_util.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" include\google\protobuf\wire_format.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.proto" include\google\protobuf\descriptor.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.proto" include\google\protobuf\duration.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.proto" include\google\protobuf\empty.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.proto" include\google\protobuf\field_mask.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.proto" include\google\protobuf\source_context.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.proto" include\google\protobuf\struct.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.proto" include\google\protobuf\timestamp.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.proto" include\google\protobuf\type.proto -copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.proto" include\google\protobuf\wrappers.proto diff --git a/cmake/gtest.cmake b/cmake/gtest.cmake new file mode 100644 index 0000000..b891db9 --- /dev/null +++ b/cmake/gtest.cmake @@ -0,0 +1,48 @@ +option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF) + +if (protobuf_USE_EXTERNAL_GTEST) + find_package(GTest REQUIRED CONFIG) +else() + if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt") + message(FATAL_ERROR + "Cannot find third_party/googletest directory that's needed to " + "build tests. If you use git, make sure you have cloned submodules:\n" + " git submodule update --init --recursive\n" + "If instead you want to skip tests, run cmake with:\n" + " cmake -Dprotobuf_BUILD_TESTS=OFF\n") + endif() + + set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock") + set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest") + include_directories( + ${googlemock_source_dir} + ${googletest_source_dir} + ${googletest_source_dir}/include + ${googlemock_source_dir}/include + ) + + add_library(gmock ${protobuf_SHARED_OR_STATIC} + "${googlemock_source_dir}/src/gmock-all.cc" + "${googletest_source_dir}/src/gtest-all.cc" + ) + if (protobuf_BUILD_SHARED_LIBS) + set_target_properties(gmock + PROPERTIES + COMPILE_DEFINITIONS + "GTEST_CREATE_SHARED_LIBRARY=1" + ) + + endif() + if (protobuf_INSTALL) + set(protobuf_INSTALL_TESTS ON) + endif() + + target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) + add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc") + target_link_libraries(gmock_main gmock) + + add_library(GTest::gmock ALIAS gmock) + add_library(GTest::gmock_main ALIAS gmock_main) + add_library(GTest::gtest ALIAS gmock) + add_library(GTest::gtest_main ALIAS gmock_main) +endif() diff --git a/cmake/install.cmake b/cmake/install.cmake index be47c54..9679d5b 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -1,19 +1,36 @@ include(GNUInstallDirs) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake +foreach(_target IN LISTS protobuf_ABSL_USED_TARGETS) + string(REPLACE :: _ _modified_target ${_target}) + list(APPEND _pc_targets ${_modified_target}) +endforeach() +list(APPEND _pc_targets "utf8_range") + +set(_protobuf_PC_REQUIRES "") +set(_sep "") +foreach (_target IN LISTS _pc_targets) + string(CONCAT _protobuf_PC_REQUIRES "${_protobuf_PC_REQUIRES}" "${_sep}" "${_target}") + set(_sep " ") +endforeach () +set(_protobuf_PC_CFLAGS) +if (protobuf_BUILD_SHARED_LIBS) + set(_protobuf_PC_CFLAGS -DPROTOBUF_USE_DLLS) +endif () + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY) set(_protobuf_libraries libprotobuf-lite libprotobuf) -if (protobuf_BUILD_PROTOC_BINARIES) +if (protobuf_BUILD_LIBPROTOC) list(APPEND _protobuf_libraries libprotoc) -endif (protobuf_BUILD_PROTOC_BINARIES) +endif (protobuf_BUILD_LIBPROTOC) foreach(_library ${_protobuf_libraries}) set_property(TARGET ${_library} PROPERTY INTERFACE_INCLUDE_DIRECTORIES - $ + $ $) if (UNIX AND NOT APPLE) set_property(TARGET ${_library} @@ -30,7 +47,8 @@ endforeach() if (protobuf_BUILD_PROTOC_BINARIES) install(TARGETS protoc EXPORT protobuf-targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc + BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) if (UNIX AND NOT APPLE) set_property(TARGET protoc PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") @@ -42,102 +60,77 @@ endif (protobuf_BUILD_PROTOC_BINARIES) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") -file(STRINGS extract_includes.bat.in _extract_strings - REGEX "^copy") -foreach(_extract_string ${_extract_strings}) - string(REGEX REPLACE "^.* .+ include\\\\(.+)$" "\\1" - _header ${_extract_string}) - string(REPLACE "\\" "/" _header ${_header}) - get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/../src/${_header}" ABSOLUTE) - get_filename_component(_extract_name ${_header} NAME) - get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" PATH) - if(EXISTS "${_extract_from}") - install(FILES "${_extract_from}" - DESTINATION "${_extract_to}" - COMPONENT protobuf-headers - RENAME "${_extract_name}") - else() - message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in " - "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" " - "but there not exists. The file will not be installed.") - endif() -endforeach() - -# Internal function for parsing auto tools scripts -function(_protobuf_auto_list FILE_NAME VARIABLE) - file(STRINGS ${FILE_NAME} _strings) - set(_list) - foreach(_string ${_strings}) - set(_found) - string(REGEX MATCH "^[ \t]*${VARIABLE}[ \t]*=[ \t]*" _found "${_string}") - if(_found) - string(LENGTH "${_found}" _length) - string(SUBSTRING "${_string}" ${_length} -1 _draft_list) - foreach(_item ${_draft_list}) - string(STRIP "${_item}" _item) - list(APPEND _list "${_item}") - endforeach() - endif() - endforeach() - set(${VARIABLE} ${_list} PARENT_SCOPE) -endfunction() - -# Install well-known type proto files -_protobuf_auto_list("../src/Makefile.am" nobase_dist_proto_DATA) -foreach(_file ${nobase_dist_proto_DATA}) - get_filename_component(_file_from "../src/${_file}" ABSOLUTE) - get_filename_component(_file_name ${_file} NAME) - get_filename_component(_file_path ${_file} PATH) - if(EXISTS "${_file_from}") - install(FILES "${_file_from}" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_file_path}" - COMPONENT protobuf-protos - RENAME "${_file_name}") - else() - message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in " - "\"${protobuf_SOURCE_DIR}/../src/Makefile.am\" as nobase_dist_proto_DATA " - "but there not exists. The file will not be installed.") +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) +set(protobuf_HEADERS + ${libprotobuf_hdrs} + ${libprotoc_hdrs} + ${wkt_protos_files} + ${cpp_features_proto_proto_srcs} + ${descriptor_proto_proto_srcs} + ${plugin_proto_proto_srcs} + ${java_features_proto_proto_srcs} +) +foreach(_header ${protobuf_HEADERS}) + string(FIND ${_header} "${protobuf_SOURCE_DIR}/src" _find_src) + string(FIND ${_header} "${protobuf_SOURCE_DIR}" _find_nosrc) + if (_find_src GREATER -1) + set(_from_dir "${protobuf_SOURCE_DIR}/src") + elseif (_find_nosrc GREATER -1) + set(_from_dir "${protobuf_SOURCE_DIR}") endif() + # On some platforms `_form_dir` ends up being just "protobuf", which can + # easily match multiple times in our paths. We force it to only replace + # prefixes to avoid this case. + string(REGEX REPLACE "^${_from_dir}" "" _header ${_header}) + get_filename_component(_extract_from "${_from_dir}/${_header}" ABSOLUTE) + get_filename_component(_extract_name ${_header} NAME) + get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" DIRECTORY) + install(FILES "${_extract_from}" + DESTINATION "${_extract_to}" + COMPONENT protobuf-headers + RENAME "${_extract_name}") endforeach() # Install configuration -set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files") +set(_install_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files") +set(_build_cmakedir_desc "Directory relative to CMAKE_CURRENT_BINARY_DIR for cmake configuration files") +set(_exampledir_desc "Directory relative to CMAKE_INSTALL_DATA to install examples") +set(_protobuf_subdir_desc "Subdirectory in which to install cmake configuration files") if(NOT MSVC) - set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}") + set(protobuf_CMAKE_SUBDIR "cmake/protobuf" CACHE STRING "${_protobuf_subdir_desc}") + set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/${protobuf_CMAKE_SUBDIR}" CACHE STRING "${_install_cmakedir_desc}") + set(CMAKE_INSTALL_EXAMPLEDIR "${CMAKE_INSTALL_DATADIR}/protobuf/examples" CACHE STRING "${_exampledir_desc}") else() + set(protobuf_CMAKE_SUBDIR "cmake" CACHE STRING "${_protobuf_subdir_desc}") set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}") + set(CMAKE_INSTALL_EXAMPLEDIR "examples" CACHE STRING "${_exampledir_desc}") endif() +set(CMAKE_BUILD_CMAKEDIR "${CMAKE_CURRENT_BINARY_DIR}/${protobuf_CMAKE_SUBDIR}" CACHE STRING "${_build_cmakedir_desc}") +mark_as_advanced(protobuf_CMAKE_SUBDIR) +mark_as_advanced(CMAKE_BUILD_CMAKEDIR) mark_as_advanced(CMAKE_INSTALL_CMAKEDIR) +mark_as_advanced(CMAKE_INSTALL_EXAMPLEDIR) -configure_file(protobuf-config.cmake.in - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY) -configure_file(protobuf-config-version.cmake.in - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY) -configure_file(protobuf-module.cmake.in - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY) -configure_file(protobuf-options.cmake - ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY) +configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config.cmake.in + ${CMAKE_BUILD_CMAKEDIR}/protobuf-config.cmake @ONLY) +configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config-version.cmake.in + ${CMAKE_BUILD_CMAKEDIR}/protobuf-config-version.cmake @ONLY) +configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-module.cmake.in + ${CMAKE_BUILD_CMAKEDIR}/protobuf-module.cmake @ONLY) +configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake + ${CMAKE_BUILD_CMAKEDIR}/protobuf-options.cmake @ONLY) +configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-generate.cmake + ${CMAKE_BUILD_CMAKEDIR}/protobuf-generate.cmake @ONLY) # Allows the build directory to be used as a find directory. -if (protobuf_BUILD_PROTOC_BINARIES) - export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc - NAMESPACE protobuf:: - FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake - ) -else (protobuf_BUILD_PROTOC_BINARIES) - export(TARGETS libprotobuf-lite libprotobuf - NAMESPACE protobuf:: - FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake - ) -endif (protobuf_BUILD_PROTOC_BINARIES) - install(EXPORT protobuf-targets DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" NAMESPACE protobuf:: - COMPONENT protobuf-export) + COMPONENT protobuf-export +) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ +install(DIRECTORY ${CMAKE_BUILD_CMAKEDIR}/ DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" COMPONENT protobuf-export PATTERN protobuf-targets.cmake EXCLUDE @@ -145,6 +138,14 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF) if(protobuf_INSTALL_EXAMPLES) - install(DIRECTORY ../examples/ DESTINATION examples + install(DIRECTORY examples/ + DESTINATION "${CMAKE_INSTALL_EXAMPLEDIR}" COMPONENT protobuf-examples) endif() + +if (protobuf_INSTALL_TESTS) + install(TARGETS gmock EXPORT protobuf-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake index 6bf86a2..f343458 100644 --- a/cmake/libprotobuf-lite.cmake +++ b/cmake/libprotobuf-lite.cmake @@ -1,74 +1,32 @@ -set(libprotobuf_lite_files - ${protobuf_source_dir}/src/google/protobuf/any_lite.cc - ${protobuf_source_dir}/src/google/protobuf/arena.cc - ${protobuf_source_dir}/src/google/protobuf/extension_set.cc - ${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc - ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc - ${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc - ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc - ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc - ${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc - ${protobuf_source_dir}/src/google/protobuf/io/strtod.cc - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc - ${protobuf_source_dir}/src/google/protobuf/message_lite.cc - ${protobuf_source_dir}/src/google/protobuf/parse_context.cc - ${protobuf_source_dir}/src/google/protobuf/repeated_field.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/common.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/status.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/time.cc - ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc -) - -set(libprotobuf_lite_includes - ${protobuf_source_dir}/src/google/protobuf/arena.h - ${protobuf_source_dir}/src/google/protobuf/arenastring.h - ${protobuf_source_dir}/src/google/protobuf/extension_set.h - ${protobuf_source_dir}/src/google/protobuf/generated_message_util.h - ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h - ${protobuf_source_dir}/src/google/protobuf/parse_context.h - ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h - ${protobuf_source_dir}/src/google/protobuf/io/strtod.h - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h - ${protobuf_source_dir}/src/google/protobuf/message_lite.h - ${protobuf_source_dir}/src/google/protobuf/repeated_field.h - ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h - ${protobuf_source_dir}/src/google/protobuf/stubs/common.h - ${protobuf_source_dir}/src/google/protobuf/stubs/int128.h - ${protobuf_source_dir}/src/google/protobuf/stubs/once.h - ${protobuf_source_dir}/src/google/protobuf/stubs/status.h - ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h - ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h - ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h - ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h - ${protobuf_source_dir}/src/google/protobuf/stubs/time.h - ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h -) +# CMake definitions for libprotobuf_lite (the "lite" C++ protobuf runtime). -if (MSVC) -set(libprotobuf_lite_rc_files - ${CMAKE_CURRENT_BINARY_DIR}/version.rc -) -endif() +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) +include(${protobuf_SOURCE_DIR}/cmake/protobuf-configure-target.cmake) add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files}) -target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT}) + ${libprotobuf_lite_srcs} + ${libprotobuf_lite_hdrs} + ${protobuf_version_rc_file}) +if(protobuf_HAVE_LD_VERSION_SCRIPT) + if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) + target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) + elseif(protobuf_BUILD_SHARED_LIBS) + target_link_libraries(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) + endif() + set_target_properties(libprotobuf-lite PROPERTIES + LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map) +endif() +target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT}) if(protobuf_LINK_LIBATOMIC) - target_link_libraries(libprotobuf-lite atomic) + target_link_libraries(libprotobuf-lite PRIVATE atomic) +endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + target_link_libraries(libprotobuf-lite PRIVATE log) endif() -target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src) -if(MSVC AND protobuf_BUILD_SHARED_LIBS) +target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src) +target_link_libraries(libprotobuf-lite PUBLIC ${protobuf_ABSL_USED_TARGETS}) +protobuf_configure_target(libprotobuf-lite) +if(protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotobuf-lite PUBLIC PROTOBUF_USE_DLLS PRIVATE LIBPROTOBUF_EXPORTS) @@ -76,5 +34,12 @@ endif() set_target_properties(libprotobuf-lite PROPERTIES VERSION ${protobuf_VERSION} OUTPUT_NAME ${LIB_PREFIX}protobuf-lite - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}" + # For -fvisibility=hidden and -fvisibility-inlines-hidden + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON +) add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) + +target_link_libraries(libprotobuf-lite PRIVATE utf8_validity) diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index 0c12596..422754a 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -1,128 +1,35 @@ -set(libprotobuf_files - ${protobuf_source_dir}/src/google/protobuf/any.cc - ${protobuf_source_dir}/src/google/protobuf/any.pb.cc - ${protobuf_source_dir}/src/google/protobuf/api.pb.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/importer.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/parser.cc - ${protobuf_source_dir}/src/google/protobuf/descriptor.cc - ${protobuf_source_dir}/src/google/protobuf/descriptor.pb.cc - ${protobuf_source_dir}/src/google/protobuf/descriptor_database.cc - ${protobuf_source_dir}/src/google/protobuf/duration.pb.cc - ${protobuf_source_dir}/src/google/protobuf/dynamic_message.cc - ${protobuf_source_dir}/src/google/protobuf/empty.pb.cc - ${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc - ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc - ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc - ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc - ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc - ${protobuf_source_dir}/src/google/protobuf/io/printer.cc - ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc - ${protobuf_source_dir}/src/google/protobuf/map_field.cc - ${protobuf_source_dir}/src/google/protobuf/message.cc - ${protobuf_source_dir}/src/google/protobuf/reflection_ops.cc - ${protobuf_source_dir}/src/google/protobuf/service.cc - ${protobuf_source_dir}/src/google/protobuf/source_context.pb.cc - ${protobuf_source_dir}/src/google/protobuf/struct.pb.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.cc - ${protobuf_source_dir}/src/google/protobuf/text_format.cc - ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.cc - ${protobuf_source_dir}/src/google/protobuf/type.pb.cc - ${protobuf_source_dir}/src/google/protobuf/unknown_field_set.cc - ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.cc - ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.cc - ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc - ${protobuf_source_dir}/src/google/protobuf/util/json_util.cc - ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc - ${protobuf_source_dir}/src/google/protobuf/util/time_util.cc - ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.cc - ${protobuf_source_dir}/src/google/protobuf/wire_format.cc - ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc -) - -set(libprotobuf_includes - ${protobuf_source_dir}/src/google/protobuf/any.h - ${protobuf_source_dir}/src/google/protobuf/any.pb.h - ${protobuf_source_dir}/src/google/protobuf/api.pb.h - ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h - ${protobuf_source_dir}/src/google/protobuf/compiler/parser.h - ${protobuf_source_dir}/src/google/protobuf/descriptor.h - ${protobuf_source_dir}/src/google/protobuf/descriptor.pb.h - ${protobuf_source_dir}/src/google/protobuf/descriptor_database.h - ${protobuf_source_dir}/src/google/protobuf/duration.pb.h - ${protobuf_source_dir}/src/google/protobuf/dynamic_message.h - ${protobuf_source_dir}/src/google/protobuf/empty.pb.h - ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h - ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h - ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h - ${protobuf_source_dir}/src/google/protobuf/io/printer.h - ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h - ${protobuf_source_dir}/src/google/protobuf/map_field.h - ${protobuf_source_dir}/src/google/protobuf/message.h - ${protobuf_source_dir}/src/google/protobuf/reflection_ops.h - ${protobuf_source_dir}/src/google/protobuf/service.h - ${protobuf_source_dir}/src/google/protobuf/source_context.pb.h - ${protobuf_source_dir}/src/google/protobuf/struct.pb.h - ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h - ${protobuf_source_dir}/src/google/protobuf/text_format.h - ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h - ${protobuf_source_dir}/src/google/protobuf/type.pb.h - ${protobuf_source_dir}/src/google/protobuf/unknown_field_set.h - ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h - ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h - ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h - ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h - ${protobuf_source_dir}/src/google/protobuf/util/json_util.h - ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h - ${protobuf_source_dir}/src/google/protobuf/util/time_util.h - ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h - ${protobuf_source_dir}/src/google/protobuf/wire_format.h - ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h -) +# CMake definitions for libprotobuf (the "full" C++ protobuf runtime). -if (MSVC) -set(libprotobuf_rc_files - ${CMAKE_CURRENT_BINARY_DIR}/version.rc -) -endif() +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) +include(${protobuf_SOURCE_DIR}/cmake/protobuf-configure-target.cmake) add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files}) -target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT}) + ${libprotobuf_srcs} + ${libprotobuf_hdrs} + ${protobuf_version_rc_file}) +if(protobuf_HAVE_LD_VERSION_SCRIPT) + if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) + target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map) + elseif(protobuf_BUILD_SHARED_LIBS) + target_link_libraries(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map) + endif() + set_target_properties(libprotobuf PROPERTIES + LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map) +endif() +target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT}) if(protobuf_WITH_ZLIB) - target_link_libraries(libprotobuf ${ZLIB_LIBRARIES}) + target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES}) endif() if(protobuf_LINK_LIBATOMIC) - target_link_libraries(libprotobuf atomic) + target_link_libraries(libprotobuf PRIVATE atomic) +endif() +if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + target_link_libraries(libprotobuf PRIVATE log) endif() -target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) -if(MSVC AND protobuf_BUILD_SHARED_LIBS) +target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src) +target_link_libraries(libprotobuf PUBLIC ${protobuf_ABSL_USED_TARGETS}) +protobuf_configure_target(libprotobuf) +if(protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotobuf PUBLIC PROTOBUF_USE_DLLS PRIVATE LIBPROTOBUF_EXPORTS) @@ -130,5 +37,12 @@ endif() set_target_properties(libprotobuf PROPERTIES VERSION ${protobuf_VERSION} OUTPUT_NAME ${LIB_PREFIX}protobuf - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}" + # For -fvisibility=hidden and -fvisibility-inlines-hidden + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON +) add_library(protobuf::libprotobuf ALIAS libprotobuf) + +target_link_libraries(libprotobuf PRIVATE utf8_validity) diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake index b71f2f1..38a67aa 100644 --- a/cmake/libprotoc.cmake +++ b/cmake/libprotoc.cmake @@ -1,174 +1,25 @@ -set(libprotoc_files - ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc -) - -set(libprotoc_headers - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h - ${protobuf_source_dir}/src/google/protobuf/compiler/scc.h - ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h - ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h -) +# CMake definitions for libprotoc (the protobuf compiler library). -if (MSVC) -set(libprotoc_rc_files - ${CMAKE_CURRENT_BINARY_DIR}/version.rc -) -endif() +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) +include(${protobuf_SOURCE_DIR}/cmake/protobuf-configure-target.cmake) add_library(libprotoc ${protobuf_SHARED_OR_STATIC} - ${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files}) -target_link_libraries(libprotoc libprotobuf) -if(MSVC AND protobuf_BUILD_SHARED_LIBS) + ${libprotoc_srcs} + ${libprotoc_hdrs} + ${protobuf_version_rc_file}) +if(protobuf_HAVE_LD_VERSION_SCRIPT) + if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13) + target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map) + elseif(protobuf_BUILD_SHARED_LIBS) + target_link_libraries(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map) + endif() + set_target_properties(libprotoc PROPERTIES + LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map) +endif() +target_link_libraries(libprotoc PRIVATE libprotobuf) +target_link_libraries(libprotoc PUBLIC ${protobuf_ABSL_USED_TARGETS}) +protobuf_configure_target(libprotoc) +if(protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotoc PUBLIC PROTOBUF_USE_DLLS PRIVATE LIBPROTOC_EXPORTS) @@ -177,6 +28,10 @@ set_target_properties(libprotoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS VERSION ${protobuf_VERSION} OUTPUT_NAME ${LIB_PREFIX}protoc - DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}" + # For -fvisibility=hidden and -fvisibility-inlines-hidden + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON +) add_library(protobuf::libprotoc ALIAS libprotoc) - diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in index 11b85d3..44805c7 100644 --- a/cmake/protobuf-config.cmake.in +++ b/cmake/protobuf-config.cmake.in @@ -3,144 +3,14 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake") # Depend packages @_protobuf_FIND_ZLIB@ +@_protobuf_FIND_ABSL@ +@_protobuf_FIND_UTF8_RANGE@ # Imported targets include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake") -function(protobuf_generate) - include(CMakeParseArguments) - - set(_options APPEND_PATH) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN) - if(COMMAND target_sources) - list(APPEND _singleargs TARGET) - endif() - set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS) - - cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") - - if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) - message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") - return() - endif() - - if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) - message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") - return() - endif() - - if(NOT protobuf_generate_LANGUAGE) - set(protobuf_generate_LANGUAGE cpp) - endif() - string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) - - if(NOT protobuf_generate_PROTOC_OUT_DIR) - set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) - set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") - endif() - - if(protobuf_generate_PLUGIN) - set(_plugin "--plugin=${protobuf_generate_PLUGIN}") - endif() - - if(NOT protobuf_generate_GENERATE_EXTENSIONS) - if(protobuf_generate_LANGUAGE STREQUAL cpp) - set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) - elseif(protobuf_generate_LANGUAGE STREQUAL python) - set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) - else() - message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") - return() - endif() - endif() - - if(protobuf_generate_TARGET) - get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) - foreach(_file ${_source_list}) - if(_file MATCHES "proto$") - list(APPEND protobuf_generate_PROTOS ${_file}) - endif() - endforeach() - endif() - - if(NOT protobuf_generate_PROTOS) - message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") - return() - endif() - - if(protobuf_generate_APPEND_PATH) - # Create an include path for each file specified - foreach(_file ${protobuf_generate_PROTOS}) - get_filename_component(_abs_file ${_file} ABSOLUTE) - get_filename_component(_abs_path ${_abs_file} PATH) - list(FIND _protobuf_include_path ${_abs_path} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${_abs_path}) - endif() - endforeach() - endif() - - foreach(DIR ${protobuf_generate_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - - if(NOT _protobuf_include_path) - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - set(_generated_srcs_all) - foreach(_proto ${protobuf_generate_PROTOS}) - get_filename_component(_abs_file ${_proto} ABSOLUTE) - get_filename_component(_abs_dir ${_abs_file} DIRECTORY) - get_filename_component(_basename ${_proto} NAME_WLE) - - set(_suitable_include_found FALSE) - foreach(DIR ${_protobuf_include_path}) - if(NOT DIR STREQUAL "-I") - file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir}) - if(NOT "${_rel_dir}" MATCHES "^\.\.[/\\].*") - set(_suitable_include_found TRUE) - break() - endif() - endif() - endforeach() - - if(NOT _suitable_include_found) - message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.") - return() - endif() - - set(_generated_srcs) - foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) - list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") - endforeach() - list(APPEND _generated_srcs_all ${_generated_srcs}) - - add_custom_command( - OUTPUT ${_generated_srcs} - COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} - DEPENDS ${_abs_file} protobuf::protoc - COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" - VERBATIM ) - endforeach() - - set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) - if(protobuf_generate_OUT_VAR) - set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) - endif() - if(protobuf_generate_TARGET) - target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) - endif() - -endfunction() +# protobuf-generate function +include("${CMAKE_CURRENT_LIST_DIR}/protobuf-generate.cmake") # CMake FindProtobuf module compatible file if(protobuf_MODULE_COMPATIBLE) diff --git a/cmake/protobuf-configure-target.cmake b/cmake/protobuf-configure-target.cmake new file mode 100644 index 0000000..f57397f --- /dev/null +++ b/cmake/protobuf-configure-target.cmake @@ -0,0 +1,55 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2013 Google LLC 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 + +# Refactors configuration options set on all Protobuf targets +function(protobuf_configure_target target) + target_compile_features("${target}" PUBLIC cxx_std_14) + if (MSVC) + # Build with multiple processes + target_compile_options("${target}" PRIVATE /MP) + # Set source file and execution character sets to UTF-8 + target_compile_options("${target}" PRIVATE /utf-8) + # MSVC warning suppressions + target_compile_options("${target}" PRIVATE + /wd4065 # switch statement contains 'default' but no 'case' labels + /wd4146 # unary minus operator applied to unsigned type + /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data + /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' + /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data + /wd4305 # 'identifier' : truncation from 'type1' to 'type2' + /wd4307 # 'operator' : integral constant overflow + /wd4309 # 'conversion' : truncation of constant value + /wd4334 # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) + /wd4355 # 'this' : used in base member initializer list + /wd4506 # no definition for inline function 'function' + /wd4800 # 'type' : forcing value to bool 'true' or 'false' (performance warning) + /wd4996 # The compiler encountered a deprecated declaration. + ) + # Allow big object + target_compile_options("${target}" PRIVATE /bigobj) + endif () + if (protobuf_UNICODE) + target_compile_definitions("${target}" PRIVATE -DUNICODE -D_UNICODE) + endif () + target_compile_definitions("${target}" PRIVATE -DGOOGLE_PROTOBUF_CMAKE_BUILD) + + if (protobuf_DISABLE_RTTI) + target_compile_definitions("${target}" PRIVATE -DGOOGLE_PROTOBUF_NO_RTTI=1) + endif() + + # The Intel compiler isn't able to deal with noinline member functions of + # template classes defined in headers. As such it spams the output with + # warning #2196: routine is both "inline" and "noinline" + # This silences that warning. + if (CMAKE_CXX_COMPILER_ID MATCHES Intel) + target_compile_options("${target}" PRIVATE -diag-disable=2196) + endif() + + if (HAVE_ZLIB) + target_compile_definitions("${target}" PRIVATE -DHAVE_ZLIB) + endif () +endfunction () diff --git a/cmake/protobuf-generate.cmake b/cmake/protobuf-generate.cmake new file mode 100644 index 0000000..1956121 --- /dev/null +++ b/cmake/protobuf-generate.cmake @@ -0,0 +1,161 @@ +function(protobuf_generate) + include(CMakeParseArguments) + + set(_options APPEND_PATH) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES) + if(COMMAND target_sources) + list(APPEND _singleargs TARGET) + endif() + set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS) + + cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}") + + if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") + return() + endif() + + if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") + return() + endif() + + if(NOT protobuf_generate_LANGUAGE) + set(protobuf_generate_LANGUAGE cpp) + endif() + string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) + + if(NOT protobuf_generate_PROTOC_OUT_DIR) + set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp) + set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}") + endif() + + foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS}) + # append comma - not using CMake lists and string replacement as users + # might have semicolons in options + if(_plugin_options) + set( _plugin_options "${_plugin_options},") + endif() + set(_plugin_options "${_plugin_options}${_option}") + endforeach() + + if(protobuf_generate_PLUGIN) + set(_plugin "--plugin=${protobuf_generate_PLUGIN}") + endif() + + if(NOT protobuf_generate_GENERATE_EXTENSIONS) + if(protobuf_generate_LANGUAGE STREQUAL cpp) + set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) + elseif(protobuf_generate_LANGUAGE STREQUAL python) + set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py) + else() + message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") + return() + endif() + endif() + + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) + endif() + endforeach() + endif() + + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() + endif() + + if(protobuf_generate_APPEND_PATH) + # Create an include path for each file specified + foreach(_file ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_file} ABSOLUTE) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + list(FIND _protobuf_include_path ${_abs_dir} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${_abs_dir}) + endif() + endforeach() + endif() + + foreach(DIR ${protobuf_generate_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + + if(NOT _protobuf_include_path) + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + set(_generated_srcs_all) + foreach(_proto ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_proto} ABSOLUTE) + get_filename_component(_abs_dir ${_abs_file} DIRECTORY) + + get_filename_component(_file_full_name ${_proto} NAME) + string(FIND "${_file_full_name}" "." _file_last_ext_pos REVERSE) + string(SUBSTRING "${_file_full_name}" 0 ${_file_last_ext_pos} _basename) + + set(_suitable_include_found FALSE) + foreach(DIR ${_protobuf_include_path}) + if(NOT DIR STREQUAL "-I") + file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir}) + if(_rel_dir STREQUAL _abs_dir) + # When there is no relative path from DIR to _abs_dir (e.g. due to + # different drive letters on Windows), _rel_dir is equal to _abs_dir. + # Therefore, DIR is not a suitable include path and must be skipped. + continue() + endif() + string(FIND "${_rel_dir}" "../" _is_in_parent_folder) + if (NOT ${_is_in_parent_folder} EQUAL 0) + set(_suitable_include_found TRUE) + break() + endif() + endif() + endforeach() + + if(NOT _suitable_include_found) + message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.") + return() + endif() + + set(_generated_srcs) + foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS}) + list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}") + endforeach() + list(APPEND _generated_srcs_all ${_generated_srcs}) + + set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}") + if(protobuf_generate_PROTOC_OPTIONS) + set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}") + endif() + if(_plugin_options) + set(_comment "${_comment}, plugin-options: ${_plugin_options}") + endif() + + add_custom_command( + OUTPUT ${_generated_srcs} + COMMAND protobuf::protoc + ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${_abs_file} ${protobuf_PROTOC_EXE} ${protobuf_generate_DEPENDENCIES} + COMMENT ${_comment} + VERBATIM ) + endforeach() + + set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE) + if(protobuf_generate_OUT_VAR) + set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE) + endif() + if(protobuf_generate_TARGET) + target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all}) + endif() + +endfunction() diff --git a/cmake/protobuf-lite.pc.cmake b/cmake/protobuf-lite.pc.cmake index cbe5426..eb5869e 100644 --- a/cmake/protobuf-lite.pc.cmake +++ b/cmake/protobuf-lite.pc.cmake @@ -6,6 +6,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ +Requires: @_protobuf_PC_REQUIRES@ Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @_protobuf_PC_CFLAGS@ Conflicts: protobuf diff --git a/cmake/protobuf-module.cmake.in b/cmake/protobuf-module.cmake.in index 74c5488..0bb05e3 100644 --- a/cmake/protobuf-module.cmake.in +++ b/cmake/protobuf-module.cmake.in @@ -94,9 +94,13 @@ function(_protobuf_find_libraries name filename) elseif(${name}_LIBRARY) # Honor cache entry used by CMake 3.5 and lower. set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE) - else() + elseif(TARGET protobuf::lib${filename}) get_target_property(${name}_LIBRARY_RELEASE protobuf::lib${filename} LOCATION_RELEASE) + get_target_property(${name}_LIBRARY_RELWITHDEBINFO protobuf::lib${filename} + LOCATION_RELWITHDEBINFO) + get_target_property(${name}_LIBRARY_MINSIZEREL protobuf::lib${filename} + LOCATION_MINSIZEREL) get_target_property(${name}_LIBRARY_DEBUG protobuf::lib${filename} LOCATION_DEBUG) @@ -106,16 +110,6 @@ function(_protobuf_find_libraries name filename) endif() endfunction() -# Internal function: find threads library -function(_protobuf_find_threads) - set(CMAKE_THREAD_PREFER_PTHREAD TRUE) - find_package(Threads) - if(Threads_FOUND) - list(APPEND PROTOBUF_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - set(PROTOBUF_LIBRARIES "${PROTOBUF_LIBRARIES}" PARENT_SCOPE) - endif() -endfunction() - # # Main. # @@ -135,24 +129,30 @@ _protobuf_find_libraries(Protobuf_LITE protobuf-lite) # The Protobuf Protoc Library _protobuf_find_libraries(Protobuf_PROTOC protoc) -if(UNIX) - _protobuf_find_threads() -endif() - # Set the include directory get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) # Set the protoc Executable -get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc - IMPORTED_LOCATION_RELEASE) -if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") +if(NOT Protobuf_PROTOC_EXECUTABLE AND TARGET protobuf::protoc) get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc - IMPORTED_LOCATION_DEBUG) -endif() -if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") - get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc - IMPORTED_LOCATION_NOCONFIG) + IMPORTED_LOCATION_RELEASE) + if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_RELWITHDEBINFO) + endif() + if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_MINSIZEREL) + endif() + if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_DEBUG) + endif() + if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc + IMPORTED_LOCATION_NOCONFIG) + endif() endif() # Version info variable diff --git a/cmake/protobuf-options.cmake b/cmake/protobuf-options.cmake index 47fb158..93ec898 100644 --- a/cmake/protobuf-options.cmake +++ b/cmake/protobuf-options.cmake @@ -2,6 +2,6 @@ option(protobuf_VERBOSE "Enable for verbose output" OFF) mark_as_advanced(protobuf_VERBOSE) -# FindProtobuf module compatibel -option(protobuf_MODULE_COMPATIBLE "CMake build-in FindProtobuf.cmake module compatible" OFF) +# FindProtobuf module compatible +option(protobuf_MODULE_COMPATIBLE "CMake built-in FindProtobuf.cmake module compatible" OFF) mark_as_advanced(protobuf_MODULE_COMPATIBLE) diff --git a/cmake/protobuf.pc.cmake b/cmake/protobuf.pc.cmake index d33e98c..81d87c1 100644 --- a/cmake/protobuf.pc.cmake +++ b/cmake/protobuf.pc.cmake @@ -6,6 +6,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ +Requires: @_protobuf_PC_REQUIRES@ Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @CMAKE_THREAD_LIBS_INIT@ +Cflags: -I${includedir} @_protobuf_PC_CFLAGS@ Conflicts: protobuf-lite diff --git a/cmake/protoc.cmake b/cmake/protoc.cmake index f90e525..385a7a3 100644 --- a/cmake/protoc.cmake +++ b/cmake/protoc.cmake @@ -1,15 +1,13 @@ set(protoc_files - ${protobuf_source_dir}/src/google/protobuf/compiler/main.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/main.cc ) -if (MSVC) -set(protoc_rc_files - ${CMAKE_CURRENT_BINARY_DIR}/version.rc +add_executable(protoc ${protoc_files} ${protobuf_version_rc_file}) +target_link_libraries(protoc + libprotoc + libprotobuf + ${protobuf_ABSL_USED_TARGETS} ) -endif() - -add_executable(protoc ${protoc_files} ${protoc_rc_files}) -target_link_libraries(protoc libprotoc libprotobuf) add_executable(protobuf::protoc ALIAS protoc) set_target_properties(protoc PROPERTIES diff --git a/cmake/tests.cmake b/cmake/tests.cmake index 4a54b70..489ca65 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -1,96 +1,35 @@ -if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../third_party/googletest/CMakeLists.txt") - message(FATAL_ERROR - "Cannot find third_party/googletest directory that's needed to " - "build tests. If you use git, make sure you have cloned submodules:\n" - " git submodule update --init --recursive\n" - "If instead you want to skip tests, run cmake with:\n" - " cmake -Dprotobuf_BUILD_TESTS=OFF\n") -endif() +option(protobuf_REMOVE_INSTALLED_HEADERS + "Remove local headers so that installed ones are used instead" OFF) option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH "Using absolute test_plugin path in tests" ON) mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) -set(googlemock_source_dir "${protobuf_source_dir}/third_party/googletest/googlemock") -set(googletest_source_dir "${protobuf_source_dir}/third_party/googletest/googletest") -include_directories( - ${googlemock_source_dir} - ${googletest_source_dir} - ${googletest_source_dir}/include - ${googlemock_source_dir}/include -) - -add_library(gmock STATIC - "${googlemock_source_dir}/src/gmock-all.cc" - "${googletest_source_dir}/src/gtest-all.cc" -) -target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) -add_library(gmock_main STATIC "${googlemock_source_dir}/src/gmock_main.cc") -target_link_libraries(gmock_main gmock) +include(${protobuf_SOURCE_DIR}/src/file_lists.cmake) set(lite_test_protos - google/protobuf/map_lite_unittest.proto - google/protobuf/unittest_import_lite.proto - google/protobuf/unittest_import_public_lite.proto - google/protobuf/unittest_lite.proto + ${protobuf_lite_test_protos_files} ) set(tests_protos - google/protobuf/any_test.proto - google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto - google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto - google/protobuf/map_proto2_unittest.proto - google/protobuf/map_unittest.proto - google/protobuf/unittest.proto - google/protobuf/unittest_arena.proto - google/protobuf/unittest_custom_options.proto - google/protobuf/unittest_drop_unknown_fields.proto - google/protobuf/unittest_embed_optimize_for.proto - google/protobuf/unittest_empty.proto - google/protobuf/unittest_import.proto - google/protobuf/unittest_import_public.proto - google/protobuf/unittest_lazy_dependencies.proto - google/protobuf/unittest_lazy_dependencies_custom_option.proto - google/protobuf/unittest_lazy_dependencies_enum.proto - google/protobuf/unittest_lite_imports_nonlite.proto - google/protobuf/unittest_mset.proto - google/protobuf/unittest_mset_wire_format.proto - google/protobuf/unittest_no_field_presence.proto - google/protobuf/unittest_no_generic_services.proto - google/protobuf/unittest_optimize_for.proto - google/protobuf/unittest_preserve_unknown_enum.proto - google/protobuf/unittest_preserve_unknown_enum2.proto - google/protobuf/unittest_proto3.proto - google/protobuf/unittest_proto3_arena.proto - google/protobuf/unittest_proto3_arena_lite.proto - google/protobuf/unittest_proto3_lite.proto - google/protobuf/unittest_proto3_optional.proto - google/protobuf/unittest_well_known_types.proto - google/protobuf/util/internal/testdata/anys.proto - google/protobuf/util/internal/testdata/books.proto - google/protobuf/util/internal/testdata/default_value.proto - google/protobuf/util/internal/testdata/default_value_test.proto - google/protobuf/util/internal/testdata/field_mask.proto - google/protobuf/util/internal/testdata/maps.proto - google/protobuf/util/internal/testdata/oneofs.proto - google/protobuf/util/internal/testdata/proto3.proto - google/protobuf/util/internal/testdata/struct.proto - google/protobuf/util/internal/testdata/timestamp_duration.proto - google/protobuf/util/internal/testdata/wrappers.proto - google/protobuf/util/json_format.proto - google/protobuf/util/json_format_proto3.proto - google/protobuf/util/message_differencer_unittest.proto + ${protobuf_test_protos_files} + ${compiler_test_protos_files} + ${util_test_protos_files} ) +set(protoc_cpp_args) +if (protobuf_BUILD_SHARED_LIBS) + set(protoc_cpp_args "dllexport_decl=PROTOBUF_TEST_EXPORTS:") +endif () macro(compile_proto_file filename) - get_filename_component(dirname ${filename} PATH) - get_filename_component(basename ${filename} NAME_WE) + string(REPLACE .proto .pb.h pb_hdr ${filename}) + string(REPLACE .proto .pb.cc pb_src ${filename}) add_custom_command( - OUTPUT ${protobuf_source_dir}/src/${dirname}/${basename}.pb.cc - DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto - COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto - --proto_path=${protobuf_source_dir}/src - --cpp_out=${protobuf_source_dir}/src + OUTPUT ${pb_hdr} ${pb_src} + DEPENDS ${protobuf_PROTOC_EXE} ${filename} + COMMAND ${protobuf_PROTOC_EXE} ${filename} + --proto_path=${protobuf_SOURCE_DIR}/src + --cpp_out=${protoc_cpp_args}${protobuf_SOURCE_DIR}/src --experimental_allow_proto3_optional ) endmacro(compile_proto_file) @@ -98,124 +37,43 @@ endmacro(compile_proto_file) set(lite_test_proto_files) foreach(proto_file ${lite_test_protos}) compile_proto_file(${proto_file}) - string(REPLACE .proto .pb.cc pb_file ${proto_file}) - set(lite_test_proto_files ${lite_test_proto_files} - ${protobuf_source_dir}/src/${pb_file}) + set(lite_test_proto_files ${lite_test_proto_files} ${pb_src} ${pb_hdr}) endforeach(proto_file) set(tests_proto_files) foreach(proto_file ${tests_protos}) + if (MSVC AND protobuf_BUILD_SHARED_LIBS AND ${proto_file} MATCHES ".*enormous.*") + # Our enormous protos are too big for windows DLLs. + continue() + endif () compile_proto_file(${proto_file}) - string(REPLACE .proto .pb.cc pb_file ${proto_file}) - set(tests_proto_files ${tests_proto_files} - ${protobuf_source_dir}/src/${pb_file}) + set(tests_proto_files ${tests_proto_files} ${pb_src} ${pb_hdr}) endforeach(proto_file) set(common_test_files - ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc - ${protobuf_source_dir}/src/google/protobuf/map_test_util.inc - ${protobuf_source_dir}/src/google/protobuf/test_util.cc - ${protobuf_source_dir}/src/google/protobuf/test_util.inc - ${protobuf_source_dir}/src/google/protobuf/testing/file.cc - ${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc -) - -set(common_lite_test_files - ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc - ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc - ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc + ${test_util_hdrs} + ${lite_test_util_srcs} + ${test_util_srcs} + ${common_test_hdrs} + ${common_test_srcs} ) set(tests_files - ${protobuf_source_dir}/src/google/protobuf/any_test.cc - ${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.inc - ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/metadata_test.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_plugin_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/parser_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_plugin_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/descriptor_database_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/descriptor_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/drop_unknown_fields_test.cc - ${protobuf_source_dir}/src/google/protobuf/dynamic_message_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/io/tokenizer_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/map_field_test.cc - ${protobuf_source_dir}/src/google/protobuf/map_test.cc - ${protobuf_source_dir}/src/google/protobuf/message_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/message_unittest.inc - ${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc - ${protobuf_source_dir}/src/google/protobuf/preserve_unknown_enum_test.cc - ${protobuf_source_dir}/src/google/protobuf/proto3_arena_lite_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/proto3_arena_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.inc - ${protobuf_source_dir}/src/google/protobuf/reflection_ops_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/repeated_field_reflection_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/repeated_field_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/int128_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/strutil_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/template_util_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/stubs/time_test.cc - ${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/field_comparator_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc - ${protobuf_source_dir}/src/google/protobuf/util/json_util_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/message_differencer_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/util/time_util_test.cc - ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc - ${protobuf_source_dir}/src/google/protobuf/well_known_types_unittest.cc - ${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.cc -) - -set(non_msvc_tests_files - ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc -) - -set(all_tests_files - ${tests_files} - ${non_msvc_tests_files} + ${protobuf_test_files} + ${compiler_test_files} + ${annotation_test_util_srcs} + ${io_test_files} + ${util_test_files} + ${stubs_test_files} ) if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) + add_compile_options(-DGOOGLE_PROTOBUF_FAKE_PLUGIN_PATH="$") add_compile_options(-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH="$") endif() if(MINGW) - set_source_files_properties(${all_tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing") + set_source_files_properties(${tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing") # required for tests on MinGW Win64 if (CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -225,32 +83,154 @@ if(MINGW) endif() -add_executable(tests ${all_tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files}) -target_link_libraries(tests libprotoc libprotobuf gmock_main) +if(protobuf_TEST_XML_OUTDIR) + if(NOT "${protobuf_TEST_XML_OUTDIR}" MATCHES "[/\\]$") + string(APPEND protobuf_TEST_XML_OUTDIR "/") + endif() + set(protobuf_GTEST_ARGS "--gtest_output=xml:${protobuf_TEST_XML_OUTDIR}") +else() + set(protobuf_GTEST_ARGS) +endif() + +add_library(libtest_common ${protobuf_SHARED_OR_STATIC} + ${tests_proto_files} +) +target_link_libraries(libtest_common + ${protobuf_LIB_PROTOC} + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} + ${protobuf_ABSL_USED_TEST_TARGETS} + GTest::gmock +) +if (MSVC) + target_compile_options(libtest_common PRIVATE /bigobj) +endif () +if(protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libtest_common + PUBLIC PROTOBUF_USE_DLLS + PRIVATE LIBPROTOBUF_TEST_EXPORTS) +endif() + +add_executable(tests ${tests_files} ${common_test_files}) +if (MSVC) + target_compile_options(tests PRIVATE + /wd4146 # unary minus operator applied to unsigned type, result still unsigned + ) +endif() +target_link_libraries(tests + libtest_common + libtest_common_lite + ${protobuf_LIB_PROTOC} + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} + ${protobuf_ABSL_USED_TEST_TARGETS} + GTest::gmock_main +) -set(test_plugin_files - ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc - ${protobuf_source_dir}/src/google/protobuf/testing/file.cc - ${protobuf_source_dir}/src/google/protobuf/testing/file.h - ${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc +add_executable(fake_plugin ${fake_plugin_files} ${common_test_files}) +target_include_directories(fake_plugin PRIVATE ${ABSL_ROOT_DIR}) +target_link_libraries(fake_plugin + libtest_common + libtest_common_lite + ${protobuf_LIB_PROTOC} + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} + ${protobuf_ABSL_USED_TEST_TARGETS} + GTest::gmock ) -add_executable(test_plugin ${test_plugin_files}) -target_link_libraries(test_plugin libprotoc libprotobuf gmock) +add_executable(test_plugin ${test_plugin_files} ${common_test_files}) +target_include_directories(test_plugin PRIVATE ${ABSL_ROOT_DIR}) +target_link_libraries(test_plugin + libtest_common + libtest_common_lite + ${protobuf_LIB_PROTOC} + ${protobuf_LIB_PROTOBUF} + ${protobuf_ABSL_USED_TARGETS} + ${protobuf_ABSL_USED_TEST_TARGETS} + GTest::gmock +) -set(lite_test_files - ${protobuf_source_dir}/src/google/protobuf/lite_unittest.cc +add_library(libtest_common_lite ${protobuf_SHARED_OR_STATIC} + ${lite_test_proto_files} +) +target_link_libraries(libtest_common_lite + ${protobuf_LIB_PROTOBUF_LITE} + ${protobuf_ABSL_USED_TARGETS} + GTest::gmock ) -add_executable(lite-test ${lite_test_files} ${common_lite_test_files} ${lite_test_proto_files}) -target_link_libraries(lite-test libprotobuf-lite gmock_main) +if(protobuf_BUILD_SHARED_LIBS) + target_compile_definitions(libtest_common_lite + PUBLIC PROTOBUF_USE_DLLS + PRIVATE LIBPROTOBUF_TEST_EXPORTS) +endif() -set(lite_arena_test_files - ${protobuf_source_dir}/src/google/protobuf/lite_arena_unittest.cc +add_executable(lite-test + ${protobuf_lite_test_files} + ${lite_test_util_hdrs} + ${lite_test_util_srcs} ) -add_executable(lite-arena-test ${lite_arena_test_files} ${common_lite_test_files} ${lite_test_proto_files}) -target_link_libraries(lite-arena-test libprotobuf-lite gmock_main) +target_link_libraries(lite-test + libtest_common_lite + ${protobuf_LIB_PROTOBUF_LITE} + ${protobuf_ABSL_USED_TARGETS} + ${protobuf_ABSL_USED_TEST_TARGETS} + GTest::gmock_main +) + +add_test(NAME lite-test + COMMAND lite-test ${protobuf_GTEST_ARGS} + WORKING_DIRECTORY ${protobuf_SOURCE_DIR}) -add_custom_target(check +add_custom_target(full-test COMMAND tests - DEPENDS tests test_plugin - WORKING_DIRECTORY ${protobuf_source_dir}) + DEPENDS tests lite-test fake_plugin test_plugin + WORKING_DIRECTORY ${protobuf_SOURCE_DIR}) + +add_test(NAME full-test + COMMAND tests ${protobuf_GTEST_ARGS} + WORKING_DIRECTORY ${protobuf_SOURCE_DIR}) + +# For test purposes, remove headers that should already be installed. This +# prevents accidental conflicts and also version skew (since local headers take +# precedence over installed headers). +add_custom_target(save-installed-headers) +add_custom_target(remove-installed-headers) +add_custom_target(restore-installed-headers) + +file(GLOB_RECURSE _local_hdrs + "${PROJECT_SOURCE_DIR}/src/*.h" + "${PROJECT_SOURCE_DIR}/src/*.inc") + +# Exclude the bootstrapping that are directly used by tests. +set(_exclude_hdrs + "${protobuf_SOURCE_DIR}/src/google/protobuf/cpp_features.pb.h" + "${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h" + "${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h" + "${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_features.pb.h") + +# Exclude test library headers. +list(APPEND _exclude_hdrs ${test_util_hdrs} ${lite_test_util_hdrs} ${common_test_hdrs} + ${compiler_test_utils_hdrs}) +foreach(_hdr ${_exclude_hdrs}) + list(REMOVE_ITEM _local_hdrs ${_hdr}) +endforeach() + +foreach(_hdr ${_local_hdrs}) + string(REPLACE "${protobuf_SOURCE_DIR}/src" "" _file ${_hdr}) + set(_tmp_file "${CMAKE_BINARY_DIR}/tmp-install-test/${_file}") + add_custom_command(TARGET remove-installed-headers PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E remove -f "${_hdr}") + add_custom_command(TARGET save-installed-headers PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy "${_hdr}" "${_tmp_file}" || true) + add_custom_command(TARGET restore-installed-headers PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E + copy "${_tmp_file}" "${_hdr}") +endforeach() + +add_dependencies(remove-installed-headers save-installed-headers) +if(protobuf_REMOVE_INSTALLED_HEADERS) + # Make sure we remove all the headers *before* any codegen occurs. + add_dependencies(${protobuf_PROTOC_EXE} remove-installed-headers) +endif() diff --git a/cmake/utf8_range.cmake b/cmake/utf8_range.cmake new file mode 100644 index 0000000..f411a8c --- /dev/null +++ b/cmake/utf8_range.cmake @@ -0,0 +1,15 @@ +if (NOT TARGET utf8_range) + set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Disable utf8_range tests") + + if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/utf8_range/CMakeLists.txt") + message(FATAL_ERROR + "Cannot find third_party/utf8_range directory that's needed for " + "the protobuf runtime.\n") + endif() + + set(utf8_range_ENABLE_INSTALL ${protobuf_INSTALL} CACHE BOOL "Set install") + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range third_party/utf8_range) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range) +endif () + +set(_protobuf_FIND_UTF8_RANGE "if(NOT TARGET utf8_range)\n find_package(utf8_range CONFIG)\nendif()") diff --git a/composer.json b/composer.json deleted file mode 100644 index 2c64ad2..0000000 --- a/composer.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "google/protobuf", - "type": "library", - "description": "proto library for PHP", - "keywords": ["proto"], - "homepage": "https://developers.google.com/protocol-buffers/", - "license": "BSD-3-Clause", - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": ">=4.8.0" - }, - "suggest": { - "ext-bcmath": "Need to support JSON deserialization" - }, - "autoload": { - "psr-4": { - "Google\\Protobuf\\": "php/src/Google/Protobuf", - "GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf" - } - } -} diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 2f82be2..0000000 --- a/configure.ac +++ /dev/null @@ -1,234 +0,0 @@ -## Process this file with autoconf to produce configure. -## In general, the safest way to proceed is to run ./autogen.sh - -AC_PREREQ(2.59) - -# Note: If you change the version, you must also update it in: -# * Protobuf.podspec -# * csharp/Google.Protobuf.Tools.nuspec -# * csharp/src/*/AssemblyInfo.cs -# * csharp/src/Google.Protobuf/Google.Protobuf.nuspec -# * java/*/pom.xml -# * python/google/protobuf/__init__.py -# * protoc-artifacts/pom.xml -# * src/google/protobuf/stubs/common.h -# * src/Makefile.am (Update -version-info for LDFLAGS if needed) -# -# In the SVN trunk, the version should always be the next anticipated release -# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed -# the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.13.0],[protobuf@googlegroups.com],[protobuf]) - -AM_MAINTAINER_MODE([enable]) - -AC_CONFIG_SRCDIR(src/google/protobuf/message.cc) -# The config file is generated but not used by the source code, since we only -# need very few of them, e.g. HAVE_PTHREAD and HAVE_ZLIB. Those macros are -# passed down in CXXFLAGS manually in src/Makefile.am -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_MACRO_DIR([m4]) - -AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., make dist)]) -case "$DIST_LANG" in - "") DIST_LANG=all ;; - all | cpp | csharp | java | python | javanano | objectivec | ruby | js | php) ;; - *) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;; -esac -AC_SUBST(DIST_LANG) - -# autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily -# the best choice for libprotobuf. -AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"], - [CFLAGS=""]) -AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], - [CXXFLAGS=""]) - -AC_CANONICAL_TARGET - -AM_INIT_AUTOMAKE([1.9 tar-ustar subdir-objects]) - -# Silent rules enabled: the output is minimal but informative. -# In particular, the warnings from the compiler stick out very clearly. -# To see all logs, use the --disable-silent-rules on configure or via make V=1 -AM_SILENT_RULES([yes]) - -AC_ARG_WITH([zlib], - [AS_HELP_STRING([--with-zlib], - [include classes for streaming compressed data in and out @<:@default=check@:>@])], - [],[with_zlib=check]) - -AC_ARG_WITH([zlib-include], - [AS_HELP_STRING([--with-zlib-include=PATH], - [zlib include directory])], - [CPPFLAGS="-I$withval $CPPFLAGS"]) - -AC_ARG_WITH([zlib-lib], - [AS_HELP_STRING([--with-zlib-lib=PATH], - [zlib lib directory])], - [LDFLAGS="-L$withval $LDFLAGS"]) - -AC_ARG_WITH([protoc], - [AS_HELP_STRING([--with-protoc=COMMAND], - [use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])], - [],[with_protoc=no]) - -# Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_PROG_CXX_FOR_BUILD -AC_LANG([C++]) -ACX_USE_SYSTEM_EXTENSIONS -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc -AC_PROG_OBJC - -# test_util.cc takes forever to compile with GCC and optimization turned on. -AC_MSG_CHECKING([C++ compiler flags...]) -AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ - AS_IF([test "$GCC" = "yes"],[ - PROTOBUF_OPT_FLAG="-O2" - CXXFLAGS="${CXXFLAGS} -g" - ]) - - # Protocol Buffers contains several checks that are intended to be used only - # for debugging and which might hurt performance. Most users are probably - # end users who don't want these checks, so add -DNDEBUG by default. - CXXFLAGS="$CXXFLAGS -std=c++11 -DNDEBUG" - - AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS]) -],[ - AC_MSG_RESULT([use user-supplied: $CXXFLAGS]) -]) - -AC_SUBST(PROTOBUF_OPT_FLAG) - -ACX_CHECK_SUNCC - -# Have to do libtool after SUNCC, other wise it "helpfully" adds Crun Cstd -# to the link -AC_PROG_LIBTOOL - -# Check whether the linker supports version scripts -AC_MSG_CHECKING([whether the linker supports version scripts]) -save_LDFLAGS=$LDFLAGS -LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" -cat > conftest.map < - #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204) - # error zlib version too old - #endif - ]], [])], [ - AC_MSG_RESULT([ok (1.2.0.4 or later)]) - - # Also need to add -lz to the linker flags and make sure this succeeds. - AC_SEARCH_LIBS([zlibVersion], [z], [ - AC_DEFINE([HAVE_ZLIB], [1], [Enable classes using zlib compression.]) - HAVE_ZLIB=1 - ], [ - AS_IF([test "$with_zlib" != check], [ - AC_MSG_FAILURE([--with-zlib was given, but no working zlib library was found]) - ]) - ]) - ], [ - AS_IF([test "$with_zlib" = check], [ - AC_MSG_RESULT([headers missing or too old (requires 1.2.0.4)]) - ], [ - AC_MSG_FAILURE([--with-zlib was given, but zlib headers were not present or were too old (requires 1.2.0.4)]) - ]) - ]) -]) -AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1]) - -# Add -std=c++11 if necesssary. It is important for us to do this before the -# libatomic check below, since that also depends on C++11. -AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) - -dnl On some platforms, std::atomic needs a helper library -AC_MSG_CHECKING(whether -latomic is needed) -AC_LINK_IFELSE([AC_LANG_SOURCE([[ - #include - #include - std::atomic v; - int main() { - return v; - } -]])], STD_ATOMIC_NEED_LIBATOMIC=no, STD_ATOMIC_NEED_LIBATOMIC=yes) -AC_MSG_RESULT($STD_ATOMIC_NEED_LIBATOMIC) -if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then - LIBATOMIC_LIBS="-latomic" -fi -AC_SUBST([LIBATOMIC_LIBS]) - -AS_IF([test "$with_protoc" != "no"], [ - PROTOC=$with_protoc - AS_IF([test "$with_protoc" = "yes"], [ - # No argument given. Use system protoc. - PROTOC=protoc - ]) - AS_IF([echo "$PROTOC" | grep -q '^@<:@^/@:>@.*/'], [ - # Does not start with a slash, but contains a slash. So, it's a relative - # path (as opposed to an absolute path or an executable in $PATH). - # Since it will actually be executed from the src directory, prefix with - # the current directory. We also insert $ac_top_build_prefix in case this - # is a nested package and --with-protoc was actually given on the outer - # package's configure script. - PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC - ]) - AC_SUBST([PROTOC]) -]) -AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"]) - -AX_PTHREAD -AM_CONDITIONAL([HAVE_PTHREAD], [test "x$ax_pthread_ok" = "xyes"]) -# We still keep this for improving pbconfig.h for unsupported platforms. -AC_CXX_STL_HASH - -# Enable ObjC support for conformance directory on OS X. -OBJC_CONFORMANCE_TEST=0 -case "$target_os" in - darwin*) - OBJC_CONFORMANCE_TEST=1 - ;; -esac -AM_CONDITIONAL([OBJC_CONFORMANCE_TEST], [test $OBJC_CONFORMANCE_TEST = 1]) - -# HACK: Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS, -# since the flags added by ACX_CHECK_SUNCC must be used when compiling gmock -# too. -export CFLAGS -export CXXFLAGS -AC_CONFIG_SUBDIRS([third_party/googletest]) - -AC_CONFIG_FILES([Makefile src/Makefile benchmarks/Makefile conformance/Makefile protobuf.pc protobuf-lite.pc]) -AC_OUTPUT diff --git a/conformance/BUILD.bazel b/conformance/BUILD.bazel new file mode 100644 index 0000000..c495504 --- /dev/null +++ b/conformance/BUILD.bazel @@ -0,0 +1,373 @@ +# Conformance testing for Protobuf. + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "objc_library") +load("@rules_ruby//ruby:defs.bzl", "ruby_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("//build_defs:internal_shell.bzl", "inline_sh_binary") +load( + "@rules_pkg//:mappings.bzl", + "pkg_filegroup", + "pkg_files", + "strip_prefix", +) + +exports_files([ + "bazel_conformance_test_runner.sh", + "failure_list_cpp.txt", + "failure_list_csharp.txt", + "failure_list_java.txt", + "failure_list_java_lite.txt", + "failure_list_objc.txt", + "failure_list_php.txt", + "failure_list_php_c.txt", + "failure_list_python.txt", + "failure_list_python_cpp.txt", + "failure_list_ruby.txt", + "failure_list_jruby.txt", + "failure_list_jruby_ffi.txt", + "text_format_failure_list_cpp.txt", + "text_format_failure_list_csharp.txt", + "text_format_failure_list_java.txt", + "text_format_failure_list_java_lite.txt", + "text_format_failure_list_php.txt", + "text_format_failure_list_php_c.txt", + "text_format_failure_list_python.txt", + "text_format_failure_list_python_cpp.txt", + "text_format_failure_list_ruby.txt", + "text_format_failure_list_jruby.txt", + "text_format_failure_list_jruby_ffi.txt", +]) + +cc_proto_library( + name = "test_messages_proto2_proto_cc", + deps = ["//src/google/protobuf:test_messages_proto2_proto"], +) + +cc_proto_library( + name = "test_messages_proto3_proto_cc", + deps = ["//src/google/protobuf:test_messages_proto3_proto"], +) + +proto_library( + name = "conformance_proto", + srcs = ["conformance.proto"], + visibility = ["//visibility:public"], +) + +cc_proto_library( + name = "conformance_cc_proto", + deps = [":conformance_proto"], +) + +internal_csharp_proto_library( + name = "conformance_csharp_proto", + srcs = ["conformance.proto"], + visibility = [ + "//csharp:__subpackages__", + ], +) + +java_proto_library( + name = "conformance_java_proto", + visibility = [ + "//java:__subpackages__", + ], + deps = [":conformance_proto"], +) + +java_lite_proto_library( + name = "conformance_java_proto_lite", + visibility = [ + "//java:__subpackages__", + ], + deps = [":conformance_proto"], +) + +internal_objc_proto_library( + name = "conformance_objc_proto", + srcs = ["conformance.proto"], + visibility = [ + "//conformance:__pkg__", + "//objc:__pkg__", + ], +) + +internal_py_proto_library( + name = "conformance_py_proto", + srcs = ["conformance.proto"], + srcs_version = "PY2AND3", + visibility = [ + "//python:__subpackages__", + ], +) + +internal_php_proto_library( + name = "conformance_php_proto", + srcs = ["conformance.proto"], + outs = [ + "Conformance/ConformanceRequest.php", + "Conformance/ConformanceResponse.php", + "Conformance/FailureSet.php", + "Conformance/JspbEncodingConfig.php", + "Conformance/TestCategory.php", + "Conformance/WireFormat.php", + "GPBMetadata/Conformance.php", + ], + visibility = [ + "//conformance:__pkg__", + "//php:__pkg__", + ], +) + +internal_ruby_proto_library( + name = "conformance_ruby_proto", + srcs = ["conformance.proto"], + visibility = [ + "//conformance:__pkg__", + "//ruby:__pkg__", + ], +) + +cc_library( + name = "conformance_test", + srcs = [ + "conformance_test.cc", + "conformance_test_runner.cc", + ], + hdrs = [ + "conformance_test.h", + ], + includes = ["."], + deps = [ + ":conformance_cc_proto", + "//src/google/protobuf:descriptor_legacy", + "//src/google/protobuf/util:differencer", + "//src/google/protobuf/util:json_util", + "//src/google/protobuf/util:type_resolver_util", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + ], +) + +cc_library( + name = "binary_json_conformance_suite", + srcs = ["binary_json_conformance_suite.cc"], + hdrs = ["binary_json_conformance_suite.h"], + deps = [ + ":conformance_test", + ":test_messages_proto2_proto_cc", + ":test_messages_proto3_proto_cc", + "@com_google_absl//absl/status", + "@jsoncpp", + ], +) + +cc_library( + name = "text_format_conformance_suite", + srcs = ["text_format_conformance_suite.cc"], + hdrs = ["text_format_conformance_suite.h"], + deps = [ + ":conformance_test", + ":test_messages_proto2_proto_cc", + ":test_messages_proto3_proto_cc", + ], +) + +cc_binary( + name = "conformance_test_runner", + srcs = ["conformance_test_main.cc"], + visibility = ["//visibility:public"], + deps = [ + ":binary_json_conformance_suite", + ":conformance_test", + ":text_format_conformance_suite", + "@com_google_absl//absl/strings:str_format", + ], +) + +cc_binary( + name = "conformance_cpp", + testonly = 1, + srcs = ["conformance_cpp.cc"], + visibility = ["//src:__subpackages__"], + deps = [ + ":conformance_cc_proto", + "//:protobuf", + "//:test_messages_proto2_cc_proto", + "//:test_messages_proto3_cc_proto", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + ], +) + +java_binary( + name = "conformance_java", + testonly = 1, + srcs = ["ConformanceJava.java"], + main_class = "ConformanceJava", + visibility = [ + "//java:__subpackages__", + ], + deps = [ + ":conformance_java_proto", + "//:protobuf_java", + "//:protobuf_java_util", + "//:test_messages_proto2_java_proto", + "//:test_messages_proto3_java_proto", + ], +) + +java_binary( + name = "conformance_java_lite", + testonly = 1, + srcs = ["ConformanceJavaLite.java"], + main_class = "ConformanceJavaLite", + visibility = [ + "//java:__subpackages__", + ], + deps = [ + ":conformance_java_proto_lite", + "//:protobuf_java_util", + "//:protobuf_javalite", + "//:test_messages_proto2_java_proto_lite", + "//:test_messages_proto3_java_proto_lite", + ], +) + +py_binary( + name = "conformance_python", + testonly = 1, + srcs = ["conformance_python.py"], + imports = [ + "..", + "../python", + ], + srcs_version = "PY2AND3", + visibility = ["//python:__subpackages__"], + deps = [ + ":conformance_py_proto", + "//:protobuf_python", + "//python:test_messages_proto2_py_proto", + "//python:test_messages_proto3_py_proto", + ], +) + +inline_sh_binary( + name = "conformance_php", + testonly = 1, + srcs = [ + "autoload.php", + "conformance_php.php", + ], + cmd = """ + php -d include_path=conformance:src/google/protobuf \\ + -d auto_prepend_file=$(rootpath autoload.php) \\ + $(rootpath conformance_php.php) + """, + visibility = ["//php:__subpackages__"], + deps = [ + ":conformance_php_proto", + "//:test_messages_proto3_php_proto", + "//php:source_files", + ], +) + +inline_sh_binary( + name = "conformance_php_c", + testonly = 1, + srcs = [ + "conformance_php.php", + "//php:extension", + ], + cmd = """ + php -dextension=$(rootpath //php:extension) \\ + -d include_path=conformance:src/google/protobuf \\ + $(rootpath conformance_php.php) + """, + visibility = ["//php:__subpackages__"], + deps = [ + ":conformance_php_proto", + "//:test_messages_proto3_php_proto", + ], +) + +inline_sh_binary( + name = "conformance_csharp", + testonly = 1, + srcs = ["//csharp/src/Google.Protobuf.Conformance:conformance_dll"], + cmd = "dotnet $(rootpath //csharp/src/Google.Protobuf.Conformance:conformance_dll)", + visibility = ["//csharp:__subpackages__"], + deps = [ + "//csharp/src/Google.Protobuf.Conformance:conformance_runfiles", + ], +) + +objc_library( + name = "conformance_objc_lib", + testonly = 1, + non_arc_srcs = ["conformance_objc.m"], + # See https://github.com/bazelbuild/bazel/issues/12897. + tags = ["manual"], + deps = [ + ":conformance_objc_proto", + "//:test_messages_proto2_objc_proto", + "//:test_messages_proto3_objc_proto", + ], +) + +cc_binary( + name = "conformance_objc", + testonly = 1, + # See https://github.com/bazelbuild/bazel/issues/12897. + tags = ["manual"], + visibility = ["//objectivec:__subpackages__"], + deps = [":conformance_objc_lib"], +) + +ruby_binary( + name = "conformance_ruby", + testonly = True, + srcs = ["conformance_ruby.rb"], + visibility = ["//ruby:__subpackages__"], + deps = [ + ":conformance_ruby_proto", + "//:test_messages_proto2_ruby_proto", + "//:test_messages_proto3_ruby_proto", + ], +) + +################################################################################ +# Distribution files +################################################################################ + +filegroup( + name = "all_files", + srcs = glob(["**/*"]), + visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"], +) + +pkg_files( + name = "dist_files", + srcs = glob( + ["**/*"], + exclude = [ + # Handled by dist_scripts: + "bazel_conformance_test_runner.sh", + + # The following are not in autotools dist: + "autoload.php", + "failure_list_jruby.txt", + "update_failure_list.py", + ], + ), + strip_prefix = strip_prefix.from_root(""), + visibility = ["//pkg:__pkg__"], +) + +pkg_filegroup( + name = "all_dist_files", + srcs = [ + ":dist_files", + ], + visibility = ["//pkg:__pkg__"], +) diff --git a/conformance/ConformanceJava.java b/conformance/ConformanceJava.java index 5319982..e76dade 100644 --- a/conformance/ConformanceJava.java +++ b/conformance/ConformanceJava.java @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 import com.google.protobuf.AbstractMessage; import com.google.protobuf.ByteString; @@ -54,7 +31,7 @@ class ConformanceJava { while (len > 0) { int read = System.in.read(buf, ofs, len); if (read == -1) { - return false; // EOF + return false; // EOF } ofs += read; len -= read; @@ -81,10 +58,10 @@ class ConformanceJava { private void writeLittleEndianIntToStdout(int val) throws Exception { byte[] buf = new byte[4]; - buf[0] = (byte)val; - buf[1] = (byte)(val >> 8); - buf[2] = (byte)(val >> 16); - buf[3] = (byte)(val >> 24); + buf[0] = (byte) val; + buf[1] = (byte) (val >> 8); + buf[2] = (byte) (val >> 16); + buf[3] = (byte) (val >> 24); writeToStdout(buf); } @@ -98,85 +75,71 @@ class ConformanceJava { INPUT_STREAM_DECODER; } - private static class BinaryDecoder { - public MessageType decode (ByteString bytes, BinaryDecoderType type, - Parser parser, ExtensionRegistry extensions) - throws InvalidProtocolBufferException { + private static class BinaryDecoder { + public T decode( + ByteString bytes, BinaryDecoderType type, Parser parser, ExtensionRegistry extensions) + throws InvalidProtocolBufferException { switch (type) { case BTYE_STRING_DECODER: - return parser.parseFrom(bytes, extensions); case BYTE_ARRAY_DECODER: - return parser.parseFrom(bytes.toByteArray(), extensions); - case ARRAY_BYTE_BUFFER_DECODER: { - ByteBuffer buffer = ByteBuffer.allocate(bytes.size()); - bytes.copyTo(buffer); - buffer.flip(); - try { + return parser.parseFrom(bytes, extensions); + case ARRAY_BYTE_BUFFER_DECODER: + { + ByteBuffer buffer = ByteBuffer.allocate(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions); - } catch (InvalidProtocolBufferException e) { - throw e; } - } - case READONLY_ARRAY_BYTE_BUFFER_DECODER: { - try { + case READONLY_ARRAY_BYTE_BUFFER_DECODER: + { return parser.parseFrom( CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions); - } catch (InvalidProtocolBufferException e) { - throw e; } - } - case DIRECT_BYTE_BUFFER_DECODER: { - ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); - bytes.copyTo(buffer); - buffer.flip(); - try { + case DIRECT_BYTE_BUFFER_DECODER: + { + ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions); - } catch (InvalidProtocolBufferException e) { - throw e; } - } - case READONLY_DIRECT_BYTE_BUFFER_DECODER: { - ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); - bytes.copyTo(buffer); - buffer.flip(); - try { + case READONLY_DIRECT_BYTE_BUFFER_DECODER: + { + ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); return parser.parseFrom( CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions); - } catch (InvalidProtocolBufferException e) { - throw e; } - } - case INPUT_STREAM_DECODER: { - try { + case INPUT_STREAM_DECODER: + { return parser.parseFrom(bytes.newInput(), extensions); - } catch (InvalidProtocolBufferException e) { - throw e; } - } - default : - return null; } + return null; } } - private MessageType parseBinary( - ByteString bytes, Parser parser, ExtensionRegistry extensions) + private T parseBinary( + ByteString bytes, Parser parser, ExtensionRegistry extensions) throws InvalidProtocolBufferException { - ArrayList messages = new ArrayList (); - ArrayList exceptions = - new ArrayList (); + ArrayList messages = new ArrayList<>(); + ArrayList exceptions = new ArrayList<>(); for (int i = 0; i < BinaryDecoderType.values().length; i++) { messages.add(null); exceptions.add(null); } - BinaryDecoder decoder = new BinaryDecoder (); + if (messages.isEmpty()) { + throw new RuntimeException("binary decoder types missing"); + } + + BinaryDecoder decoder = new BinaryDecoder<>(); boolean hasMessage = false; boolean hasException = false; for (int i = 0; i < BinaryDecoderType.values().length; ++i) { try { - //= BinaryDecoderType.values()[i].parseProto3(bytes); + // = BinaryDecoderType.values()[i].parseProto3(bytes); messages.set(i, decoder.decode(bytes, BinaryDecoderType.values()[i], parser, extensions)); hasMessage = true; } catch (InvalidProtocolBufferException e) { @@ -202,7 +165,15 @@ class ConformanceJava { if (hasException) { // We do not check if exceptions are equal. Different implementations may return different // exception messages. Throw an arbitrary one out instead. - throw exceptions.get(0); + InvalidProtocolBufferException exception = null; + for (InvalidProtocolBufferException e : exceptions) { + if (exception != null) { + exception.addSuppressed(e); + } else { + exception = e; + } + } + throw exception; } // Fast path comparing all the messages with the first message, assuming equality being @@ -235,122 +206,147 @@ class ConformanceJava { } private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) { - com.google.protobuf.AbstractMessage testMessage; - boolean isProto3 = - request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3"); - boolean isProto2 = - request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2"); + AbstractMessage testMessage; + String messageType = request.getMessageType(); + boolean isProto3 = messageType.equals("protobuf_test_messages.proto3.TestAllTypesProto3"); + boolean isProto2 = messageType.equals("protobuf_test_messages.proto2.TestAllTypesProto2"); switch (request.getPayloadCase()) { - case PROTOBUF_PAYLOAD: { - if (isProto3) { - try { - ExtensionRegistry extensions = ExtensionRegistry.newInstance(); - TestMessagesProto3.registerAllExtensions(extensions); - testMessage = parseBinary(request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions); - } catch (InvalidProtocolBufferException e) { - return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); - } - } else if (isProto2) { - try { - ExtensionRegistry extensions = ExtensionRegistry.newInstance(); - TestMessagesProto2.registerAllExtensions(extensions); - testMessage = parseBinary(request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions); - } catch (InvalidProtocolBufferException e) { - return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); - } - } else { - throw new RuntimeException("Protobuf request doesn't have specific payload type."); - } - break; - } - case JSON_PAYLOAD: { - try { - JsonFormat.Parser parser = JsonFormat.parser().usingTypeRegistry(typeRegistry); - if (request.getTestCategory() - == Conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST) { - parser = parser.ignoringUnknownFields(); - } + case PROTOBUF_PAYLOAD: + { if (isProto3) { - TestMessagesProto3.TestAllTypesProto3.Builder builder = - TestMessagesProto3.TestAllTypesProto3.newBuilder(); - parser.merge(request.getJsonPayload(), builder); - testMessage = builder.build(); + try { + ExtensionRegistry extensions = ExtensionRegistry.newInstance(); + TestMessagesProto3.registerAllExtensions(extensions); + testMessage = + parseBinary( + request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions); + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder() + .setParseError(e.getMessage()) + .build(); + } } else if (isProto2) { - TestMessagesProto2.TestAllTypesProto2.Builder builder = - TestMessagesProto2.TestAllTypesProto2.newBuilder(); - parser.merge(request.getJsonPayload(), builder); - testMessage = builder.build(); + try { + ExtensionRegistry extensions = ExtensionRegistry.newInstance(); + TestMessagesProto2.registerAllExtensions(extensions); + testMessage = + parseBinary( + request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions); + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder() + .setParseError(e.getMessage()) + .build(); + } } else { - throw new RuntimeException("Protobuf request doesn't have specific payload type."); + throw new IllegalArgumentException( + "Protobuf request has unexpected payload type: " + messageType); } - } catch (InvalidProtocolBufferException e) { - return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); + break; } - break; - } - case TEXT_PAYLOAD: { - if (isProto3) { + case JSON_PAYLOAD: + { try { - TestMessagesProto3.TestAllTypesProto3.Builder builder = - TestMessagesProto3.TestAllTypesProto3.newBuilder(); - TextFormat.merge(request.getTextPayload(), builder); - testMessage = builder.build(); - } catch (TextFormat.ParseException e) { + JsonFormat.Parser parser = JsonFormat.parser().usingTypeRegistry(typeRegistry); + if (request.getTestCategory() + == Conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST) { + parser = parser.ignoringUnknownFields(); + } + if (isProto3) { + TestMessagesProto3.TestAllTypesProto3.Builder builder = + TestMessagesProto3.TestAllTypesProto3.newBuilder(); + parser.merge(request.getJsonPayload(), builder); + testMessage = builder.build(); + } else if (isProto2) { + TestMessagesProto2.TestAllTypesProto2.Builder builder = + TestMessagesProto2.TestAllTypesProto2.newBuilder(); + parser.merge(request.getJsonPayload(), builder); + testMessage = builder.build(); + } else { + throw new IllegalArgumentException( + "Protobuf request has unexpected payload type: " + messageType); + } + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder() + .setParseError(e.getMessage()) + .build(); + } + break; + } + case TEXT_PAYLOAD: + { + if (isProto3) { + try { + TestMessagesProto3.TestAllTypesProto3.Builder builder = + TestMessagesProto3.TestAllTypesProto3.newBuilder(); + TextFormat.merge(request.getTextPayload(), builder); + testMessage = builder.build(); + } catch (TextFormat.ParseException e) { return Conformance.ConformanceResponse.newBuilder() .setParseError(e.getMessage()) .build(); - } - } else if (isProto2) { - try { - TestMessagesProto2.TestAllTypesProto2.Builder builder = - TestMessagesProto2.TestAllTypesProto2.newBuilder(); - TextFormat.merge(request.getTextPayload(), builder); - testMessage = builder.build(); - } catch (TextFormat.ParseException e) { + } + } else if (isProto2) { + try { + TestMessagesProto2.TestAllTypesProto2.Builder builder = + TestMessagesProto2.TestAllTypesProto2.newBuilder(); + TextFormat.merge(request.getTextPayload(), builder); + testMessage = builder.build(); + } catch (TextFormat.ParseException e) { return Conformance.ConformanceResponse.newBuilder() .setParseError(e.getMessage()) .build(); + } + } else { + throw new IllegalArgumentException( + "Protobuf request has unexpected payload type: " + messageType); } - } else { - throw new RuntimeException("Protobuf request doesn't have specific payload type."); + break; + } + case PAYLOAD_NOT_SET: + { + throw new IllegalArgumentException("Request didn't have payload."); } - break; - } - case PAYLOAD_NOT_SET: { - throw new RuntimeException("Request didn't have payload."); - } - default: { - throw new RuntimeException("Unexpected payload case."); - } + default: + { + throw new IllegalArgumentException("Unexpected payload case."); + } } switch (request.getRequestedOutputFormat()) { case UNSPECIFIED: - throw new RuntimeException("Unspecified output format."); - - case PROTOBUF: { - ByteString MessageString = testMessage.toByteString(); - return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(MessageString).build(); - } + throw new IllegalArgumentException("Unspecified output format."); + + case PROTOBUF: + { + ByteString messageString = testMessage.toByteString(); + return Conformance.ConformanceResponse.newBuilder() + .setProtobufPayload(messageString) + .build(); + } case JSON: try { - return Conformance.ConformanceResponse.newBuilder().setJsonPayload( - JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage)).build(); + return Conformance.ConformanceResponse.newBuilder() + .setJsonPayload( + JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage)) + .build(); } catch (InvalidProtocolBufferException | IllegalArgumentException e) { - return Conformance.ConformanceResponse.newBuilder().setSerializeError( - e.getMessage()).build(); + return Conformance.ConformanceResponse.newBuilder() + .setSerializeError(e.getMessage()) + .build(); } case TEXT_FORMAT: - return Conformance.ConformanceResponse.newBuilder().setTextPayload( - TextFormat.printToString(testMessage)).build(); + return Conformance.ConformanceResponse.newBuilder() + .setTextPayload(TextFormat.printer().printToString(testMessage)) + .build(); - default: { - throw new RuntimeException("Unexpected request output."); - } + default: + { + throw new IllegalArgumentException("Unexpected request output."); + } } } @@ -358,7 +354,7 @@ class ConformanceJava { int bytes = readLittleEndianIntFromStdin(); if (bytes == -1) { - return false; // EOF + return false; // EOF } byte[] serializedInput = new byte[bytes]; @@ -379,14 +375,16 @@ class ConformanceJava { } public void run() throws Exception { - typeRegistry = TypeRegistry.newBuilder().add( - TestMessagesProto3.TestAllTypesProto3.getDescriptor()).build(); + typeRegistry = + TypeRegistry.newBuilder() + .add(TestMessagesProto3.TestAllTypesProto3.getDescriptor()) + .build(); while (doTestIo()) { this.testCount++; } - System.err.println("ConformanceJava: received EOF from test runner after " + - this.testCount + " tests"); + System.err.println( + "ConformanceJava: received EOF from test runner after " + this.testCount + " tests"); } public static void main(String[] args) throws Exception { diff --git a/conformance/ConformanceJavaLite.java b/conformance/ConformanceJavaLite.java index 147738d..ac4ed1f 100644 --- a/conformance/ConformanceJavaLite.java +++ b/conformance/ConformanceJavaLite.java @@ -1,35 +1,23 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 -import com.google.protobuf.conformance.Conformance; +import com.google.protobuf.ByteString; +import com.google.protobuf.CodedInputStream; +import com.google.protobuf.ExtensionRegistryLite; import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.MessageLite; +import com.google.protobuf.Parser; +import com.google.protobuf.conformance.Conformance; +import com.google.protobuf_test_messages.proto2.TestMessagesProto2; +import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2; +import com.google.protobuf_test_messages.proto3.TestMessagesProto3; +import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3; +import java.nio.ByteBuffer; +import java.util.ArrayList; class ConformanceJavaLite { private int testCount = 0; @@ -39,7 +27,7 @@ class ConformanceJavaLite { while (len > 0) { int read = System.in.read(buf, ofs, len); if (read == -1) { - return false; // EOF + return false; // EOF } ofs += read; len -= read; @@ -66,36 +54,214 @@ class ConformanceJavaLite { private void writeLittleEndianIntToStdout(int val) throws Exception { byte[] buf = new byte[4]; - buf[0] = (byte)val; - buf[1] = (byte)(val >> 8); - buf[2] = (byte)(val >> 16); - buf[3] = (byte)(val >> 24); + buf[0] = (byte) val; + buf[1] = (byte) (val >> 8); + buf[2] = (byte) (val >> 16); + buf[3] = (byte) (val >> 24); writeToStdout(buf); } - private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) { - Conformance.TestAllTypes testMessage; + private enum BinaryDecoderType { + BTYE_STRING_DECODER, + BYTE_ARRAY_DECODER, + ARRAY_BYTE_BUFFER_DECODER, + READONLY_ARRAY_BYTE_BUFFER_DECODER, + DIRECT_BYTE_BUFFER_DECODER, + READONLY_DIRECT_BYTE_BUFFER_DECODER, + INPUT_STREAM_DECODER; + } - switch (request.getPayloadCase()) { - case PROTOBUF_PAYLOAD: { - try { - testMessage = Conformance.TestAllTypes.parseFrom(request.getProtobufPayload()); - } catch (InvalidProtocolBufferException e) { - return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build(); + private static class BinaryDecoder { + public T decode( + ByteString bytes, + BinaryDecoderType type, + Parser parser, + ExtensionRegistryLite extensions) + throws InvalidProtocolBufferException { + switch (type) { + case BTYE_STRING_DECODER: + case BYTE_ARRAY_DECODER: + return parser.parseFrom(bytes, extensions); + case ARRAY_BYTE_BUFFER_DECODER: + { + ByteBuffer buffer = ByteBuffer.allocate(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); + return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions); + } + case READONLY_ARRAY_BYTE_BUFFER_DECODER: + { + return parser.parseFrom( + CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions); + } + case DIRECT_BYTE_BUFFER_DECODER: + { + ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); + return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions); + } + case READONLY_DIRECT_BYTE_BUFFER_DECODER: + { + ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size()); + bytes.copyTo(buffer); + buffer.flip(); + return parser.parseFrom( + CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions); + } + case INPUT_STREAM_DECODER: + { + return parser.parseFrom(bytes.newInput(), extensions); + } + } + return null; + } + } + + private T parseBinary( + ByteString bytes, Parser parser, ExtensionRegistryLite extensions) + throws InvalidProtocolBufferException { + ArrayList messages = new ArrayList<>(); + ArrayList exceptions = new ArrayList<>(); + + for (int i = 0; i < BinaryDecoderType.values().length; i++) { + messages.add(null); + exceptions.add(null); + } + if (messages.isEmpty()) { + throw new RuntimeException("binary decoder types missing"); + } + + BinaryDecoder decoder = new BinaryDecoder<>(); + + boolean hasMessage = false; + boolean hasException = false; + for (int i = 0; i < BinaryDecoderType.values().length; ++i) { + try { + messages.set(i, decoder.decode(bytes, BinaryDecoderType.values()[i], parser, extensions)); + hasMessage = true; + } catch (InvalidProtocolBufferException e) { + exceptions.set(i, e); + hasException = true; + } + } + + if (hasMessage && hasException) { + StringBuilder sb = + new StringBuilder("Binary decoders disagreed on whether the payload was valid.\n"); + for (int i = 0; i < BinaryDecoderType.values().length; ++i) { + sb.append(BinaryDecoderType.values()[i].name()); + if (messages.get(i) != null) { + sb.append(" accepted the payload.\n"); + } else { + sb.append(" rejected the payload.\n"); } - break; } - case JSON_PAYLOAD: { - return Conformance.ConformanceResponse.newBuilder().setSkipped( - "Lite runtime does not support JSON format.").build(); + throw new RuntimeException(sb.toString()); + } + + if (hasException) { + // We do not check if exceptions are equal. Different implementations may return different + // exception messages. Throw an arbitrary one out instead. + InvalidProtocolBufferException exception = null; + for (InvalidProtocolBufferException e : exceptions) { + if (exception != null) { + exception.addSuppressed(e); + } else { + exception = e; + } } - case PAYLOAD_NOT_SET: { - throw new RuntimeException("Request didn't have payload."); + throw exception; + } + + // Fast path comparing all the messages with the first message, assuming equality being + // symmetric and transitive. + boolean allEqual = true; + for (int i = 1; i < messages.size(); ++i) { + if (!messages.get(0).equals(messages.get(i))) { + allEqual = false; + break; } + } - default: { - throw new RuntimeException("Unexpected payload case."); + // Slow path: compare and find out all unequal pairs. + if (!allEqual) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < messages.size() - 1; ++i) { + for (int j = i + 1; j < messages.size(); ++j) { + if (!messages.get(i).equals(messages.get(j))) { + sb.append(BinaryDecoderType.values()[i].name()) + .append(" and ") + .append(BinaryDecoderType.values()[j].name()) + .append(" parsed the payload differently.\n"); + } + } } + throw new RuntimeException(sb.toString()); + } + + return messages.get(0); + } + + private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) { + com.google.protobuf.MessageLite testMessage; + boolean isProto3 = + request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3"); + boolean isProto2 = + request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2"); + + switch (request.getPayloadCase()) { + case PROTOBUF_PAYLOAD: + { + if (isProto3) { + try { + ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance(); + TestMessagesProto3.registerAllExtensions(extensions); + testMessage = + parseBinary( + request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions); + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder() + .setParseError(e.getMessage()) + .build(); + } + } else if (isProto2) { + try { + ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance(); + TestMessagesProto2.registerAllExtensions(extensions); + testMessage = + parseBinary( + request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions); + } catch (InvalidProtocolBufferException e) { + return Conformance.ConformanceResponse.newBuilder() + .setParseError(e.getMessage()) + .build(); + } + } else { + throw new RuntimeException("Protobuf request doesn't have specific payload type."); + } + break; + } + case JSON_PAYLOAD: + { + return Conformance.ConformanceResponse.newBuilder() + .setSkipped("Lite runtime does not support JSON format.") + .build(); + } + case TEXT_PAYLOAD: + { + return Conformance.ConformanceResponse.newBuilder() + .setSkipped("Lite runtime does not support Text format.") + .build(); + } + case PAYLOAD_NOT_SET: + { + throw new RuntimeException("Request didn't have payload."); + } + default: + { + throw new RuntimeException("Unexpected payload case."); + } } switch (request.getRequestedOutputFormat()) { @@ -103,15 +269,23 @@ class ConformanceJavaLite { throw new RuntimeException("Unspecified output format."); case PROTOBUF: - return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build(); + return Conformance.ConformanceResponse.newBuilder() + .setProtobufPayload(testMessage.toByteString()) + .build(); case JSON: - return Conformance.ConformanceResponse.newBuilder().setSkipped( - "Lite runtime does not support JSON format.").build(); + return Conformance.ConformanceResponse.newBuilder() + .setSkipped("Lite runtime does not support JSON format.") + .build(); - default: { - throw new RuntimeException("Unexpected request output."); - } + case TEXT_FORMAT: + return Conformance.ConformanceResponse.newBuilder() + .setSkipped("Lite runtime does not support Text format.") + .build(); + default: + { + throw new RuntimeException("Unexpected request output."); + } } } @@ -119,7 +293,7 @@ class ConformanceJavaLite { int bytes = readLittleEndianIntFromStdin(); if (bytes == -1) { - return false; // EOF + return false; // EOF } byte[] serializedInput = new byte[bytes]; @@ -144,8 +318,8 @@ class ConformanceJavaLite { this.testCount++; } - System.err.println("ConformanceJavaLite: received EOF from test runner after " + - this.testCount + " tests"); + System.err.println( + "ConformanceJavaLite: received EOF from test runner after " + this.testCount + " tests"); } public static void main(String[] args) throws Exception { diff --git a/conformance/Makefile.am b/conformance/Makefile.am deleted file mode 100644 index 6815c73..0000000 --- a/conformance/Makefile.am +++ /dev/null @@ -1,375 +0,0 @@ -## Process this file with automake to produce Makefile.in - -conformance_protoc_inputs = \ - conformance.proto \ - $(top_srcdir)/src/google/protobuf/test_messages_proto3.proto - -# proto2 input files, should be separated with proto3, as we -# can't generate proto2 files for ruby, php and objc -conformance_proto2_protoc_inputs = \ - $(top_srcdir)/src/google/protobuf/test_messages_proto2.proto - -well_known_type_protoc_inputs = \ - $(top_srcdir)/src/google/protobuf/any.proto \ - $(top_srcdir)/src/google/protobuf/duration.proto \ - $(top_srcdir)/src/google/protobuf/field_mask.proto \ - $(top_srcdir)/src/google/protobuf/struct.proto \ - $(top_srcdir)/src/google/protobuf/timestamp.proto \ - $(top_srcdir)/src/google/protobuf/wrappers.proto - - -protoc_outputs = \ - conformance.pb.cc \ - conformance.pb.h - -other_language_protoc_outputs = \ - conformance_pb2.py \ - Conformance.pbobjc.h \ - Conformance.pbobjc.m \ - conformance_pb.js \ - conformance_pb.rb \ - com/google/protobuf/Any.java \ - com/google/protobuf/AnyOrBuilder.java \ - com/google/protobuf/AnyProto.java \ - com/google/protobuf/BoolValue.java \ - com/google/protobuf/BoolValueOrBuilder.java \ - com/google/protobuf/BytesValue.java \ - com/google/protobuf/BytesValueOrBuilder.java \ - com/google/protobuf/conformance/Conformance.java \ - com/google/protobuf/DoubleValue.java \ - com/google/protobuf/DoubleValueOrBuilder.java \ - com/google/protobuf/Duration.java \ - com/google/protobuf/DurationOrBuilder.java \ - com/google/protobuf/DurationProto.java \ - com/google/protobuf/FieldMask.java \ - com/google/protobuf/FieldMaskOrBuilder.java \ - com/google/protobuf/FieldMaskProto.java \ - com/google/protobuf/FloatValue.java \ - com/google/protobuf/FloatValueOrBuilder.java \ - com/google/protobuf/Int32Value.java \ - com/google/protobuf/Int32ValueOrBuilder.java \ - com/google/protobuf/Int64Value.java \ - com/google/protobuf/Int64ValueOrBuilder.java \ - com/google/protobuf/ListValue.java \ - com/google/protobuf/ListValueOrBuilder.java \ - com/google/protobuf/NullValue.java \ - com/google/protobuf/StringValue.java \ - com/google/protobuf/StringValueOrBuilder.java \ - com/google/protobuf/Struct.java \ - com/google/protobuf/StructOrBuilder.java \ - com/google/protobuf/StructProto.java \ - com/google/protobuf/Timestamp.java \ - com/google/protobuf/TimestampOrBuilder.java \ - com/google/protobuf/TimestampProto.java \ - com/google/protobuf/UInt32Value.java \ - com/google/protobuf/UInt32ValueOrBuilder.java \ - com/google/protobuf/UInt64Value.java \ - com/google/protobuf/UInt64ValueOrBuilder.java \ - com/google/protobuf/Value.java \ - com/google/protobuf/ValueOrBuilder.java \ - com/google/protobuf/WrappersProto.java \ - com/google/protobuf_test_messages/proto3/TestMessagesProto3.java \ - com/google/protobuf_test_messages/proto2/TestMessagesProto2.java \ - google/protobuf/any.pb.cc \ - google/protobuf/any.pb.h \ - google/protobuf/any.rb \ - google/protobuf/any_pb2.py \ - google/protobuf/duration.pb.cc \ - google/protobuf/duration.pb.h \ - google/protobuf/duration.rb \ - google/protobuf/duration_pb2.py \ - google/protobuf/field_mask.pb.cc \ - google/protobuf/field_mask.pb.h \ - google/protobuf/field_mask.rb \ - google/protobuf/field_mask_pb2.py \ - google/protobuf/struct.pb.cc \ - google/protobuf/struct.pb.h \ - google/protobuf/struct.rb \ - google/protobuf/struct_pb2.py \ - google/protobuf/TestMessagesProto2.pbobjc.h \ - google/protobuf/TestMessagesProto2.pbobjc.m \ - google/protobuf/TestMessagesProto3.pbobjc.h \ - google/protobuf/TestMessagesProto3.pbobjc.m \ - google/protobuf/test_messages_proto3.pb.cc \ - google/protobuf/test_messages_proto3.pb.h \ - google/protobuf/test_messages_proto2.pb.cc \ - google/protobuf/test_messages_proto2.pb.h \ - google/protobuf/test_messages_proto3_pb.rb \ - google/protobuf/test_messages_proto3_pb2.py \ - google/protobuf/test_messages_proto2_pb2.py \ - google/protobuf/timestamp.pb.cc \ - google/protobuf/timestamp.pb.h \ - google/protobuf/timestamp.rb \ - google/protobuf/timestamp_pb2.py \ - google/protobuf/wrappers.pb.cc \ - google/protobuf/wrappers.pb.h \ - google/protobuf/wrappers.rb \ - google/protobuf/wrappers_pb2.py \ - Conformance/ConformanceRequest.php \ - Conformance/ConformanceResponse.php \ - Conformance/FailureSet.php \ - Conformance/WireFormat.php \ - GPBMetadata/Conformance.php \ - GPBMetadata/Google/Protobuf/Any.php \ - GPBMetadata/Google/Protobuf/Duration.php \ - GPBMetadata/Google/Protobuf/FieldMask.php \ - GPBMetadata/Google/Protobuf/Struct.php \ - GPBMetadata/Google/Protobuf/TestMessagesProto3.php \ - GPBMetadata/Google/Protobuf/Timestamp.php \ - GPBMetadata/Google/Protobuf/Wrappers.php \ - Google/Protobuf/Any.php \ - Google/Protobuf/BoolValue.php \ - Google/Protobuf/BytesValue.php \ - Google/Protobuf/DoubleValue.php \ - Google/Protobuf/Duration.php \ - Google/Protobuf/FieldMask.php \ - Google/Protobuf/FloatValue.php \ - Google/Protobuf/Int32Value.php \ - Google/Protobuf/Int64Value.php \ - Google/Protobuf/ListValue.php \ - Google/Protobuf/NullValue.php \ - Google/Protobuf/StringValue.php \ - Google/Protobuf/Struct.php \ - Google/Protobuf/Timestamp.php \ - Google/Protobuf/UInt32Value.php \ - Google/Protobuf/UInt64Value.php \ - Google/Protobuf/Value.php \ - Protobuf_test_messages/Proto3/ForeignEnum.php \ - Protobuf_test_messages/Proto3/ForeignMessage.php \ - Protobuf_test_messages/Proto3/TestAllTypes_NestedEnum.php \ - Protobuf_test_messages/Proto3/TestAllTypes_NestedMessage.php \ - Protobuf_test_messages/Proto3/TestAllTypes.php - # lite/com/google/protobuf/Any.java \ - # lite/com/google/protobuf/AnyOrBuilder.java \ - # lite/com/google/protobuf/AnyProto.java \ - # lite/com/google/protobuf/BoolValue.java \ - # lite/com/google/protobuf/BoolValueOrBuilder.java \ - # lite/com/google/protobuf/BytesValue.java \ - # lite/com/google/protobuf/BytesValueOrBuilder.java \ - # lite/com/google/protobuf/conformance/Conformance.java \ - # lite/com/google/protobuf/DoubleValue.java \ - # lite/com/google/protobuf/DoubleValueOrBuilder.java \ - # lite/com/google/protobuf/Duration.java \ - # lite/com/google/protobuf/DurationOrBuilder.java \ - # lite/com/google/protobuf/DurationProto.java \ - # lite/com/google/protobuf/FieldMask.java \ - # lite/com/google/protobuf/FieldMaskOrBuilder.java \ - # lite/com/google/protobuf/FieldMaskProto.java \ - # lite/com/google/protobuf/FloatValue.java \ - # lite/com/google/protobuf/FloatValueOrBuilder.java \ - # lite/com/google/protobuf/Int32Value.java \ - # lite/com/google/protobuf/Int32ValueOrBuilder.java \ - # lite/com/google/protobuf/Int64Value.java \ - # lite/com/google/protobuf/Int64ValueOrBuilder.java \ - # lite/com/google/protobuf/ListValue.java \ - # lite/com/google/protobuf/ListValueOrBuilder.java \ - # lite/com/google/protobuf/NullValue.java \ - # lite/com/google/protobuf/StringValue.java \ - # lite/com/google/protobuf/StringValueOrBuilder.java \ - # lite/com/google/protobuf/Struct.java \ - # lite/com/google/protobuf/StructOrBuilder.java \ - # lite/com/google/protobuf/StructProto.java \ - # lite/com/google/protobuf/Timestamp.java \ - # lite/com/google/protobuf/TimestampOrBuilder.java \ - # lite/com/google/protobuf/TimestampProto.java \ - # lite/com/google/protobuf/UInt32Value.java \ - # lite/com/google/protobuf/UInt32ValueOrBuilder.java \ - # lite/com/google/protobuf/UInt64Value.java \ - # lite/com/google/protobuf/UInt64ValueOrBuilder.java \ - # lite/com/google/protobuf/Value.java \ - # lite/com/google/protobuf/ValueOrBuilder.java \ - # lite/com/google/protobuf/WrappersProto.java - -bin_PROGRAMS = conformance-test-runner conformance-cpp - -# All source files excepet C++/Objective-C ones should be explicitly listed -# here because the autoconf tools don't include files of other languages -# automatically. -EXTRA_DIST = \ - ConformanceJava.java \ - ConformanceJavaLite.java \ - README.md \ - conformance.proto \ - conformance_python.py \ - conformance_ruby.rb \ - conformance_php.php \ - failure_list_cpp.txt \ - failure_list_csharp.txt \ - failure_list_java.txt \ - failure_list_js.txt \ - failure_list_objc.txt \ - failure_list_python.txt \ - failure_list_python_cpp.txt \ - failure_list_python-post26.txt \ - failure_list_ruby.txt \ - failure_list_php.txt \ - failure_list_php_c.txt - -conformance_test_runner_LDADD = $(top_srcdir)/src/libprotobuf.la -conformance_test_runner_SOURCES = conformance_test.h conformance_test.cc \ - conformance_test_main.cc \ - binary_json_conformance_suite.h \ - binary_json_conformance_suite.cc \ - text_format_conformance_suite.h \ - text_format_conformance_suite.cc \ - conformance_test_runner.cc \ - third_party/jsoncpp/json.h \ - third_party/jsoncpp/jsoncpp.cpp -nodist_conformance_test_runner_SOURCES = conformance.pb.cc google/protobuf/test_messages_proto3.pb.cc google/protobuf/test_messages_proto2.pb.cc -conformance_test_runner_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -conformance_test_runner_CXXFLAGS = -std=c++11 -# Explicit deps because BUILT_SOURCES are only done before a "make all/check" -# so a direct "make test_cpp" could fail if parallel enough. -conformance_test_runner-conformance_test.$(OBJEXT): conformance.pb.h -conformance_test_runner-conformance_test_runner.$(OBJEXT): conformance.pb.h - -conformance_cpp_LDADD = $(top_srcdir)/src/libprotobuf.la -conformance_cpp_SOURCES = conformance_cpp.cc -nodist_conformance_cpp_SOURCES = conformance.pb.cc google/protobuf/test_messages_proto3.pb.cc google/protobuf/test_messages_proto2.pb.cc -conformance_cpp_CPPFLAGS = -I$(top_srcdir)/src -# Explicit dep because BUILT_SOURCES are only done before a "make all/check" -# so a direct "make test_cpp" could fail if parallel enough. -conformance_cpp-conformance_cpp.$(OBJEXT): conformance.pb.h - -if OBJC_CONFORMANCE_TEST - -bin_PROGRAMS += conformance-objc - -conformance_objc_SOURCES = conformance_objc.m ../objectivec/GPBProtocolBuffers.m -nodist_conformance_objc_SOURCES = Conformance.pbobjc.m google/protobuf/TestMessagesProto2.pbobjc.m google/protobuf/TestMessagesProto3.pbobjc.m -# On travis, the build fails without the isysroot because whatever system -# headers are being found don't include generics support for -# NSArray/NSDictionary, the only guess is their image at one time had an odd -# setup for Xcode and old frameworks are being found. -conformance_objc_CPPFLAGS = -I$(top_srcdir)/objectivec -isysroot `xcrun --sdk macosx --show-sdk-path` -conformance_objc_LDFLAGS = -framework Foundation -# Explicit dep because BUILT_SOURCES are only done before a "make all/check" -# so a direct "make test_objc" could fail if parallel enough. -conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobuf/TestMessagesProto2.pbobjc.h google/protobuf/TestMessagesProto3.pbobjc.h - -endif - -# JavaScript well-known types are expected to be in a directory called -# google-protobuf, because they are usually in the google-protobuf npm -# package. But we want to use the sources from our tree, so we recreate -# that directory structure here. -google-protobuf: - mkdir google-protobuf - -if USE_EXTERNAL_PROTOC - -# Some implementations include pre-generated versions of well-known types. -protoc_middleman: $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:. $(conformance_protoc_inputs) - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --objc_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs) - $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. --js_out=import_style=commonjs,binary:google-protobuf $(well_known_type_protoc_inputs) - ## $(PROTOC) -I$(srcdir) -I$(top_srcdir) --java_out=lite:lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) - touch protoc_middleman - -else - -# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is -# relative to srcdir, which may not be the same as the current directory when -# building out-of-tree. -protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --objc_out=. --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_proto2_protoc_inputs) ) - oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd/google-protobuf $(well_known_type_protoc_inputs) ) - ## @mkdir -p lite - ## oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --java_out=lite:$$oldpwd/lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) ) - touch protoc_middleman - -endif - -$(protoc_outputs): protoc_middleman - -$(other_language_protoc_outputs): protoc_middleman - -CLEANFILES = $(protoc_outputs) protoc_middleman javac_middleman conformance-java javac_middleman_lite conformance-java-lite conformance-csharp conformance-php conformance-php-c $(other_language_protoc_outputs) - -MAINTAINERCLEANFILES = \ - Makefile.in - -javac_middleman: ConformanceJava.java protoc_middleman $(other_language_protoc_outputs) - jar=`ls ../java/util/target/*jar-with-dependencies.jar` && javac -classpath ../java/target/classes:$$jar ConformanceJava.java com/google/protobuf/conformance/Conformance.java com/google/protobuf_test_messages/proto3/TestMessagesProto3.java com/google/protobuf_test_messages/proto2/TestMessagesProto2.java - @touch javac_middleman - -conformance-java: javac_middleman - @echo "Writing shortcut script conformance-java..." - @echo '#! /bin/sh' > conformance-java - @jar=`ls ../java/util/target/*jar-with-dependencies.jar` && echo java -classpath .:../java/target/classes:$$jar ConformanceJava '$$@' >> conformance-java - @chmod +x conformance-java - -javac_middleman_lite: ConformanceJavaLite.java protoc_middleman $(other_language_protoc_outputs) - javac -classpath ../java/lite/target/classes:lite ConformanceJavaLite.java lite/com/google/protobuf/conformance/Conformance.java - @touch javac_middleman_lite - -conformance-java-lite: javac_middleman_lite - @echo "Writing shortcut script conformance-java-lite..." - @echo '#! /bin/sh' > conformance-java-lite - @echo java -classpath .:../java/lite/target/classes:lite ConformanceJavaLite '$$@' >> conformance-java-lite - @chmod +x conformance-java-lite - -# Currently the conformance code is alongside the rest of the C# -# source, as it's easier to maintain there. We assume we've already -# built that, so we just need a script to run it. -conformance-csharp: $(other_language_protoc_outputs) - @echo "Writing shortcut script conformance-csharp..." - @echo '#! /bin/sh' > conformance-csharp - @echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp2.1/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp - @chmod +x conformance-csharp - -conformance-php: - @echo "Writing shortcut script conformance-php..." - @echo '#! /bin/sh' > conformance-php - @echo 'php -d auto_prepend_file=autoload.php ./conformance_php.php' >> conformance-php - @chmod +x conformance-php - -conformance-php-c: - @echo "Writing shortcut script conformance-php-c..." - @echo '#! /bin/sh' > conformance-php-c - @echo 'php -dextension=../php/ext/google/protobuf/modules/protobuf.so ./conformance_php.php' >> conformance-php-c - @chmod +x conformance-php-c - -# Targets for actually running tests. -test_cpp: protoc_middleman conformance-test-runner conformance-cpp - ./conformance-test-runner --enforce_recommended --failure_list failure_list_cpp.txt ./conformance-cpp - -test_java: protoc_middleman conformance-test-runner conformance-java - ./conformance-test-runner --enforce_recommended --failure_list failure_list_java.txt --text_format_failure_list text_format_failure_list_java.txt ./conformance-java - -test_java_lite: protoc_middleman conformance-test-runner conformance-java-lite - ./conformance-test-runner --enforce_recommended ./conformance-java-lite - -test_csharp: protoc_middleman conformance-test-runner conformance-csharp - ./conformance-test-runner --enforce_recommended --failure_list failure_list_csharp.txt --text_format_failure_list text_format_failure_list_csharp.txt ./conformance-csharp - -test_ruby: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) - RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb - -test_php: protoc_middleman conformance-test-runner conformance-php $(other_language_protoc_outputs) - ./conformance-test-runner --enforce_recommended --failure_list failure_list_php.txt --text_format_failure_list text_format_failure_list_php.txt ./conformance-php - -test_php_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs) - ./conformance-test-runner --enforce_recommended --failure_list failure_list_php_c.txt --text_format_failure_list text_format_failure_list_php.txt ./conformance-php-c - -test_php_c_32: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs) - ./conformance-test-runner --enforce_recommended --failure_list failure_list_php_c_32.txt --text_format_failure_list text_format_failure_list_php.txt ./conformance-php-c - -# These depend on library paths being properly set up. The easiest way to -# run them is to just use "tox" from the python dir. -test_python: protoc_middleman conformance-test-runner - ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python.txt ./conformance_python.py - -test_python_cpp: protoc_middleman conformance-test-runner - ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt ./conformance_python.py - -test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) - NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js - -if OBJC_CONFORMANCE_TEST - -test_objc: protoc_middleman conformance-test-runner conformance-objc - ./conformance-test-runner --enforce_recommended --failure_list failure_list_objc.txt ./conformance-objc - -endif diff --git a/conformance/README.md b/conformance/README.md index 06925db..24f1cbe 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -12,44 +12,77 @@ contains all of the tests themselves. Then separate programs written in whatever language you want to test communicate with the tester program over a pipe. -Before running any of these tests, make sure you run `make` in the base -directory to build `protoc`, since all the tests depend on it. +If you're not using Bazel to run these tests, make sure you build the C++ +tester code beforehand, e.g. from the base directory: - $ make + $ cmake . -Dprotobuf_BUILD_CONFORMANCE=ON && cmake --build . + +This will produce a `conformance_test_runner` binary that can be used to run +conformance tests on any executable. Pass it `--help` for more information. Running the tests for C++ ------------------------- To run the tests against the C++ implementation, run: - $ cd conformance && make test_cpp + $ bazel test //src:conformance_test -Running the tests for JavaScript (Node.js) ------------------------------------------- +Or alternatively with CMake: -To run the JavaScript tests against Node.js, make sure you have "node" -on your path and then run: + $ ctest -R conformance_cpp_test - $ cd conformance && make test_nodejs +Running the tests for other languages +------------------------------------- -Running the tests for Ruby (MRI) --------------------------------- +All of the languages in the Protobuf source tree are set up to run conformance +tests using similar patterns. You can either use Bazel to run the +`conformance_test` target defined in the language's root `BUILD.bazel` file, +or create an executable for a custom test and pass it to +`conformance_test_runner`. -To run the Ruby tests against MRI, first build the C extension: +Note: CMake can be used to build the conformance test runner, but not any of +the conformance test executables outside C++. So if you aren't using Bazel +you'll need to create the executable you pass to `conformance_test_runner` via +some alternate build system. - $ cd ruby && rake +While we plan to model all our supported languages more completely in Bazel, +today some of them are a bit tricky to run. Below is a list of the commands +(and prerequisites) to run each language's conformance tests. -Then run the tests like so: +Java: - $ cd conformance && make test_ruby + $ bazel test //java/core:conformance_test //java/lite:conformance_test -Running the tests for other languages -------------------------------------- +Python: + + $ bazel test //python:conformance_test + +Python C++: + + $ bazel test //python:conformance_test_cpp --define=use_fast_cpp_protos=true + +C#: + + $ `which dotnet || echo "You must have dotnet installed!" + $ `bazel test //csharp:conformance_test \ + --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=~ \ + --action_env=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 + +Objective-C (Mac only): + + $ `bazel test //objectivec:conformance_test --macos_minimum_os=10.9 + +Ruby: + + $ [[ $(ruby --version) == "ruby"* ]] || echo "Select a C Ruby!" + $ bazel test //ruby:conformance_test --define=ruby_platform=c \ + --action_env=PATH --action_env=GEM_PATH --action_env=GEM_HOME + +JRuby: -Most of the languages in the Protobuf source tree are set up to run -conformance tests. However some of them are more tricky to set up -properly. See `tests.sh` in the base of the repository to see how -Travis runs the tests. + $ [[ $(ruby --version) == "jruby"* ]] || echo "Switch to Java Ruby!" + $ bazel test //ruby:conformance_test_jruby --define=ruby_platform=java \ + --action_env=PATH --action_env=GEM_PATH --action_env=GEM_HOME Testing other Protocol Buffer implementations --------------------------------------------- @@ -57,10 +90,10 @@ Testing other Protocol Buffer implementations To run these tests against a new Protocol Buffers implementation, write a program in your language that uses the protobuf implementation you want to test. This program should implement the testing protocol defined in -[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance.proto). +[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance.proto). This is designed to be as easy as possible: the C++ version is only 150 lines and is a good example for what this program should look like -(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance_cpp.cc)). +(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance_cpp.cc)). The program only needs to be able to read from stdin and write to stdout. Portability diff --git a/conformance/autoload.php b/conformance/autoload.php index 0f49aec..7f04cc0 100644 --- a/conformance/autoload.php +++ b/conformance/autoload.php @@ -7,7 +7,7 @@ define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\"); function protobuf_autoloader_impl($class, $prefix) { $length = strlen($prefix); if ((substr($class, 0, $length) === $prefix)) { - $path = '../php/src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php'; + $path = 'php/src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php'; include_once $path; } } diff --git a/conformance/bazel_conformance_test_runner.sh b/conformance/bazel_conformance_test_runner.sh new file mode 100644 index 0000000..fcf4a48 --- /dev/null +++ b/conformance/bazel_conformance_test_runner.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# This is an internal file that should only be called from Bazel rules. For +# custom conformance tests outside of Bazel use CMAKE with +# -Dprotobuf_BUILD_CONFORMANCE=ON to build the test runner. + +set -x +echo $@ + +set -euo pipefail +# --- begin runfiles.bash initialization --- +if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then + if [[ -f "$0.runfiles_manifest" ]]; then + export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" + elif [[ -f "$0.runfiles/MANIFEST" ]]; then + export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" + elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then + export RUNFILES_DIR="$0.runfiles" + fi +fi +if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then + source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" +elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then + source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ + "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" +else + echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" + exit 1 +fi +# --- end runfiles.bash initialization --- + +TESTEE=unset +FAILURE_LIST=unset +TEXT_FORMAT_FAILURE_LIST=unset + +while [[ -n "$@" ]]; do + arg="$1"; shift + val="$1"; shift + case "$arg" in + "--testee") TESTEE="$val" ;; + "--failure_list") FAILURE_LIST="$val" ;; + "--text_format_failure_list") TEXT_FORMAT_FAILURE_LIST="$val" ;; + *) echo "Flag $arg is not recognized." && exit 1 ;; + esac +done + +conformance_test_runner=$(rlocation com_google_protobuf/conformance/conformance_test_runner) +conformance_testee=$(rlocation $TESTEE) +args=(--enforce_recommended) + +failure_list=$(rlocation $FAILURE_LIST) || unset +if [ -n "$failure_list" ] ; then + args+=(--failure_list $failure_list) +fi + +text_format_failure_list=$(rlocation $TEXT_FORMAT_FAILURE_LIST) || unset +if [ -n "$text_format_failure_list" ]; then + args+=(--text_format_failure_list $text_format_failure_list) +fi + +$conformance_test_runner "${args[@]}" $conformance_testee diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index f62c705..cc43c86 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -1,44 +1,31 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #include "binary_json_conformance_suite.h" -#include -#include -#include -#include -#include "third_party/jsoncpp/json.h" +#include +#include +#include +#include + +#include "google/protobuf/util/json_util.h" +#include "google/protobuf/util/type_resolver_util.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" +#include "absl/status/status.h" +#include "absl/strings/str_cat.h" +#include "json/json.h" +#include "conformance/conformance.pb.h" #include "conformance_test.h" -#include -#include -#include +#include "google/protobuf/endian.h" +#include "google/protobuf/test_messages_proto2.pb.h" +#include "google/protobuf/test_messages_proto3.pb.h" +#include "google/protobuf/text_format.h" +#include "google/protobuf/wire_format_lite.h" namespace proto2_messages = protobuf_test_messages::proto2; @@ -48,8 +35,8 @@ using conformance::WireFormat; using google::protobuf::Descriptor; using google::protobuf::FieldDescriptor; using google::protobuf::Message; -using google::protobuf::TextFormat; using google::protobuf::internal::WireFormatLite; +using google::protobuf::internal::little_endian::FromHost; using google::protobuf::util::NewTypeResolverForDescriptorPool; using proto2_messages::TestAllTypesProto2; using protobuf_test_messages::proto3::TestAllTypesProto3; @@ -57,10 +44,14 @@ using std::string; namespace { -static const char kTypeUrlPrefix[] = "type.googleapis.com"; +constexpr absl::string_view kTypeUrlPrefix = "type.googleapis.com"; + +// The number of repetitions to use for performance tests. +// Corresponds approx to 500KB wireformat bytes. +const size_t kPerformanceRepeatCount = 50000; -static string GetTypeUrl(const Descriptor* message) { - return string(kTypeUrlPrefix) + "/" + message->full_name(); +string GetTypeUrl(const Descriptor* message) { + return absl::StrCat(kTypeUrlPrefix, "/", message->full_name()); } /* Routines for building arbitrary protos *************************************/ @@ -68,42 +59,14 @@ static string GetTypeUrl(const Descriptor* message) { // We would use CodedOutputStream except that we want more freedom to build // arbitrary protos (even invalid ones). -const string empty; - -string cat(const string& a, const string& b, - const string& c = empty, - const string& d = empty, - const string& e = empty, - const string& f = empty, - const string& g = empty, - const string& h = empty, - const string& i = empty, - const string& j = empty, - const string& k = empty, - const string& l = empty) { - string ret; - ret.reserve(a.size() + b.size() + c.size() + d.size() + e.size() + f.size() + - g.size() + h.size() + i.size() + j.size() + k.size() + l.size()); - ret.append(a); - ret.append(b); - ret.append(c); - ret.append(d); - ret.append(e); - ret.append(f); - ret.append(g); - ret.append(h); - ret.append(i); - ret.append(j); - ret.append(k); - ret.append(l); - return ret; -} - // The maximum number of bytes that it takes to encode a 64-bit varint. #define VARINT_MAX_LEN 10 -size_t vencode64(uint64_t val, int over_encoded_bytes, char *buf) { - if (val == 0) { buf[0] = 0; return 1; } +size_t vencode64(uint64_t val, int over_encoded_bytes, char* buf) { + if (val == 0) { + buf[0] = 0; + return 1; + } size_t i = 0; while (val) { uint8_t byte = val & 0x7fU; @@ -133,11 +96,22 @@ string longvarint(uint64_t x, int extra) { return string(buf, len); } -// TODO: proper byte-swapping for big-endian machines. -string fixed32(void *data) { return string(static_cast(data), 4); } -string fixed64(void *data) { return string(static_cast(data), 8); } +string fixed32(void* data) { + uint32_t data_le; + std::memcpy(&data_le, data, 4); + data_le = FromHost(data_le); + return string(reinterpret_cast(&data_le), 4); +} +string fixed64(void* data) { + uint64_t data_le; + std::memcpy(&data_le, data, 8); + data_le = FromHost(data_le); + return string(reinterpret_cast(&data_le), 8); +} -string delim(const string& buf) { return cat(varint(buf.size()), buf); } +string delim(const string& buf) { + return absl::StrCat(varint(buf.size()), buf); +} string u32(uint32_t u32) { return fixed32(&u32); } string u64(uint64_t u64) { return fixed64(&u64); } string flt(float f) { return fixed32(&f); } @@ -149,6 +123,10 @@ string tag(uint32_t fieldnum, char wire_type) { return varint((fieldnum << 3) | wire_type); } +string tag(int fieldnum, char wire_type) { + return tag(static_cast(fieldnum), wire_type); +} + string GetDefaultValue(FieldDescriptor::Type type) { switch (type) { case FieldDescriptor::TYPE_INT32: @@ -209,7 +187,8 @@ string GetNonDefaultValue(FieldDescriptor::Type type) { case FieldDescriptor::TYPE_BYTES: return delim("a"); case FieldDescriptor::TYPE_MESSAGE: - return delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234))); + return delim( + absl::StrCat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234))); default: return ""; } @@ -219,39 +198,40 @@ string GetNonDefaultValue(FieldDescriptor::Type type) { #define UNKNOWN_FIELD 666 enum class Packed { - UNSPECIFIED = 0, - TRUE = 1, - FALSE = 2, + kUnspecified = 0, + kTrue = 1, + kFalse = 2, }; const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type, bool repeated, bool is_proto3, - Packed packed = Packed::UNSPECIFIED) { - const Descriptor* d = is_proto3 ? - TestAllTypesProto3().GetDescriptor() : TestAllTypesProto2().GetDescriptor(); + Packed packed = Packed::kUnspecified) { + const Descriptor* d = is_proto3 ? TestAllTypesProto3().GetDescriptor() + : TestAllTypesProto2().GetDescriptor(); for (int i = 0; i < d->field_count(); i++) { const FieldDescriptor* f = d->field(i); if (f->type() == type && f->is_repeated() == repeated) { - if ((packed == Packed::TRUE && !f->is_packed()) || - (packed == Packed::FALSE && f->is_packed())) { + if ((packed == Packed::kTrue && !f->is_packed()) || + (packed == Packed::kFalse && f->is_packed())) { continue; } return f; } } - string packed_string = ""; - const string repeated_string = repeated ? "Repeated " : "Singular "; - const string proto_string = is_proto3 ? "Proto3" : "Proto2"; - if (packed == Packed::TRUE) { + absl::string_view packed_string = ""; + const absl::string_view repeated_string = + repeated ? "Repeated " : "Singular "; + const absl::string_view proto_string = is_proto3 ? "Proto3" : "Proto2"; + if (packed == Packed::kTrue) { packed_string = "Packed "; } - if (packed == Packed::FALSE) { + if (packed == Packed::kFalse) { packed_string = "Unpacked "; } - GOOGLE_LOG(FATAL) << "Couldn't find field with type: " << repeated_string.c_str() - << packed_string.c_str() << FieldDescriptor::TypeName(type) - << " for " << proto_string.c_str(); + ABSL_LOG(FATAL) << "Couldn't find field with type: " << repeated_string + << packed_string << FieldDescriptor::TypeName(type) << " for " + << proto_string; return nullptr; } @@ -272,11 +252,11 @@ const FieldDescriptor* GetFieldForMapType(FieldDescriptor::Type key_type, } } - const string proto_string = is_proto3 ? "Proto3" : "Proto2"; - GOOGLE_LOG(FATAL) << "Couldn't find map field with type: " - << FieldDescriptor::TypeName(key_type) << " and " - << FieldDescriptor::TypeName(key_type) << " for " - << proto_string.c_str(); + const absl::string_view proto_string = is_proto3 ? "Proto3" : "Proto2"; + ABSL_LOG(FATAL) << "Couldn't find map field with type: " + << FieldDescriptor::TypeName(key_type) << " and " + << FieldDescriptor::TypeName(key_type) << " for " + << proto_string; return nullptr; } @@ -292,15 +272,14 @@ const FieldDescriptor* GetFieldForOneofType(FieldDescriptor::Type type, } } - const string proto_string = is_proto3 ? "Proto3" : "Proto2"; - GOOGLE_LOG(FATAL) << "Couldn't find oneof field with type: " - << FieldDescriptor::TypeName(type) << " for " - << proto_string.c_str(); + const absl::string_view proto_string = is_proto3 ? "Proto3" : "Proto2"; + ABSL_LOG(FATAL) << "Couldn't find oneof field with type: " + << FieldDescriptor::TypeName(type) << " for " << proto_string; return nullptr; } string UpperCase(string str) { - for (int i = 0; i < str.size(); i++) { + for (size_t i = 0; i < str.size(); i++) { str[i] = toupper(str[i]); } return str; @@ -309,9 +288,9 @@ string UpperCase(string str) { std::unique_ptr NewTestMessage(bool is_proto3) { std::unique_ptr prototype; if (is_proto3) { - prototype.reset(new TestAllTypesProto3()); + prototype = std::make_unique(); } else { - prototype.reset(new TestAllTypesProto2()); + prototype = std::make_unique(); } return prototype; } @@ -351,10 +330,9 @@ namespace google { namespace protobuf { bool BinaryAndJsonConformanceSuite::ParseJsonResponse( - const ConformanceResponse& response, - Message* test_message) { + const ConformanceResponse& response, Message* test_message) { string binary_protobuf; - util::Status status = + absl::Status status = JsonToBinaryString(type_resolver_.get(), type_url_, response.json_payload(), &binary_protobuf); @@ -363,8 +341,8 @@ bool BinaryAndJsonConformanceSuite::ParseJsonResponse( } if (!test_message->ParseFromString(binary_protobuf)) { - GOOGLE_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode " - << "yielded unparseable proto."; + ABSL_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode " + << "yielded unparseable proto."; return false; } @@ -373,8 +351,7 @@ bool BinaryAndJsonConformanceSuite::ParseJsonResponse( bool BinaryAndJsonConformanceSuite::ParseResponse( const ConformanceResponse& response, - const ConformanceRequestSetting& setting, - Message* test_message) { + const ConformanceRequestSetting& setting, Message* test_message) { const ConformanceRequest& request = setting.GetRequest(); WireFormat requested_output = request.requested_output_format(); const string& test_name = setting.GetTestName(); @@ -384,16 +361,15 @@ bool BinaryAndJsonConformanceSuite::ParseResponse( case ConformanceResponse::kProtobufPayload: { if (requested_output != conformance::PROTOBUF) { ReportFailure(test_name, level, request, response, - StrCat("Test was asked for ", + absl::StrCat("Test was asked for ", WireFormatToString(requested_output), - " output but provided PROTOBUF instead.") - .c_str()); + " output but provided PROTOBUF instead.")); return false; } if (!test_message->ParseFromString(response.protobuf_payload())) { ReportFailure(test_name, level, request, response, - "Protobuf output we received from test was unparseable."); + "Protobuf output we received from test was unparseable."); return false; } @@ -403,10 +379,9 @@ bool BinaryAndJsonConformanceSuite::ParseResponse( case ConformanceResponse::kJsonPayload: { if (requested_output != conformance::JSON) { ReportFailure(test_name, level, request, response, - StrCat("Test was asked for ", + absl::StrCat("Test was asked for ", WireFormatToString(requested_output), - " output but provided JSON instead.") - .c_str()); + " output but provided JSON instead.")); return false; } @@ -420,14 +395,14 @@ bool BinaryAndJsonConformanceSuite::ParseResponse( } default: - GOOGLE_LOG(FATAL) << test_name - << ": unknown payload type: " << response.result_case(); + ABSL_LOG(FATAL) << test_name + << ": unknown payload type: " << response.result_case(); } return true; } -void BinaryAndJsonConformanceSuite::ExpectParseFailureForProtoWithProtoVersion ( +void BinaryAndJsonConformanceSuite::ExpectParseFailureForProtoWithProtoVersion( const string& proto, const string& test_name, ConformanceLevel level, bool is_proto3) { std::unique_ptr prototype = NewTestMessage(is_proto3); @@ -435,12 +410,11 @@ void BinaryAndJsonConformanceSuite::ExpectParseFailureForProtoWithProtoVersion ( // we let it send its response as this. We must not leave it unspecified. ConformanceRequestSetting setting( level, conformance::PROTOBUF, conformance::PROTOBUF, - conformance::BINARY_TEST, - *prototype, test_name, proto); + conformance::BINARY_TEST, *prototype, test_name, proto); const ConformanceRequest& request = setting.GetRequest(); ConformanceResponse response; - string effective_test_name = StrCat( + string effective_test_name = absl::StrCat( setting.ConformanceLevelToString(level), (is_proto3 ? ".Proto3" : ".Proto2"), ".ProtobufInput.", test_name); @@ -466,7 +440,7 @@ void BinaryAndJsonConformanceSuite::ExpectParseFailureForProto( // by valid protobuf data. We can try running this twice: once with this // data verbatim and once with this data followed by some valid data. // -// TODO(haberman): implement the second of these. +// TODO: implement the second of these. void BinaryAndJsonConformanceSuite::ExpectHardParseFailureForProto( const string& proto, const string& test_name, ConformanceLevel level) { return ExpectParseFailureForProto(proto, test_name, level); @@ -476,24 +450,40 @@ void BinaryAndJsonConformanceSuite::RunValidJsonTest( const string& test_name, ConformanceLevel level, const string& input_json, const string& equivalent_text_format) { TestAllTypesProto3 prototype; + RunValidJsonTestWithMessage(test_name, level, input_json, + equivalent_text_format, prototype); +} + +void BinaryAndJsonConformanceSuite::RunValidJsonTest( + const string& test_name, ConformanceLevel level, const string& input_json, + const string& equivalent_text_format, bool is_proto3) { + if (is_proto3) { + RunValidJsonTest(test_name, level, input_json, equivalent_text_format); + } else { + TestAllTypesProto2 prototype; + RunValidJsonTestWithMessage(test_name, level, input_json, + equivalent_text_format, prototype); + } +} + +void BinaryAndJsonConformanceSuite::RunValidJsonTestWithMessage( + const string& test_name, ConformanceLevel level, const string& input_json, + const string& equivalent_text_format, const Message& prototype) { ConformanceRequestSetting setting1( - level, conformance::JSON, conformance::PROTOBUF, - conformance::JSON_TEST, + level, conformance::JSON, conformance::PROTOBUF, conformance::JSON_TEST, prototype, test_name, input_json); RunValidInputTest(setting1, equivalent_text_format); - ConformanceRequestSetting setting2( - level, conformance::JSON, conformance::JSON, - conformance::JSON_TEST, - prototype, test_name, input_json); + ConformanceRequestSetting setting2(level, conformance::JSON, + conformance::JSON, conformance::JSON_TEST, + prototype, test_name, input_json); RunValidInputTest(setting2, equivalent_text_format); } void BinaryAndJsonConformanceSuite::RunValidJsonTestWithProtobufInput( - const string& test_name, ConformanceLevel level, const TestAllTypesProto3& input, - const string& equivalent_text_format) { + const string& test_name, ConformanceLevel level, + const TestAllTypesProto3& input, const string& equivalent_text_format) { ConformanceRequestSetting setting( - level, conformance::PROTOBUF, conformance::JSON, - conformance::JSON_TEST, + level, conformance::PROTOBUF, conformance::JSON, conformance::JSON_TEST, input, test_name, input.SerializeAsString()); RunValidInputTest(setting, equivalent_text_format); } @@ -504,8 +494,8 @@ void BinaryAndJsonConformanceSuite::RunValidJsonIgnoreUnknownTest( TestAllTypesProto3 prototype; ConformanceRequestSetting setting( level, conformance::JSON, conformance::PROTOBUF, - conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST, - prototype, test_name, input_json); + conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST, prototype, test_name, + input_json); RunValidInputTest(setting, equivalent_text_format); } @@ -517,15 +507,13 @@ void BinaryAndJsonConformanceSuite::RunValidProtobufTest( ConformanceRequestSetting setting1( level, conformance::PROTOBUF, conformance::PROTOBUF, - conformance::BINARY_TEST, - *prototype, test_name, input_protobuf); + conformance::BINARY_TEST, *prototype, test_name, input_protobuf); RunValidInputTest(setting1, equivalent_text_format); if (is_proto3) { ConformanceRequestSetting setting2( level, conformance::PROTOBUF, conformance::JSON, - conformance::BINARY_TEST, - *prototype, test_name, input_protobuf); + conformance::BINARY_TEST, *prototype, test_name, input_protobuf); RunValidInputTest(setting2, equivalent_text_format); } } @@ -544,13 +532,33 @@ void BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest( std::unique_ptr prototype = NewTestMessage(is_proto3); ConformanceRequestSetting setting( level, conformance::PROTOBUF, conformance::PROTOBUF, - conformance::BINARY_TEST, - *prototype, test_name, input_protobuf); + conformance::BINARY_TEST, *prototype, test_name, input_protobuf); RunValidBinaryInputTest(setting, expected_protobuf, true); } +void BinaryAndJsonConformanceSuite::RunBinaryPerformanceMergeMessageWithField( + const string& test_name, const string& field_proto, bool is_proto3) { + string message_tag = tag(27, WireFormatLite::WIRETYPE_LENGTH_DELIMITED); + string message_proto = absl::StrCat(message_tag, delim(field_proto)); + + string proto; + for (size_t i = 0; i < kPerformanceRepeatCount; i++) { + proto.append(message_proto); + } + + string multiple_repeated_field_proto; + for (size_t i = 0; i < kPerformanceRepeatCount; i++) { + multiple_repeated_field_proto.append(field_proto); + } + string expected_proto = + absl::StrCat(message_tag, delim(multiple_repeated_field_proto)); + + RunValidBinaryProtobufTest(test_name, RECOMMENDED, proto, expected_proto, + is_proto3); +} + void BinaryAndJsonConformanceSuite::RunValidProtobufTestWithMessage( - const string& test_name, ConformanceLevel level, const Message *input, + const string& test_name, ConformanceLevel level, const Message* input, const string& equivalent_text_format, bool is_proto3) { RunValidProtobufTest(test_name, level, input->SerializeAsString(), equivalent_text_format, is_proto3); @@ -571,7 +579,7 @@ void BinaryAndJsonConformanceSuite::RunValidJsonTestWithValidator( const ConformanceRequest& request = setting.GetRequest(); ConformanceResponse response; string effective_test_name = - StrCat(setting.ConformanceLevelToString(level), + absl::StrCat(setting.ConformanceLevelToString(level), is_proto3 ? ".Proto3.JsonInput." : ".Proto2.JsonInput.", test_name, ".Validator"); @@ -584,16 +592,16 @@ void BinaryAndJsonConformanceSuite::RunValidJsonTestWithValidator( if (response.result_case() != ConformanceResponse::kJsonPayload) { ReportFailure(effective_test_name, level, request, response, - "Expected JSON payload but got type %d.", - response.result_case()); + absl::StrCat("Expected JSON payload but got type ", + response.result_case())); return; } Json::Reader reader; Json::Value value; if (!reader.parse(response.json_payload(), value)) { ReportFailure(effective_test_name, level, request, response, - "JSON payload cannot be parsed as valid JSON: %s", - reader.getFormattedErrorMessages().c_str()); + absl::StrCat("JSON payload cannot be parsed as valid JSON: ", + reader.getFormattedErrorMessages())); return; } if (!validator(value)) { @@ -609,13 +617,12 @@ void BinaryAndJsonConformanceSuite::ExpectParseFailureForJson( TestAllTypesProto3 prototype; // We don't expect output, but if the program erroneously accepts the protobuf // we let it send its response as this. We must not leave it unspecified. - ConformanceRequestSetting setting( - level, conformance::JSON, conformance::JSON, - conformance::JSON_TEST, - prototype, test_name, input_json); + ConformanceRequestSetting setting(level, conformance::JSON, conformance::JSON, + conformance::JSON_TEST, prototype, + test_name, input_json); const ConformanceRequest& request = setting.GetRequest(); ConformanceResponse response; - string effective_test_name = StrCat( + string effective_test_name = absl::StrCat( setting.ConformanceLevelToString(level), ".Proto3.JsonInput.", test_name); RunTest(effective_test_name, request, &response); @@ -630,19 +637,19 @@ void BinaryAndJsonConformanceSuite::ExpectParseFailureForJson( } void BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson( - const string& test_name, ConformanceLevel level, const string& text_format) { + const string& test_name, ConformanceLevel level, + const string& text_format) { TestAllTypesProto3 payload_message; - GOOGLE_CHECK(TextFormat::ParseFromString(text_format, &payload_message)) + ABSL_CHECK(TextFormat::ParseFromString(text_format, &payload_message)) << "Failed to parse: " << text_format; TestAllTypesProto3 prototype; ConformanceRequestSetting setting( - level, conformance::PROTOBUF, conformance::JSON, - conformance::JSON_TEST, + level, conformance::PROTOBUF, conformance::JSON, conformance::JSON_TEST, prototype, test_name, payload_message.SerializeAsString()); const ConformanceRequest& request = setting.GetRequest(); ConformanceResponse response; - string effective_test_name = StrCat( + string effective_test_name = absl::StrCat( setting.ConformanceLevelToString(level), ".", test_name, ".JsonOutput"); RunTest(effective_test_name, request, &response); @@ -659,88 +666,97 @@ void BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson( void BinaryAndJsonConformanceSuite::TestPrematureEOFForType( FieldDescriptor::Type type) { // Incomplete values for each wire type. - static const string incompletes[6] = { - string("\x80"), // VARINT - string("abcdefg"), // 64BIT - string("\x80"), // DELIMITED (partial length) - string(), // START_GROUP (no value required) - string(), // END_GROUP (no value required) - string("abc") // 32BIT + static constexpr absl::string_view incompletes[6] = { + "\x80", // VARINT + "abcdefg", // 64BIT + "\x80", // DELIMITED (partial length) + "", // START_GROUP (no value required) + "", // END_GROUP (no value required) + "abc" // 32BIT }; const FieldDescriptor* field = GetFieldForType(type, false, true); const FieldDescriptor* rep_field = GetFieldForType(type, true, true); WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( static_cast(type)); - const string& incomplete = incompletes[wire_type]; + absl::string_view incomplete = incompletes[wire_type]; const string type_name = - UpperCase(string(".") + FieldDescriptor::TypeName(type)); + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(type))); ExpectParseFailureForProto( tag(field->number(), wire_type), - "PrematureEofBeforeKnownNonRepeatedValue" + type_name, REQUIRED); + absl::StrCat("PrematureEofBeforeKnownNonRepeatedValue", type_name), + REQUIRED); ExpectParseFailureForProto( tag(rep_field->number(), wire_type), - "PrematureEofBeforeKnownRepeatedValue" + type_name, REQUIRED); + absl::StrCat("PrematureEofBeforeKnownRepeatedValue", type_name), + REQUIRED); ExpectParseFailureForProto( tag(UNKNOWN_FIELD, wire_type), - "PrematureEofBeforeUnknownValue" + type_name, REQUIRED); + absl::StrCat("PrematureEofBeforeUnknownValue", type_name), REQUIRED); ExpectParseFailureForProto( - cat( tag(field->number(), wire_type), incomplete ), - "PrematureEofInsideKnownNonRepeatedValue" + type_name, REQUIRED); + absl::StrCat(tag(field->number(), wire_type), incomplete), + absl::StrCat("PrematureEofInsideKnownNonRepeatedValue", type_name), + REQUIRED); ExpectParseFailureForProto( - cat( tag(rep_field->number(), wire_type), incomplete ), - "PrematureEofInsideKnownRepeatedValue" + type_name, REQUIRED); + absl::StrCat(tag(rep_field->number(), wire_type), incomplete), + absl::StrCat("PrematureEofInsideKnownRepeatedValue", type_name), + REQUIRED); ExpectParseFailureForProto( - cat( tag(UNKNOWN_FIELD, wire_type), incomplete ), - "PrematureEofInsideUnknownValue" + type_name, REQUIRED); + absl::StrCat(tag(UNKNOWN_FIELD, wire_type), incomplete), + absl::StrCat("PrematureEofInsideUnknownValue", type_name), REQUIRED); if (wire_type == WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { ExpectParseFailureForProto( - cat( tag(field->number(), wire_type), varint(1) ), - "PrematureEofInDelimitedDataForKnownNonRepeatedValue" + type_name, + absl::StrCat(tag(field->number(), wire_type), varint(1)), + absl::StrCat("PrematureEofInDelimitedDataForKnownNonRepeatedValue", + type_name), REQUIRED); ExpectParseFailureForProto( - cat( tag(rep_field->number(), wire_type), varint(1) ), - "PrematureEofInDelimitedDataForKnownRepeatedValue" + type_name, + absl::StrCat(tag(rep_field->number(), wire_type), varint(1)), + absl::StrCat("PrematureEofInDelimitedDataForKnownRepeatedValue", + type_name), REQUIRED); // EOF in the middle of delimited data for unknown value. ExpectParseFailureForProto( - cat( tag(UNKNOWN_FIELD, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForUnknownValue" + type_name, REQUIRED); + absl::StrCat(tag(UNKNOWN_FIELD, wire_type), varint(1)), + absl::StrCat("PrematureEofInDelimitedDataForUnknownValue", type_name), + REQUIRED); if (type == FieldDescriptor::TYPE_MESSAGE) { // Submessage ends in the middle of a value. - string incomplete_submsg = - cat( tag(WireFormatLite::TYPE_INT32, WireFormatLite::WIRETYPE_VARINT), - incompletes[WireFormatLite::WIRETYPE_VARINT] ); + string incomplete_submsg = absl::StrCat( + tag(WireFormatLite::TYPE_INT32, WireFormatLite::WIRETYPE_VARINT), + incompletes[WireFormatLite::WIRETYPE_VARINT]); ExpectHardParseFailureForProto( - cat( tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - varint(incomplete_submsg.size()), - incomplete_submsg ), - "PrematureEofInSubmessageValue" + type_name, REQUIRED); + absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + varint(incomplete_submsg.size()), incomplete_submsg), + absl::StrCat("PrematureEofInSubmessageValue", type_name), REQUIRED); } } else if (type != FieldDescriptor::TYPE_GROUP) { // Non-delimited, non-group: eligible for packing. // Packed region ends in the middle of a value. ExpectHardParseFailureForProto( - cat(tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + absl::StrCat( + tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), varint(incomplete.size()), incomplete), - "PrematureEofInPackedFieldValue" + type_name, REQUIRED); + absl::StrCat("PrematureEofInPackedFieldValue", type_name), REQUIRED); // EOF in the middle of packed region. ExpectParseFailureForProto( - cat(tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + absl::StrCat( + tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), varint(1)), - "PrematureEofInPackedField" + type_name, REQUIRED); + absl::StrCat("PrematureEofInPackedField", type_name), REQUIRED); } } @@ -749,7 +765,7 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( std::vector> values) { for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { const string type_name = - UpperCase(string(".") + FieldDescriptor::TypeName(type)); + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(type))); WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( static_cast(type)); const FieldDescriptor* field = GetFieldForType(type, false, is_proto3); @@ -757,21 +773,23 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( // Test singular data for singular fields. for (size_t i = 0; i < values.size(); i++) { - string proto = cat(tag(field->number(), wire_type), values[i].first); + string proto = + absl::StrCat(tag(field->number(), wire_type), values[i].first); // In proto3, default primitive fields should not be encoded. string expected_proto = is_proto3 && IsProto3Default(field->type(), values[i].second) ? "" - : cat(tag(field->number(), wire_type), values[i].second); + : absl::StrCat(tag(field->number(), wire_type), values[i].second); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(expected_proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest( - StrCat("ValidDataScalar", type_name, "[", i, "]"), REQUIRED, + absl::StrCat("ValidDataScalar", type_name, "[", i, "]"), REQUIRED, proto, text, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataScalarBinary", type_name, "[", i, "]"), + absl::StrCat("ValidDataScalarBinary", type_name, "[", i, "]"), RECOMMENDED, proto, expected_proto, is_proto3); } @@ -781,24 +799,25 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( if (type != FieldDescriptor::TYPE_MESSAGE) { string proto; for (size_t i = 0; i < values.size(); i++) { - proto += cat(tag(field->number(), wire_type), values[i].first); + proto += absl::StrCat(tag(field->number(), wire_type), values[i].first); } string expected_proto = - cat(tag(field->number(), wire_type), values.back().second); + absl::StrCat(tag(field->number(), wire_type), values.back().second); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(expected_proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); - RunValidProtobufTest("RepeatedScalarSelectsLast" + type_name, REQUIRED, - proto, text, is_proto3); + RunValidProtobufTest(absl::StrCat("RepeatedScalarSelectsLast", type_name), + REQUIRED, proto, text, is_proto3); } // Test repeated fields. if (FieldDescriptor::IsTypePackable(type)) { const FieldDescriptor* packed_field = - GetFieldForType(type, true, is_proto3, Packed::TRUE); + GetFieldForType(type, true, is_proto3, Packed::kTrue); const FieldDescriptor* unpacked_field = - GetFieldForType(type, true, is_proto3, Packed::FALSE); + GetFieldForType(type, true, is_proto3, Packed::kFalse); string default_proto_packed; string default_proto_unpacked; @@ -813,49 +832,51 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( for (size_t i = 0; i < values.size(); i++) { default_proto_unpacked += - cat(tag(rep_field->number(), wire_type), values[i].first); + absl::StrCat(tag(rep_field->number(), wire_type), values[i].first); default_proto_unpacked_expected += - cat(tag(rep_field->number(), wire_type), values[i].second); + absl::StrCat(tag(rep_field->number(), wire_type), values[i].second); default_proto_packed += values[i].first; default_proto_packed_expected += values[i].second; - packed_proto_unpacked += - cat(tag(packed_field->number(), wire_type), values[i].first); + packed_proto_unpacked += absl::StrCat( + tag(packed_field->number(), wire_type), values[i].first); packed_proto_packed += values[i].first; packed_proto_expected += values[i].second; - unpacked_proto_unpacked += - cat(tag(unpacked_field->number(), wire_type), values[i].first); + unpacked_proto_unpacked += absl::StrCat( + tag(unpacked_field->number(), wire_type), values[i].first); unpacked_proto_packed += values[i].first; - unpacked_proto_expected += - cat(tag(unpacked_field->number(), wire_type), values[i].second); + unpacked_proto_expected += absl::StrCat( + tag(unpacked_field->number(), wire_type), values[i].second); } - default_proto_packed = cat( + default_proto_packed = absl::StrCat( tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), delim(default_proto_packed)); - default_proto_packed_expected = cat( + default_proto_packed_expected = absl::StrCat( tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), delim(default_proto_packed_expected)); - packed_proto_packed = cat(tag(packed_field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(packed_proto_packed)); + packed_proto_packed = + absl::StrCat(tag(packed_field->number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(packed_proto_packed)); packed_proto_expected = - cat(tag(packed_field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(packed_proto_expected)); + absl::StrCat(tag(packed_field->number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(packed_proto_expected)); unpacked_proto_packed = - cat(tag(unpacked_field->number(), - WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(unpacked_proto_packed)); + absl::StrCat(tag(unpacked_field->number(), + WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(unpacked_proto_packed)); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(default_proto_packed_expected); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); // Ensures both packed and unpacked data can be parsed. RunValidProtobufTest( - StrCat("ValidDataRepeated", type_name, ".UnpackedInput"), + absl::StrCat("ValidDataRepeated", type_name, ".UnpackedInput"), REQUIRED, default_proto_unpacked, text, is_proto3); RunValidProtobufTest( - StrCat("ValidDataRepeated", type_name, ".PackedInput"), + absl::StrCat("ValidDataRepeated", type_name, ".PackedInput"), REQUIRED, default_proto_packed, text, is_proto3); // proto2 should encode as unpacked by default and proto3 should encode as @@ -863,27 +884,27 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( string expected_proto = rep_field->is_packed() ? default_proto_packed_expected : default_proto_unpacked_expected; - RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataRepeated", type_name, ".UnpackedInput.DefaultOutput"), RECOMMENDED, default_proto_unpacked, expected_proto, is_proto3); - RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataRepeated", type_name, ".PackedInput.DefaultOutput"), RECOMMENDED, default_proto_packed, expected_proto, is_proto3); - RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataRepeated", type_name, ".UnpackedInput.PackedOutput"), RECOMMENDED, packed_proto_unpacked, packed_proto_expected, is_proto3); - RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataRepeated", type_name, ".PackedInput.PackedOutput"), RECOMMENDED, packed_proto_packed, packed_proto_expected, is_proto3); - RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataRepeated", type_name, ".UnpackedInput.UnpackedOutput"), RECOMMENDED, unpacked_proto_unpacked, unpacked_proto_expected, is_proto3); - RunValidBinaryProtobufTest(StrCat("ValidDataRepeated", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataRepeated", type_name, ".PackedInput.UnpackedOutput"), RECOMMENDED, unpacked_proto_packed, unpacked_proto_expected, is_proto3); @@ -891,15 +912,17 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( string proto; string expected_proto; for (size_t i = 0; i < values.size(); i++) { - proto += cat(tag(rep_field->number(), wire_type), values[i].first); + proto += + absl::StrCat(tag(rep_field->number(), wire_type), values[i].first); expected_proto += - cat(tag(rep_field->number(), wire_type), values[i].second); + absl::StrCat(tag(rep_field->number(), wire_type), values[i].second); } std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(expected_proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); - RunValidProtobufTest(StrCat("ValidDataRepeated", type_name), + RunValidProtobufTest(absl::StrCat("ValidDataRepeated", type_name), REQUIRED, proto, text, is_proto3); } } @@ -907,16 +930,18 @@ void BinaryAndJsonConformanceSuite::TestValidDataForType( void BinaryAndJsonConformanceSuite::TestValidDataForRepeatedScalarMessage() { std::vector values = { - delim(cat( + delim(absl::StrCat( tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234), - tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1234), - tag(31, WireFormatLite::WIRETYPE_VARINT), varint(1234))))), - delim(cat( + delim(absl::StrCat( + tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234), + tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1234), + tag(31, WireFormatLite::WIRETYPE_VARINT), varint(1234))))), + delim(absl::StrCat( tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(4321), - tag(3, WireFormatLite::WIRETYPE_VARINT), varint(4321), - tag(31, WireFormatLite::WIRETYPE_VARINT), varint(4321))))), + delim(absl::StrCat( + tag(1, WireFormatLite::WIRETYPE_VARINT), varint(4321), + tag(3, WireFormatLite::WIRETYPE_VARINT), varint(4321), + tag(31, WireFormatLite::WIRETYPE_VARINT), varint(4321))))), }; const std::string expected = @@ -934,34 +959,37 @@ void BinaryAndJsonConformanceSuite::TestValidDataForRepeatedScalarMessage() { const FieldDescriptor* field = GetFieldForType(FieldDescriptor::TYPE_MESSAGE, false, is_proto3); for (size_t i = 0; i < values.size(); i++) { - proto += - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - values[i]); + proto += absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + values[i]); } RunValidProtobufTest("RepeatedScalarMessageMerge", REQUIRED, proto, - field->name() + ": " + expected, is_proto3); + absl::StrCat(field->name(), ": ", expected), + is_proto3); } } void BinaryAndJsonConformanceSuite::TestValidDataForMapType( FieldDescriptor::Type key_type, FieldDescriptor::Type value_type) { const string key_type_name = - UpperCase(string(".") + FieldDescriptor::TypeName(key_type)); + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(key_type))); const string value_type_name = - UpperCase(string(".") + FieldDescriptor::TypeName(value_type)); + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(value_type))); WireFormatLite::WireType key_wire_type = WireFormatLite::WireTypeForFieldType( static_cast(key_type)); WireFormatLite::WireType value_wire_type = WireFormatLite::WireTypeForFieldType( static_cast(value_type)); - string key1_data = cat(tag(1, key_wire_type), GetDefaultValue(key_type)); + string key1_data = + absl::StrCat(tag(1, key_wire_type), GetDefaultValue(key_type)); string value1_data = - cat(tag(2, value_wire_type), GetDefaultValue(value_type)); - string key2_data = cat(tag(1, key_wire_type), GetNonDefaultValue(key_type)); + absl::StrCat(tag(2, value_wire_type), GetDefaultValue(value_type)); + string key2_data = + absl::StrCat(tag(1, key_wire_type), GetNonDefaultValue(key_type)); string value2_data = - cat(tag(2, value_wire_type), GetNonDefaultValue(value_type)); + absl::StrCat(tag(2, value_wire_type), GetNonDefaultValue(value_type)); for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { const FieldDescriptor* field = @@ -969,97 +997,104 @@ void BinaryAndJsonConformanceSuite::TestValidDataForMapType( { // Tests map with default key and value. - string proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key1_data, value1_data))); + string proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key1_data, value1_data))); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); - RunValidProtobufTest(StrCat("ValidDataMap", key_type_name, + string text; + TextFormat::PrintToString(*test_message, &text); + RunValidProtobufTest(absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".Default"), REQUIRED, proto, text, is_proto3); } { // Tests map with missing default key and value. - string proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim("")); + string proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim("")); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); - RunValidProtobufTest(StrCat("ValidDataMap", key_type_name, + string text; + TextFormat::PrintToString(*test_message, &text); + RunValidProtobufTest(absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".MissingDefault"), REQUIRED, proto, text, is_proto3); } { // Tests map with non-default key and value. - string proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key2_data, value2_data))); + string proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key2_data, value2_data))); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); - RunValidProtobufTest(StrCat("ValidDataMap", key_type_name, + string text; + TextFormat::PrintToString(*test_message, &text); + RunValidProtobufTest(absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".NonDefault"), REQUIRED, proto, text, is_proto3); } { // Tests map with unordered key and value. - string proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(value2_data, key2_data))); + string proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(value2_data, key2_data))); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); - RunValidProtobufTest(StrCat("ValidDataMap", key_type_name, + string text; + TextFormat::PrintToString(*test_message, &text); + RunValidProtobufTest(absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".Unordered"), REQUIRED, proto, text, is_proto3); } { // Tests map with duplicate key. - string proto1 = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key2_data, value1_data))); - string proto2 = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key2_data, value2_data))); - string proto = cat(proto1, proto2); + string proto1 = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key2_data, value1_data))); + string proto2 = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key2_data, value2_data))); + string proto = absl::StrCat(proto1, proto2); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto2); - string text = test_message->DebugString(); - RunValidProtobufTest(StrCat("ValidDataMap", key_type_name, + string text; + TextFormat::PrintToString(*test_message, &text); + RunValidProtobufTest(absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".DuplicateKey"), REQUIRED, proto, text, is_proto3); } { // Tests map with duplicate key in map entry. - string proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key1_data, key2_data, value2_data))); + string proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key1_data, key2_data, value2_data))); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest( - StrCat("ValidDataMap", key_type_name, value_type_name, + absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".DuplicateKeyInMapEntry"), REQUIRED, proto, text, is_proto3); } { // Tests map with duplicate value in map entry. - string proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key2_data, value1_data, value2_data))); + string proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key2_data, value1_data, value2_data))); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest( - StrCat("ValidDataMap", key_type_name, value_type_name, + absl::StrCat("ValidDataMap", key_type_name, value_type_name, ".DuplicateValueInMapEntry"), REQUIRED, proto, text, is_proto3); } @@ -1067,37 +1102,40 @@ void BinaryAndJsonConformanceSuite::TestValidDataForMapType( } void BinaryAndJsonConformanceSuite::TestOverwriteMessageValueMap() { - string key_data = - cat(tag(1, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), delim("")); - string field1_data = cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1)); - string field2_data = cat(tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string key_data = absl::StrCat( + tag(1, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), delim("")); + string field1_data = + absl::StrCat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string field2_data = + absl::StrCat(tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1)); string field31_data = - cat(tag(31, WireFormatLite::WIRETYPE_VARINT), varint(1)); - string submsg1_data = delim(cat(field1_data, field31_data)); - string submsg2_data = delim(cat(field2_data, field31_data)); - string value1_data = - cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - submsg1_data))); - string value2_data = - cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - submsg2_data))); + absl::StrCat(tag(31, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string submsg1_data = delim(absl::StrCat(field1_data, field31_data)); + string submsg2_data = delim(absl::StrCat(field2_data, field31_data)); + string value1_data = absl::StrCat( + tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + submsg1_data))); + string value2_data = absl::StrCat( + tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + submsg2_data))); for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { const FieldDescriptor* field = GetFieldForMapType( FieldDescriptor::TYPE_STRING, FieldDescriptor::TYPE_MESSAGE, is_proto3); - string proto1 = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key_data, value1_data))); - string proto2 = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(key_data, value2_data))); - string proto = cat(proto1, proto2); + string proto1 = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key_data, value1_data))); + string proto2 = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(key_data, value2_data))); + string proto = absl::StrCat(proto1, proto2); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto2); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest("ValidDataMap.STRING.MESSAGE.MergeValue", REQUIRED, proto, text, is_proto3); } @@ -1106,29 +1144,30 @@ void BinaryAndJsonConformanceSuite::TestOverwriteMessageValueMap() { void BinaryAndJsonConformanceSuite::TestValidDataForOneofType( FieldDescriptor::Type type) { const string type_name = - UpperCase(string(".") + FieldDescriptor::TypeName(type)); + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(type))); WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( static_cast(type)); for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { const FieldDescriptor* field = GetFieldForOneofType(type, is_proto3); const string default_value = - cat(tag(field->number(), wire_type), GetDefaultValue(type)); + absl::StrCat(tag(field->number(), wire_type), GetDefaultValue(type)); const string non_default_value = - cat(tag(field->number(), wire_type), GetNonDefaultValue(type)); + absl::StrCat(tag(field->number(), wire_type), GetNonDefaultValue(type)); { // Tests oneof with default value. const string proto = default_value; std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest( - StrCat("ValidDataOneof", type_name, ".DefaultValue"), REQUIRED, + absl::StrCat("ValidDataOneof", type_name, ".DefaultValue"), REQUIRED, proto, text, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataOneofBinary", type_name, ".DefaultValue"), + absl::StrCat("ValidDataOneofBinary", type_name, ".DefaultValue"), RECOMMENDED, proto, proto, is_proto3); } @@ -1137,28 +1176,30 @@ void BinaryAndJsonConformanceSuite::TestValidDataForOneofType( const string proto = non_default_value; std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest( - StrCat("ValidDataOneof", type_name, ".NonDefaultValue"), + absl::StrCat("ValidDataOneof", type_name, ".NonDefaultValue"), REQUIRED, proto, text, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataOneofBinary", type_name, ".NonDefaultValue"), + absl::StrCat("ValidDataOneofBinary", type_name, ".NonDefaultValue"), RECOMMENDED, proto, proto, is_proto3); } { // Tests oneof with multiple values of the same field. - const string proto = StrCat(default_value, non_default_value); + const string proto = absl::StrCat(default_value, non_default_value); const string expected_proto = non_default_value; std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(expected_proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); - RunValidProtobufTest(StrCat("ValidDataOneof", type_name, + RunValidProtobufTest(absl::StrCat("ValidDataOneof", type_name, ".MultipleValuesForSameField"), REQUIRED, proto, text, is_proto3); - RunValidBinaryProtobufTest(StrCat("ValidDataOneofBinary", type_name, + RunValidBinaryProtobufTest(absl::StrCat("ValidDataOneofBinary", type_name, ".MultipleValuesForSameField"), RECOMMENDED, proto, expected_proto, is_proto3); } @@ -1172,20 +1213,21 @@ void BinaryAndJsonConformanceSuite::TestValidDataForOneofType( WireFormatLite::WireTypeForFieldType( static_cast(other_type)); const string other_value = - cat(tag(other_field->number(), other_wire_type), - GetDefaultValue(other_type)); + absl::StrCat(tag(other_field->number(), other_wire_type), + GetDefaultValue(other_type)); - const string proto = StrCat(other_value, non_default_value); + const string proto = absl::StrCat(other_value, non_default_value); const string expected_proto = non_default_value; std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(expected_proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); - RunValidProtobufTest(StrCat("ValidDataOneof", type_name, + RunValidProtobufTest(absl::StrCat("ValidDataOneof", type_name, ".MultipleValuesForDifferentField"), REQUIRED, proto, text, is_proto3); RunValidBinaryProtobufTest( - StrCat("ValidDataOneofBinary", type_name, + absl::StrCat("ValidDataOneofBinary", type_name, ".MultipleValuesForDifferentField"), RECOMMENDED, proto, expected_proto, is_proto3); } @@ -1193,38 +1235,44 @@ void BinaryAndJsonConformanceSuite::TestValidDataForOneofType( } void BinaryAndJsonConformanceSuite::TestMergeOneofMessage() { - string field1_data = cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1)); - string field2a_data = cat(tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1)); - string field2b_data = cat(tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string field1_data = + absl::StrCat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string field2a_data = + absl::StrCat(tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string field2b_data = + absl::StrCat(tag(2, WireFormatLite::WIRETYPE_VARINT), varint(1)); string field89_data = - cat(tag(89, WireFormatLite::WIRETYPE_VARINT), varint(1)); - string submsg1_data = - cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(field1_data, field2a_data, field89_data))); - string submsg2_data = cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(field2b_data, field89_data))); + absl::StrCat(tag(89, WireFormatLite::WIRETYPE_VARINT), varint(1)); + string submsg1_data = absl::StrCat( + tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(field1_data, field2a_data, field89_data))); + string submsg2_data = + absl::StrCat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(field2b_data, field89_data))); string merged_data = - cat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(cat(field1_data, field2b_data, field89_data, field89_data))); + absl::StrCat(tag(2, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(absl::StrCat(field1_data, field2b_data, field89_data, + field89_data))); for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { const FieldDescriptor* field = GetFieldForOneofType(FieldDescriptor::TYPE_MESSAGE, is_proto3); - string proto1 = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(submsg1_data)); - string proto2 = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(submsg2_data)); - string proto = cat(proto1, proto2); - string expected_proto = - cat(tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - delim(merged_data)); + string proto1 = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(submsg1_data)); + string proto2 = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(submsg2_data)); + string proto = absl::StrCat(proto1, proto2); + string expected_proto = absl::StrCat( + tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + delim(merged_data)); std::unique_ptr test_message = NewTestMessage(is_proto3); test_message->MergeFromString(expected_proto); - string text = test_message->DebugString(); + string text; + TextFormat::PrintToString(*test_message, &text); RunValidProtobufTest("ValidDataOneof.MESSAGE.Merge", REQUIRED, proto, text, is_proto3); RunValidBinaryProtobufTest("ValidDataOneofBinary.MESSAGE.Merge", @@ -1234,12 +1282,7 @@ void BinaryAndJsonConformanceSuite::TestMergeOneofMessage() { void BinaryAndJsonConformanceSuite::TestIllegalTags() { // field num 0 is illegal - string nullfield[] = { - "\1DEADBEEF", - "\2\1\1", - "\3\4", - "\5DEAD" - }; + string nullfield[] = {"\1DEADBEEF", "\2\1\1", "\3\4", "\5DEAD"}; for (int i = 0; i < 4; i++) { string name = "IllegalZeroFieldNum_Case_0"; name.back() += i; @@ -1247,52 +1290,108 @@ void BinaryAndJsonConformanceSuite::TestIllegalTags() { } } template -void BinaryAndJsonConformanceSuite::TestOneofMessage ( - MessageType &message, bool is_proto3) { +void BinaryAndJsonConformanceSuite::TestOneofMessage(MessageType& message, + bool is_proto3) { message.set_oneof_uint32(0); - RunValidProtobufTestWithMessage( - "OneofZeroUint32", RECOMMENDED, &message, "oneof_uint32: 0", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroUint32", RECOMMENDED, &message, + "oneof_uint32: 0", is_proto3); message.mutable_oneof_nested_message()->set_a(0); RunValidProtobufTestWithMessage( "OneofZeroMessage", RECOMMENDED, &message, is_proto3 ? "oneof_nested_message: {}" : "oneof_nested_message: {a: 0}", is_proto3); message.mutable_oneof_nested_message()->set_a(1); - RunValidProtobufTestWithMessage( - "OneofZeroMessageSetTwice", RECOMMENDED, &message, - "oneof_nested_message: {a: 1}", - is_proto3); + RunValidProtobufTestWithMessage("OneofZeroMessageSetTwice", RECOMMENDED, + &message, "oneof_nested_message: {a: 1}", + is_proto3); message.set_oneof_string(""); - RunValidProtobufTestWithMessage( - "OneofZeroString", RECOMMENDED, &message, "oneof_string: \"\"", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroString", RECOMMENDED, &message, + "oneof_string: \"\"", is_proto3); message.set_oneof_bytes(""); - RunValidProtobufTestWithMessage( - "OneofZeroBytes", RECOMMENDED, &message, "oneof_bytes: \"\"", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroBytes", RECOMMENDED, &message, + "oneof_bytes: \"\"", is_proto3); message.set_oneof_bool(false); - RunValidProtobufTestWithMessage( - "OneofZeroBool", RECOMMENDED, &message, "oneof_bool: false", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroBool", RECOMMENDED, &message, + "oneof_bool: false", is_proto3); message.set_oneof_uint64(0); - RunValidProtobufTestWithMessage( - "OneofZeroUint64", RECOMMENDED, &message, "oneof_uint64: 0", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroUint64", RECOMMENDED, &message, + "oneof_uint64: 0", is_proto3); message.set_oneof_float(0.0f); - RunValidProtobufTestWithMessage( - "OneofZeroFloat", RECOMMENDED, &message, "oneof_float: 0", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroFloat", RECOMMENDED, &message, + "oneof_float: 0", is_proto3); message.set_oneof_double(0.0); - RunValidProtobufTestWithMessage( - "OneofZeroDouble", RECOMMENDED, &message, "oneof_double: 0", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroDouble", RECOMMENDED, &message, + "oneof_double: 0", is_proto3); message.set_oneof_enum(MessageType::FOO); - RunValidProtobufTestWithMessage( - "OneofZeroEnum", RECOMMENDED, &message, "oneof_enum: FOO", is_proto3); + RunValidProtobufTestWithMessage("OneofZeroEnum", RECOMMENDED, &message, + "oneof_enum: FOO", is_proto3); } template -void BinaryAndJsonConformanceSuite::TestUnknownMessage( - MessageType& message, bool is_proto3) { +void BinaryAndJsonConformanceSuite::TestUnknownMessage(MessageType& message, + bool is_proto3) { message.ParseFromString("\xA8\x1F\x01"); RunValidBinaryProtobufTest("UnknownVarint", REQUIRED, message.SerializeAsString(), is_proto3); } +void BinaryAndJsonConformanceSuite:: + TestBinaryPerformanceForAlternatingUnknownFields() { + string unknown_field_1 = absl::StrCat( + tag(UNKNOWN_FIELD, WireFormatLite::WIRETYPE_VARINT), varint(1234)); + string unknown_field_2 = absl::StrCat( + tag(UNKNOWN_FIELD + 1, WireFormatLite::WIRETYPE_VARINT), varint(5678)); + for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { + string proto; + for (size_t i = 0; i < kPerformanceRepeatCount; i++) { + proto.append(unknown_field_1); + proto.append(unknown_field_2); + } + + RunValidBinaryProtobufTest( + "TestBinaryPerformanceForAlternatingUnknownFields", RECOMMENDED, proto, + is_proto3); + } +} + +void BinaryAndJsonConformanceSuite:: + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::Type type) { + const string type_name = + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(type))); + for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { + int field_number = + GetFieldForType(type, true, is_proto3, Packed::kFalse)->number(); + string rep_field_proto = absl::StrCat( + tag(field_number, WireFormatLite::WireTypeForFieldType( + static_cast(type))), + GetNonDefaultValue(type)); + + RunBinaryPerformanceMergeMessageWithField( + absl::StrCat( + "TestBinaryPerformanceMergeMessageWithRepeatedFieldForType", + type_name), + rep_field_proto, is_proto3); + } +} + +void BinaryAndJsonConformanceSuite:: + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::Type type) { + const string type_name = + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(type))); + string unknown_field_proto = absl::StrCat( + tag(UNKNOWN_FIELD, WireFormatLite::WireTypeForFieldType( + static_cast(type))), + GetNonDefaultValue(type)); + for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { + RunBinaryPerformanceMergeMessageWithField( + absl::StrCat("TestBinaryPerformanceMergeMessageWithUnknownFieldForType", + type_name), + unknown_field_proto, is_proto3); + } +} + void BinaryAndJsonConformanceSuite::RunSuiteImpl() { // Hack to get the list of test failures based on whether // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER is enabled or not. @@ -1303,7 +1402,7 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() { req.set_protobuf_payload(""); req.set_requested_output_format(conformance::WireFormat::PROTOBUF); RunTest("FindFailures", req, &res); - GOOGLE_CHECK(failure_set.MergeFromString(res.protobuf_payload())); + ABSL_CHECK(failure_set.MergeFromString(res.protobuf_payload())); for (const string& failure : failure_set.failure()) { AddExpectedFailedTest(failure); } @@ -1312,232 +1411,329 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() { kTypeUrlPrefix, DescriptorPool::generated_pool())); type_url_ = GetTypeUrl(TestAllTypesProto3::descriptor()); - for (int i = 1; i <= FieldDescriptor::MAX_TYPE; i++) { - if (i == FieldDescriptor::TYPE_GROUP) continue; - TestPrematureEOFForType(static_cast(i)); - } + if (!performance_) { + for (int i = 1; i <= FieldDescriptor::MAX_TYPE; i++) { + if (i == FieldDescriptor::TYPE_GROUP) continue; + TestPrematureEOFForType(static_cast(i)); + } - TestIllegalTags(); - - int64 kInt64Min = -9223372036854775808ULL; - int64 kInt64Max = 9223372036854775807ULL; - uint64 kUint64Max = 18446744073709551615ULL; - int32 kInt32Max = 2147483647; - int32 kInt32Min = -2147483648; - uint32 kUint32Max = 4294967295UL; - - TestValidDataForType( - FieldDescriptor::TYPE_DOUBLE, - { - {dbl(0), dbl(0)}, - {dbl(0.1), dbl(0.1)}, - {dbl(1.7976931348623157e+308), dbl(1.7976931348623157e+308)}, - {dbl(2.22507385850720138309e-308), dbl(2.22507385850720138309e-308)}, - }); - TestValidDataForType( - FieldDescriptor::TYPE_FLOAT, - { - {flt(0), flt(0)}, - {flt(0.1), flt(0.1)}, - {flt(1.00000075e-36), flt(1.00000075e-36)}, - {flt(3.402823e+38), flt(3.402823e+38)}, // 3.40282347e+38 - {flt(1.17549435e-38f), flt(1.17549435e-38)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_INT64, - { - {varint(0), varint(0)}, - {varint(12345), varint(12345)}, - {varint(kInt64Max), varint(kInt64Max)}, - {varint(kInt64Min), varint(kInt64Min)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_UINT64, - { - {varint(0), varint(0)}, - {varint(12345), varint(12345)}, - {varint(kUint64Max), varint(kUint64Max)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_INT32, - { - {varint(0), varint(0)}, - {varint(12345), varint(12345)}, - {longvarint(12345, 2), varint(12345)}, - {longvarint(12345, 7), varint(12345)}, - {varint(kInt32Max), varint(kInt32Max)}, - {varint(kInt32Min), varint(kInt32Min)}, - {varint(1LL << 33), varint(0)}, - {varint((1LL << 33) - 1), varint(-1)}, - {varint(kInt64Max), varint(-1)}, - {varint(kInt64Min + 1), varint(1)}, - }); - TestValidDataForType( - FieldDescriptor::TYPE_UINT32, - { - {varint(0), varint(0)}, - {varint(12345), varint(12345)}, - {longvarint(12345, 2), varint(12345)}, - {longvarint(12345, 7), varint(12345)}, - {varint(kUint32Max), varint(kUint32Max)}, // UINT32_MAX - {varint(1LL << 33), varint(0)}, - {varint((1LL << 33) + 1), varint(1)}, - {varint((1LL << 33) - 1), varint((1LL << 32) - 1)}, - {varint(kInt64Max), varint((1LL << 32) - 1)}, - {varint(kInt64Min + 1), varint(1)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_FIXED64, - { - {u64(0), u64(0)}, - {u64(12345), u64(12345)}, - {u64(kUint64Max), u64(kUint64Max)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_FIXED32, - { - {u32(0), u32(0)}, - {u32(12345), u32(12345)}, - {u32(kUint32Max), u32(kUint32Max)}, // UINT32_MAX - }); - TestValidDataForType(FieldDescriptor::TYPE_SFIXED64, - { - {u64(0), u64(0)}, - {u64(12345), u64(12345)}, - {u64(kInt64Max), u64(kInt64Max)}, - {u64(kInt64Min), u64(kInt64Min)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_SFIXED32, - { - {u32(0), u32(0)}, - {u32(12345), u32(12345)}, - {u32(kInt32Max), u32(kInt32Max)}, - {u32(kInt32Min), u32(kInt32Min)}, - }); - // Bools should be serialized as 0 for false and 1 for true. Parsers should - // also interpret any nonzero value as true. - TestValidDataForType(FieldDescriptor::TYPE_BOOL, - { - {varint(0), varint(0)}, - {varint(1), varint(1)}, - {varint(-1), varint(1)}, - {varint(12345678), varint(1)}, - {varint(1LL << 33), varint(1)}, - {varint(kInt64Max), varint(1)}, - {varint(kInt64Min), varint(1)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_SINT32, - { - {zz32(0), zz32(0)}, - {zz32(12345), zz32(12345)}, - {zz32(kInt32Max), zz32(kInt32Max)}, - {zz32(kInt32Min), zz32(kInt32Min)}, - {zz64(kInt32Max + 2LL), zz32(1)}, - }); - TestValidDataForType(FieldDescriptor::TYPE_SINT64, - { - {zz64(0), zz64(0)}, - {zz64(12345), zz64(12345)}, - {zz64(kInt64Max), zz64(kInt64Max)}, - {zz64(kInt64Min), zz64(kInt64Min)}, - }); - TestValidDataForType( - FieldDescriptor::TYPE_STRING, - { - {delim(""), delim("")}, - {delim("Hello world!"), delim("Hello world!")}, - {delim("\'\"\?\\\a\b\f\n\r\t\v"), - delim("\'\"\?\\\a\b\f\n\r\t\v")}, // escape - {delim("è°·æ­Œ"), delim("è°·æ­Œ")}, // Google in Chinese - {delim("\u8C37\u6B4C"), delim("è°·æ­Œ")}, // unicode escape - {delim("\u8c37\u6b4c"), delim("è°·æ­Œ")}, // lowercase unicode - {delim("\xF0\x9F\x98\x81"), delim("\xF0\x9F\x98\x81")}, // emoji: 😠- }); - TestValidDataForType(FieldDescriptor::TYPE_BYTES, - { - {delim(""), delim("")}, - {delim("Hello world!"), delim("Hello world!")}, - {delim("\x01\x02"), delim("\x01\x02")}, - {delim("\xfb"), delim("\xfb")}, - }); - TestValidDataForType(FieldDescriptor::TYPE_ENUM, - { - {varint(0), varint(0)}, - {varint(1), varint(1)}, - {varint(2), varint(2)}, - {varint(-1), varint(-1)}, - {varint(kInt64Max), varint(-1)}, - {varint(kInt64Min + 1), varint(1)}, - }); - TestValidDataForRepeatedScalarMessage(); - TestValidDataForType( - FieldDescriptor::TYPE_MESSAGE, - { - {delim(""), delim("")}, - {delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234))), - delim(cat(tag(1, WireFormatLite::WIRETYPE_VARINT), varint(1234)))}, - }); - - TestValidDataForMapType(FieldDescriptor::TYPE_INT32, - FieldDescriptor::TYPE_INT32); - TestValidDataForMapType(FieldDescriptor::TYPE_INT64, - FieldDescriptor::TYPE_INT64); - TestValidDataForMapType(FieldDescriptor::TYPE_UINT32, - FieldDescriptor::TYPE_UINT32); - TestValidDataForMapType(FieldDescriptor::TYPE_UINT64, - FieldDescriptor::TYPE_UINT64); - TestValidDataForMapType(FieldDescriptor::TYPE_SINT32, - FieldDescriptor::TYPE_SINT32); - TestValidDataForMapType(FieldDescriptor::TYPE_SINT64, - FieldDescriptor::TYPE_SINT64); - TestValidDataForMapType(FieldDescriptor::TYPE_FIXED32, - FieldDescriptor::TYPE_FIXED32); - TestValidDataForMapType(FieldDescriptor::TYPE_FIXED64, - FieldDescriptor::TYPE_FIXED64); - TestValidDataForMapType(FieldDescriptor::TYPE_SFIXED32, - FieldDescriptor::TYPE_SFIXED32); - TestValidDataForMapType(FieldDescriptor::TYPE_SFIXED64, - FieldDescriptor::TYPE_SFIXED64); - TestValidDataForMapType(FieldDescriptor::TYPE_INT32, - FieldDescriptor::TYPE_FLOAT); - TestValidDataForMapType(FieldDescriptor::TYPE_INT32, - FieldDescriptor::TYPE_DOUBLE); - TestValidDataForMapType(FieldDescriptor::TYPE_BOOL, - FieldDescriptor::TYPE_BOOL); - TestValidDataForMapType(FieldDescriptor::TYPE_STRING, - FieldDescriptor::TYPE_STRING); - TestValidDataForMapType(FieldDescriptor::TYPE_STRING, - FieldDescriptor::TYPE_BYTES); - TestValidDataForMapType(FieldDescriptor::TYPE_STRING, - FieldDescriptor::TYPE_ENUM); - TestValidDataForMapType(FieldDescriptor::TYPE_STRING, - FieldDescriptor::TYPE_MESSAGE); - // Additional test to check overwriting message value map. - TestOverwriteMessageValueMap(); - - TestValidDataForOneofType(FieldDescriptor::TYPE_UINT32); - TestValidDataForOneofType(FieldDescriptor::TYPE_BOOL); - TestValidDataForOneofType(FieldDescriptor::TYPE_UINT64); - TestValidDataForOneofType(FieldDescriptor::TYPE_FLOAT); - TestValidDataForOneofType(FieldDescriptor::TYPE_DOUBLE); - TestValidDataForOneofType(FieldDescriptor::TYPE_STRING); - TestValidDataForOneofType(FieldDescriptor::TYPE_BYTES); - TestValidDataForOneofType(FieldDescriptor::TYPE_ENUM); - TestValidDataForOneofType(FieldDescriptor::TYPE_MESSAGE); - // Additional test to check merging oneof message. - TestMergeOneofMessage(); - - // TODO(haberman): - // TestValidDataForType(FieldDescriptor::TYPE_GROUP - - // Unknown fields. - { - TestAllTypesProto3 messageProto3; - TestAllTypesProto2 messageProto2; - // TODO(yilunchong): update this behavior when unknown field's behavior - // changed in open source. Also delete - // Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput - // from failure list of python_cpp python java - TestUnknownMessage(messageProto3, true); - TestUnknownMessage(messageProto2, false); + TestIllegalTags(); + + int64_t kInt64Min = -9223372036854775808ULL; + int64_t kInt64Max = 9223372036854775807ULL; + uint64_t kUint64Max = 18446744073709551615ULL; + int32_t kInt32Max = 2147483647; + int32_t kInt32Min = -2147483648; + uint32_t kUint32Max = 4294967295UL; + + TestValidDataForType( + FieldDescriptor::TYPE_DOUBLE, + { + {dbl(0), dbl(0)}, + {dbl(0.1), dbl(0.1)}, + {dbl(1.7976931348623157e+308), dbl(1.7976931348623157e+308)}, + {dbl(2.22507385850720138309e-308), + dbl(2.22507385850720138309e-308)}, + }); + TestValidDataForType( + FieldDescriptor::TYPE_FLOAT, + { + {flt(0), flt(0)}, + {flt(0.1), flt(0.1)}, + {flt(1.00000075e-36), flt(1.00000075e-36)}, + {flt(3.402823e+38), flt(3.402823e+38)}, // 3.40282347e+38 + {flt(1.17549435e-38f), flt(1.17549435e-38)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_INT64, + { + {varint(0), varint(0)}, + {varint(12345), varint(12345)}, + {varint(kInt64Max), varint(kInt64Max)}, + {varint(kInt64Min), varint(kInt64Min)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_UINT64, + { + {varint(0), varint(0)}, + {varint(12345), varint(12345)}, + {varint(kUint64Max), varint(kUint64Max)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_INT32, + { + {varint(0), varint(0)}, + {varint(12345), varint(12345)}, + {longvarint(12345, 2), varint(12345)}, + {longvarint(12345, 7), varint(12345)}, + {varint(kInt32Max), varint(kInt32Max)}, + {varint(kInt32Min), varint(kInt32Min)}, + {varint(1LL << 33), varint(0)}, + {varint((1LL << 33) - 1), varint(-1)}, + {varint(kInt64Max), varint(-1)}, + {varint(kInt64Min + 1), varint(1)}, + }); + TestValidDataForType( + FieldDescriptor::TYPE_UINT32, + { + {varint(0), varint(0)}, + {varint(12345), varint(12345)}, + {longvarint(12345, 2), varint(12345)}, + {longvarint(12345, 7), varint(12345)}, + {varint(kUint32Max), varint(kUint32Max)}, // UINT32_MAX + {varint(1LL << 33), varint(0)}, + {varint((1LL << 33) + 1), varint(1)}, + {varint((1LL << 33) - 1), varint((1LL << 32) - 1)}, + {varint(kInt64Max), varint((1LL << 32) - 1)}, + {varint(kInt64Min + 1), varint(1)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED64, + { + {u64(0), u64(0)}, + {u64(12345), u64(12345)}, + {u64(kUint64Max), u64(kUint64Max)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED32, + { + {u32(0), u32(0)}, + {u32(12345), u32(12345)}, + {u32(kUint32Max), u32(kUint32Max)}, // UINT32_MAX + }); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED64, + { + {u64(0), u64(0)}, + {u64(12345), u64(12345)}, + {u64(kInt64Max), u64(kInt64Max)}, + {u64(kInt64Min), u64(kInt64Min)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED32, + { + {u32(0), u32(0)}, + {u32(12345), u32(12345)}, + {u32(kInt32Max), u32(kInt32Max)}, + {u32(kInt32Min), u32(kInt32Min)}, + }); + // Bools should be serialized as 0 for false and 1 for true. Parsers should + // also interpret any nonzero value as true. + TestValidDataForType(FieldDescriptor::TYPE_BOOL, + { + {varint(0), varint(0)}, + {varint(1), varint(1)}, + {varint(-1), varint(1)}, + {varint(12345678), varint(1)}, + {varint(1LL << 33), varint(1)}, + {varint(kInt64Max), varint(1)}, + {varint(kInt64Min), varint(1)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_SINT32, + { + {zz32(0), zz32(0)}, + {zz32(12345), zz32(12345)}, + {zz32(kInt32Max), zz32(kInt32Max)}, + {zz32(kInt32Min), zz32(kInt32Min)}, + {zz64(kInt32Max + 2LL), zz32(1)}, + }); + TestValidDataForType(FieldDescriptor::TYPE_SINT64, + { + {zz64(0), zz64(0)}, + {zz64(12345), zz64(12345)}, + {zz64(kInt64Max), zz64(kInt64Max)}, + {zz64(kInt64Min), zz64(kInt64Min)}, + }); + TestValidDataForType( + FieldDescriptor::TYPE_STRING, + { + {delim(""), delim("")}, + {delim("Hello world!"), delim("Hello world!")}, + {delim("\'\"\?\\\a\b\f\n\r\t\v"), + delim("\'\"\?\\\a\b\f\n\r\t\v")}, // escape + {delim("è°·æ­Œ"), delim("è°·æ­Œ")}, // Google in Chinese + {delim("\u8C37\u6B4C"), delim("è°·æ­Œ")}, // unicode escape + {delim("\u8c37\u6b4c"), delim("è°·æ­Œ")}, // lowercase unicode + {delim("\xF0\x9F\x98\x81"), + delim("\xF0\x9F\x98\x81")}, // emoji: 😠+ }); + TestValidDataForType(FieldDescriptor::TYPE_BYTES, + { + {delim(""), delim("")}, + {delim("Hello world!"), delim("Hello world!")}, + {delim("\x01\x02"), delim("\x01\x02")}, + {delim("\xfb"), delim("\xfb")}, + }); + TestValidDataForType(FieldDescriptor::TYPE_ENUM, + { + {varint(0), varint(0)}, + {varint(1), varint(1)}, + {varint(2), varint(2)}, + {varint(-1), varint(-1)}, + {varint(kInt64Max), varint(-1)}, + {varint(kInt64Min + 1), varint(1)}, + }); + TestValidDataForRepeatedScalarMessage(); + TestValidDataForType( + FieldDescriptor::TYPE_MESSAGE, + { + {delim(""), delim("")}, + {delim(absl::StrCat(tag(1, WireFormatLite::WIRETYPE_VARINT), + varint(1234))), + delim(absl::StrCat(tag(1, WireFormatLite::WIRETYPE_VARINT), + varint(1234)))}, + }); + + TestValidDataForMapType(FieldDescriptor::TYPE_INT32, + FieldDescriptor::TYPE_INT32); + TestValidDataForMapType(FieldDescriptor::TYPE_INT64, + FieldDescriptor::TYPE_INT64); + TestValidDataForMapType(FieldDescriptor::TYPE_UINT32, + FieldDescriptor::TYPE_UINT32); + TestValidDataForMapType(FieldDescriptor::TYPE_UINT64, + FieldDescriptor::TYPE_UINT64); + TestValidDataForMapType(FieldDescriptor::TYPE_SINT32, + FieldDescriptor::TYPE_SINT32); + TestValidDataForMapType(FieldDescriptor::TYPE_SINT64, + FieldDescriptor::TYPE_SINT64); + TestValidDataForMapType(FieldDescriptor::TYPE_FIXED32, + FieldDescriptor::TYPE_FIXED32); + TestValidDataForMapType(FieldDescriptor::TYPE_FIXED64, + FieldDescriptor::TYPE_FIXED64); + TestValidDataForMapType(FieldDescriptor::TYPE_SFIXED32, + FieldDescriptor::TYPE_SFIXED32); + TestValidDataForMapType(FieldDescriptor::TYPE_SFIXED64, + FieldDescriptor::TYPE_SFIXED64); + TestValidDataForMapType(FieldDescriptor::TYPE_INT32, + FieldDescriptor::TYPE_FLOAT); + TestValidDataForMapType(FieldDescriptor::TYPE_INT32, + FieldDescriptor::TYPE_DOUBLE); + TestValidDataForMapType(FieldDescriptor::TYPE_BOOL, + FieldDescriptor::TYPE_BOOL); + TestValidDataForMapType(FieldDescriptor::TYPE_STRING, + FieldDescriptor::TYPE_STRING); + TestValidDataForMapType(FieldDescriptor::TYPE_STRING, + FieldDescriptor::TYPE_BYTES); + TestValidDataForMapType(FieldDescriptor::TYPE_STRING, + FieldDescriptor::TYPE_ENUM); + TestValidDataForMapType(FieldDescriptor::TYPE_STRING, + FieldDescriptor::TYPE_MESSAGE); + // Additional test to check overwriting message value map. + TestOverwriteMessageValueMap(); + + TestValidDataForOneofType(FieldDescriptor::TYPE_UINT32); + TestValidDataForOneofType(FieldDescriptor::TYPE_BOOL); + TestValidDataForOneofType(FieldDescriptor::TYPE_UINT64); + TestValidDataForOneofType(FieldDescriptor::TYPE_FLOAT); + TestValidDataForOneofType(FieldDescriptor::TYPE_DOUBLE); + TestValidDataForOneofType(FieldDescriptor::TYPE_STRING); + TestValidDataForOneofType(FieldDescriptor::TYPE_BYTES); + TestValidDataForOneofType(FieldDescriptor::TYPE_ENUM); + TestValidDataForOneofType(FieldDescriptor::TYPE_MESSAGE); + // Additional test to check merging oneof message. + TestMergeOneofMessage(); + + // TODO: + // TestValidDataForType(FieldDescriptor::TYPE_GROUP + + // Unknown fields. + { + TestAllTypesProto3 messageProto3; + TestAllTypesProto2 messageProto2; + // TODO: update this behavior when unknown field's behavior + // changed in open source. Also delete + // Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput + // from failure list of python_cpp python java + TestUnknownMessage(messageProto3, true); + TestUnknownMessage(messageProto2, false); + } + + RunJsonTests(); } + // Flag control performance tests to keep them internal and opt-in only + if (performance_) { + RunBinaryPerformanceTests(); + RunJsonPerformanceTests(); + } +} + +void BinaryAndJsonConformanceSuite::RunBinaryPerformanceTests() { + TestBinaryPerformanceForAlternatingUnknownFields(); + + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_BOOL); + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_DOUBLE); + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_FLOAT); + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_UINT32); + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_UINT64); + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_STRING); + TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_BYTES); + + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_BOOL); + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_DOUBLE); + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_FLOAT); + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_UINT32); + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_UINT64); + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_STRING); + TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + FieldDescriptor::TYPE_BYTES); +} + +void BinaryAndJsonConformanceSuite::RunJsonPerformanceTests() { + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_BOOL, "true"); + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_DOUBLE, "123"); + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_FLOAT, "123"); + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_UINT32, "123"); + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_UINT64, "123"); + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_STRING, "\"foo\""); + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::TYPE_BYTES, "\"foo\""); +} + +// This is currently considered valid input by some languages but not others +void BinaryAndJsonConformanceSuite:: + TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + FieldDescriptor::Type type, string field_value) { + const string type_name = + UpperCase(absl::StrCat(".", FieldDescriptor::TypeName(type))); + for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) { + const FieldDescriptor* field = + GetFieldForType(type, true, is_proto3, Packed::kFalse); + string field_name = field->name(); + + string message_field = + absl::StrCat("\"", field_name, "\": [", field_value, "]"); + string recursive_message = + absl::StrCat("\"recursive_message\": { ", message_field, "}"); + string input = absl::StrCat("{", recursive_message); + for (size_t i = 1; i < kPerformanceRepeatCount; i++) { + absl::StrAppend(&input, ",", recursive_message); + } + absl::StrAppend(&input, "}"); - RunJsonTests(); + string textproto_message_field = + absl::StrCat(field_name, ": ", field_value); + string expected_textproto = "recursive_message { "; + for (size_t i = 0; i < kPerformanceRepeatCount; i++) { + absl::StrAppend(&expected_textproto, textproto_message_field, " "); + } + absl::StrAppend(&expected_textproto, "}"); + RunValidJsonTest( + absl::StrCat("TestJsonPerformanceMergeMessageWithRepeatedFieldForType", + type_name), + RECOMMENDED, input, expected_textproto, is_proto3); + } } void BinaryAndJsonConformanceSuite::RunJsonTests() { @@ -1557,6 +1753,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTests() { RunJsonTestsForStruct(); RunJsonTestsForValue(); RunJsonTestsForAny(); + RunJsonTestsForUnknownEnumStringValues(); RunValidJsonIgnoreUnknownTest("IgnoreUnknownJsonNumber", REQUIRED, R"({ @@ -1592,34 +1789,66 @@ void BinaryAndJsonConformanceSuite::RunJsonTests() { ExpectParseFailureForJson("RejectTopLevelNull", REQUIRED, "null"); } +void BinaryAndJsonConformanceSuite::RunJsonTestsForUnknownEnumStringValues() { + // Tests the handling of unknown enum values when encoded as string labels. + // The expected behavior depends on whether unknown fields are ignored: + // * when ignored, the parser should ignore the unknown enum string value. + // * when not ignored, the parser should fail. + struct TestCase { + // Used in the test name. + string enum_location; + // JSON input which will contain the unknown field. + string input_json; + }; + const std::vector test_cases = { + {"InOptionalField", R"json({ + "optional_nested_enum": "UNKNOWN_ENUM_VALUE" + })json"}, + {"InRepeatedField", R"json({ + "repeated_nested_enum": ["UNKNOWN_ENUM_VALUE"] + })json"}, + {"InMapValue", R"json({ + "map_string_nested_enum": {"key": "UNKNOWN_ENUM_VALUE"} + })json"}, + }; + for (const TestCase& test_case : test_cases) { + // Unknown enum string value is a parse failure when not ignoring unknown + // fields. + ExpectParseFailureForJson( + absl::StrCat("RejectUnknownEnumStringValue", test_case.enum_location), + RECOMMENDED, test_case.input_json); + // Unknown enum string value is ignored when ignoring unknown fields. + RunValidJsonIgnoreUnknownTest( + absl::StrCat("IgnoreUnknownEnumStringValue", test_case.enum_location), + RECOMMENDED, test_case.input_json, ""); + } +} + void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { - RunValidJsonTest( - "FieldNameInSnakeCase", REQUIRED, - R"({ + RunValidJsonTest("FieldNameInSnakeCase", REQUIRED, + R"({ "fieldname1": 1, "fieldName2": 2, "FieldName3": 3, "fieldName4": 4 })", - R"( + R"( fieldname1: 1 field_name2: 2 _field_name3: 3 field__name4_: 4 )"); - RunValidJsonTest( - "FieldNameWithNumbers", REQUIRED, - R"({ + RunValidJsonTest("FieldNameWithNumbers", REQUIRED, + R"({ "field0name5": 5, "field0Name6": 6 })", - R"( + R"( field0name5: 5 field_0_name6: 6 )"); - RunValidJsonTest( - "FieldNameWithMixedCases", REQUIRED, - R"({ + RunValidJsonTest("FieldNameWithMixedCases", REQUIRED, + R"({ "fieldName7": 7, "FieldName8": 8, "fieldName9": 9, @@ -1627,7 +1856,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "FIELDNAME11": 11, "FIELDName12": 12 })", - R"( + R"( fieldName7: 7 FieldName8: 8 field_Name9: 9 @@ -1635,9 +1864,8 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { FIELD_NAME11: 11 FIELD_name12: 12 )"); - RunValidJsonTest( - "FieldNameWithDoubleUnderscores", RECOMMENDED, - R"({ + RunValidJsonTest("FieldNameWithDoubleUnderscores", RECOMMENDED, + R"({ "FieldName13": 13, "FieldName14": 14, "fieldName15": 15, @@ -1645,7 +1873,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "fieldName17": 17, "FieldName18": 18 })", - R"( + R"( __field_name13: 13 __Field_name14: 14 field__name15: 15 @@ -1654,9 +1882,8 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { Field_name18__: 18 )"); // Using the original proto field name in JSON is also allowed. - RunValidJsonTest( - "OriginalProtoFieldName", REQUIRED, - R"({ + RunValidJsonTest("OriginalProtoFieldName", REQUIRED, + R"({ "fieldname1": 1, "field_name2": 2, "_field_name3": 3, @@ -1676,7 +1903,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "field_name17__": 17, "Field_name18__": 18 })", - R"( + R"( fieldname1: 1 field_name2: 2 _field_name3: 3 @@ -1697,59 +1924,47 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { Field_name18__: 18 )"); // Field names can be escaped. - RunValidJsonTest( - "FieldNameEscaped", REQUIRED, - R"({"fieldn\u0061me1": 1})", - "fieldname1: 1"); + RunValidJsonTest("FieldNameEscaped", REQUIRED, R"({"fieldn\u0061me1": 1})", + "fieldname1: 1"); // String ends with escape character. - ExpectParseFailureForJson( - "StringEndsWithEscapeChar", RECOMMENDED, - "{\"optionalString\": \"abc\\"); + ExpectParseFailureForJson("StringEndsWithEscapeChar", RECOMMENDED, + "{\"optionalString\": \"abc\\"); // Field names must be quoted (or it's not valid JSON). - ExpectParseFailureForJson( - "FieldNameNotQuoted", RECOMMENDED, - "{fieldname1: 1}"); + ExpectParseFailureForJson("FieldNameNotQuoted", RECOMMENDED, + "{fieldname1: 1}"); // Trailing comma is not allowed (not valid JSON). - ExpectParseFailureForJson( - "TrailingCommaInAnObject", RECOMMENDED, - R"({"fieldname1":1,})"); - ExpectParseFailureForJson( - "TrailingCommaInAnObjectWithSpace", RECOMMENDED, - R"({"fieldname1":1 ,})"); - ExpectParseFailureForJson( - "TrailingCommaInAnObjectWithSpaceCommaSpace", RECOMMENDED, - R"({"fieldname1":1 , })"); - ExpectParseFailureForJson( - "TrailingCommaInAnObjectWithNewlines", RECOMMENDED, - R"({ + ExpectParseFailureForJson("TrailingCommaInAnObject", RECOMMENDED, + R"({"fieldname1":1,})"); + ExpectParseFailureForJson("TrailingCommaInAnObjectWithSpace", RECOMMENDED, + R"({"fieldname1":1 ,})"); + ExpectParseFailureForJson("TrailingCommaInAnObjectWithSpaceCommaSpace", + RECOMMENDED, R"({"fieldname1":1 , })"); + ExpectParseFailureForJson("TrailingCommaInAnObjectWithNewlines", RECOMMENDED, + R"({ "fieldname1":1, })"); // JSON doesn't support comments. - ExpectParseFailureForJson( - "JsonWithComments", RECOMMENDED, - R"({ + ExpectParseFailureForJson("JsonWithComments", RECOMMENDED, + R"({ // This is a comment. "fieldname1": 1 })"); // JSON spec says whitespace doesn't matter, so try a few spacings to be sure. - RunValidJsonTest( - "OneLineNoSpaces", RECOMMENDED, - "{\"optionalInt32\":1,\"optionalInt64\":2}", - R"( + RunValidJsonTest("OneLineNoSpaces", RECOMMENDED, + "{\"optionalInt32\":1,\"optionalInt64\":2}", + R"( optional_int32: 1 optional_int64: 2 )"); - RunValidJsonTest( - "OneLineWithSpaces", RECOMMENDED, - "{ \"optionalInt32\" : 1 , \"optionalInt64\" : 2 }", - R"( + RunValidJsonTest("OneLineWithSpaces", RECOMMENDED, + "{ \"optionalInt32\" : 1 , \"optionalInt64\" : 2 }", + R"( optional_int32: 1 optional_int64: 2 )"); - RunValidJsonTest( - "MultilineNoSpaces", RECOMMENDED, - "{\n\"optionalInt32\"\n:\n1\n,\n\"optionalInt64\"\n:\n2\n}", - R"( + RunValidJsonTest("MultilineNoSpaces", RECOMMENDED, + "{\n\"optionalInt32\"\n:\n1\n,\n\"optionalInt64\"\n:\n2\n}", + R"( optional_int32: 1 optional_int64: 2 )"); @@ -1761,28 +1976,24 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { optional_int64: 2 )"); // Missing comma between key/value pairs. - ExpectParseFailureForJson( - "MissingCommaOneLine", RECOMMENDED, - "{ \"optionalInt32\": 1 \"optionalInt64\": 2 }"); + ExpectParseFailureForJson("MissingCommaOneLine", RECOMMENDED, + "{ \"optionalInt32\": 1 \"optionalInt64\": 2 }"); ExpectParseFailureForJson( "MissingCommaMultiline", RECOMMENDED, "{\n \"optionalInt32\": 1\n \"optionalInt64\": 2\n}"); // Duplicated field names are not allowed. - ExpectParseFailureForJson( - "FieldNameDuplicate", RECOMMENDED, - R"({ + ExpectParseFailureForJson("FieldNameDuplicate", RECOMMENDED, + R"({ "optionalNestedMessage": {a: 1}, "optionalNestedMessage": {} })"); - ExpectParseFailureForJson( - "FieldNameDuplicateDifferentCasing1", RECOMMENDED, - R"({ + ExpectParseFailureForJson("FieldNameDuplicateDifferentCasing1", RECOMMENDED, + R"({ "optional_nested_message": {a: 1}, "optionalNestedMessage": {} })"); - ExpectParseFailureForJson( - "FieldNameDuplicateDifferentCasing2", RECOMMENDED, - R"({ + ExpectParseFailureForJson("FieldNameDuplicateDifferentCasing2", RECOMMENDED, + R"({ "optionalNestedMessage": {a: 1}, "optional_nested_message": {} })"); @@ -1796,10 +2007,8 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "fieldName4": 4 })", [](const Json::Value& value) { - return value.isMember("fieldname1") && - value.isMember("fieldName2") && - value.isMember("FieldName3") && - value.isMember("fieldName4"); + return value.isMember("fieldname1") && value.isMember("fieldName2") && + value.isMember("FieldName3") && value.isMember("fieldName4"); }, true); RunValidJsonTestWithValidator( @@ -1809,8 +2018,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "field0Name6": 6 })", [](const Json::Value& value) { - return value.isMember("field0name5") && - value.isMember("field0Name6"); + return value.isMember("field0name5") && value.isMember("field0Name6"); }, true); RunValidJsonTestWithValidator( @@ -1824,12 +2032,9 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "FIELDName12": 12 })", [](const Json::Value& value) { - return value.isMember("fieldName7") && - value.isMember("FieldName8") && - value.isMember("fieldName9") && - value.isMember("FieldName10") && - value.isMember("FIELDNAME11") && - value.isMember("FIELDName12"); + return value.isMember("fieldName7") && value.isMember("FieldName8") && + value.isMember("fieldName9") && value.isMember("FieldName10") && + value.isMember("FIELDNAME11") && value.isMember("FIELDName12"); }, true); RunValidJsonTestWithValidator( @@ -1843,12 +2048,9 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { "FieldName18": 18 })", [](const Json::Value& value) { - return value.isMember("FieldName13") && - value.isMember("FieldName14") && - value.isMember("fieldName15") && - value.isMember("fieldName16") && - value.isMember("fieldName17") && - value.isMember("FieldName18"); + return value.isMember("FieldName13") && value.isMember("FieldName14") && + value.isMember("fieldName15") && value.isMember("fieldName16") && + value.isMember("fieldName17") && value.isMember("FieldName18"); }, true); RunValidJsonTestWithValidator( @@ -1879,539 +2081,413 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() { void BinaryAndJsonConformanceSuite::RunJsonTestsForNonRepeatedTypes() { // Integer fields. - RunValidJsonTest( - "Int32FieldMaxValue", REQUIRED, - R"({"optionalInt32": 2147483647})", - "optional_int32: 2147483647"); - RunValidJsonTest( - "Int32FieldMinValue", REQUIRED, - R"({"optionalInt32": -2147483648})", - "optional_int32: -2147483648"); - RunValidJsonTest( - "Uint32FieldMaxValue", REQUIRED, - R"({"optionalUint32": 4294967295})", - "optional_uint32: 4294967295"); - RunValidJsonTest( - "Int64FieldMaxValue", REQUIRED, - R"({"optionalInt64": "9223372036854775807"})", - "optional_int64: 9223372036854775807"); - RunValidJsonTest( - "Int64FieldMinValue", REQUIRED, - R"({"optionalInt64": "-9223372036854775808"})", - "optional_int64: -9223372036854775808"); - RunValidJsonTest( - "Uint64FieldMaxValue", REQUIRED, - R"({"optionalUint64": "18446744073709551615"})", - "optional_uint64: 18446744073709551615"); + RunValidJsonTest("Int32FieldMaxValue", REQUIRED, + R"({"optionalInt32": 2147483647})", + "optional_int32: 2147483647"); + RunValidJsonTest("Int32FieldMinValue", REQUIRED, + R"({"optionalInt32": -2147483648})", + "optional_int32: -2147483648"); + RunValidJsonTest("Uint32FieldMaxValue", REQUIRED, + R"({"optionalUint32": 4294967295})", + "optional_uint32: 4294967295"); + RunValidJsonTest("Int64FieldMaxValue", REQUIRED, + R"({"optionalInt64": "9223372036854775807"})", + "optional_int64: 9223372036854775807"); + RunValidJsonTest("Int64FieldMinValue", REQUIRED, + R"({"optionalInt64": "-9223372036854775808"})", + "optional_int64: -9223372036854775808"); + RunValidJsonTest("Uint64FieldMaxValue", REQUIRED, + R"({"optionalUint64": "18446744073709551615"})", + "optional_uint64: 18446744073709551615"); // While not the largest Int64, this is the largest // Int64 which can be exactly represented within an // IEEE-754 64-bit float, which is the expected level // of interoperability guarantee. Larger values may // work in some implementations, but should not be // relied upon. - RunValidJsonTest( - "Int64FieldMaxValueNotQuoted", REQUIRED, - R"({"optionalInt64": 9223372036854774784})", - "optional_int64: 9223372036854774784"); - RunValidJsonTest( - "Int64FieldMinValueNotQuoted", REQUIRED, - R"({"optionalInt64": -9223372036854775808})", - "optional_int64: -9223372036854775808"); + RunValidJsonTest("Int64FieldMaxValueNotQuoted", REQUIRED, + R"({"optionalInt64": 9223372036854774784})", + "optional_int64: 9223372036854774784"); + RunValidJsonTest("Int64FieldMinValueNotQuoted", REQUIRED, + R"({"optionalInt64": -9223372036854775808})", + "optional_int64: -9223372036854775808"); // Largest interoperable Uint64; see comment above // for Int64FieldMaxValueNotQuoted. - RunValidJsonTest( - "Uint64FieldMaxValueNotQuoted", REQUIRED, - R"({"optionalUint64": 18446744073709549568})", - "optional_uint64: 18446744073709549568"); + RunValidJsonTest("Uint64FieldMaxValueNotQuoted", REQUIRED, + R"({"optionalUint64": 18446744073709549568})", + "optional_uint64: 18446744073709549568"); // Values can be represented as JSON strings. - RunValidJsonTest( - "Int32FieldStringValue", REQUIRED, - R"({"optionalInt32": "2147483647"})", - "optional_int32: 2147483647"); - RunValidJsonTest( - "Int32FieldStringValueEscaped", REQUIRED, - R"({"optionalInt32": "2\u003147483647"})", - "optional_int32: 2147483647"); + RunValidJsonTest("Int32FieldStringValue", REQUIRED, + R"({"optionalInt32": "2147483647"})", + "optional_int32: 2147483647"); + RunValidJsonTest("Int32FieldStringValueEscaped", REQUIRED, + R"({"optionalInt32": "2\u003147483647"})", + "optional_int32: 2147483647"); // Parsers reject out-of-bound integer values. - ExpectParseFailureForJson( - "Int32FieldTooLarge", REQUIRED, - R"({"optionalInt32": 2147483648})"); - ExpectParseFailureForJson( - "Int32FieldTooSmall", REQUIRED, - R"({"optionalInt32": -2147483649})"); - ExpectParseFailureForJson( - "Uint32FieldTooLarge", REQUIRED, - R"({"optionalUint32": 4294967296})"); - ExpectParseFailureForJson( - "Int64FieldTooLarge", REQUIRED, - R"({"optionalInt64": "9223372036854775808"})"); - ExpectParseFailureForJson( - "Int64FieldTooSmall", REQUIRED, - R"({"optionalInt64": "-9223372036854775809"})"); - ExpectParseFailureForJson( - "Uint64FieldTooLarge", REQUIRED, - R"({"optionalUint64": "18446744073709551616"})"); + ExpectParseFailureForJson("Int32FieldTooLarge", REQUIRED, + R"({"optionalInt32": 2147483648})"); + ExpectParseFailureForJson("Int32FieldTooSmall", REQUIRED, + R"({"optionalInt32": -2147483649})"); + ExpectParseFailureForJson("Uint32FieldTooLarge", REQUIRED, + R"({"optionalUint32": 4294967296})"); + ExpectParseFailureForJson("Int64FieldTooLarge", REQUIRED, + R"({"optionalInt64": "9223372036854775808"})"); + ExpectParseFailureForJson("Int64FieldTooSmall", REQUIRED, + R"({"optionalInt64": "-9223372036854775809"})"); + ExpectParseFailureForJson("Uint64FieldTooLarge", REQUIRED, + R"({"optionalUint64": "18446744073709551616"})"); // Parser reject non-integer numeric values as well. - ExpectParseFailureForJson( - "Int32FieldNotInteger", REQUIRED, - R"({"optionalInt32": 0.5})"); - ExpectParseFailureForJson( - "Uint32FieldNotInteger", REQUIRED, - R"({"optionalUint32": 0.5})"); - ExpectParseFailureForJson( - "Int64FieldNotInteger", REQUIRED, - R"({"optionalInt64": "0.5"})"); - ExpectParseFailureForJson( - "Uint64FieldNotInteger", REQUIRED, - R"({"optionalUint64": "0.5"})"); + ExpectParseFailureForJson("Int32FieldNotInteger", REQUIRED, + R"({"optionalInt32": 0.5})"); + ExpectParseFailureForJson("Uint32FieldNotInteger", REQUIRED, + R"({"optionalUint32": 0.5})"); + ExpectParseFailureForJson("Int64FieldNotInteger", REQUIRED, + R"({"optionalInt64": "0.5"})"); + ExpectParseFailureForJson("Uint64FieldNotInteger", REQUIRED, + R"({"optionalUint64": "0.5"})"); // Integers but represented as float values are accepted. - RunValidJsonTest( - "Int32FieldFloatTrailingZero", REQUIRED, - R"({"optionalInt32": 100000.000})", - "optional_int32: 100000"); - RunValidJsonTest( - "Int32FieldExponentialFormat", REQUIRED, - R"({"optionalInt32": 1e5})", - "optional_int32: 100000"); - RunValidJsonTest( - "Int32FieldMaxFloatValue", REQUIRED, - R"({"optionalInt32": 2.147483647e9})", - "optional_int32: 2147483647"); - RunValidJsonTest( - "Int32FieldMinFloatValue", REQUIRED, - R"({"optionalInt32": -2.147483648e9})", - "optional_int32: -2147483648"); - RunValidJsonTest( - "Uint32FieldMaxFloatValue", REQUIRED, - R"({"optionalUint32": 4.294967295e9})", - "optional_uint32: 4294967295"); + RunValidJsonTest("Int32FieldFloatTrailingZero", REQUIRED, + R"({"optionalInt32": 100000.000})", + "optional_int32: 100000"); + RunValidJsonTest("Int32FieldExponentialFormat", REQUIRED, + R"({"optionalInt32": 1e5})", "optional_int32: 100000"); + RunValidJsonTest("Int32FieldMaxFloatValue", REQUIRED, + R"({"optionalInt32": 2.147483647e9})", + "optional_int32: 2147483647"); + RunValidJsonTest("Int32FieldMinFloatValue", REQUIRED, + R"({"optionalInt32": -2.147483648e9})", + "optional_int32: -2147483648"); + RunValidJsonTest("Uint32FieldMaxFloatValue", REQUIRED, + R"({"optionalUint32": 4.294967295e9})", + "optional_uint32: 4294967295"); // Parser reject non-numeric values. - ExpectParseFailureForJson( - "Int32FieldNotNumber", REQUIRED, - R"({"optionalInt32": "3x3"})"); - ExpectParseFailureForJson( - "Uint32FieldNotNumber", REQUIRED, - R"({"optionalUint32": "3x3"})"); - ExpectParseFailureForJson( - "Int64FieldNotNumber", REQUIRED, - R"({"optionalInt64": "3x3"})"); - ExpectParseFailureForJson( - "Uint64FieldNotNumber", REQUIRED, - R"({"optionalUint64": "3x3"})"); + ExpectParseFailureForJson("Int32FieldNotNumber", REQUIRED, + R"({"optionalInt32": "3x3"})"); + ExpectParseFailureForJson("Uint32FieldNotNumber", REQUIRED, + R"({"optionalUint32": "3x3"})"); + ExpectParseFailureForJson("Int64FieldNotNumber", REQUIRED, + R"({"optionalInt64": "3x3"})"); + ExpectParseFailureForJson("Uint64FieldNotNumber", REQUIRED, + R"({"optionalUint64": "3x3"})"); // JSON does not allow "+" on numeric values. - ExpectParseFailureForJson( - "Int32FieldPlusSign", REQUIRED, - R"({"optionalInt32": +1})"); + ExpectParseFailureForJson("Int32FieldPlusSign", REQUIRED, + R"({"optionalInt32": +1})"); // JSON doesn't allow leading 0s. - ExpectParseFailureForJson( - "Int32FieldLeadingZero", REQUIRED, - R"({"optionalInt32": 01})"); - ExpectParseFailureForJson( - "Int32FieldNegativeWithLeadingZero", REQUIRED, - R"({"optionalInt32": -01})"); + ExpectParseFailureForJson("Int32FieldLeadingZero", REQUIRED, + R"({"optionalInt32": 01})"); + ExpectParseFailureForJson("Int32FieldNegativeWithLeadingZero", REQUIRED, + R"({"optionalInt32": -01})"); // String values must follow the same syntax rule. Specifically leading // or trailing spaces are not allowed. - ExpectParseFailureForJson( - "Int32FieldLeadingSpace", REQUIRED, - R"({"optionalInt32": " 1"})"); - ExpectParseFailureForJson( - "Int32FieldTrailingSpace", REQUIRED, - R"({"optionalInt32": "1 "})"); + ExpectParseFailureForJson("Int32FieldLeadingSpace", REQUIRED, + R"({"optionalInt32": " 1"})"); + ExpectParseFailureForJson("Int32FieldTrailingSpace", REQUIRED, + R"({"optionalInt32": "1 "})"); // 64-bit values are serialized as strings. RunValidJsonTestWithValidator( "Int64FieldBeString", RECOMMENDED, R"({"optionalInt64": 1})", [](const Json::Value& value) { return value["optionalInt64"].type() == Json::stringValue && - value["optionalInt64"].asString() == "1"; + value["optionalInt64"].asString() == "1"; }, true); RunValidJsonTestWithValidator( "Uint64FieldBeString", RECOMMENDED, R"({"optionalUint64": 1})", [](const Json::Value& value) { return value["optionalUint64"].type() == Json::stringValue && - value["optionalUint64"].asString() == "1"; + value["optionalUint64"].asString() == "1"; }, true); // Bool fields. - RunValidJsonTest( - "BoolFieldTrue", REQUIRED, - R"({"optionalBool":true})", - "optional_bool: true"); - RunValidJsonTest( - "BoolFieldFalse", REQUIRED, - R"({"optionalBool":false})", - "optional_bool: false"); + RunValidJsonTest("BoolFieldTrue", REQUIRED, R"({"optionalBool":true})", + "optional_bool: true"); + RunValidJsonTest("BoolFieldFalse", REQUIRED, R"({"optionalBool":false})", + "optional_bool: false"); // Other forms are not allowed. - ExpectParseFailureForJson( - "BoolFieldIntegerZero", RECOMMENDED, - R"({"optionalBool":0})"); - ExpectParseFailureForJson( - "BoolFieldIntegerOne", RECOMMENDED, - R"({"optionalBool":1})"); - ExpectParseFailureForJson( - "BoolFieldCamelCaseTrue", RECOMMENDED, - R"({"optionalBool":True})"); - ExpectParseFailureForJson( - "BoolFieldCamelCaseFalse", RECOMMENDED, - R"({"optionalBool":False})"); - ExpectParseFailureForJson( - "BoolFieldAllCapitalTrue", RECOMMENDED, - R"({"optionalBool":TRUE})"); - ExpectParseFailureForJson( - "BoolFieldAllCapitalFalse", RECOMMENDED, - R"({"optionalBool":FALSE})"); - ExpectParseFailureForJson( - "BoolFieldDoubleQuotedTrue", RECOMMENDED, - R"({"optionalBool":"true"})"); - ExpectParseFailureForJson( - "BoolFieldDoubleQuotedFalse", RECOMMENDED, - R"({"optionalBool":"false"})"); + ExpectParseFailureForJson("BoolFieldIntegerZero", RECOMMENDED, + R"({"optionalBool":0})"); + ExpectParseFailureForJson("BoolFieldIntegerOne", RECOMMENDED, + R"({"optionalBool":1})"); + ExpectParseFailureForJson("BoolFieldCamelCaseTrue", RECOMMENDED, + R"({"optionalBool":True})"); + ExpectParseFailureForJson("BoolFieldCamelCaseFalse", RECOMMENDED, + R"({"optionalBool":False})"); + ExpectParseFailureForJson("BoolFieldAllCapitalTrue", RECOMMENDED, + R"({"optionalBool":TRUE})"); + ExpectParseFailureForJson("BoolFieldAllCapitalFalse", RECOMMENDED, + R"({"optionalBool":FALSE})"); + ExpectParseFailureForJson("BoolFieldDoubleQuotedTrue", RECOMMENDED, + R"({"optionalBool":"true"})"); + ExpectParseFailureForJson("BoolFieldDoubleQuotedFalse", RECOMMENDED, + R"({"optionalBool":"false"})"); // Float fields. - RunValidJsonTest( - "FloatFieldMinPositiveValue", REQUIRED, - R"({"optionalFloat": 1.175494e-38})", - "optional_float: 1.175494e-38"); - RunValidJsonTest( - "FloatFieldMaxNegativeValue", REQUIRED, - R"({"optionalFloat": -1.175494e-38})", - "optional_float: -1.175494e-38"); - RunValidJsonTest( - "FloatFieldMaxPositiveValue", REQUIRED, - R"({"optionalFloat": 3.402823e+38})", - "optional_float: 3.402823e+38"); - RunValidJsonTest( - "FloatFieldMinNegativeValue", REQUIRED, - R"({"optionalFloat": 3.402823e+38})", - "optional_float: 3.402823e+38"); + RunValidJsonTest("FloatFieldMinPositiveValue", REQUIRED, + R"({"optionalFloat": 1.175494e-38})", + "optional_float: 1.175494e-38"); + RunValidJsonTest("FloatFieldMaxNegativeValue", REQUIRED, + R"({"optionalFloat": -1.175494e-38})", + "optional_float: -1.175494e-38"); + RunValidJsonTest("FloatFieldMaxPositiveValue", REQUIRED, + R"({"optionalFloat": 3.402823e+38})", + "optional_float: 3.402823e+38"); + RunValidJsonTest("FloatFieldMinNegativeValue", REQUIRED, + R"({"optionalFloat": 3.402823e+38})", + "optional_float: 3.402823e+38"); // Values can be quoted. - RunValidJsonTest( - "FloatFieldQuotedValue", REQUIRED, - R"({"optionalFloat": "1"})", - "optional_float: 1"); + RunValidJsonTest("FloatFieldQuotedValue", REQUIRED, + R"({"optionalFloat": "1"})", "optional_float: 1"); // Special values. - RunValidJsonTest( - "FloatFieldNan", REQUIRED, - R"({"optionalFloat": "NaN"})", - "optional_float: nan"); - RunValidJsonTest( - "FloatFieldInfinity", REQUIRED, - R"({"optionalFloat": "Infinity"})", - "optional_float: inf"); - RunValidJsonTest( - "FloatFieldNegativeInfinity", REQUIRED, - R"({"optionalFloat": "-Infinity"})", - "optional_float: -inf"); + RunValidJsonTest("FloatFieldNan", REQUIRED, R"({"optionalFloat": "NaN"})", + "optional_float: nan"); + RunValidJsonTest("FloatFieldInfinity", REQUIRED, + R"({"optionalFloat": "Infinity"})", "optional_float: inf"); + RunValidJsonTest("FloatFieldNegativeInfinity", REQUIRED, + R"({"optionalFloat": "-Infinity"})", "optional_float: -inf"); // Non-canonical Nan will be correctly normalized. { TestAllTypesProto3 message; // IEEE floating-point standard 32-bit quiet NaN: // 0111 1111 1xxx xxxx xxxx xxxx xxxx xxxx - message.set_optional_float( - WireFormatLite::DecodeFloat(0x7FA12345)); - RunValidJsonTestWithProtobufInput( - "FloatFieldNormalizeQuietNan", REQUIRED, message, - "optional_float: nan"); + message.set_optional_float(WireFormatLite::DecodeFloat(0x7FA12345)); + RunValidJsonTestWithProtobufInput("FloatFieldNormalizeQuietNan", REQUIRED, + message, "optional_float: nan"); // IEEE floating-point standard 64-bit signaling NaN: // 1111 1111 1xxx xxxx xxxx xxxx xxxx xxxx - message.set_optional_float( - WireFormatLite::DecodeFloat(0xFFB54321)); - RunValidJsonTestWithProtobufInput( - "FloatFieldNormalizeSignalingNan", REQUIRED, message, - "optional_float: nan"); + message.set_optional_float(WireFormatLite::DecodeFloat(0xFFB54321)); + RunValidJsonTestWithProtobufInput("FloatFieldNormalizeSignalingNan", + REQUIRED, message, "optional_float: nan"); } // Special values must be quoted. - ExpectParseFailureForJson( - "FloatFieldNanNotQuoted", RECOMMENDED, - R"({"optionalFloat": NaN})"); - ExpectParseFailureForJson( - "FloatFieldInfinityNotQuoted", RECOMMENDED, - R"({"optionalFloat": Infinity})"); - ExpectParseFailureForJson( - "FloatFieldNegativeInfinityNotQuoted", RECOMMENDED, - R"({"optionalFloat": -Infinity})"); + ExpectParseFailureForJson("FloatFieldNanNotQuoted", RECOMMENDED, + R"({"optionalFloat": NaN})"); + ExpectParseFailureForJson("FloatFieldInfinityNotQuoted", RECOMMENDED, + R"({"optionalFloat": Infinity})"); + ExpectParseFailureForJson("FloatFieldNegativeInfinityNotQuoted", RECOMMENDED, + R"({"optionalFloat": -Infinity})"); // Parsers should reject out-of-bound values. - ExpectParseFailureForJson( - "FloatFieldTooSmall", REQUIRED, - R"({"optionalFloat": -3.502823e+38})"); - ExpectParseFailureForJson( - "FloatFieldTooLarge", REQUIRED, - R"({"optionalFloat": 3.502823e+38})"); + ExpectParseFailureForJson("FloatFieldTooSmall", REQUIRED, + R"({"optionalFloat": -3.502823e+38})"); + ExpectParseFailureForJson("FloatFieldTooLarge", REQUIRED, + R"({"optionalFloat": 3.502823e+38})"); // Double fields. - RunValidJsonTest( - "DoubleFieldMinPositiveValue", REQUIRED, - R"({"optionalDouble": 2.22507e-308})", - "optional_double: 2.22507e-308"); - RunValidJsonTest( - "DoubleFieldMaxNegativeValue", REQUIRED, - R"({"optionalDouble": -2.22507e-308})", - "optional_double: -2.22507e-308"); - RunValidJsonTest( - "DoubleFieldMaxPositiveValue", REQUIRED, - R"({"optionalDouble": 1.79769e+308})", - "optional_double: 1.79769e+308"); - RunValidJsonTest( - "DoubleFieldMinNegativeValue", REQUIRED, - R"({"optionalDouble": -1.79769e+308})", - "optional_double: -1.79769e+308"); + RunValidJsonTest("DoubleFieldMinPositiveValue", REQUIRED, + R"({"optionalDouble": 2.22507e-308})", + "optional_double: 2.22507e-308"); + RunValidJsonTest("DoubleFieldMaxNegativeValue", REQUIRED, + R"({"optionalDouble": -2.22507e-308})", + "optional_double: -2.22507e-308"); + RunValidJsonTest("DoubleFieldMaxPositiveValue", REQUIRED, + R"({"optionalDouble": 1.79769e+308})", + "optional_double: 1.79769e+308"); + RunValidJsonTest("DoubleFieldMinNegativeValue", REQUIRED, + R"({"optionalDouble": -1.79769e+308})", + "optional_double: -1.79769e+308"); // Values can be quoted. - RunValidJsonTest( - "DoubleFieldQuotedValue", REQUIRED, - R"({"optionalDouble": "1"})", - "optional_double: 1"); + RunValidJsonTest("DoubleFieldQuotedValue", REQUIRED, + R"({"optionalDouble": "1"})", "optional_double: 1"); // Special values. - RunValidJsonTest( - "DoubleFieldNan", REQUIRED, - R"({"optionalDouble": "NaN"})", - "optional_double: nan"); - RunValidJsonTest( - "DoubleFieldInfinity", REQUIRED, - R"({"optionalDouble": "Infinity"})", - "optional_double: inf"); - RunValidJsonTest( - "DoubleFieldNegativeInfinity", REQUIRED, - R"({"optionalDouble": "-Infinity"})", - "optional_double: -inf"); + RunValidJsonTest("DoubleFieldNan", REQUIRED, R"({"optionalDouble": "NaN"})", + "optional_double: nan"); + RunValidJsonTest("DoubleFieldInfinity", REQUIRED, + R"({"optionalDouble": "Infinity"})", "optional_double: inf"); + RunValidJsonTest("DoubleFieldNegativeInfinity", REQUIRED, + R"({"optionalDouble": "-Infinity"})", + "optional_double: -inf"); // Non-canonical Nan will be correctly normalized. { TestAllTypesProto3 message; message.set_optional_double( - WireFormatLite::DecodeDouble(int64{0x7FFA123456789ABC})); - RunValidJsonTestWithProtobufInput( - "DoubleFieldNormalizeQuietNan", REQUIRED, message, - "optional_double: nan"); + WireFormatLite::DecodeDouble(int64_t{0x7FFA123456789ABC})); + RunValidJsonTestWithProtobufInput("DoubleFieldNormalizeQuietNan", REQUIRED, + message, "optional_double: nan"); message.set_optional_double( - WireFormatLite::DecodeDouble(uint64{0xFFFBCBA987654321})); - RunValidJsonTestWithProtobufInput( - "DoubleFieldNormalizeSignalingNan", REQUIRED, message, - "optional_double: nan"); + WireFormatLite::DecodeDouble(uint64_t{0xFFFBCBA987654321})); + RunValidJsonTestWithProtobufInput("DoubleFieldNormalizeSignalingNan", + REQUIRED, message, + "optional_double: nan"); } // Special values must be quoted. - ExpectParseFailureForJson( - "DoubleFieldNanNotQuoted", RECOMMENDED, - R"({"optionalDouble": NaN})"); - ExpectParseFailureForJson( - "DoubleFieldInfinityNotQuoted", RECOMMENDED, - R"({"optionalDouble": Infinity})"); - ExpectParseFailureForJson( - "DoubleFieldNegativeInfinityNotQuoted", RECOMMENDED, - R"({"optionalDouble": -Infinity})"); + ExpectParseFailureForJson("DoubleFieldNanNotQuoted", RECOMMENDED, + R"({"optionalDouble": NaN})"); + ExpectParseFailureForJson("DoubleFieldInfinityNotQuoted", RECOMMENDED, + R"({"optionalDouble": Infinity})"); + ExpectParseFailureForJson("DoubleFieldNegativeInfinityNotQuoted", RECOMMENDED, + R"({"optionalDouble": -Infinity})"); // Parsers should reject out-of-bound values. - ExpectParseFailureForJson( - "DoubleFieldTooSmall", REQUIRED, - R"({"optionalDouble": -1.89769e+308})"); - ExpectParseFailureForJson( - "DoubleFieldTooLarge", REQUIRED, - R"({"optionalDouble": +1.89769e+308})"); + ExpectParseFailureForJson("DoubleFieldTooSmall", REQUIRED, + R"({"optionalDouble": -1.89769e+308})"); + ExpectParseFailureForJson("DoubleFieldTooLarge", REQUIRED, + R"({"optionalDouble": +1.89769e+308})"); // Enum fields. - RunValidJsonTest( - "EnumField", REQUIRED, - R"({"optionalNestedEnum": "FOO"})", - "optional_nested_enum: FOO"); + RunValidJsonTest("EnumField", REQUIRED, R"({"optionalNestedEnum": "FOO"})", + "optional_nested_enum: FOO"); // Enum fields with alias - RunValidJsonTest( - "EnumFieldWithAlias", REQUIRED, - R"({"optionalAliasedEnum": "ALIAS_BAZ"})", - "optional_aliased_enum: ALIAS_BAZ"); - RunValidJsonTest( - "EnumFieldWithAliasUseAlias", REQUIRED, - R"({"optionalAliasedEnum": "QUX"})", - "optional_aliased_enum: ALIAS_BAZ"); - RunValidJsonTest( - "EnumFieldWithAliasLowerCase", REQUIRED, - R"({"optionalAliasedEnum": "qux"})", - "optional_aliased_enum: ALIAS_BAZ"); - RunValidJsonTest( - "EnumFieldWithAliasDifferentCase", REQUIRED, - R"({"optionalAliasedEnum": "bAz"})", - "optional_aliased_enum: ALIAS_BAZ"); + RunValidJsonTest("EnumFieldWithAlias", REQUIRED, + R"({"optionalAliasedEnum": "ALIAS_BAZ"})", + "optional_aliased_enum: ALIAS_BAZ"); + RunValidJsonTest("EnumFieldWithAliasUseAlias", REQUIRED, + R"({"optionalAliasedEnum": "MOO"})", + "optional_aliased_enum: ALIAS_BAZ"); + RunValidJsonTest("EnumFieldWithAliasLowerCase", REQUIRED, + R"({"optionalAliasedEnum": "moo"})", + "optional_aliased_enum: ALIAS_BAZ"); + RunValidJsonTest("EnumFieldWithAliasDifferentCase", REQUIRED, + R"({"optionalAliasedEnum": "bAz"})", + "optional_aliased_enum: ALIAS_BAZ"); // Enum values must be represented as strings. - ExpectParseFailureForJson( - "EnumFieldNotQuoted", REQUIRED, - R"({"optionalNestedEnum": FOO})"); + ExpectParseFailureForJson("EnumFieldNotQuoted", REQUIRED, + R"({"optionalNestedEnum": FOO})"); // Numeric values are allowed. - RunValidJsonTest( - "EnumFieldNumericValueZero", REQUIRED, - R"({"optionalNestedEnum": 0})", - "optional_nested_enum: FOO"); - RunValidJsonTest( - "EnumFieldNumericValueNonZero", REQUIRED, - R"({"optionalNestedEnum": 1})", - "optional_nested_enum: BAR"); + RunValidJsonTest("EnumFieldNumericValueZero", REQUIRED, + R"({"optionalNestedEnum": 0})", "optional_nested_enum: FOO"); + RunValidJsonTest("EnumFieldNumericValueNonZero", REQUIRED, + R"({"optionalNestedEnum": 1})", "optional_nested_enum: BAR"); // Unknown enum values are represented as numeric values. RunValidJsonTestWithValidator( "EnumFieldUnknownValue", REQUIRED, R"({"optionalNestedEnum": 123})", [](const Json::Value& value) { return value["optionalNestedEnum"].type() == Json::intValue && - value["optionalNestedEnum"].asInt() == 123; + value["optionalNestedEnum"].asInt() == 123; }, true); // String fields. - RunValidJsonTest( - "StringField", REQUIRED, - R"({"optionalString": "Hello world!"})", - "optional_string: \"Hello world!\""); - RunValidJsonTest( - "StringFieldUnicode", REQUIRED, - // Google in Chinese. - R"({"optionalString": "è°·æ­Œ"})", - R"(optional_string: "è°·æ­Œ")"); - RunValidJsonTest( - "StringFieldEscape", REQUIRED, - R"({"optionalString": "\"\\\/\b\f\n\r\t"})", - R"(optional_string: "\"\\/\b\f\n\r\t")"); - RunValidJsonTest( - "StringFieldUnicodeEscape", REQUIRED, - R"({"optionalString": "\u8C37\u6B4C"})", - R"(optional_string: "è°·æ­Œ")"); - RunValidJsonTest( - "StringFieldUnicodeEscapeWithLowercaseHexLetters", REQUIRED, - R"({"optionalString": "\u8c37\u6b4c"})", - R"(optional_string: "è°·æ­Œ")"); + RunValidJsonTest("StringField", REQUIRED, + R"({"optionalString": "Hello world!"})", + R"(optional_string: "Hello world!")"); + RunValidJsonTest("StringFieldUnicode", REQUIRED, + // Google in Chinese. + R"({"optionalString": "è°·æ­Œ"})", + R"(optional_string: "è°·æ­Œ")"); + RunValidJsonTest("StringFieldEscape", REQUIRED, + R"({"optionalString": "\"\\\/\b\f\n\r\t"})", + R"(optional_string: "\"\\/\b\f\n\r\t")"); + RunValidJsonTest("StringFieldUnicodeEscape", REQUIRED, + R"({"optionalString": "\u8C37\u6B4C"})", + R"(optional_string: "è°·æ­Œ")"); + RunValidJsonTest("StringFieldUnicodeEscapeWithLowercaseHexLetters", REQUIRED, + R"({"optionalString": "\u8c37\u6b4c"})", + R"(optional_string: "è°·æ­Œ")"); RunValidJsonTest( "StringFieldSurrogatePair", REQUIRED, // The character is an emoji: grinning face with smiling eyes. 😠R"({"optionalString": "\uD83D\uDE01"})", R"(optional_string: "\xF0\x9F\x98\x81")"); + RunValidJsonTest("StringFieldEmbeddedNull", REQUIRED, + R"({"optionalString": "Hello\u0000world!"})", + R"(optional_string: "Hello\000world!")"); // Unicode escapes must start with "\u" (lowercase u). - ExpectParseFailureForJson( - "StringFieldUppercaseEscapeLetter", RECOMMENDED, - R"({"optionalString": "\U8C37\U6b4C"})"); - ExpectParseFailureForJson( - "StringFieldInvalidEscape", RECOMMENDED, - R"({"optionalString": "\uXXXX\u6B4C"})"); - ExpectParseFailureForJson( - "StringFieldUnterminatedEscape", RECOMMENDED, - R"({"optionalString": "\u8C3"})"); - ExpectParseFailureForJson( - "StringFieldUnpairedHighSurrogate", RECOMMENDED, - R"({"optionalString": "\uD800"})"); - ExpectParseFailureForJson( - "StringFieldUnpairedLowSurrogate", RECOMMENDED, - R"({"optionalString": "\uDC00"})"); - ExpectParseFailureForJson( - "StringFieldSurrogateInWrongOrder", RECOMMENDED, - R"({"optionalString": "\uDE01\uD83D"})"); - ExpectParseFailureForJson( - "StringFieldNotAString", REQUIRED, - R"({"optionalString": 12345})"); + ExpectParseFailureForJson("StringFieldUppercaseEscapeLetter", RECOMMENDED, + R"({"optionalString": "\U8C37\U6b4C"})"); + ExpectParseFailureForJson("StringFieldInvalidEscape", RECOMMENDED, + R"({"optionalString": "\uXXXX\u6B4C"})"); + ExpectParseFailureForJson("StringFieldUnterminatedEscape", RECOMMENDED, + R"({"optionalString": "\u8C3"})"); + ExpectParseFailureForJson("StringFieldUnpairedHighSurrogate", RECOMMENDED, + R"({"optionalString": "\uD800"})"); + ExpectParseFailureForJson("StringFieldUnpairedLowSurrogate", RECOMMENDED, + R"({"optionalString": "\uDC00"})"); + ExpectParseFailureForJson("StringFieldSurrogateInWrongOrder", RECOMMENDED, + R"({"optionalString": "\uDE01\uD83D"})"); + ExpectParseFailureForJson("StringFieldNotAString", REQUIRED, + R"({"optionalString": 12345})"); // Bytes fields. - RunValidJsonTest( - "BytesField", REQUIRED, - R"({"optionalBytes": "AQI="})", - R"(optional_bytes: "\x01\x02")"); - RunValidJsonTest( - "BytesFieldBase64Url", RECOMMENDED, - R"({"optionalBytes": "-_"})", - R"(optional_bytes: "\xfb")"); + RunValidJsonTest("BytesField", REQUIRED, R"({"optionalBytes": "AQI="})", + R"(optional_bytes: "\x01\x02")"); + RunValidJsonTest("BytesFieldBase64Url", RECOMMENDED, + R"({"optionalBytes": "-_"})", R"(optional_bytes: "\xfb")"); // Message fields. - RunValidJsonTest( - "MessageField", REQUIRED, - R"({"optionalNestedMessage": {"a": 1234}})", - "optional_nested_message: {a: 1234}"); + RunValidJsonTest("MessageField", REQUIRED, + R"({"optionalNestedMessage": {"a": 1234}})", + "optional_nested_message: {a: 1234}"); // Oneof fields. - ExpectParseFailureForJson( - "OneofFieldDuplicate", REQUIRED, - R"({"oneofUint32": 1, "oneofString": "test"})"); + ExpectParseFailureForJson("OneofFieldDuplicate", REQUIRED, + R"({"oneofUint32": 1, "oneofString": "test"})"); + RunValidJsonTest("OneofFieldNullFirst", REQUIRED, + R"({"oneofUint32": null, "oneofString": "test"})", + "oneof_string: \"test\""); + RunValidJsonTest("OneofFieldNullSecond", REQUIRED, + R"({"oneofString": "test", "oneofUint32": null})", + "oneof_string: \"test\""); // Ensure zero values for oneof make it out/backs. TestAllTypesProto3 messageProto3; TestAllTypesProto2 messageProto2; TestOneofMessage(messageProto3, true); TestOneofMessage(messageProto2, false); - RunValidJsonTest( - "OneofZeroUint32", RECOMMENDED, - R"({"oneofUint32": 0})", "oneof_uint32: 0"); - RunValidJsonTest( - "OneofZeroMessage", RECOMMENDED, - R"({"oneofNestedMessage": {}})", "oneof_nested_message: {}"); - RunValidJsonTest( - "OneofZeroString", RECOMMENDED, - R"({"oneofString": ""})", "oneof_string: \"\""); - RunValidJsonTest( - "OneofZeroBytes", RECOMMENDED, - R"({"oneofBytes": ""})", "oneof_bytes: \"\""); - RunValidJsonTest( - "OneofZeroBool", RECOMMENDED, - R"({"oneofBool": false})", "oneof_bool: false"); - RunValidJsonTest( - "OneofZeroUint64", RECOMMENDED, - R"({"oneofUint64": 0})", "oneof_uint64: 0"); - RunValidJsonTest( - "OneofZeroFloat", RECOMMENDED, - R"({"oneofFloat": 0.0})", "oneof_float: 0"); - RunValidJsonTest( - "OneofZeroDouble", RECOMMENDED, - R"({"oneofDouble": 0.0})", "oneof_double: 0"); - RunValidJsonTest( - "OneofZeroEnum", RECOMMENDED, - R"({"oneofEnum":"FOO"})", "oneof_enum: FOO"); + RunValidJsonTest("OneofZeroUint32", RECOMMENDED, R"({"oneofUint32": 0})", + "oneof_uint32: 0"); + RunValidJsonTest("OneofZeroMessage", RECOMMENDED, + R"({"oneofNestedMessage": {}})", "oneof_nested_message: {}"); + RunValidJsonTest("OneofZeroString", RECOMMENDED, R"({"oneofString": ""})", + "oneof_string: \"\""); + RunValidJsonTest("OneofZeroBytes", RECOMMENDED, R"({"oneofBytes": ""})", + "oneof_bytes: \"\""); + RunValidJsonTest("OneofZeroBool", RECOMMENDED, R"({"oneofBool": false})", + "oneof_bool: false"); + RunValidJsonTest("OneofZeroUint64", RECOMMENDED, R"({"oneofUint64": 0})", + "oneof_uint64: 0"); + RunValidJsonTest("OneofZeroFloat", RECOMMENDED, R"({"oneofFloat": 0.0})", + "oneof_float: 0"); + RunValidJsonTest("OneofZeroDouble", RECOMMENDED, R"({"oneofDouble": 0.0})", + "oneof_double: 0"); + RunValidJsonTest("OneofZeroEnum", RECOMMENDED, R"({"oneofEnum":"FOO"})", + "oneof_enum: FOO"); // Map fields. - RunValidJsonTest( - "Int32MapField", REQUIRED, - R"({"mapInt32Int32": {"1": 2, "3": 4}})", - "map_int32_int32: {key: 1 value: 2}" - "map_int32_int32: {key: 3 value: 4}"); - ExpectParseFailureForJson( - "Int32MapFieldKeyNotQuoted", RECOMMENDED, - R"({"mapInt32Int32": {1: 2, 3: 4}})"); - RunValidJsonTest( - "Uint32MapField", REQUIRED, - R"({"mapUint32Uint32": {"1": 2, "3": 4}})", - "map_uint32_uint32: {key: 1 value: 2}" - "map_uint32_uint32: {key: 3 value: 4}"); - ExpectParseFailureForJson( - "Uint32MapFieldKeyNotQuoted", RECOMMENDED, - R"({"mapUint32Uint32": {1: 2, 3: 4}})"); - RunValidJsonTest( - "Int64MapField", REQUIRED, - R"({"mapInt64Int64": {"1": 2, "3": 4}})", - "map_int64_int64: {key: 1 value: 2}" - "map_int64_int64: {key: 3 value: 4}"); - ExpectParseFailureForJson( - "Int64MapFieldKeyNotQuoted", RECOMMENDED, - R"({"mapInt64Int64": {1: 2, 3: 4}})"); - RunValidJsonTest( - "Uint64MapField", REQUIRED, - R"({"mapUint64Uint64": {"1": 2, "3": 4}})", - "map_uint64_uint64: {key: 1 value: 2}" - "map_uint64_uint64: {key: 3 value: 4}"); - ExpectParseFailureForJson( - "Uint64MapFieldKeyNotQuoted", RECOMMENDED, - R"({"mapUint64Uint64": {1: 2, 3: 4}})"); - RunValidJsonTest( - "BoolMapField", REQUIRED, - R"({"mapBoolBool": {"true": true, "false": false}})", - "map_bool_bool: {key: true value: true}" - "map_bool_bool: {key: false value: false}"); - ExpectParseFailureForJson( - "BoolMapFieldKeyNotQuoted", RECOMMENDED, - R"({"mapBoolBool": {true: true, false: false}})"); - RunValidJsonTest( - "MessageMapField", REQUIRED, - R"({ + RunValidJsonTest("Int32MapField", REQUIRED, + R"({"mapInt32Int32": {"1": 2, "3": 4}})", + "map_int32_int32: {key: 1 value: 2}" + "map_int32_int32: {key: 3 value: 4}"); + ExpectParseFailureForJson("Int32MapFieldKeyNotQuoted", RECOMMENDED, + R"({"mapInt32Int32": {1: 2, 3: 4}})"); + RunValidJsonTest("Uint32MapField", REQUIRED, + R"({"mapUint32Uint32": {"1": 2, "3": 4}})", + "map_uint32_uint32: {key: 1 value: 2}" + "map_uint32_uint32: {key: 3 value: 4}"); + ExpectParseFailureForJson("Uint32MapFieldKeyNotQuoted", RECOMMENDED, + R"({"mapUint32Uint32": {1: 2, 3: 4}})"); + RunValidJsonTest("Int64MapField", REQUIRED, + R"({"mapInt64Int64": {"1": 2, "3": 4}})", + "map_int64_int64: {key: 1 value: 2}" + "map_int64_int64: {key: 3 value: 4}"); + ExpectParseFailureForJson("Int64MapFieldKeyNotQuoted", RECOMMENDED, + R"({"mapInt64Int64": {1: 2, 3: 4}})"); + RunValidJsonTest("Uint64MapField", REQUIRED, + R"({"mapUint64Uint64": {"1": 2, "3": 4}})", + "map_uint64_uint64: {key: 1 value: 2}" + "map_uint64_uint64: {key: 3 value: 4}"); + ExpectParseFailureForJson("Uint64MapFieldKeyNotQuoted", RECOMMENDED, + R"({"mapUint64Uint64": {1: 2, 3: 4}})"); + RunValidJsonTest("BoolMapField", REQUIRED, + R"({"mapBoolBool": {"true": true, "false": false}})", + "map_bool_bool: {key: true value: true}" + "map_bool_bool: {key: false value: false}"); + ExpectParseFailureForJson("BoolMapFieldKeyNotQuoted", RECOMMENDED, + R"({"mapBoolBool": {true: true, false: false}})"); + RunValidJsonTest("MessageMapField", REQUIRED, + R"({ "mapStringNestedMessage": { "hello": {"a": 1234}, "world": {"a": 5678} } })", - R"( + R"( map_string_nested_message: { key: "hello" value: {a: 1234} @@ -2422,18 +2498,15 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForNonRepeatedTypes() { } )"); // Since Map keys are represented as JSON strings, escaping should be allowed. - RunValidJsonTest( - "Int32MapEscapedKey", REQUIRED, - R"({"mapInt32Int32": {"\u0031": 2}})", - "map_int32_int32: {key: 1 value: 2}"); - RunValidJsonTest( - "Int64MapEscapedKey", REQUIRED, - R"({"mapInt64Int64": {"\u0031": 2}})", - "map_int64_int64: {key: 1 value: 2}"); - RunValidJsonTest( - "BoolMapEscapedKey", REQUIRED, - R"({"mapBoolBool": {"tr\u0075e": true}})", - "map_bool_bool: {key: true value: true}"); + RunValidJsonTest("Int32MapEscapedKey", REQUIRED, + R"({"mapInt32Int32": {"\u0031": 2}})", + "map_int32_int32: {key: 1 value: 2}"); + RunValidJsonTest("Int64MapEscapedKey", REQUIRED, + R"({"mapInt64Int64": {"\u0031": 2}})", + "map_int64_int64: {key: 1 value: 2}"); + RunValidJsonTest("BoolMapEscapedKey", REQUIRED, + R"({"mapBoolBool": {"tr\u0075e": true}})", + "map_bool_bool: {key: true value: true}"); // http://www.rfc-editor.org/rfc/rfc7159.txt says strings have to use double // quotes. @@ -2507,9 +2580,8 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForRepeatedTypes() { void BinaryAndJsonConformanceSuite::RunJsonTestsForNullTypes() { // "null" is accepted for all fields types. - RunValidJsonTest( - "AllFieldAcceptNull", REQUIRED, - R"({ + RunValidJsonTest("AllFieldAcceptNull", REQUIRED, + R"({ "optionalInt32": null, "optionalInt64": null, "optionalUint32": null, @@ -2548,64 +2620,52 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForNullTypes() { "mapBoolBool": null, "mapStringNestedMessage": null })", - ""); + ""); // Repeated field elements cannot be null. - ExpectParseFailureForJson( - "RepeatedFieldPrimitiveElementIsNull", RECOMMENDED, - R"({"repeatedInt32": [1, null, 2]})"); + ExpectParseFailureForJson("RepeatedFieldPrimitiveElementIsNull", RECOMMENDED, + R"({"repeatedInt32": [1, null, 2]})"); ExpectParseFailureForJson( "RepeatedFieldMessageElementIsNull", RECOMMENDED, R"({"repeatedNestedMessage": [{"a":1}, null, {"a":2}]})"); // Map field keys cannot be null. - ExpectParseFailureForJson( - "MapFieldKeyIsNull", RECOMMENDED, - R"({"mapInt32Int32": {null: 1}})"); + ExpectParseFailureForJson("MapFieldKeyIsNull", RECOMMENDED, + R"({"mapInt32Int32": {null: 1}})"); // Map field values cannot be null. - ExpectParseFailureForJson( - "MapFieldValueIsNull", RECOMMENDED, - R"({"mapInt32Int32": {"0": null}})"); + ExpectParseFailureForJson("MapFieldValueIsNull", RECOMMENDED, + R"({"mapInt32Int32": {"0": null}})"); } void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { RunValidJsonTest("OptionalBoolWrapper", REQUIRED, R"({"optionalBoolWrapper": false})", "optional_bool_wrapper: {value: false}"); - RunValidJsonTest( - "OptionalInt32Wrapper", REQUIRED, - R"({"optionalInt32Wrapper": 0})", - "optional_int32_wrapper: {value: 0}"); - RunValidJsonTest( - "OptionalUint32Wrapper", REQUIRED, - R"({"optionalUint32Wrapper": 0})", - "optional_uint32_wrapper: {value: 0}"); - RunValidJsonTest( - "OptionalInt64Wrapper", REQUIRED, - R"({"optionalInt64Wrapper": 0})", - "optional_int64_wrapper: {value: 0}"); - RunValidJsonTest( - "OptionalUint64Wrapper", REQUIRED, - R"({"optionalUint64Wrapper": 0})", - "optional_uint64_wrapper: {value: 0}"); - RunValidJsonTest( - "OptionalFloatWrapper", REQUIRED, - R"({"optionalFloatWrapper": 0})", - "optional_float_wrapper: {value: 0}"); - RunValidJsonTest( - "OptionalDoubleWrapper", REQUIRED, - R"({"optionalDoubleWrapper": 0})", - "optional_double_wrapper: {value: 0}"); - RunValidJsonTest( - "OptionalStringWrapper", REQUIRED, - R"({"optionalStringWrapper": ""})", - R"(optional_string_wrapper: {value: ""})"); - RunValidJsonTest( - "OptionalBytesWrapper", REQUIRED, - R"({"optionalBytesWrapper": ""})", - R"(optional_bytes_wrapper: {value: ""})"); - RunValidJsonTest( - "OptionalWrapperTypesWithNonDefaultValue", REQUIRED, - R"({ + RunValidJsonTest("OptionalInt32Wrapper", REQUIRED, + R"({"optionalInt32Wrapper": 0})", + "optional_int32_wrapper: {value: 0}"); + RunValidJsonTest("OptionalUint32Wrapper", REQUIRED, + R"({"optionalUint32Wrapper": 0})", + "optional_uint32_wrapper: {value: 0}"); + RunValidJsonTest("OptionalInt64Wrapper", REQUIRED, + R"({"optionalInt64Wrapper": 0})", + "optional_int64_wrapper: {value: 0}"); + RunValidJsonTest("OptionalUint64Wrapper", REQUIRED, + R"({"optionalUint64Wrapper": 0})", + "optional_uint64_wrapper: {value: 0}"); + RunValidJsonTest("OptionalFloatWrapper", REQUIRED, + R"({"optionalFloatWrapper": 0})", + "optional_float_wrapper: {value: 0}"); + RunValidJsonTest("OptionalDoubleWrapper", REQUIRED, + R"({"optionalDoubleWrapper": 0})", + "optional_double_wrapper: {value: 0}"); + RunValidJsonTest("OptionalStringWrapper", REQUIRED, + R"({"optionalStringWrapper": ""})", + R"(optional_string_wrapper: {value: ""})"); + RunValidJsonTest("OptionalBytesWrapper", REQUIRED, + R"({"optionalBytesWrapper": ""})", + R"(optional_bytes_wrapper: {value: ""})"); + RunValidJsonTest("OptionalWrapperTypesWithNonDefaultValue", REQUIRED, + R"({ "optionalBoolWrapper": true, "optionalInt32Wrapper": 1, "optionalUint32Wrapper": 1, @@ -2616,7 +2676,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { "optionalStringWrapper": "1", "optionalBytesWrapper": "AQI=" })", - R"( + R"( optional_bool_wrapper: {value: true} optional_int32_wrapper: {value: 1} optional_uint32_wrapper: {value: 1} @@ -2627,58 +2687,48 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { optional_string_wrapper: {value: "1"} optional_bytes_wrapper: {value: "\x01\x02"} )"); - RunValidJsonTest( - "RepeatedBoolWrapper", REQUIRED, - R"({"repeatedBoolWrapper": [true, false]})", - "repeated_bool_wrapper: {value: true}" - "repeated_bool_wrapper: {value: false}"); - RunValidJsonTest( - "RepeatedInt32Wrapper", REQUIRED, - R"({"repeatedInt32Wrapper": [0, 1]})", - "repeated_int32_wrapper: {value: 0}" - "repeated_int32_wrapper: {value: 1}"); - RunValidJsonTest( - "RepeatedUint32Wrapper", REQUIRED, - R"({"repeatedUint32Wrapper": [0, 1]})", - "repeated_uint32_wrapper: {value: 0}" - "repeated_uint32_wrapper: {value: 1}"); - RunValidJsonTest( - "RepeatedInt64Wrapper", REQUIRED, - R"({"repeatedInt64Wrapper": [0, 1]})", - "repeated_int64_wrapper: {value: 0}" - "repeated_int64_wrapper: {value: 1}"); - RunValidJsonTest( - "RepeatedUint64Wrapper", REQUIRED, - R"({"repeatedUint64Wrapper": [0, 1]})", - "repeated_uint64_wrapper: {value: 0}" - "repeated_uint64_wrapper: {value: 1}"); - RunValidJsonTest( - "RepeatedFloatWrapper", REQUIRED, - R"({"repeatedFloatWrapper": [0, 1]})", - "repeated_float_wrapper: {value: 0}" - "repeated_float_wrapper: {value: 1}"); - RunValidJsonTest( - "RepeatedDoubleWrapper", REQUIRED, - R"({"repeatedDoubleWrapper": [0, 1]})", - "repeated_double_wrapper: {value: 0}" - "repeated_double_wrapper: {value: 1}"); - RunValidJsonTest( - "RepeatedStringWrapper", REQUIRED, - R"({"repeatedStringWrapper": ["", "AQI="]})", - R"( + RunValidJsonTest("RepeatedBoolWrapper", REQUIRED, + R"({"repeatedBoolWrapper": [true, false]})", + "repeated_bool_wrapper: {value: true}" + "repeated_bool_wrapper: {value: false}"); + RunValidJsonTest("RepeatedInt32Wrapper", REQUIRED, + R"({"repeatedInt32Wrapper": [0, 1]})", + "repeated_int32_wrapper: {value: 0}" + "repeated_int32_wrapper: {value: 1}"); + RunValidJsonTest("RepeatedUint32Wrapper", REQUIRED, + R"({"repeatedUint32Wrapper": [0, 1]})", + "repeated_uint32_wrapper: {value: 0}" + "repeated_uint32_wrapper: {value: 1}"); + RunValidJsonTest("RepeatedInt64Wrapper", REQUIRED, + R"({"repeatedInt64Wrapper": [0, 1]})", + "repeated_int64_wrapper: {value: 0}" + "repeated_int64_wrapper: {value: 1}"); + RunValidJsonTest("RepeatedUint64Wrapper", REQUIRED, + R"({"repeatedUint64Wrapper": [0, 1]})", + "repeated_uint64_wrapper: {value: 0}" + "repeated_uint64_wrapper: {value: 1}"); + RunValidJsonTest("RepeatedFloatWrapper", REQUIRED, + R"({"repeatedFloatWrapper": [0, 1]})", + "repeated_float_wrapper: {value: 0}" + "repeated_float_wrapper: {value: 1}"); + RunValidJsonTest("RepeatedDoubleWrapper", REQUIRED, + R"({"repeatedDoubleWrapper": [0, 1]})", + "repeated_double_wrapper: {value: 0}" + "repeated_double_wrapper: {value: 1}"); + RunValidJsonTest("RepeatedStringWrapper", REQUIRED, + R"({"repeatedStringWrapper": ["", "AQI="]})", + R"( repeated_string_wrapper: {value: ""} repeated_string_wrapper: {value: "AQI="} )"); - RunValidJsonTest( - "RepeatedBytesWrapper", REQUIRED, - R"({"repeatedBytesWrapper": ["", "AQI="]})", - R"( + RunValidJsonTest("RepeatedBytesWrapper", REQUIRED, + R"({"repeatedBytesWrapper": ["", "AQI="]})", + R"( repeated_bytes_wrapper: {value: ""} repeated_bytes_wrapper: {value: "\x01\x02"} )"); - RunValidJsonTest( - "WrapperTypesWithNullValue", REQUIRED, - R"({ + RunValidJsonTest("WrapperTypesWithNullValue", REQUIRED, + R"({ "optionalBoolWrapper": null, "optionalInt32Wrapper": null, "optionalUint32Wrapper": null, @@ -2698,7 +2748,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { "repeatedStringWrapper": null, "repeatedBytesWrapper": null })", - ""); + ""); // Duration RunValidJsonTest( @@ -2709,19 +2759,21 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { "DurationMaxValue", REQUIRED, R"({"optionalDuration": "315576000000.999999999s"})", "optional_duration: {seconds: 315576000000 nanos: 999999999}"); - RunValidJsonTest( - "DurationRepeatedValue", REQUIRED, - R"({"repeatedDuration": ["1.5s", "-1.5s"]})", - "repeated_duration: {seconds: 1 nanos: 500000000}" - "repeated_duration: {seconds: -1 nanos: -500000000}"); - RunValidJsonTest( - "DurationNull", REQUIRED, - R"({"optionalDuration": null})", - ""); - - ExpectParseFailureForJson( - "DurationMissingS", REQUIRED, - R"({"optionalDuration": "1"})"); + RunValidJsonTest("DurationRepeatedValue", REQUIRED, + R"({"repeatedDuration": ["1.5s", "-1.5s"]})", + "repeated_duration: {seconds: 1 nanos: 500000000}" + "repeated_duration: {seconds: -1 nanos: -500000000}"); + RunValidJsonTest("DurationNull", REQUIRED, R"({"optionalDuration": null})", + ""); + RunValidJsonTest("DurationNegativeSeconds", REQUIRED, + R"({"optionalDuration": "-5s"})", + "optional_duration: {seconds: -5 nanos: 0}"); + RunValidJsonTest("DurationNegativeNanos", REQUIRED, + R"({"optionalDuration": "-0.5s"})", + "optional_duration: {seconds: 0 nanos: -500000000}"); + + ExpectParseFailureForJson("DurationMissingS", REQUIRED, + R"({"optionalDuration": "1"})"); ExpectParseFailureForJson( "DurationJsonInputTooSmall", REQUIRED, R"({"optionalDuration": "-315576000001.000000000s"})"); @@ -2765,10 +2817,9 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { true); // Timestamp - RunValidJsonTest( - "TimestampMinValue", REQUIRED, - R"({"optionalTimestamp": "0001-01-01T00:00:00Z"})", - "optional_timestamp: {seconds: -62135596800}"); + RunValidJsonTest("TimestampMinValue", REQUIRED, + R"({"optionalTimestamp": "0001-01-01T00:00:00Z"})", + "optional_timestamp: {seconds: -62135596800}"); RunValidJsonTest( "TimestampMaxValue", REQUIRED, R"({"optionalTimestamp": "9999-12-31T23:59:59.999999999Z"})", @@ -2792,35 +2843,26 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { RunValidJsonTest("TimestampWithNegativeOffset", REQUIRED, R"({"optionalTimestamp": "1969-12-31T16:00:01-08:00"})", "optional_timestamp: {seconds: 1}"); - RunValidJsonTest( - "TimestampNull", REQUIRED, - R"({"optionalTimestamp": null})", - ""); + RunValidJsonTest("TimestampNull", REQUIRED, R"({"optionalTimestamp": null})", + ""); - ExpectParseFailureForJson( - "TimestampJsonInputTooSmall", REQUIRED, - R"({"optionalTimestamp": "0000-01-01T00:00:00Z"})"); + ExpectParseFailureForJson("TimestampJsonInputTooSmall", REQUIRED, + R"({"optionalTimestamp": "0000-01-01T00:00:00Z"})"); ExpectParseFailureForJson( "TimestampJsonInputTooLarge", REQUIRED, R"({"optionalTimestamp": "10000-01-01T00:00:00Z"})"); - ExpectParseFailureForJson( - "TimestampJsonInputMissingZ", REQUIRED, - R"({"optionalTimestamp": "0001-01-01T00:00:00"})"); - ExpectParseFailureForJson( - "TimestampJsonInputMissingT", REQUIRED, - R"({"optionalTimestamp": "0001-01-01 00:00:00Z"})"); - ExpectParseFailureForJson( - "TimestampJsonInputLowercaseZ", REQUIRED, - R"({"optionalTimestamp": "0001-01-01T00:00:00z"})"); - ExpectParseFailureForJson( - "TimestampJsonInputLowercaseT", REQUIRED, - R"({"optionalTimestamp": "0001-01-01t00:00:00Z"})"); - ExpectSerializeFailureForJson( - "TimestampProtoInputTooSmall", REQUIRED, - "optional_timestamp: {seconds: -62135596801}"); - ExpectSerializeFailureForJson( - "TimestampProtoInputTooLarge", REQUIRED, - "optional_timestamp: {seconds: 253402300800}"); + ExpectParseFailureForJson("TimestampJsonInputMissingZ", REQUIRED, + R"({"optionalTimestamp": "0001-01-01T00:00:00"})"); + ExpectParseFailureForJson("TimestampJsonInputMissingT", REQUIRED, + R"({"optionalTimestamp": "0001-01-01 00:00:00Z"})"); + ExpectParseFailureForJson("TimestampJsonInputLowercaseZ", REQUIRED, + R"({"optionalTimestamp": "0001-01-01T00:00:00z"})"); + ExpectParseFailureForJson("TimestampJsonInputLowercaseT", REQUIRED, + R"({"optionalTimestamp": "0001-01-01t00:00:00Z"})"); + ExpectSerializeFailureForJson("TimestampProtoInputTooSmall", REQUIRED, + "optional_timestamp: {seconds: -62135596801}"); + ExpectSerializeFailureForJson("TimestampProtoInputTooLarge", REQUIRED, + "optional_timestamp: {seconds: 253402300800}"); RunValidJsonTestWithValidator( "TimestampZeroNormalized", RECOMMENDED, R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})", @@ -2862,32 +2904,24 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForWrapperTypes() { } void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldMask() { - RunValidJsonTest( - "FieldMask", REQUIRED, - R"({"optionalFieldMask": "foo,barBaz"})", - R"(optional_field_mask: {paths: "foo" paths: "bar_baz"})"); - RunValidJsonTest( - "EmptyFieldMask", REQUIRED, - R"({"optionalFieldMask": ""})", - R"(optional_field_mask: {})"); - ExpectParseFailureForJson( - "FieldMaskInvalidCharacter", RECOMMENDED, - R"({"optionalFieldMask": "foo,bar_bar"})"); - ExpectSerializeFailureForJson( - "FieldMaskPathsDontRoundTrip", RECOMMENDED, - R"(optional_field_mask: {paths: "fooBar"})"); - ExpectSerializeFailureForJson( - "FieldMaskNumbersDontRoundTrip", RECOMMENDED, - R"(optional_field_mask: {paths: "foo_3_bar"})"); - ExpectSerializeFailureForJson( - "FieldMaskTooManyUnderscore", RECOMMENDED, - R"(optional_field_mask: {paths: "foo__bar"})"); + RunValidJsonTest("FieldMask", REQUIRED, + R"({"optionalFieldMask": "foo,barBaz"})", + R"(optional_field_mask: {paths: "foo" paths: "bar_baz"})"); + RunValidJsonTest("EmptyFieldMask", REQUIRED, R"({"optionalFieldMask": ""})", + R"(optional_field_mask: {})"); + ExpectParseFailureForJson("FieldMaskInvalidCharacter", RECOMMENDED, + R"({"optionalFieldMask": "foo,bar_bar"})"); + ExpectSerializeFailureForJson("FieldMaskPathsDontRoundTrip", RECOMMENDED, + R"(optional_field_mask: {paths: "fooBar"})"); + ExpectSerializeFailureForJson("FieldMaskNumbersDontRoundTrip", RECOMMENDED, + R"(optional_field_mask: {paths: "foo_3_bar"})"); + ExpectSerializeFailureForJson("FieldMaskTooManyUnderscore", RECOMMENDED, + R"(optional_field_mask: {paths: "foo__bar"})"); } void BinaryAndJsonConformanceSuite::RunJsonTestsForStruct() { - RunValidJsonTest( - "Struct", REQUIRED, - R"({ + RunValidJsonTest("Struct", REQUIRED, + R"({ "optionalStruct": { "nullValue": null, "intValue": 1234, @@ -2900,7 +2934,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForStruct() { } } })", - R"( + R"( optional_struct: { fields: { key: "nullValue" @@ -2950,14 +2984,13 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForStruct() { } } )"); - RunValidJsonTest( - "StructWithEmptyListValue", REQUIRED, - R"({ + RunValidJsonTest("StructWithEmptyListValue", REQUIRED, + R"({ "optionalStruct": { "listValue": [] } })", - R"( + R"( optional_struct: { fields: { key: "listValue" @@ -2971,30 +3004,20 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForStruct() { } void BinaryAndJsonConformanceSuite::RunJsonTestsForValue() { - RunValidJsonTest( - "ValueAcceptInteger", REQUIRED, - R"({"optionalValue": 1})", - "optional_value: { number_value: 1}"); - RunValidJsonTest( - "ValueAcceptFloat", REQUIRED, - R"({"optionalValue": 1.5})", - "optional_value: { number_value: 1.5}"); - RunValidJsonTest( - "ValueAcceptBool", REQUIRED, - R"({"optionalValue": false})", - "optional_value: { bool_value: false}"); - RunValidJsonTest( - "ValueAcceptNull", REQUIRED, - R"({"optionalValue": null})", - "optional_value: { null_value: NULL_VALUE}"); - RunValidJsonTest( - "ValueAcceptString", REQUIRED, - R"({"optionalValue": "hello"})", - R"(optional_value: { string_value: "hello"})"); - RunValidJsonTest( - "ValueAcceptList", REQUIRED, - R"({"optionalValue": [0, "hello"]})", - R"( + RunValidJsonTest("ValueAcceptInteger", REQUIRED, R"({"optionalValue": 1})", + "optional_value: { number_value: 1}"); + RunValidJsonTest("ValueAcceptFloat", REQUIRED, R"({"optionalValue": 1.5})", + "optional_value: { number_value: 1.5}"); + RunValidJsonTest("ValueAcceptBool", REQUIRED, R"({"optionalValue": false})", + "optional_value: { bool_value: false}"); + RunValidJsonTest("ValueAcceptNull", REQUIRED, R"({"optionalValue": null})", + "optional_value: { null_value: NULL_VALUE}"); + RunValidJsonTest("ValueAcceptString", REQUIRED, + R"({"optionalValue": "hello"})", + R"(optional_value: { string_value: "hello"})"); + RunValidJsonTest("ValueAcceptList", REQUIRED, + R"({"optionalValue": [0, "hello"]})", + R"( optional_value: { list_value: { values: { @@ -3006,10 +3029,9 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForValue() { } } )"); - RunValidJsonTest( - "ValueAcceptObject", REQUIRED, - R"({"optionalValue": {"value": 1}})", - R"( + RunValidJsonTest("ValueAcceptObject", REQUIRED, + R"({"optionalValue": {"value": 1}})", + R"( optional_value: { struct_value: { fields: { @@ -3021,12 +3043,11 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForValue() { } } )"); - RunValidJsonTest( - "RepeatedValue", REQUIRED, - R"({ + RunValidJsonTest("RepeatedValue", REQUIRED, + R"({ "repeatedValue": [["a"]] })", - R"( + R"( repeated_value: [ { list_value: { @@ -3037,12 +3058,11 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForValue() { } ] )"); - RunValidJsonTest( - "RepeatedListValue", REQUIRED, - R"({ + RunValidJsonTest("RepeatedListValue", REQUIRED, + R"({ "repeatedListValue": [["a"]] })", - R"( + R"( repeated_list_value: [ { values: [ @@ -3051,27 +3071,48 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForValue() { } ] )"); + RunValidJsonTestWithValidator( + "NullValueInOtherOneofOldFormat", RECOMMENDED, + R"({"oneofNullValue": "NULL_VALUE"})", + [](const Json::Value& value) { + return (value.isMember("oneofNullValue") && + value["oneofNullValue"].isNull()); + }, + true); + RunValidJsonTestWithValidator( + "NullValueInOtherOneofNewFormat", RECOMMENDED, + R"({"oneofNullValue": null})", + [](const Json::Value& value) { + return (value.isMember("oneofNullValue") && + value["oneofNullValue"].isNull()); + }, + true); + RunValidJsonTestWithValidator( + "NullValueInNormalMessage", RECOMMENDED, R"({"optionalNullValue": null})", + [](const Json::Value& value) { return value.empty(); }, true); + ExpectSerializeFailureForJson("ValueRejectNanNumberValue", RECOMMENDED, + "optional_value: { number_value: nan}"); + ExpectSerializeFailureForJson("ValueRejectInfNumberValue", RECOMMENDED, + "optional_value: { number_value: inf}"); } void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { - RunValidJsonTest( - "Any", REQUIRED, - R"({ + RunValidJsonTest("Any", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3", "optionalInt32": 12345 } })", - R"( + R"( optional_any: { [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { optional_int32: 12345 } } )"); - RunValidJsonTest( - "AnyNested", REQUIRED, - R"({ + RunValidJsonTest("AnyNested", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Any", "value": { @@ -3080,7 +3121,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Any] { [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { @@ -3090,15 +3131,14 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } )"); // The special "@type" tag is not required to appear first. - RunValidJsonTest( - "AnyUnorderedTypeTag", REQUIRED, - R"({ + RunValidJsonTest("AnyUnorderedTypeTag", REQUIRED, + R"({ "optionalAny": { "optionalInt32": 12345, "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3" } })", - R"( + R"( optional_any: { [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { optional_int32: 12345 @@ -3106,30 +3146,28 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } )"); // Well-known types in Any. - RunValidJsonTest( - "AnyWithInt32ValueWrapper", REQUIRED, - R"({ + RunValidJsonTest("AnyWithInt32ValueWrapper", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Int32Value", "value": 12345 } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Int32Value] { value: 12345 } } )"); - RunValidJsonTest( - "AnyWithDuration", REQUIRED, - R"({ + RunValidJsonTest("AnyWithDuration", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.5s" } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Duration] { seconds: 1 @@ -3137,15 +3175,14 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } )"); - RunValidJsonTest( - "AnyWithTimestamp", REQUIRED, - R"({ + RunValidJsonTest("AnyWithTimestamp", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Timestamp", "value": "1970-01-01T00:00:00Z" } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Timestamp] { seconds: 0 @@ -3153,24 +3190,22 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } )"); - RunValidJsonTest( - "AnyWithFieldMask", REQUIRED, - R"({ + RunValidJsonTest("AnyWithFieldMask", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.FieldMask", "value": "foo,barBaz" } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.FieldMask] { paths: ["foo", "bar_baz"] } } )"); - RunValidJsonTest( - "AnyWithStruct", REQUIRED, - R"({ + RunValidJsonTest("AnyWithStruct", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Struct", "value": { @@ -3178,7 +3213,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Struct] { fields: { @@ -3190,9 +3225,8 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } )"); - RunValidJsonTest( - "AnyWithValueForJsonObject", REQUIRED, - R"({ + RunValidJsonTest("AnyWithValueForJsonObject", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Value", "value": { @@ -3200,7 +3234,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Value] { struct_value: { @@ -3214,15 +3248,14 @@ void BinaryAndJsonConformanceSuite::RunJsonTestsForAny() { } } )"); - RunValidJsonTest( - "AnyWithValueForInteger", REQUIRED, - R"({ + RunValidJsonTest("AnyWithValueForInteger", REQUIRED, + R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Value", "value": 1 } })", - R"( + R"( optional_any: { [type.googleapis.com/google.protobuf.Value] { number_value: 1 diff --git a/conformance/binary_json_conformance_suite.h b/conformance/binary_json_conformance_suite.h index 0a17526..be9579c 100644 --- a/conformance/binary_json_conformance_suite.h +++ b/conformance/binary_json_conformance_suite.h @@ -1,38 +1,16 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #ifndef CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H #define CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H -#include "third_party/jsoncpp/json.h" +#include "json/json.h" #include "conformance_test.h" +#include "google/protobuf/descriptor.h" namespace google { namespace protobuf { @@ -42,7 +20,9 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite { BinaryAndJsonConformanceSuite() {} private: - void RunSuiteImpl(); + void RunSuiteImpl() override; + void RunBinaryPerformanceTests(); + void RunJsonPerformanceTests(); void RunJsonTests(); void RunJsonTestsForFieldNameConvention(); void RunJsonTestsForNonRepeatedTypes(); @@ -53,9 +33,19 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite { void RunJsonTestsForStruct(); void RunJsonTestsForValue(); void RunJsonTestsForAny(); + void RunJsonTestsForUnknownEnumStringValues(); void RunValidJsonTest(const std::string& test_name, ConformanceLevel level, const std::string& input_json, const std::string& equivalent_text_format); + void RunValidJsonTest(const std::string& test_name, ConformanceLevel level, + const std::string& input_json, + const std::string& equivalent_text_format, + bool is_proto3); + void RunValidJsonTestWithMessage(const std::string& test_name, + ConformanceLevel level, + const std::string& input_json, + const std::string& equivalent_text_forma, + const Message& prototype); void RunValidJsonTestWithProtobufInput( const std::string& test_name, ConformanceLevel level, const protobuf_test_messages::proto3::TestAllTypesProto3& input, @@ -78,18 +68,20 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite { const std::string& input_protobuf, const std::string& expected_protobuf, bool is_proto3); + void RunBinaryPerformanceMergeMessageWithField(const std::string& test_name, + const std::string& field_proto, + bool is_proto3); + void RunValidProtobufTestWithMessage( const std::string& test_name, ConformanceLevel level, const Message* input, const std::string& equivalent_text_format, bool is_proto3); - bool ParseJsonResponse( - const conformance::ConformanceResponse& response, - Message* test_message); - bool ParseResponse( - const conformance::ConformanceResponse& response, - const ConformanceRequestSetting& setting, - Message* test_message) override; + bool ParseJsonResponse(const conformance::ConformanceResponse& response, + Message* test_message); + bool ParseResponse(const conformance::ConformanceResponse& response, + const ConformanceRequestSetting& setting, + Message* test_message) override; typedef std::function Validator; void RunValidJsonTestWithValidator(const std::string& test_name, @@ -116,11 +108,9 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite { void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type); void TestIllegalTags(); template - void TestOneofMessage (MessageType &message, - bool is_proto3); + void TestOneofMessage(MessageType& message, bool is_proto3); template - void TestUnknownMessage (MessageType &message, - bool is_proto3); + void TestUnknownMessage(MessageType& message, bool is_proto3); void TestValidDataForType( google::protobuf::FieldDescriptor::Type, std::vector> values); @@ -130,6 +120,13 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite { void TestValidDataForOneofType(google::protobuf::FieldDescriptor::Type); void TestMergeOneofMessage(); void TestOverwriteMessageValueMap(); + void TestBinaryPerformanceForAlternatingUnknownFields(); + void TestBinaryPerformanceMergeMessageWithRepeatedFieldForType( + google::protobuf::FieldDescriptor::Type); + void TestBinaryPerformanceMergeMessageWithUnknownFieldForType( + google::protobuf::FieldDescriptor::Type); + void TestJsonPerformanceMergeMessageWithRepeatedFieldForType( + google::protobuf::FieldDescriptor::Type, std::string field_value); std::unique_ptr type_resolver_; std::string type_url_; diff --git a/conformance/conformance.proto b/conformance/conformance.proto index 26c0bd2..c4aed80 100644 --- a/conformance/conformance.proto +++ b/conformance/conformance.proto @@ -1,36 +1,16 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 syntax = "proto3"; + package conformance; + option java_package = "com.google.protobuf.conformance"; +option objc_class_prefix = "Conformance"; // This defines the conformance testing protocol. This protocol exists between // the conformance test suite itself and the code being tested. For each test, @@ -55,7 +35,7 @@ enum WireFormat { UNSPECIFIED = 0; PROTOBUF = 1; JSON = 2; - JSPB = 3; // Google internal only. Opensource testees just skip it. + JSPB = 3; // Only used inside Google. Opensource testees just skip it. TEXT_FORMAT = 4; } @@ -64,12 +44,13 @@ enum TestCategory { BINARY_TEST = 1; // Test binary wire format. JSON_TEST = 2; // Test json wire format. // Similar to JSON_TEST. However, during parsing json, testee should ignore - // unknown fields. This feature is optional. Each implementation can descide + // unknown fields. This feature is optional. Each implementation can decide // whether to support it. See // https://developers.google.com/protocol-buffers/docs/proto3#json_options // for more detail. JSON_IGNORE_UNKNOWN_PARSING_TEST = 3; - // Test jspb wire format. Google internal only. Opensource testees just skip it. + // Test jspb wire format. Only used inside Google. Opensource testees just + // skip it. JSPB_TEST = 4; // Test text format. For cpp, java and python, testees can already deal with // this type. Testees of other languages can simply skip it. @@ -92,14 +73,10 @@ message ConformanceRequest { // The payload (whether protobuf of JSON) is always for a // protobuf_test_messages.proto3.TestAllTypes proto (as defined in // src/google/protobuf/proto3_test_messages.proto). - // - // TODO(haberman): if/when we expand the conformance tests to support proto2, - // we will want to include a field that lets the payload/response be a - // protobuf_test_messages.proto2.TestAllTypes message instead. oneof payload { bytes protobuf_payload = 1; string json_payload = 2; - // Google internal only. Opensource testees just skip it. + // Only used inside Google. Opensource testees just skip it. string jspb_payload = 7; string text_payload = 8; } @@ -109,12 +86,12 @@ message ConformanceRequest { // The full name for the test message to use; for the moment, either: // protobuf_test_messages.proto3.TestAllTypesProto3 or - // protobuf_test_messages.proto2.TestAllTypesProto2. + // protobuf_test_messages.google.protobuf.TestAllTypesProto2. string message_type = 4; // Each test is given a specific test category. Some category may need - // spedific support in testee programs. Refer to the definition of TestCategory - // for more information. + // specific support in testee programs. Refer to the definition of + // TestCategory for more information. TestCategory test_category = 5; // Specify details for how to encode jspb. @@ -140,6 +117,11 @@ message ConformanceResponse { // this field. string serialize_error = 6; + // This should be set if the test program timed out. The string should + // provide more information about what the child process was doing when it + // was killed. + string timeout_error = 9; + // This should be set if some other error occurred. This will always // indicate that the test failed. The string can provide more information // about the failure. @@ -158,8 +140,8 @@ message ConformanceResponse { string skipped = 5; // If the input was successfully parsed and the requested output was JSPB, - // serialize to JSPB and set it in this field. JSPB is google internal only - // format. Opensource testees can just skip it. + // serialize to JSPB and set it in this field. JSPB is only used inside + // Google. Opensource testees can just skip it. string jspb_payload = 7; // If the input was successfully parsed and the requested output was @@ -173,4 +155,3 @@ message JspbEncodingConfig { // Encode the value field of Any as jspb array if true, otherwise binary. bool use_jspb_array_any_format = 1; } - diff --git a/conformance/conformance_cpp.cc b/conformance/conformance_cpp.cc index 1cdfdae..30baafc 100644 --- a/conformance/conformance_cpp.cc +++ b/conformance/conformance_cpp.cc @@ -1,191 +1,184 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #include #include #include -#include -#include -#include -#include -#include "conformance.pb.h" -#include -#include -#include - -using conformance::ConformanceRequest; -using conformance::ConformanceResponse; -using google::protobuf::Descriptor; -using google::protobuf::DescriptorPool; -using google::protobuf::Message; -using google::protobuf::MessageFactory; -using google::protobuf::TextFormat; -using google::protobuf::util::BinaryToJsonString; -using google::protobuf::util::JsonParseOptions; -using google::protobuf::util::JsonToBinaryString; -using google::protobuf::util::NewTypeResolverForDescriptorPool; -using google::protobuf::util::TypeResolver; -using protobuf_test_messages::proto3::TestAllTypesProto3; -using std::string; - -static const char kTypeUrlPrefix[] = "type.googleapis.com"; - -const char* kFailures[] = { -}; - -static string GetTypeUrl(const Descriptor* message) { - return string(kTypeUrlPrefix) + "/" + message->full_name(); -} - -int test_count = 0; -bool verbose = false; -TypeResolver* type_resolver; -string* type_url; +#include +#include +#include + +#include "google/protobuf/util/json_util.h" +#include "google/protobuf/util/type_resolver_util.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "conformance/conformance.pb.h" +#include "conformance/conformance.pb.h" +#include "google/protobuf/endian.h" +#include "google/protobuf/message.h" +#include "google/protobuf/test_messages_proto2.pb.h" +#include "google/protobuf/test_messages_proto3.pb.h" +#include "google/protobuf/test_messages_proto3.pb.h" +#include "google/protobuf/text_format.h" +#include "google/protobuf/util/type_resolver.h" +#include "google/protobuf/stubs/status_macros.h" + +// Must be included last. +#include "google/protobuf/port_def.inc" namespace google { namespace protobuf { - -using util::Status; - -bool CheckedRead(int fd, void *buf, size_t len) { - size_t ofs = 0; +namespace { +using ::conformance::ConformanceRequest; +using ::conformance::ConformanceResponse; +using ::google::protobuf::util::BinaryToJsonString; +using ::google::protobuf::util::JsonParseOptions; +using ::google::protobuf::util::JsonToBinaryString; +using ::google::protobuf::util::NewTypeResolverForDescriptorPool; +using ::google::protobuf::util::TypeResolver; +using ::protobuf_test_messages::proto2::TestAllTypesProto2; +using ::protobuf_test_messages::proto3::TestAllTypesProto3; + +absl::Status ReadFd(int fd, char* buf, size_t len) { while (len > 0) { - ssize_t bytes_read = read(fd, (char*)buf + ofs, len); + ssize_t bytes_read = read(fd, buf, len); - if (bytes_read == 0) return false; + if (bytes_read == 0) { + return absl::DataLossError("unexpected EOF"); + } if (bytes_read < 0) { - GOOGLE_LOG(FATAL) << "Error reading from test runner: " << strerror(errno); + return absl::ErrnoToStatus(errno, "error reading from test runner"); } len -= bytes_read; - ofs += bytes_read; + buf += bytes_read; } - - return true; + return absl::OkStatus(); } -void CheckedWrite(int fd, const void *buf, size_t len) { - if (write(fd, buf, len) != len) { - GOOGLE_LOG(FATAL) << "Error writing to test runner: " << strerror(errno); +absl::Status WriteFd(int fd, const void* buf, size_t len) { + if (static_cast(write(fd, buf, len)) != len) { + return absl::ErrnoToStatus(errno, "error reading to test runner"); } + return absl::OkStatus(); } -void DoTest(const ConformanceRequest& request, ConformanceResponse* response) { - Message *test_message; - const Descriptor *descriptor = DescriptorPool::generated_pool()->FindMessageTypeByName( - request.message_type()); - if (!descriptor) { - GOOGLE_LOG(FATAL) << "No such message type: " << request.message_type(); +class Harness { + public: + Harness() { + google::protobuf::LinkMessageReflection(); + google::protobuf::LinkMessageReflection(); + + resolver_.reset(NewTypeResolverForDescriptorPool( + "type.googleapis.com", DescriptorPool::generated_pool())); + type_url_ = absl::StrCat("type.googleapis.com/", + TestAllTypesProto3::GetDescriptor()->full_name()); } - test_message = MessageFactory::generated_factory()->GetPrototype(descriptor)->New(); + + absl::StatusOr RunTest( + const ConformanceRequest& request); + + // Returns Ok(true) if we're done processing requests. + absl::StatusOr ServeConformanceRequest(); + + private: + bool verbose_ = false; + std::unique_ptr resolver_; + std::string type_url_; +}; + +absl::StatusOr Harness::RunTest( + const ConformanceRequest& request) { + const Descriptor* descriptor = + DescriptorPool::generated_pool()->FindMessageTypeByName( + request.message_type()); + if (descriptor == nullptr) { + return absl::NotFoundError( + absl::StrCat("No such message type: ", request.message_type())); + } + + std::unique_ptr test_message( + MessageFactory::generated_factory()->GetPrototype(descriptor)->New()); + ConformanceResponse response; switch (request.payload_case()) { case ConformanceRequest::kProtobufPayload: { if (!test_message->ParseFromString(request.protobuf_payload())) { - // Getting parse details would involve something like: - // http://stackoverflow.com/questions/22121922/how-can-i-get-more-details-about-errors-generated-during-protobuf-parsing-c - response->set_parse_error("Parse error (no more details available)."); - return; + response.set_parse_error("parse error (no more details available)"); + return response; } break; } case ConformanceRequest::kJsonPayload: { - string proto_binary; JsonParseOptions options; options.ignore_unknown_fields = (request.test_category() == - conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST); - Status status = JsonToBinaryString(type_resolver, *type_url, - request.json_payload(), &proto_binary, - options); + conformance::JSON_IGNORE_UNKNOWN_PARSING_TEST); + + std::string proto_binary; + absl::Status status = + JsonToBinaryString(resolver_.get(), type_url_, request.json_payload(), + &proto_binary, options); if (!status.ok()) { - response->set_parse_error(string("Parse error: ") + - std::string(status.error_message())); - return; + response.set_parse_error( + absl::StrCat("parse error: ", status.message())); + return response; } if (!test_message->ParseFromString(proto_binary)) { - response->set_runtime_error( - "Parsing JSON generates invalid proto output."); - return; + response.set_runtime_error( + "parsing JSON generated invalid proto output"); + return response; } + break; } case ConformanceRequest::kTextPayload: { - if (!TextFormat::ParseFromString(request.text_payload(), test_message)) { - response->set_parse_error("Parse error"); - return; + if (!TextFormat::ParseFromString(request.text_payload(), + test_message.get())) { + response.set_parse_error("parse error (no more details available)"); + return response; } break; } case ConformanceRequest::PAYLOAD_NOT_SET: - GOOGLE_LOG(FATAL) << "Request didn't have payload."; - break; + return absl::InvalidArgumentError("request didn't have payload"); default: - GOOGLE_LOG(FATAL) << "unknown payload type: " << request.payload_case(); - break; - } - - conformance::FailureSet failures; - if (descriptor == failures.GetDescriptor()) { - for (const char* s : kFailures) failures.add_failure(s); - test_message = &failures; + return absl::InvalidArgumentError( + absl::StrCat("unknown payload type", request.payload_case())); } switch (request.requested_output_format()) { case conformance::UNSPECIFIED: - GOOGLE_LOG(FATAL) << "Unspecified output format"; - break; + return absl::InvalidArgumentError("unspecified output format"); case conformance::PROTOBUF: { - GOOGLE_CHECK(test_message->SerializeToString( - response->mutable_protobuf_payload())); + ABSL_CHECK( + test_message->SerializeToString(response.mutable_protobuf_payload())); break; } case conformance::JSON: { - string proto_binary; - GOOGLE_CHECK(test_message->SerializeToString(&proto_binary)); - Status status = BinaryToJsonString(type_resolver, *type_url, proto_binary, - response->mutable_json_payload()); + std::string proto_binary; + ABSL_CHECK(test_message->SerializeToString(&proto_binary)); + absl::Status status = + BinaryToJsonString(resolver_.get(), type_url_, proto_binary, + response.mutable_json_payload()); if (!status.ok()) { - response->set_serialize_error( - string("Failed to serialize JSON output: ") + - std::string(status.error_message())); - return; + response.set_serialize_error(absl::StrCat( + "failed to serialize JSON output: ", status.message())); } break; } @@ -193,71 +186,71 @@ void DoTest(const ConformanceRequest& request, ConformanceResponse* response) { case conformance::TEXT_FORMAT: { TextFormat::Printer printer; printer.SetHideUnknownFields(!request.print_unknown_fields()); - GOOGLE_CHECK(printer.PrintToString(*test_message, - response->mutable_text_payload())); + ABSL_CHECK(printer.PrintToString(*test_message, + response.mutable_text_payload())); break; } default: - GOOGLE_LOG(FATAL) << "Unknown output format: " - << request.requested_output_format(); + return absl::InvalidArgumentError(absl::StrCat( + "unknown output format", request.requested_output_format())); } -} -bool DoTestIo() { - string serialized_input; - string serialized_output; - ConformanceRequest request; - ConformanceResponse response; - uint32_t bytes; + return response; +} - if (!CheckedRead(STDIN_FILENO, &bytes, sizeof(uint32_t))) { - // EOF. - return false; +absl::StatusOr Harness::ServeConformanceRequest() { + uint32_t in_len; + if (!ReadFd(STDIN_FILENO, reinterpret_cast(&in_len), sizeof(in_len)) + .ok()) { + // EOF means we're done. + return true; } + in_len = internal::little_endian::ToHost(in_len); - serialized_input.resize(bytes); + std::string serialized_input; + serialized_input.resize(in_len); + RETURN_IF_ERROR(ReadFd(STDIN_FILENO, &serialized_input[0], in_len)); - if (!CheckedRead(STDIN_FILENO, (char*)serialized_input.c_str(), bytes)) { - GOOGLE_LOG(ERROR) << "Unexpected EOF on stdin. " << strerror(errno); - } + ConformanceRequest request; + ABSL_CHECK(request.ParseFromString(serialized_input)); - if (!request.ParseFromString(serialized_input)) { - GOOGLE_LOG(FATAL) << "Parse of ConformanceRequest proto failed."; - return false; - } + absl::StatusOr response = RunTest(request); + RETURN_IF_ERROR(response.status()); - DoTest(request, &response); + std::string serialized_output; + response->SerializeToString(&serialized_output); - response.SerializeToString(&serialized_output); + uint32_t out_len = internal::little_endian::FromHost( + static_cast(serialized_output.size())); - bytes = serialized_output.size(); - CheckedWrite(STDOUT_FILENO, &bytes, sizeof(uint32_t)); - CheckedWrite(STDOUT_FILENO, serialized_output.c_str(), bytes); + RETURN_IF_ERROR(WriteFd(STDOUT_FILENO, &out_len, sizeof(out_len))); + RETURN_IF_ERROR(WriteFd(STDOUT_FILENO, serialized_output.data(), + serialized_output.size())); - if (verbose) { - fprintf(stderr, "conformance-cpp: request=%s, response=%s\n", - request.ShortDebugString().c_str(), - response.ShortDebugString().c_str()); + if (verbose_) { + ABSL_LOG(INFO) << "conformance-cpp: request=" << request.ShortDebugString() + << ", response=" << response->ShortDebugString(); } - - test_count++; - - return true; + return false; } - +} // namespace } // namespace protobuf } // namespace google int main() { - type_resolver = NewTypeResolverForDescriptorPool( - kTypeUrlPrefix, DescriptorPool::generated_pool()); - type_url = new string(GetTypeUrl(TestAllTypesProto3::descriptor())); - while (1) { - if (!google::protobuf::DoTestIo()) { - fprintf(stderr, "conformance-cpp: received EOF from test runner " - "after %d tests, exiting\n", test_count); - return 0; + google::protobuf::Harness harness; + int total_runs = 0; + while (true) { + auto is_done = harness.ServeConformanceRequest(); + if (!is_done.ok()) { + ABSL_LOG(FATAL) << is_done.status(); + } + if (*is_done) { + break; } + total_runs++; } + ABSL_LOG(INFO) << "conformance-cpp: received EOF from test runner after " + << total_runs << " tests"; } diff --git a/conformance/conformance_dart.dart b/conformance/conformance_dart.dart new file mode 100644 index 0000000..8491fa0 --- /dev/null +++ b/conformance/conformance_dart.dart @@ -0,0 +1,106 @@ +import 'dart:io'; + +import 'package:pb_runtime/ffi/bytes.dart'; +import 'package:pb_runtime/pb_runtime.dart' as pb; +import 'package:third_party.protobuf/test_messages_proto2.upb.dart'; +import 'package:third_party.protobuf/test_messages_proto3.upb.dart'; +import 'package:third_party.protobuf.conformance/conformance.upb.dart'; + +List? readFromStdin(int numBytes) { + final bytesOut = []; + for (var i = 0; i < numBytes; i++) { + final byte = stdin.readByteSync(); + if (byte == -1) return null; + bytesOut.add(byte); + } + return bytesOut; +} + +int readLittleEndianIntFromStdin() { + final buf = readFromStdin(4); + if (buf == null) return -1; + return (buf[0] & 0xff) | + ((buf[1] & 0xff) << 8) | + ((buf[2] & 0xff) << 16) | + ((buf[3] & 0xff) << 24); +} + +void writeLittleEndianIntToStdout(int value) { + final buf = []; + buf.add(value & 0xff); + buf.add((value >> 8) & 0xff); + buf.add((value >> 16) & 0xff); + buf.add((value >> 24) & 0xff); + stdout.add(buf); +} + +ConformanceResponse doTest(ConformanceRequest request) { + final response = ConformanceResponse(); + pb.GeneratedMessage? testMessage; + final messageType = request.messageType; + final isProto3 = + messageType == 'protobuf_test_messages.proto3.TestAllTypesProto3'; + + if (!isProto3 && + messageType != 'protobuf_test_messages.proto2.TestAllTypesProto2') { + throw ArgumentError('Invalid message type $messageType'); + } + + switch (request.whichPayload) { + case ConformanceRequest_payload.protobufPayload: + try { + testMessage = isProto3 + ? TestAllTypesProto3.fromBinary(request.protobufPayload.data) + : TestAllTypesProto2.fromBinary(request.protobufPayload.data); + } catch (e) { + final parseErrorResponse = ConformanceResponse(); + parseErrorResponse.parseError = '$e'; + return parseErrorResponse; + } + break; + default: + response.skipped = 'Only protobuf payload input is supported'; + return response; + } + + switch (request.requestedOutputFormat) { + case WireFormat.PROTOBUF: + try { + response.protobufPayload = + Bytes(pb.GeneratedMessage.toBinary(testMessage)); + } catch (e) { + response.serializeError = '$e'; + } + break; + default: + response.skipped = 'Only protobuf payload output is supported'; + } + + return response; +} + +Future doTestIo() async { + final msgLength = readLittleEndianIntFromStdin(); + if (msgLength == -1) return false; // EOF + final serializedMsg = readFromStdin(msgLength); + if (serializedMsg == null) { + throw 'Unexpected EOF from test program.'; + } + final request = ConformanceRequest.fromBinary(serializedMsg); + final response = doTest(request); + final serializedOutput = pb.GeneratedMessage.toBinary(response); + writeLittleEndianIntToStdout(serializedOutput.length); + stdout.add(serializedOutput); + await stdout.flush(); + return true; +} + +void main() async { + await pb.initGlobalInstance(); + var testCount = 0; + while (await doTestIo()) { + testCount++; + } + stderr.writeln( + 'ConformanceDart: received EOF from test runner after $testCount tests'); +} diff --git a/conformance/conformance_nodejs.js b/conformance/conformance_nodejs.js deleted file mode 100755 index 4d96a38..0000000 --- a/conformance/conformance_nodejs.js +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env node - -/* - * Protocol Buffers - Google's data interchange format - * Copyright 2008 Google Inc. 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 Inc. 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. - */ - -var conformance = require('conformance_pb'); -var test_messages_proto3 = require('google/protobuf/test_messages_proto3_pb'); -var test_messages_proto2 = require('google/protobuf/test_messages_proto2_pb'); -var fs = require('fs'); - -var testCount = 0; - -function doTest(request) { - var testMessage; - var response = new conformance.ConformanceResponse(); - - try { - if (request.getRequestedOutputFormat() === conformance.WireFormat.JSON) { - response.setSkipped("JSON not supported."); - return response; - } - - switch (request.getPayloadCase()) { - case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD: { - if (request.getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") { - try { - testMessage = test_messages_proto3.TestAllTypesProto3.deserializeBinary( - request.getProtobufPayload()); - } catch (err) { - response.setParseError(err.toString()); - return response; - } - } else if (request.getMessageType() == "protobuf_test_messages.proto2.TestAllTypesProto2"){ - try { - testMessage = test_messages_proto2.TestAllTypesProto2.deserializeBinary( - request.getProtobufPayload()); - } catch (err) { - response.setParseError(err.toString()); - return response; - } - } else { - throw "Protobuf request doesn\'t have specific payload type"; - } - } - - case conformance.ConformanceRequest.PayloadCase.JSON_PAYLOAD: - response.setSkipped("JSON not supported."); - return response; - - case conformance.ConformanceRequest.PayloadCase.TEXT_PAYLOAD: - response.setSkipped("Text format not supported."); - return response; - - case conformance.ConformanceRequest.PayloadCase.PAYLOAD_NOT_SET: - response.setRuntimeError("Request didn't have payload"); - return response; - } - - switch (request.getRequestedOutputFormat()) { - case conformance.WireFormat.UNSPECIFIED: - response.setRuntimeError("Unspecified output format"); - return response; - - case conformance.WireFormat.PROTOBUF: - response.setProtobufPayload(testMessage.serializeBinary()); - - case conformance.WireFormat.JSON: - response.setSkipped("JSON not supported."); - return response; - - default: - throw "Request didn't have requested output format"; - } - } catch (err) { - response.setRuntimeError(err.toString()); - } - - return response; -} - -function onEof(totalRead) { - if (totalRead == 0) { - return undefined; - } else { - throw "conformance_nodejs: premature EOF on stdin."; - } -} - -// Utility function to read a buffer of N bytes. -function readBuffer(bytes) { - var buf = new Buffer(bytes); - var totalRead = 0; - while (totalRead < bytes) { - var read = 0; - try { - read = fs.readSync(process.stdin.fd, buf, totalRead, bytes - totalRead); - } catch (e) { - if (e.code == 'EOF') { - return onEof(totalRead) - } else if (e.code == 'EAGAIN') { - } else { - throw "conformance_nodejs: Error reading from stdin." + e; - } - } - - totalRead += read; - } - - return buf; -} - -function writeBuffer(buffer) { - var totalWritten = 0; - while (totalWritten < buffer.length) { - totalWritten += fs.writeSync( - process.stdout.fd, buffer, totalWritten, buffer.length - totalWritten); - } -} - -// Returns true if the test ran successfully, false on legitimate EOF. -// If EOF is encountered in an unexpected place, raises IOError. -function doTestIo() { - var lengthBuf = readBuffer(4); - if (!lengthBuf) { - return false; - } - - var length = lengthBuf.readInt32LE(0); - var serializedRequest = readBuffer(length); - if (!serializedRequest) { - throw "conformance_nodejs: Failed to read request."; - } - - serializedRequest = new Uint8Array(serializedRequest); - var request = - conformance.ConformanceRequest.deserializeBinary(serializedRequest); - var response = doTest(request); - - var serializedResponse = response.serializeBinary(); - - lengthBuf = new Buffer(4); - lengthBuf.writeInt32LE(serializedResponse.length, 0); - writeBuffer(lengthBuf); - writeBuffer(new Buffer(serializedResponse)); - - testCount += 1 - - return true; -} - -while (true) { - if (!doTestIo()) { - console.error('conformance_nodejs: received EOF from test runner ' + - "after " + testCount + " tests, exiting") - break; - } -} diff --git a/conformance/conformance_objc.m b/conformance/conformance_objc.m index ab751c8..5060ce9 100644 --- a/conformance/conformance_objc.m +++ b/conformance/conformance_objc.m @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2015 Google Inc. 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 Inc. 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. +// 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 #import @@ -56,8 +33,7 @@ static NSData *CheckedReadDataOfLength(NSFileHandle *handle, NSUInteger numBytes return nil; // EOF. } if (dataLen != numBytes) { - Die(@"Failed to read the request length (%d), only got: %@", - numBytes, data); + Die(@"Failed to read the request length (%d), only got: %@", numBytes, data); } return data; } @@ -76,8 +52,9 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { Class msgClass = nil; if ([request.messageType isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) { msgClass = [Proto3TestAllTypesProto3 class]; - } else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) { - msgClass = [TestAllTypesProto2 class]; + } else if ([request.messageType + isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) { + msgClass = [Proto2TestAllTypesProto2 class]; } else { response.runtimeError = [NSString stringWithFormat:@"Protobuf request had an unknown message_type: %@", @@ -87,8 +64,7 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { NSError *error = nil; testMessage = [msgClass parseFromData:request.protobufPayload error:&error]; if (!testMessage) { - response.parseError = - [NSString stringWithFormat:@"Parse error: %@", error]; + response.parseError = [NSString stringWithFormat:@"Parse error: %@", error]; } break; } @@ -98,9 +74,8 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { break; case ConformanceRequest_Payload_OneOfCase_JspbPayload: - response.skipped = - @"ConformanceRequest had a jspb_payload ConformanceRequest.payload;" - " those aren't supposed to happen with opensource."; + response.skipped = @"ConformanceRequest had a jspb_payload ConformanceRequest.payload;" + " those aren't supposed to happen with opensource."; break; case ConformanceRequest_Payload_OneOfCase_TextPayload: @@ -110,31 +85,31 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) { if (testMessage) { switch (request.requestedOutputFormat) { - case WireFormat_GPBUnrecognizedEnumeratorValue: - case WireFormat_Unspecified: + case ConformanceWireFormat_GPBUnrecognizedEnumeratorValue: + case ConformanceWireFormat_Unspecified: response.runtimeError = [NSString stringWithFormat:@"Unrecognized/unspecified output format: %@", request]; break; - case WireFormat_Protobuf: + case ConformanceWireFormat_Protobuf: response.protobufPayload = testMessage.data; if (!response.protobufPayload) { response.serializeError = - [NSString stringWithFormat:@"Failed to make data from: %@", testMessage]; + [NSString stringWithFormat:@"Failed to make data from: %@", testMessage]; } break; - case WireFormat_Json: + case ConformanceWireFormat_Json: response.skipped = @"ObjC doesn't support generating JSON"; break; - case WireFormat_Jspb: + case ConformanceWireFormat_Jspb: response.skipped = @"ConformanceRequest had a requested_output_format of JSPB WireFormat; that" - " isn't supposed to happen with opensource."; + " isn't supposed to happen with opensource."; break; - case WireFormat_TextFormat: + case ConformanceWireFormat_TextFormat: // ObjC only has partial objc generation, so don't attempt any tests that need // support. response.skipped = @"ObjC doesn't support generating TextFormat"; @@ -173,8 +148,7 @@ static BOOL DoTestIo(NSFileHandle *input, NSFileHandle *output) { } NSError *error = nil; - ConformanceRequest *request = [ConformanceRequest parseFromData:data - error:&error]; + ConformanceRequest *request = [ConformanceRequest parseFromData:data error:&error]; if (!request) { Die(@"Failed to parse the message data: %@", error); } diff --git a/conformance/conformance_php.php b/conformance/conformance_php.php index 9eef0c5..f250ebf 100644 --- a/conformance/conformance_php.php +++ b/conformance/conformance_php.php @@ -14,7 +14,7 @@ require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedMessage.php require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedEnum.php"); require_once("GPBMetadata/Conformance.php"); -require_once("GPBMetadata/Google/Protobuf/TestMessagesProto3.php"); +require_once("GPBMetadata/TestMessagesProto3.php"); use \Conformance\TestCategory; use \Conformance\WireFormat; @@ -113,7 +113,7 @@ function doTestIO() while(true){ if (!doTestIO()) { fprintf(STDERR, - "conformance_php: received EOF from test runner " + + "conformance_php: received EOF from test runner " . "after %d tests, exiting\n", $test_count); exit; } diff --git a/conformance/conformance_python.py b/conformance/conformance_python.py index 37ee36e..5e2a99a 100755 --- a/conformance/conformance_python.py +++ b/conformance/conformance_python.py @@ -1,33 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. 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 Inc. 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. +# 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 """A conformance test implementation for the Python protobuf library. @@ -36,30 +13,28 @@ See conformance.proto for more information. import struct import sys -import os from google.protobuf import json_format from google.protobuf import message -from google.protobuf import test_messages_proto3_pb2 -from google.protobuf import test_messages_proto2_pb2 from google.protobuf import text_format -import conformance_pb2 - -sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0) -sys.stdin = os.fdopen(sys.stdin.fileno(), 'rb', 0) +from google.protobuf import test_messages_proto2_pb2 +from google.protobuf import test_messages_proto3_pb2 +from conformance import conformance_pb2 test_count = 0 verbose = False + class ProtocolError(Exception): pass + def do_test(request): response = conformance_pb2.ConformanceResponse() if request.message_type == "conformance.FailureSet": failure_set = conformance_pb2.FailureSet() failures = [] - # TODO(gerbens): Remove, this is a hack to detect if the old vs new + # TODO: Remove, this is a hack to detect if the old vs new # parser is used by the cpp code. Relying on a bug in the old parser. hack_proto = test_messages_proto2_pb2.TestAllTypesProto2() old_parser = True @@ -171,18 +146,16 @@ def do_test(request): return response + def do_test_io(): - length_bytes = sys.stdin.read(4) + length_bytes = sys.stdin.buffer.read(4) if len(length_bytes) == 0: return False # EOF elif len(length_bytes) != 4: raise IOError("I/O error") - # "I" is "unsigned int", so this depends on running on a platform with - # 32-bit "unsigned int" type. The Python struct module unfortunately - # has no format specifier for uint32_t. length = struct.unpack(" err - response.parse_error = err.message.encode('utf-8') - return response - end - elsif request.message_type.eql?('protobuf_test_messages.proto2.TestAllTypesProto2') - response.skipped = "Ruby doesn't support proto2" + begin + test_message = descriptor.msgclass.decode(request.protobuf_payload) + rescue Google::Protobuf::ParseError => err + response.parse_error = err.message.encode('utf-8') return response - else - fail "Protobuf request doesn't have specific payload type" end when :json_payload begin - test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.decode_json( - request.json_payload) + options = {} + if request.test_category == :JSON_IGNORE_UNKNOWN_PARSING_TEST + options[:ignore_unknown_fields] = true + end + test_message = descriptor.msgclass.decode_json(request.json_payload, options) rescue Google::Protobuf::ParseError => err response.parse_error = err.message.encode('utf-8') return response end - - when :text_payload - begin - response.skipped = "Ruby doesn't support proto2" - return response - end + + when :text_payload + begin + response.skipped = "Ruby doesn't support text format" + return response + end when nil fail "Request didn't have payload" @@ -82,10 +60,18 @@ def do_test(request) fail 'Unspecified output format' when :PROTOBUF - response.protobuf_payload = test_message.to_proto + begin + response.protobuf_payload = test_message.to_proto + rescue Google::Protobuf::ParseError => err + response.serialize_error = err.message.encode('utf-8') + end when :JSON - response.json_payload = test_message.to_json + begin + response.json_payload = test_message.to_json + rescue Google::Protobuf::ParseError => err + response.serialize_error = err.message.encode('utf-8') + end when nil fail "Request didn't have requested output format" diff --git a/conformance/conformance_rust.rs b/conformance/conformance_rust.rs new file mode 100644 index 0000000..db7df6a --- /dev/null +++ b/conformance/conformance_rust.rs @@ -0,0 +1,104 @@ +// Copyright 2023 Google LLC. 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 + +use conformance_proto::conformance::{ConformanceRequest, ConformanceResponse}; + +#[cfg(cpp_kernel)] +use protobuf_cpp as kernel; + +#[cfg(upb_kernel)] +use protobuf_upb as kernel; + +use kernel::Optional::{Set, Unset}; + +use std::io::{self, ErrorKind, Read, Write}; +use test_messages_proto2::protobuf_test_messages::proto2::TestAllTypesProto2; + +/// Returns Some(i32) if a binary read can succeed from stdin. +/// Returns None if we have reached an EOF. +/// Panics for any other error reading. +fn read_little_endian_i32_from_stdin() -> Option { + let mut buffer = [0_u8; 4]; + if let Err(e) = io::stdin().read_exact(&mut buffer) { + match e.kind() { + ErrorKind::UnexpectedEof => None, + _ => panic!("failed to read i32 from stdin"), + } + } else { + Some(i32::from_le_bytes(buffer)) + } +} + +/// Returns Some of a conformance request read from stdin. +/// Returns None if we have hit an EOF that suggests the test suite is complete. +/// Panics in any other case (e.g. an EOF in a place that would imply a +/// programmer error in the conformance test suite). +fn read_request_from_stdin() -> Option { + let msg_len = read_little_endian_i32_from_stdin()?; + let mut serialized = vec![0_u8; msg_len as usize]; + io::stdin().read_exact(&mut serialized).unwrap(); + let mut req = ConformanceRequest::new(); + req.deserialize(&serialized).unwrap(); + Some(req) +} + +fn write_response_to_stdout(resp: &ConformanceResponse) { + let bytes = resp.serialize(); + let len = bytes.len() as u32; + let mut handle = io::stdout(); + handle.write_all(&len.to_le_bytes()).unwrap(); + handle.write(&bytes).unwrap(); + handle.flush().unwrap(); +} + +fn do_test(req: &ConformanceRequest) -> ConformanceResponse { + let mut resp = ConformanceResponse::new(); + let message_type = req.message_type(); + let is_proto2 = match message_type.as_bytes() { + b"protobuf_test_messages.proto2.TestAllTypesProto2" => true, + b"protobuf_test_messages.proto3.TestAllTypesProto3" => false, + _ => panic!("unexpected msg type {message_type}"), + }; + + // Enums aren't supported yet (and not in scope for v0.6) so we can't perform + // this check yet. + + // if req.requested_output_format() != WireFormat.PROTOBUF { + // resp.skipped_mut().set("only wire format output implemented") + // } + + let bytes = match req.protobuf_payload_opt() { + Unset(_) => { + resp.skipped_mut().set("only wire format input implemented"); + return resp; + } + Set(bytes) => bytes, + }; + + if is_proto2 { + let mut proto = TestAllTypesProto2::new(); + if let Err(_) = proto.deserialize(bytes) { + resp.parse_error_mut().set("failed to parse bytes"); + return resp; + } + let serialized = proto.serialize(); // Note: serialize() is infallible in Rust api. + resp.protobuf_payload_mut().set(serialized.as_ref()); + return resp; + } else { + resp.skipped_mut().set("only proto2 supported"); + return resp; + } +} + +fn main() { + let mut total_runs = 0; + while let Some(req) = read_request_from_stdin() { + let resp = do_test(&req); + write_response_to_stdout(&resp); + total_runs += 1; + } + eprintln!("conformance_rust: received EOF from test runner after {total_runs} tests"); +} diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index 07b4150..88cfdc2 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -1,48 +1,29 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #include "conformance_test.h" #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include "conformance.pb.h" +#include "google/protobuf/util/field_comparator.h" +#include "google/protobuf/util/json_util.h" +#include "google/protobuf/util/message_differencer.h" +#include "absl/log/absl_log.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "conformance/conformance.pb.h" +#include "conformance/conformance.pb.h" +#include "google/protobuf/descriptor_legacy.h" +#include "google/protobuf/message.h" +#include "google/protobuf/text_format.h" using conformance::ConformanceRequest; using conformance::ConformanceResponse; @@ -69,17 +50,52 @@ static string ToOctString(const string& binary_string) { return oct_string; } +template +bool CheckSetEmpty(const SetT& set_to_check, absl::string_view write_to_file, + absl::string_view msg, absl::string_view output_dir, + std::string* output) { + if (set_to_check.empty()) return true; + + absl::StrAppendFormat(output, "\n"); + absl::StrAppendFormat(output, "%s\n\n", msg); + for (absl::string_view v : set_to_check) { + absl::StrAppendFormat(output, " %s\n", v); + } + absl::StrAppendFormat(output, "\n"); + + if (!write_to_file.empty()) { + std::string full_filename; + absl::string_view filename = write_to_file; + if (!output_dir.empty()) { + full_filename = std::string(output_dir); + if (*output_dir.rbegin() != '/') { + full_filename.push_back('/'); + } + absl::StrAppend(&full_filename, write_to_file); + filename = full_filename; + } + std::ofstream os{std::string(filename)}; + if (os) { + for (absl::string_view v : set_to_check) { + os << v << "\n"; + } + } else { + absl::StrAppendFormat(output, "Failed to open file: %s\n", filename); + } + } + + return false; +} + } // namespace namespace google { namespace protobuf { ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting( - ConformanceLevel level, - conformance::WireFormat input_format, + ConformanceLevel level, conformance::WireFormat input_format, conformance::WireFormat output_format, - conformance::TestCategory test_category, - const Message& prototype_message, + conformance::TestCategory test_category, const Message& prototype_message, const string& test_name, const string& input) : level_(level), input_format_(input_format), @@ -109,7 +125,7 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting( } default: - GOOGLE_LOG(FATAL) << "Unspecified input format"; + ABSL_LOG(FATAL) << "Unspecified input format"; } request_.set_test_category(test_category); @@ -123,30 +139,40 @@ ConformanceTestSuite::ConformanceRequestSetting::NewTestMessage() const { return std::unique_ptr(prototype_message_for_compare_->New()); } -string ConformanceTestSuite::ConformanceRequestSetting:: - GetTestName() const { - string rname = - prototype_message_.GetDescriptor()->file()->syntax() == - FileDescriptor::SYNTAX_PROTO3 ? "Proto3" : "Proto2"; +string ConformanceTestSuite::ConformanceRequestSetting::GetTestName() const { + string rname; + switch (FileDescriptorLegacy(prototype_message_.GetDescriptor()->file()) + .syntax()) { + case FileDescriptorLegacy::Syntax::SYNTAX_PROTO3: + rname = ".Proto3."; + break; + case FileDescriptorLegacy::Syntax::SYNTAX_PROTO2: + rname = ".Proto2."; + break; + default: + break; + } - return StrCat(ConformanceLevelToString(level_), ".", rname, ".", + return absl::StrCat(ConformanceLevelToString(level_), rname, InputFormatString(input_format_), ".", test_name_, ".", OutputFormatString(output_format_)); } -string ConformanceTestSuite::ConformanceRequestSetting:: - ConformanceLevelToString( - ConformanceLevel level) const { +string +ConformanceTestSuite::ConformanceRequestSetting::ConformanceLevelToString( + ConformanceLevel level) const { switch (level) { - case REQUIRED: return "Required"; - case RECOMMENDED: return "Recommended"; + case REQUIRED: + return "Required"; + case RECOMMENDED: + return "Recommended"; } - GOOGLE_LOG(FATAL) << "Unknown value: " << level; + ABSL_LOG(FATAL) << "Unknown value: " << level; return ""; } -string ConformanceTestSuite::ConformanceRequestSetting:: - InputFormatString(conformance::WireFormat format) const { +string ConformanceTestSuite::ConformanceRequestSetting::InputFormatString( + conformance::WireFormat format) const { switch (format) { case conformance::PROTOBUF: return "ProtobufInput"; @@ -155,13 +181,13 @@ string ConformanceTestSuite::ConformanceRequestSetting:: case conformance::TEXT_FORMAT: return "TextFormatInput"; default: - GOOGLE_LOG(FATAL) << "Unspecified output format"; + ABSL_LOG(FATAL) << "Unspecified output format"; } return ""; } -string ConformanceTestSuite::ConformanceRequestSetting:: - OutputFormatString(conformance::WireFormat format) const { +string ConformanceTestSuite::ConformanceRequestSetting::OutputFormatString( + conformance::WireFormat format) const { switch (format) { case conformance::PROTOBUF: return "ProtobufOutput"; @@ -170,17 +196,71 @@ string ConformanceTestSuite::ConformanceRequestSetting:: case conformance::TEXT_FORMAT: return "TextFormatOutput"; default: - GOOGLE_LOG(FATAL) << "Unspecified output format"; + ABSL_LOG(FATAL) << "Unspecified output format"; } return ""; } +void ConformanceTestSuite::TruncateDebugPayload(string* payload) { + if (payload != nullptr && payload->size() > 200) { + payload->resize(200); + payload->append("...(truncated)"); + } +} + +const ConformanceRequest ConformanceTestSuite::TruncateRequest( + const ConformanceRequest& request) { + ConformanceRequest debug_request(request); + switch (debug_request.payload_case()) { + case ConformanceRequest::kProtobufPayload: + TruncateDebugPayload(debug_request.mutable_protobuf_payload()); + break; + case ConformanceRequest::kJsonPayload: + TruncateDebugPayload(debug_request.mutable_json_payload()); + break; + case ConformanceRequest::kTextPayload: + TruncateDebugPayload(debug_request.mutable_text_payload()); + break; + case ConformanceRequest::kJspbPayload: + TruncateDebugPayload(debug_request.mutable_jspb_payload()); + break; + default: + // Do nothing. + break; + } + return debug_request; +} + +const ConformanceResponse ConformanceTestSuite::TruncateResponse( + const ConformanceResponse& response) { + ConformanceResponse debug_response(response); + switch (debug_response.result_case()) { + case ConformanceResponse::kProtobufPayload: + TruncateDebugPayload(debug_response.mutable_protobuf_payload()); + break; + case ConformanceResponse::kJsonPayload: + TruncateDebugPayload(debug_response.mutable_json_payload()); + break; + case ConformanceResponse::kTextPayload: + TruncateDebugPayload(debug_response.mutable_text_payload()); + break; + case ConformanceResponse::kJspbPayload: + TruncateDebugPayload(debug_response.mutable_jspb_payload()); + break; + default: + // Do nothing. + break; + } + return debug_response; +} + void ConformanceTestSuite::ReportSuccess(const string& test_name) { if (expected_to_fail_.erase(test_name) != 0) { - StringAppendF(&output_, - "ERROR: test %s is in the failure list, but test succeeded. " - "Remove it from the failure list.\n", - test_name.c_str()); + absl::StrAppendFormat( + &output_, + "ERROR: test %s is in the failure list, but test succeeded. " + "Remove it from the failure list.\n", + test_name); unexpected_succeeding_tests_.insert(test_name); } successes_++; @@ -190,33 +270,29 @@ void ConformanceTestSuite::ReportFailure(const string& test_name, ConformanceLevel level, const ConformanceRequest& request, const ConformanceResponse& response, - const char* fmt, ...) { + absl::string_view message) { if (expected_to_fail_.erase(test_name) == 1) { expected_failures_++; - if (!verbose_) - return; + if (!verbose_) return; } else if (level == RECOMMENDED && !enforce_recommended_) { - StringAppendF(&output_, "WARNING, test=%s: ", test_name.c_str()); + absl::StrAppendFormat(&output_, "WARNING, test=%s: ", test_name); } else { - StringAppendF(&output_, "ERROR, test=%s: ", test_name.c_str()); + absl::StrAppendFormat(&output_, "ERROR, test=%s: ", test_name); unexpected_failing_tests_.insert(test_name); } - va_list args; - va_start(args, fmt); - StringAppendV(&output_, fmt, args); - va_end(args); - StringAppendF(&output_, " request=%s, response=%s\n", - request.ShortDebugString().c_str(), - response.ShortDebugString().c_str()); + + absl::StrAppendFormat(&output_, "%s, request=%s, response=%s\n", message, + TruncateRequest(request).ShortDebugString(), + TruncateResponse(response).ShortDebugString()); } void ConformanceTestSuite::ReportSkip(const string& test_name, const ConformanceRequest& request, const ConformanceResponse& response) { if (verbose_) { - StringAppendF(&output_, "SKIPPED, test=%s request=%s, response=%s\n", - test_name.c_str(), request.ShortDebugString().c_str(), - response.ShortDebugString().c_str()); + absl::StrAppendFormat( + &output_, "SKIPPED, test=%s request=%s, response=%s\n", test_name, + request.ShortDebugString(), response.ShortDebugString()); } skipped_.insert(test_name); } @@ -225,8 +301,8 @@ void ConformanceTestSuite::RunValidInputTest( const ConformanceRequestSetting& setting, const string& equivalent_text_format) { std::unique_ptr reference_message(setting.NewTestMessage()); - GOOGLE_CHECK(TextFormat::ParseFromString(equivalent_text_format, - reference_message.get())) + ABSL_CHECK(TextFormat::ParseFromString(equivalent_text_format, + reference_message.get())) << "Failed to parse data for test case: " << setting.GetTestName() << ", data: " << equivalent_text_format; const string equivalent_wire_format = reference_message->SerializeAsString(); @@ -253,7 +329,7 @@ void ConformanceTestSuite::VerifyResponse( ConformanceLevel level = setting.GetLevel(); std::unique_ptr reference_message = setting.NewTestMessage(); - GOOGLE_CHECK(reference_message->ParseFromString(equivalent_wire_format)) + ABSL_CHECK(reference_message->ParseFromString(equivalent_wire_format)) << "Failed to parse wire data for test case: " << test_name; switch (response.result_case()) { @@ -263,6 +339,7 @@ void ConformanceTestSuite::VerifyResponse( return; case ConformanceResponse::kParseError: + case ConformanceResponse::kTimeoutError: case ConformanceResponse::kRuntimeError: case ConformanceResponse::kSerializeError: ReportFailure(test_name, level, request, response, @@ -287,10 +364,11 @@ void ConformanceTestSuite::VerifyResponse( bool check = false; if (require_same_wire_format) { - GOOGLE_DCHECK_EQ(response.result_case(), ConformanceResponse::kProtobufPayload); + ABSL_DCHECK_EQ(response.result_case(), + ConformanceResponse::kProtobufPayload); const string& protobuf_payload = response.protobuf_payload(); check = equivalent_wire_format == protobuf_payload; - differences = StrCat("Expect: ", ToOctString(equivalent_wire_format), + differences = absl::StrCat("Expect: ", ToOctString(equivalent_wire_format), ", but got: ", ToOctString(protobuf_payload)); } else { check = differencer.Compare(*reference_message, *test_message); @@ -301,9 +379,10 @@ void ConformanceTestSuite::VerifyResponse( ReportSuccess(test_name); } } else { - ReportFailure(test_name, level, request, response, - "Output was not equivalent to reference message: %s.", - differences.c_str()); + ReportFailure( + test_name, level, request, response, + absl::StrCat("Output was not equivalent to reference message: ", + differences)); } } @@ -311,7 +390,7 @@ void ConformanceTestSuite::RunTest(const string& test_name, const ConformanceRequest& request, ConformanceResponse* response) { if (test_names_.insert(test_name).second == false) { - GOOGLE_LOG(FATAL) << "Duplicated test name: " << test_name; + ABSL_LOG(FATAL) << "Duplicated test name: " << test_name; } string serialized_request; @@ -326,48 +405,14 @@ void ConformanceTestSuite::RunTest(const string& test_name, } if (verbose_) { - StringAppendF(&output_, - "conformance test: name=%s, request=%s, response=%s\n", - test_name.c_str(), - request.ShortDebugString().c_str(), - response->ShortDebugString().c_str()); - } -} - -bool ConformanceTestSuite::CheckSetEmpty( - const std::set& set_to_check, - const std::string& write_to_file, - const std::string& msg) { - if (set_to_check.empty()) { - return true; - } else { - StringAppendF(&output_, "\n"); - StringAppendF(&output_, "%s\n\n", msg.c_str()); - for (std::set::const_iterator iter = set_to_check.begin(); - iter != set_to_check.end(); ++iter) { - StringAppendF(&output_, " %s\n", iter->c_str()); - } - StringAppendF(&output_, "\n"); - - if (!write_to_file.empty()) { - std::ofstream os(write_to_file); - if (os) { - for (std::set::const_iterator iter = set_to_check.begin(); - iter != set_to_check.end(); ++iter) { - os << *iter << "\n"; - } - } else { - StringAppendF(&output_, "Failed to open file: %s\n", - write_to_file.c_str()); - } - } - - return false; + absl::StrAppendFormat( + &output_, "conformance test: name=%s, request=%s, response=%s\n", + test_name, TruncateRequest(request).ShortDebugString(), + TruncateResponse(*response).ShortDebugString()); } } -string ConformanceTestSuite::WireFormatToString( - WireFormat wire_format) { +string ConformanceTestSuite::WireFormatToString(WireFormat wire_format) { switch (wire_format) { case conformance::PROTOBUF: return "PROTOBUF"; @@ -380,7 +425,7 @@ string ConformanceTestSuite::WireFormatToString( case conformance::UNSPECIFIED: return "UNSPECIFIED"; default: - GOOGLE_LOG(FATAL) << "unknown wire type: " << wire_format; + ABSL_LOG(FATAL) << "unknown wire type: " << wire_format; } return ""; } @@ -410,44 +455,53 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, RunSuiteImpl(); bool ok = true; - if (!CheckSetEmpty(expected_to_fail_, "nonexistent_tests.txt", - "These tests were listed in the failure list, but they " - "don't exist. Remove them from the failure list by " - "running:\n" - " ./update_failure_list.py " + failure_list_filename_ + - " --remove nonexistent_tests.txt")) { + if (!CheckSetEmpty( + expected_to_fail_, "nonexistent_tests.txt", + absl::StrCat("These tests were listed in the failure list, but they " + "don't exist. Remove them from the failure list by " + "running:\n" + " ./update_failure_list.py ", + failure_list_filename_, + " --remove nonexistent_tests.txt"), + output_dir_, &output_)) { ok = false; } - if (!CheckSetEmpty(unexpected_failing_tests_, "failing_tests.txt", - "These tests failed. If they can't be fixed right now, " - "you can add them to the failure list so the overall " - "suite can succeed. Add them to the failure list by " - "running:\n" - " ./update_failure_list.py " + failure_list_filename_ + - " --add failing_tests.txt")) { + if (!CheckSetEmpty( + unexpected_failing_tests_, "failing_tests.txt", + absl::StrCat("These tests failed. If they can't be fixed right now, " + "you can add them to the failure list so the overall " + "suite can succeed. Add them to the failure list by " + "running:\n" + " ./update_failure_list.py ", + failure_list_filename_, " --add failing_tests.txt"), + output_dir_, &output_)) { ok = false; } - if (!CheckSetEmpty(unexpected_succeeding_tests_, "succeeding_tests.txt", - "These tests succeeded, even though they were listed in " - "the failure list. Remove them from the failure list " - "by running:\n" - " ./update_failure_list.py " + failure_list_filename_ + - " --remove succeeding_tests.txt")) { + if (!CheckSetEmpty( + unexpected_succeeding_tests_, "succeeding_tests.txt", + absl::StrCat("These tests succeeded, even though they were listed in " + "the failure list. Remove them from the failure list " + "by running:\n" + " ./update_failure_list.py ", + failure_list_filename_, + " --remove succeeding_tests.txt"), + output_dir_, &output_)) { ok = false; } if (verbose_) { CheckSetEmpty(skipped_, "", "These tests were skipped (probably because support for some " - "features is not implemented)"); + "features is not implemented)", + output_dir_, &output_); } - StringAppendF(&output_, - "CONFORMANCE SUITE %s: %d successes, %zu skipped, " - "%d expected failures, %zu unexpected failures.\n", - ok ? "PASSED" : "FAILED", successes_, skipped_.size(), - expected_failures_, unexpected_failing_tests_.size()); - StringAppendF(&output_, "\n"); + absl::StrAppendFormat(&output_, + "CONFORMANCE SUITE %s: %d successes, %zu skipped, " + "%d expected failures, %zu unexpected failures.\n", + ok ? "PASSED" : "FAILED", successes_, skipped_.size(), + expected_failures_, unexpected_failing_tests_.size()); + absl::StrAppendFormat(&output_, "\n"); output->assign(output_); diff --git a/conformance/conformance_test.h b/conformance/conformance_test.h index 76bd1bc..0e3fb70 100644 --- a/conformance/conformance_test.h +++ b/conformance/conformance_test.h @@ -1,33 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. - +// 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 // This file defines a protocol for running the conformance test suite // in-process. In other words, the suite itself will run in the same process as @@ -42,10 +18,12 @@ #include #include -#include -#include -#include -#include "conformance.pb.h" +#include "google/protobuf/util/type_resolver.h" +#include "absl/container/btree_set.h" +#include "absl/container/flat_hash_set.h" +#include "conformance/conformance.pb.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/wire_format_lite.h" namespace conformance { class ConformanceRequest; @@ -74,8 +52,7 @@ class ConformanceTestRunner { // // If there is any error in running the test itself, set "runtime_error" in // the response. - virtual void RunTest(const std::string& test_name, - const std::string& input, + virtual void RunTest(const std::string& test_name, const std::string& input, std::string* output) = 0; }; @@ -84,36 +61,38 @@ class ConformanceTestRunner { class ForkPipeRunner : public ConformanceTestRunner { public: // Note: Run() doesn't take ownership of the pointers inside suites. - static int Run(int argc, char *argv[], + static int Run(int argc, char* argv[], const std::vector& suites); ForkPipeRunner(const std::string& executable, - const std::vector& executable_args) + const std::vector& executable_args, + bool performance) : child_pid_(-1), executable_(executable), - executable_args_(executable_args) {} + executable_args_(executable_args), + performance_(performance) {} explicit ForkPipeRunner(const std::string& executable) : child_pid_(-1), executable_(executable) {} virtual ~ForkPipeRunner() {} - void RunTest(const std::string& test_name, - const std::string& request, + void RunTest(const std::string& test_name, const std::string& request, std::string* response); private: void SpawnTestProgram(); - void CheckedWrite(int fd, const void *buf, size_t len); - bool TryRead(int fd, void *buf, size_t len); - void CheckedRead(int fd, void *buf, size_t len); + void CheckedWrite(int fd, const void* buf, size_t len); + bool TryRead(int fd, void* buf, size_t len); + void CheckedRead(int fd, void* buf, size_t len); int write_fd_; int read_fd_; pid_t child_pid_; std::string executable_; const std::vector executable_args_; + bool performance_; std::string current_test_name_; }; @@ -124,7 +103,7 @@ class ForkPipeRunner : public ConformanceTestRunner { // class MyConformanceTestSuite : public ConformanceTestSuite { // public: // void RunSuiteImpl() { -// // INSERT ACTURAL TESTS. +// // INSERT ACTUAL TESTS. // } // }; // @@ -148,10 +127,12 @@ class ConformanceTestSuite { public: ConformanceTestSuite() : verbose_(false), + performance_(false), enforce_recommended_(false), failure_list_flag_name_("--failure_list") {} virtual ~ConformanceTestSuite() {} + void SetPerformance(bool performance) { performance_ = performance; } void SetVerbose(bool verbose) { verbose_ = verbose; } // Whether to require the testee to pass RECOMMENDED tests. By default failing @@ -162,9 +143,7 @@ class ConformanceTestSuite { // can enable this if it wants to be strictly conforming to protobuf spec. // See the comments about ConformanceLevel below to learn more about the // difference between REQUIRED and RECOMMENDED test cases. - void SetEnforceRecommended(bool value) { - enforce_recommended_ = value; - } + void SetEnforceRecommended(bool value) { enforce_recommended_ = value; } // Gets the flag name to the failure list file. // By default, this would return --failure_list @@ -174,6 +153,9 @@ class ConformanceTestSuite { failure_list_flag_name_ = failure_list_flag_name; } + // Sets the path of the output directory. + void SetOutputDir(const char* output_dir) { output_dir_ = output_dir; } + // Run all the conformance tests against the given test runner. // Test output will be stored in "output". // @@ -222,9 +204,7 @@ class ConformanceTestSuite { return request_; } - const ConformanceLevel GetLevel() const { - return level_; - } + const ConformanceLevel GetLevel() const { return level_; } std::string ConformanceLevelToString(ConformanceLevel level) const; @@ -251,27 +231,30 @@ class ConformanceTestSuite { std::string test_name_; }; - bool CheckSetEmpty(const std::set& set_to_check, - const std::string& write_to_file, const std::string& msg); std::string WireFormatToString(conformance::WireFormat wire_format); // Parse payload in the response to the given message. Returns true on // success. - virtual bool ParseResponse( - const conformance::ConformanceResponse& response, - const ConformanceRequestSetting& setting, - Message* test_message) = 0; + virtual bool ParseResponse(const conformance::ConformanceResponse& response, + const ConformanceRequestSetting& setting, + Message* test_message) = 0; void VerifyResponse(const ConformanceRequestSetting& setting, const std::string& equivalent_wire_format, const conformance::ConformanceResponse& response, bool need_report_success, bool require_same_wire_format); + void TruncateDebugPayload(std::string* payload); + const conformance::ConformanceRequest TruncateRequest( + const conformance::ConformanceRequest& request); + const conformance::ConformanceResponse TruncateResponse( + const conformance::ConformanceResponse& response); + void ReportSuccess(const std::string& test_name); void ReportFailure(const std::string& test_name, ConformanceLevel level, const conformance::ConformanceRequest& request, const conformance::ConformanceResponse& response, - const char* fmt, ...); + absl::string_view message); void ReportSkip(const std::string& test_name, const conformance::ConformanceRequest& request, const conformance::ConformanceResponse& response); @@ -294,27 +277,29 @@ class ConformanceTestSuite { int successes_; int expected_failures_; bool verbose_; + bool performance_; bool enforce_recommended_; std::string output_; + std::string output_dir_; std::string failure_list_flag_name_; std::string failure_list_filename_; // The set of test names that are expected to fail in this run, but haven't // failed yet. - std::set expected_to_fail_; + absl::btree_set expected_to_fail_; // The set of test names that have been run. Used to ensure that there are no // duplicate names in the suite. - std::set test_names_; + absl::flat_hash_set test_names_; // The set of tests that failed, but weren't expected to. - std::set unexpected_failing_tests_; + absl::btree_set unexpected_failing_tests_; // The set of tests that succeeded, but weren't expected to. - std::set unexpected_succeeding_tests_; + absl::btree_set unexpected_succeeding_tests_; // The set of tests that the testee opted out of; - std::set skipped_; + absl::btree_set skipped_; }; } // namespace protobuf diff --git a/conformance/conformance_test_main.cc b/conformance/conformance_test_main.cc index c7ac9fc..a58a498 100644 --- a/conformance/conformance_test_main.cc +++ b/conformance/conformance_test_main.cc @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #include "binary_json_conformance_suite.h" #include "conformance_test.h" diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc index 9f893cb..44b9a09 100644 --- a/conformance/conformance_test_runner.cc +++ b/conformance/conformance_test_runner.cc @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 // This file contains a program for running the test suite in a separate // process. The other alternative is to run the suite in-process. See @@ -54,17 +31,22 @@ // 4. testee sends M bytes representing a ConformanceResponse proto #include +#include #include #include #include #include +#include #include +#include #include -#include -#include "conformance.pb.h" +#include "absl/log/absl_log.h" +#include "absl/strings/str_format.h" +#include "conformance/conformance.pb.h" #include "conformance_test.h" +#include "google/protobuf/endian.h" using conformance::ConformanceResponse; using google::protobuf::ConformanceTestSuite; @@ -73,10 +55,10 @@ using std::vector; #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) -#define GOOGLE_CHECK_SYSCALL(call) \ - if (call < 0) { \ +#define CHECK_SYSCALL(call) \ + if (call < 0) { \ perror(#call " " __FILE__ ":" TOSTRING(__LINE__)); \ - exit(1); \ + exit(1); \ } namespace google { @@ -93,8 +75,7 @@ void ParseFailureList(const char *filename, for (string line; getline(infile, line);) { // Remove whitespace. - line.erase(std::remove_if(line.begin(), line.end(), ::isspace), - line.end()); + line.erase(std::remove_if(line.begin(), line.end(), ::isspace), line.end()); // Remove comments. line = line.substr(0, line.find("#")); @@ -106,8 +87,7 @@ void ParseFailureList(const char *filename, } void UsageError() { - fprintf(stderr, - "Usage: conformance-test-runner [options] \n"); + fprintf(stderr, "Usage: conformance-test-runner [options] \n"); fprintf(stderr, "\n"); fprintf(stderr, "Options:\n"); fprintf(stderr, @@ -122,8 +102,7 @@ void UsageError() { " --text_format_failure_list Use to specify list \n"); fprintf(stderr, " of tests that are expected to \n"); - fprintf(stderr, - " fail in the \n"); + fprintf(stderr, " fail in the \n"); fprintf(stderr, " text_format_conformance_suite. \n"); fprintf(stderr, @@ -139,78 +118,94 @@ void UsageError() { " this flag if you want to be\n"); fprintf(stderr, " strictly conforming to protobuf\n"); + fprintf(stderr, " spec.\n"); fprintf(stderr, - " spec.\n"); + " --output_dir Directory to write\n" + " output files.\n"); exit(1); } -void ForkPipeRunner::RunTest( - const std::string& test_name, - const std::string& request, - std::string* response) { +void ForkPipeRunner::RunTest(const std::string &test_name, + const std::string &request, + std::string *response) { if (child_pid_ < 0) { SpawnTestProgram(); } - current_test_name_ = test_name; - uint32_t len = request.size(); + uint32_t len = + internal::little_endian::FromHost(static_cast(request.size())); CheckedWrite(write_fd_, &len, sizeof(uint32_t)); CheckedWrite(write_fd_, request.c_str(), request.size()); if (!TryRead(read_fd_, &len, sizeof(uint32_t))) { // We failed to read from the child, assume a crash and try to reap. - GOOGLE_LOG(INFO) << "Trying to reap child, pid=" << child_pid_; + ABSL_LOG(INFO) << "Trying to reap child, pid=" << child_pid_; - int status; + int status = 0; waitpid(child_pid_, &status, WEXITED); string error_msg; + conformance::ConformanceResponse response_obj; if (WIFEXITED(status)) { - StringAppendF(&error_msg, - "child exited, status=%d", WEXITSTATUS(status)); + if (WEXITSTATUS(status) == 0) { + absl::StrAppendFormat(&error_msg, + "child timed out, killed by signal %d", + WTERMSIG(status)); + response_obj.set_timeout_error(error_msg); + } else { + absl::StrAppendFormat(&error_msg, "child exited, status=%d", + WEXITSTATUS(status)); + response_obj.set_runtime_error(error_msg); + } } else if (WIFSIGNALED(status)) { - StringAppendF(&error_msg, - "child killed by signal %d", WTERMSIG(status)); + absl::StrAppendFormat(&error_msg, "child killed by signal %d", + WTERMSIG(status)); } - GOOGLE_LOG(INFO) << error_msg; + ABSL_LOG(INFO) << error_msg; child_pid_ = -1; - conformance::ConformanceResponse response_obj; - response_obj.set_runtime_error(error_msg); response_obj.SerializeToString(response); return; } + len = internal::little_endian::ToHost(len); response->resize(len); - CheckedRead(read_fd_, (void*)response->c_str(), len); + CheckedRead(read_fd_, (void *)response->c_str(), len); } -int ForkPipeRunner::Run( - int argc, char *argv[], const std::vector& suites) { +int ForkPipeRunner::Run(int argc, char *argv[], + const std::vector &suites) { if (suites.empty()) { fprintf(stderr, "No test suites found.\n"); return EXIT_FAILURE; } bool all_ok = true; - for (ConformanceTestSuite* suite : suites) { + for (ConformanceTestSuite *suite : suites) { string program; std::vector program_args; string failure_list_filename; conformance::FailureSet failure_list; + bool performance = false; for (int arg = 1; arg < argc; ++arg) { if (strcmp(argv[arg], suite->GetFailureListFlagName().c_str()) == 0) { if (++arg == argc) UsageError(); failure_list_filename = argv[arg]; ParseFailureList(argv[arg], &failure_list); + } else if (strcmp(argv[arg], "--performance") == 0) { + performance = true; + suite->SetPerformance(true); } else if (strcmp(argv[arg], "--verbose") == 0) { suite->SetVerbose(true); } else if (strcmp(argv[arg], "--enforce_recommended") == 0) { suite->SetEnforceRecommended(true); + } else if (strcmp(argv[arg], "--output_dir") == 0) { + if (++arg == argc) UsageError(); + suite->SetOutputDir(argv[arg]); } else if (argv[arg][0] == '-') { bool recognized_flag = false; - for (ConformanceTestSuite* suite : suites) { + for (ConformanceTestSuite *suite : suites) { if (strcmp(argv[arg], suite->GetFailureListFlagName().c_str()) == 0) { if (++arg == argc) UsageError(); recognized_flag = true; @@ -221,7 +216,7 @@ int ForkPipeRunner::Run( UsageError(); } } else { - program += argv[arg]; + program += argv[arg++]; while (arg < argc) { program_args.push_back(argv[arg]); arg++; @@ -229,18 +224,18 @@ int ForkPipeRunner::Run( } } - ForkPipeRunner runner(program, program_args); + ForkPipeRunner runner(program, program_args, performance); std::string output; - all_ok = all_ok && - suite->RunSuite(&runner, &output, failure_list_filename, &failure_list); + all_ok = all_ok && suite->RunSuite(&runner, &output, failure_list_filename, + &failure_list); fwrite(output.c_str(), 1, output.size(), stderr); } return all_ok ? EXIT_SUCCESS : EXIT_FAILURE; } -// TODO(haberman): make this work on Windows, instead of using these +// TODO: make this work on Windows, instead of using these // UNIX-specific APIs. // // There is a platform-agnostic API in @@ -274,22 +269,22 @@ void ForkPipeRunner::SpawnTestProgram() { if (pid) { // Parent. - GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0])); - GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1])); + CHECK_SYSCALL(close(toproc_pipe_fd[0])); + CHECK_SYSCALL(close(fromproc_pipe_fd[1])); write_fd_ = toproc_pipe_fd[1]; read_fd_ = fromproc_pipe_fd[0]; child_pid_ = pid; } else { // Child. - GOOGLE_CHECK_SYSCALL(close(STDIN_FILENO)); - GOOGLE_CHECK_SYSCALL(close(STDOUT_FILENO)); - GOOGLE_CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO)); - GOOGLE_CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO)); + CHECK_SYSCALL(close(STDIN_FILENO)); + CHECK_SYSCALL(close(STDOUT_FILENO)); + CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO)); + CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO)); - GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0])); - GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1])); - GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[1])); - GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[0])); + CHECK_SYSCALL(close(toproc_pipe_fd[0])); + CHECK_SYSCALL(close(fromproc_pipe_fd[1])); + CHECK_SYSCALL(close(toproc_pipe_fd[1])); + CHECK_SYSCALL(close(fromproc_pipe_fd[0])); std::unique_ptr executable(new char[executable_.size() + 1]); memcpy(executable.get(), executable_.c_str(), executable_.size()); @@ -297,33 +292,66 @@ void ForkPipeRunner::SpawnTestProgram() { std::vector argv; argv.push_back(executable.get()); - for (int i = 0; i < executable_args_.size(); ++i) { + ABSL_LOG(INFO) << argv[0]; + for (size_t i = 0; i < executable_args_.size(); ++i) { argv.push_back(executable_args_[i].c_str()); + ABSL_LOG(INFO) << executable_args_[i]; } argv.push_back(nullptr); // Never returns. - GOOGLE_CHECK_SYSCALL(execv(executable.get(), const_cast(argv.data()))); + CHECK_SYSCALL(execv(executable.get(), const_cast(argv.data()))); } } void ForkPipeRunner::CheckedWrite(int fd, const void *buf, size_t len) { - if (write(fd, buf, len) != len) { - GOOGLE_LOG(FATAL) << current_test_name_ - << ": error writing to test program: " << strerror(errno); + if (static_cast(write(fd, buf, len)) != len) { + ABSL_LOG(FATAL) << current_test_name_ + << ": error writing to test program: " << strerror(errno); } } bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) { size_t ofs = 0; while (len > 0) { - ssize_t bytes_read = read(fd, (char*)buf + ofs, len); - + std::future future = std::async( + std::launch::async, + [](int fd, void *buf, size_t ofs, size_t len) { + return read(fd, (char *)buf + ofs, len); + }, + fd, buf, ofs, len); + std::future_status status; + if (performance_) { + status = future.wait_for(std::chrono::seconds(5)); + if (status == std::future_status::timeout) { + ABSL_LOG(ERROR) << current_test_name_ << ": timeout from test program"; + kill(child_pid_, SIGQUIT); + // TODO: Only log in flag-guarded mode, since reading output + // from SIGQUIT is slow and verbose. + std::vector err; + err.resize(5000); + ssize_t err_bytes_read; + size_t err_ofs = 0; + do { + err_bytes_read = + read(fd, (void *)&err[err_ofs], err.size() - err_ofs); + err_ofs += err_bytes_read; + } while (err_bytes_read > 0 && err_ofs < err.size()); + ABSL_LOG(ERROR) << "child_pid_=" << child_pid_ << " SIGQUIT: \n" + << &err[0]; + return false; + } + } else { + future.wait(); + } + ssize_t bytes_read = future.get(); if (bytes_read == 0) { - GOOGLE_LOG(ERROR) << current_test_name_ << ": unexpected EOF from test program"; + ABSL_LOG(ERROR) << current_test_name_ + << ": unexpected EOF from test program"; return false; } else if (bytes_read < 0) { - GOOGLE_LOG(ERROR) << current_test_name_ - << ": error reading from test program: " << strerror(errno); + ABSL_LOG(ERROR) << current_test_name_ + << ": error reading from test program: " + << strerror(errno); return false; } @@ -336,8 +364,8 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) { void ForkPipeRunner::CheckedRead(int fd, void *buf, size_t len) { if (!TryRead(fd, buf, len)) { - GOOGLE_LOG(FATAL) << current_test_name_ - << ": error reading from test program: " << strerror(errno); + ABSL_LOG(FATAL) << current_test_name_ + << ": error reading from test program: " << strerror(errno); } } diff --git a/conformance/defs.bzl b/conformance/defs.bzl new file mode 100644 index 0000000..8daef86 --- /dev/null +++ b/conformance/defs.bzl @@ -0,0 +1,48 @@ +"""Starlark definitions for Protobuf conformance tests. + +PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE. +""" + +def conformance_test( + name, + testee, + failure_list = None, + text_format_failure_list = None, + **kwargs): + """Conformance test runner. + + Args: + name: the name for the test. + testee: a conformance test client binary. + failure_list: a text file with known failures, one per line. + text_format_failure_list: a text file with known failures (one per line) + for the text format conformance suite. + **kwargs: common arguments to pass to sh_test. + """ + args = ["--testee %s" % _strip_bazel(testee)] + failure_lists = [] + if failure_list: + args = args + ["--failure_list %s" % _strip_bazel(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)] + failure_lists = failure_lists + [text_format_failure_list] + + native.sh_test( + name = name, + srcs = ["//conformance:bazel_conformance_test_runner.sh"], + data = [testee] + failure_lists + [ + "//conformance:conformance_test_runner", + ], + args = args, + deps = [ + "@bazel_tools//tools/bash/runfiles", + ], + tags = ["conformance"], + **kwargs + ) + +def _strip_bazel(testee): + if testee.startswith("//"): + testee = testee.replace("//", "com_google_protobuf/") + return testee.replace(":", "/") diff --git a/conformance/failure_list_cpp.txt b/conformance/failure_list_cpp.txt index d55fa9f..aa18cea 100644 --- a/conformance/failure_list_cpp.txt +++ b/conformance/failure_list_cpp.txt @@ -4,7 +4,7 @@ # By listing them here we can keep tabs on which ones are failing and be sure # that we don't introduce regressions in other tests. # -# TODO(haberman): insert links to corresponding bugs tracking the issue. +# TODO: insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput @@ -12,13 +12,12 @@ Recommended.FieldMaskPathsDontRoundTrip.JsonOutput Recommended.FieldMaskTooManyUnderscore.JsonOutput Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedFalse Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedTrue -Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput -Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter Recommended.Proto3.JsonInput.FieldNameDuplicate Recommended.Proto3.JsonInput.FieldNameDuplicateDifferentCasing1 Recommended.Proto3.JsonInput.FieldNameDuplicateDifferentCasing2 Recommended.Proto3.JsonInput.FieldNameNotQuoted +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput Recommended.Proto3.JsonInput.MapFieldValueIsNull Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt index 31bdf25..6999ff0 100644 --- a/conformance/failure_list_csharp.txt +++ b/conformance/failure_list_csharp.txt @@ -1,3 +1,9 @@ +Recommended.Proto2.JsonInput.FieldNameExtension.Validator Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput -Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Required.Proto3.JsonInput.OneofFieldNullFirst.JsonOutput +Required.Proto3.JsonInput.OneofFieldNullFirst.ProtobufOutput +Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput +Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput +Recommended.ValueRejectInfNumberValue.JsonOutput +Recommended.ValueRejectNanNumberValue.JsonOutput \ No newline at end of file diff --git a/benchmarks/__init__.py b/conformance/failure_list_dart_upb.txt similarity index 100% rename from benchmarks/__init__.py rename to conformance/failure_list_dart_upb.txt diff --git a/conformance/failure_list_java.txt b/conformance/failure_list_java.txt index b29a63f..808e230 100644 --- a/conformance/failure_list_java.txt +++ b/conformance/failure_list_java.txt @@ -42,7 +42,3 @@ Required.Proto3.JsonInput.Int32FieldPlusSign Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt Required.Proto3.JsonInput.StringFieldNotAString -Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE diff --git a/conformance/failure_list_java_lite.txt b/conformance/failure_list_java_lite.txt new file mode 100644 index 0000000..57a082e --- /dev/null +++ b/conformance/failure_list_java_lite.txt @@ -0,0 +1,10 @@ +# This is the list of conformance tests that are known to fail for the Java +# implementation right now. These should be fixed. +# +# By listing them here we can keep tabs on which ones are failing and be sure +# that we don't introduce regressions in other tests. + +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE diff --git a/conformance/failure_list_jruby.txt b/conformance/failure_list_jruby.txt new file mode 100644 index 0000000..c0d2980 --- /dev/null +++ b/conformance/failure_list_jruby.txt @@ -0,0 +1,38 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Recommended.Proto3.JsonInput.BoolFieldAllCapitalFalse +Recommended.Proto3.JsonInput.BoolFieldAllCapitalTrue +Recommended.Proto3.JsonInput.BoolFieldCamelCaseFalse +Recommended.Proto3.JsonInput.BoolFieldCamelCaseTrue +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedFalse +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedTrue +Recommended.Proto3.JsonInput.BoolMapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNanNotQuoted +Recommended.Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter +Recommended.Proto3.JsonInput.FieldNameDuplicate +Recommended.Proto3.JsonInput.FieldNameNotQuoted +Recommended.Proto3.JsonInput.FloatFieldInfinityNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNanNotQuoted +Recommended.Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted +Recommended.Proto3.JsonInput.Int32MapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.Int64MapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.JsonWithComments +Recommended.Proto3.JsonInput.StringFieldSingleQuoteBoth +Recommended.Proto3.JsonInput.StringFieldSingleQuoteKey +Recommended.Proto3.JsonInput.StringFieldSingleQuoteValue +Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.Proto3.JsonInput.Uint32MapFieldKeyNotQuoted +Recommended.Proto3.JsonInput.Uint64MapFieldKeyNotQuoted +Required.Proto3.JsonInput.EnumFieldNotQuoted +Required.Proto3.JsonInput.Int32FieldLeadingZero +Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero +Required.Proto3.JsonInput.Int32FieldPlusSign +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.Proto3.JsonInput.StringFieldNotAString diff --git a/conformance/failure_list_jruby_ffi.txt b/conformance/failure_list_jruby_ffi.txt new file mode 100644 index 0000000..6a487cb --- /dev/null +++ b/conformance/failure_list_jruby_ffi.txt @@ -0,0 +1,2 @@ +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput \ No newline at end of file diff --git a/conformance/failure_list_js.txt b/conformance/failure_list_js.txt deleted file mode 100644 index ef9131a..0000000 --- a/conformance/failure_list_js.txt +++ /dev/null @@ -1,115 +0,0 @@ - -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput -Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput diff --git a/conformance/failure_list_php.txt b/conformance/failure_list_php.txt index d51a75d..4876e10 100644 --- a/conformance/failure_list_php.txt +++ b/conformance/failure_list_php.txt @@ -5,14 +5,20 @@ Recommended.Proto2.JsonInput.FieldNameExtension.Validator Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator Required.Proto3.JsonInput.DoubleFieldTooSmall +Required.Proto3.JsonInput.DurationNegativeNanos.JsonOutput +Required.Proto3.JsonInput.DurationNegativeNanos.ProtobufOutput Required.Proto3.JsonInput.FloatFieldTooLarge Required.Proto3.JsonInput.FloatFieldTooSmall Required.Proto3.JsonInput.Int32FieldNotInteger Required.Proto3.JsonInput.Int64FieldNotInteger Required.Proto3.JsonInput.OneofFieldDuplicate +Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput +Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt Required.Proto3.JsonInput.RepeatedListValue.JsonOutput Required.Proto3.JsonInput.RepeatedListValue.ProtobufOutput diff --git a/conformance/failure_list_php_c.txt b/conformance/failure_list_php_c.txt index 63c7e8a..2844486 100644 --- a/conformance/failure_list_php_c.txt +++ b/conformance/failure_list_php_c.txt @@ -1,2 +1,4 @@ Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator diff --git a/conformance/failure_list_php_c_32.txt b/conformance/failure_list_php_c_32.txt deleted file mode 100644 index 63c7e8a..0000000 --- a/conformance/failure_list_php_c_32.txt +++ /dev/null @@ -1,2 +0,0 @@ -Recommended.Proto2.JsonInput.FieldNameExtension.Validator -Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator diff --git a/conformance/failure_list_python.txt b/conformance/failure_list_python.txt index e69de29..8bbf094 100644 --- a/conformance/failure_list_python.txt +++ b/conformance/failure_list_python.txt @@ -0,0 +1,3 @@ +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInOptionalField.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput diff --git a/conformance/failure_list_python_cpp.txt b/conformance/failure_list_python_cpp.txt index 9efb6cf..a499393 100644 --- a/conformance/failure_list_python_cpp.txt +++ b/conformance/failure_list_python_cpp.txt @@ -4,5 +4,8 @@ # By listing them here we can keep tabs on which ones are failing and be sure # that we don't introduce regressions in other tests. # -# TODO(haberman): insert links to corresponding bugs tracking the issue. +# TODO: insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInOptionalField.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt index ff206dc..2fb4dc8 100644 --- a/conformance/failure_list_ruby.txt +++ b/conformance/failure_list_ruby.txt @@ -1,111 +1,2 @@ -Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput -Recommended.FieldMaskPathsDontRoundTrip.JsonOutput -Recommended.FieldMaskTooManyUnderscore.JsonOutput -Recommended.Proto2.JsonInput.FieldNameExtension.Validator -Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput -Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput -Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator -Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator -Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter -Recommended.Proto3.JsonInput.MapFieldValueIsNull -Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull -Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull -Recommended.Proto3.JsonInput.StringEndsWithEscapeChar -Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder -Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate -Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate -Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator -Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput -Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput -Required.DurationProtoInputTooLarge.JsonOutput -Required.DurationProtoInputTooSmall.JsonOutput -Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator -Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput -Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput -Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput -Required.Proto3.JsonInput.DurationMinValue.JsonOutput -Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput -Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput -Required.Proto3.JsonInput.FloatFieldNan.JsonOutput -Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonFalse.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonNull.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonNumber.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonObject.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonString.ProtobufOutput -Required.Proto3.JsonInput.IgnoreUnknownJsonTrue.ProtobufOutput -Required.Proto3.JsonInput.OneofFieldDuplicate -Required.Proto3.JsonInput.RejectTopLevelNull -Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput -Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput -Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput -Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput -Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput -Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput -Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput -Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput -Required.TimestampProtoInputTooLarge.JsonOutput -Required.TimestampProtoInputTooSmall.JsonOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput +Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput diff --git a/benchmarks/python/__init__.py b/conformance/failure_list_rust_cc.txt similarity index 100% rename from benchmarks/python/__init__.py rename to conformance/failure_list_rust_cc.txt diff --git a/benchmarks/util/__init__.py b/conformance/failure_list_rust_upb.txt similarity index 100% rename from benchmarks/util/__init__.py rename to conformance/failure_list_rust_upb.txt diff --git a/conformance/text_format_conformance_suite.cc b/conformance/text_format_conformance_suite.cc index 6574b10..25740ee 100644 --- a/conformance/text_format_conformance_suite.cc +++ b/conformance/text_format_conformance_suite.cc @@ -1,40 +1,19 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #include "text_format_conformance_suite.h" -#include -#include +#include "google/protobuf/any.pb.h" +#include "absl/log/absl_log.h" +#include "absl/strings/str_cat.h" #include "conformance_test.h" -#include -#include +#include "google/protobuf/test_messages_proto2.pb.h" +#include "google/protobuf/test_messages_proto3.pb.h" +#include "google/protobuf/text_format.h" namespace proto2_messages = protobuf_test_messages::proto2; @@ -51,6 +30,10 @@ using std::string; namespace google { namespace protobuf { +// The number of repetitions to use for performance tests. +// Corresponds approx to 500KB wireformat bytes. +static const size_t kPerformanceRepeatCount = 50000; + TextFormatConformanceTestSuite::TextFormatConformanceTestSuite() { SetFailureListFlagName("--text_format_failure_list"); } @@ -64,9 +47,9 @@ bool TextFormatConformanceTestSuite::ParseTextFormatResponse( parser.AllowFieldNumber(true); } if (!parser.ParseFromString(response.text_payload(), test_message)) { - GOOGLE_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode " - << "yielded unparseable proto. Text payload: " - << response.text_payload(); + ABSL_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode " + << "yielded unparseable proto. Text payload: " + << response.text_payload(); return false; } @@ -85,10 +68,9 @@ bool TextFormatConformanceTestSuite::ParseResponse( case ConformanceResponse::kProtobufPayload: { if (requested_output != conformance::PROTOBUF) { ReportFailure(test_name, level, request, response, - StrCat("Test was asked for ", + absl::StrCat("Test was asked for ", WireFormatToString(requested_output), - " output but provided PROTOBUF instead.") - .c_str()); + " output but provided PROTOBUF instead.")); return false; } @@ -103,11 +85,11 @@ bool TextFormatConformanceTestSuite::ParseResponse( case ConformanceResponse::kTextPayload: { if (requested_output != conformance::TEXT_FORMAT) { - ReportFailure(test_name, level, request, response, - StrCat("Test was asked for ", - WireFormatToString(requested_output), - " output but provided TEXT_FORMAT instead.") - .c_str()); + ReportFailure( + test_name, level, request, response, + absl::StrCat("Test was asked for ", + WireFormatToString(requested_output), + " output but provided TEXT_FORMAT instead.")); return false; } @@ -122,8 +104,8 @@ bool TextFormatConformanceTestSuite::ParseResponse( } default: - GOOGLE_LOG(FATAL) << test_name - << ": unknown payload type: " << response.result_case(); + ABSL_LOG(FATAL) << test_name + << ": unknown payload type: " << response.result_case(); } return true; @@ -141,7 +123,7 @@ void TextFormatConformanceTestSuite::ExpectParseFailure(const string& test_name, const ConformanceRequest& request = setting.GetRequest(); ConformanceResponse response; string effective_test_name = - StrCat(setting.ConformanceLevelToString(level), + absl::StrCat(setting.ConformanceLevelToString(level), ".Proto3.TextFormatInput.", test_name); RunTest(effective_test_name, request, &response); @@ -167,6 +149,22 @@ void TextFormatConformanceTestSuite::RunValidTextFormatTestProto2( RunValidTextFormatTestWithMessage(test_name, level, input_text, prototype); } +void TextFormatConformanceTestSuite::RunValidTextFormatTestWithExpected( + const string& test_name, ConformanceLevel level, const string& input_text, + const string& expected_text) { + TestAllTypesProto3 prototype; + RunValidTextFormatTestWithMessage(test_name, level, input_text, expected_text, + prototype); +} + +void TextFormatConformanceTestSuite::RunValidTextFormatTestProto2WithExpected( + const string& test_name, ConformanceLevel level, const string& input_text, + const string& expected_text) { + TestAllTypesProto2 prototype; + RunValidTextFormatTestWithMessage(test_name, level, input_text, expected_text, + prototype); +} + void TextFormatConformanceTestSuite::RunValidTextFormatTestWithMessage( const string& test_name, ConformanceLevel level, const string& input_text, const Message& prototype) { @@ -180,6 +178,19 @@ void TextFormatConformanceTestSuite::RunValidTextFormatTestWithMessage( RunValidInputTest(setting2, input_text); } +void TextFormatConformanceTestSuite::RunValidTextFormatTestWithMessage( + const string& test_name, ConformanceLevel level, const string& input_text, + const string& expected_text, const Message& prototype) { + ConformanceRequestSetting setting1( + level, conformance::TEXT_FORMAT, conformance::PROTOBUF, + conformance::TEXT_FORMAT_TEST, prototype, test_name, input_text); + RunValidInputTest(setting1, expected_text); + ConformanceRequestSetting setting2( + level, conformance::TEXT_FORMAT, conformance::TEXT_FORMAT, + conformance::TEXT_FORMAT_TEST, prototype, test_name, input_text); + RunValidInputTest(setting2, expected_text); +} + void TextFormatConformanceTestSuite::RunValidUnknownTextFormatTest( const string& test_name, const Message& message) { string serialized_input; @@ -187,192 +198,340 @@ void TextFormatConformanceTestSuite::RunValidUnknownTextFormatTest( TestAllTypesProto3 prototype; ConformanceRequestSetting setting1( RECOMMENDED, conformance::PROTOBUF, conformance::TEXT_FORMAT, - conformance::TEXT_FORMAT_TEST, prototype, test_name + "_Drop", - serialized_input); + conformance::TEXT_FORMAT_TEST, prototype, + absl::StrCat(test_name, "_Drop"), serialized_input); setting1.SetPrototypeMessageForCompare(message); RunValidBinaryInputTest(setting1, ""); ConformanceRequestSetting setting2( RECOMMENDED, conformance::PROTOBUF, conformance::TEXT_FORMAT, - conformance::TEXT_FORMAT_TEST, prototype, test_name + "_Print", - serialized_input); + conformance::TEXT_FORMAT_TEST, prototype, + absl::StrCat(test_name, "_Print"), serialized_input); setting2.SetPrototypeMessageForCompare(message); setting2.SetPrintUnknownFields(true); RunValidBinaryInputTest(setting2, serialized_input); } void TextFormatConformanceTestSuite::RunSuiteImpl() { - RunValidTextFormatTest("HelloWorld", REQUIRED, - "optional_string: 'Hello, World!'"); - // Integer fields. - RunValidTextFormatTest("Int32FieldMaxValue", REQUIRED, - "optional_int32: 2147483647"); - RunValidTextFormatTest("Int32FieldMinValue", REQUIRED, - "optional_int32: -2147483648"); - RunValidTextFormatTest("Uint32FieldMaxValue", REQUIRED, - "optional_uint32: 4294967295"); - RunValidTextFormatTest("Int64FieldMaxValue", REQUIRED, - "optional_int64: 9223372036854775807"); - RunValidTextFormatTest("Int64FieldMinValue", REQUIRED, - "optional_int64: -9223372036854775808"); - RunValidTextFormatTest("Uint64FieldMaxValue", REQUIRED, - "optional_uint64: 18446744073709551615"); - - // Parsers reject out-of-bound integer values. - ExpectParseFailure("Int32FieldTooLarge", REQUIRED, - "optional_int32: 2147483648"); - ExpectParseFailure("Int32FieldTooSmall", REQUIRED, - "optional_int32: -2147483649"); - ExpectParseFailure("Uint32FieldTooLarge", REQUIRED, - "optional_uint32: 4294967296"); - ExpectParseFailure("Int64FieldTooLarge", REQUIRED, - "optional_int64: 9223372036854775808"); - ExpectParseFailure("Int64FieldTooSmall", REQUIRED, - "optional_int64: -9223372036854775809"); - ExpectParseFailure("Uint64FieldTooLarge", REQUIRED, - "optional_uint64: 18446744073709551616"); - - // Floating point fields - RunValidTextFormatTest("FloatField", REQUIRED, - "optional_float: 3.192837"); - RunValidTextFormatTest("FloatFieldWithVeryPreciseNumber", REQUIRED, - "optional_float: 3.123456789123456789"); - RunValidTextFormatTest("FloatFieldMaxValue", REQUIRED, - "optional_float: 3.4028235e+38"); - RunValidTextFormatTest("FloatFieldMinValue", REQUIRED, - "optional_float: 1.17549e-38"); - RunValidTextFormatTest("FloatFieldNaNValue", REQUIRED, - "optional_float: NaN"); - RunValidTextFormatTest("FloatFieldPosInfValue", REQUIRED, - "optional_float: inf"); - RunValidTextFormatTest("FloatFieldNegInfValue", REQUIRED, - "optional_float: -inf"); - RunValidTextFormatTest("FloatFieldWithInt32Max", REQUIRED, - "optional_float: 4294967296"); - RunValidTextFormatTest("FloatFieldLargerThanInt64", REQUIRED, - "optional_float: 9223372036854775808"); - RunValidTextFormatTest("FloatFieldTooLarge", REQUIRED, - "optional_float: 3.4028235e+39"); - RunValidTextFormatTest("FloatFieldTooSmall", REQUIRED, - "optional_float: 1.17549e-39"); - RunValidTextFormatTest("FloatFieldLargerThanUint64", REQUIRED, - "optional_float: 18446744073709551616"); - - // Group fields - RunValidTextFormatTestProto2("GroupFieldNoColon", REQUIRED, - "Data { group_int32: 1 }"); - RunValidTextFormatTestProto2("GroupFieldWithColon", REQUIRED, - "Data: { group_int32: 1 }"); - RunValidTextFormatTestProto2("GroupFieldEmpty", REQUIRED, - "Data {}"); - - - // Unknown Fields - UnknownToTestAllTypes message; - // Unable to print unknown Fixed32/Fixed64 fields as if they are known. - // Fixed32/Fixed64 fields are not added in the tests. - message.set_optional_int32(123); - message.set_optional_string("hello"); - message.set_optional_bool(true); - RunValidUnknownTextFormatTest("ScalarUnknownFields", message); - - message.Clear(); - message.mutable_nested_message()->set_c(111); - RunValidUnknownTextFormatTest("MessageUnknownFields", message); - - message.Clear(); - message.mutable_optionalgroup()->set_a(321); - RunValidUnknownTextFormatTest("GroupUnknownFields", message); - - message.add_repeated_int32(1); - message.add_repeated_int32(2); - message.add_repeated_int32(3); - RunValidUnknownTextFormatTest("RepeatedUnknownFields", message); - - // Any fields - RunValidTextFormatTest("AnyField", REQUIRED, - R"( - optional_any: { - [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { - optional_int32: 12345 + if (!performance_) { + RunValidTextFormatTest("HelloWorld", REQUIRED, + "optional_string: 'Hello, World!'"); + // Integer fields. + RunValidTextFormatTest("Int32FieldMaxValue", REQUIRED, + "optional_int32: 2147483647"); + RunValidTextFormatTest("Int32FieldMinValue", REQUIRED, + "optional_int32: -2147483648"); + RunValidTextFormatTest("Uint32FieldMaxValue", REQUIRED, + "optional_uint32: 4294967295"); + RunValidTextFormatTest("Int64FieldMaxValue", REQUIRED, + "optional_int64: 9223372036854775807"); + RunValidTextFormatTest("Int64FieldMinValue", REQUIRED, + "optional_int64: -9223372036854775808"); + RunValidTextFormatTest("Uint64FieldMaxValue", REQUIRED, + "optional_uint64: 18446744073709551615"); + + // Parsers reject out-of-bound integer values. + ExpectParseFailure("Int32FieldTooLarge", REQUIRED, + "optional_int32: 2147483648"); + ExpectParseFailure("Int32FieldTooSmall", REQUIRED, + "optional_int32: -2147483649"); + ExpectParseFailure("Uint32FieldTooLarge", REQUIRED, + "optional_uint32: 4294967296"); + ExpectParseFailure("Int64FieldTooLarge", REQUIRED, + "optional_int64: 9223372036854775808"); + ExpectParseFailure("Int64FieldTooSmall", REQUIRED, + "optional_int64: -9223372036854775809"); + ExpectParseFailure("Uint64FieldTooLarge", REQUIRED, + "optional_uint64: 18446744073709551616"); + + // Floating point fields + RunValidTextFormatTest("FloatField", REQUIRED, "optional_float: 3.192837"); + RunValidTextFormatTest("FloatFieldWithVeryPreciseNumber", REQUIRED, + "optional_float: 3.123456789123456789"); + RunValidTextFormatTest("FloatFieldMaxValue", REQUIRED, + "optional_float: 3.4028235e+38"); + RunValidTextFormatTest("FloatFieldMinValue", REQUIRED, + "optional_float: 1.17549e-38"); + RunValidTextFormatTest("FloatFieldNaNValue", REQUIRED, + "optional_float: NaN"); + RunValidTextFormatTest("FloatFieldPosInfValue", REQUIRED, + "optional_float: inf"); + RunValidTextFormatTest("FloatFieldNegInfValue", REQUIRED, + "optional_float: -inf"); + RunValidTextFormatTest("FloatFieldWithInt32Max", REQUIRED, + "optional_float: 4294967296"); + RunValidTextFormatTest("FloatFieldLargerThanInt64", REQUIRED, + "optional_float: 9223372036854775808"); + RunValidTextFormatTest("FloatFieldTooLarge", REQUIRED, + "optional_float: 3.4028235e+39"); + RunValidTextFormatTest("FloatFieldTooSmall", REQUIRED, + "optional_float: 1.17549e-39"); + RunValidTextFormatTest("FloatFieldLargerThanUint64", REQUIRED, + "optional_float: 18446744073709551616"); + + // String literals x {Strings, Bytes} + for (const auto& field_type : std::vector{"String", "Bytes"}) { + const std::string field_name = + field_type == "String" ? "optional_string" : "optional_bytes"; + RunValidTextFormatTest( + absl::StrCat("StringLiteralConcat", field_type), REQUIRED, + absl::StrCat(field_name, ": 'first' \"second\"\n'third'")); + RunValidTextFormatTest( + absl::StrCat("StringLiteralBasicEscapes", field_type), REQUIRED, + absl::StrCat(field_name, ": '\\a\\b\\f\\n\\r\\t\\v\\?\\\\\\'\\\"'")); + RunValidTextFormatTest( + absl::StrCat("StringLiteralOctalEscapes", field_type), REQUIRED, + absl::StrCat(field_name, ": '\\341\\210\\264'")); + RunValidTextFormatTest( + absl::StrCat("StringLiteralHexEscapes", field_type), REQUIRED, + absl::StrCat(field_name, ": '\\xe1\\x88\\xb4'")); + RunValidTextFormatTest( + absl::StrCat("StringLiteralShortUnicodeEscape", field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\u1234'")); + RunValidTextFormatTest( + absl::StrCat("StringLiteralLongUnicodeEscapes", field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\U00001234\\U00010437'")); + // String literals don't include line feeds. + ExpectParseFailure( + absl::StrCat("StringLiteralIncludesLF", field_type), REQUIRED, + absl::StrCat(field_name, ": 'first line\nsecond line'")); + // Unicode escapes don't include code points that lie beyond the planes + // (> 0x10ffff). + ExpectParseFailure( + absl::StrCat("StringLiteralLongUnicodeEscapeTooLarge", field_type), + REQUIRED, absl::StrCat(field_name, ": '\\U00110000'")); + // Unicode escapes don't include surrogates. + ExpectParseFailure( + absl::StrCat("StringLiteralShortUnicodeEscapeSurrogatePair", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\ud801\\udc37'")); + ExpectParseFailure( + absl::StrCat("StringLiteralShortUnicodeEscapeSurrogateFirstOnly", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\ud800'")); + ExpectParseFailure( + absl::StrCat("StringLiteralShortUnicodeEscapeSurrogateSecondOnly", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\udc00'")); + ExpectParseFailure( + absl::StrCat("StringLiteralLongUnicodeEscapeSurrogateFirstOnly", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\U0000d800'")); + ExpectParseFailure( + absl::StrCat("StringLiteralLongUnicodeEscapeSurrogateSecondOnly", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\U0000dc00'")); + ExpectParseFailure( + absl::StrCat("StringLiteralLongUnicodeEscapeSurrogatePair", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\U0000d801\\U00000dc37'")); + ExpectParseFailure( + absl::StrCat("StringLiteralUnicodeEscapeSurrogatePairLongShort", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\U0000d801\\udc37'")); + ExpectParseFailure( + absl::StrCat("StringLiteralUnicodeEscapeSurrogatePairShortLong", + field_type), + RECOMMENDED, absl::StrCat(field_name, ": '\\ud801\\U0000dc37'")); + + // The following method depend on the type of field, as strings have extra + // validation. + const auto test_method = + field_type == "String" + ? &TextFormatConformanceTestSuite::ExpectParseFailure + : &TextFormatConformanceTestSuite::RunValidTextFormatTest; + + // String fields reject invalid UTF-8 byte sequences; bytes fields don't. + (this->*test_method)(absl::StrCat(field_type, "FieldBadUTF8Octal"), + REQUIRED, absl::StrCat(field_name, ": '\\300'")); + (this->*test_method)(absl::StrCat(field_type, "FieldBadUTF8Hex"), + REQUIRED, absl::StrCat(field_name, ": '\\xc0'")); + } + + // Group fields + RunValidTextFormatTestProto2("GroupFieldNoColon", REQUIRED, + "Data { group_int32: 1 }"); + RunValidTextFormatTestProto2("GroupFieldWithColon", REQUIRED, + "Data: { group_int32: 1 }"); + RunValidTextFormatTestProto2("GroupFieldEmpty", REQUIRED, "Data {}"); + + // Unknown Fields + UnknownToTestAllTypes message; + // Unable to print unknown Fixed32/Fixed64 fields as if they are known. + // Fixed32/Fixed64 fields are not added in the tests. + message.set_optional_int32(123); + message.set_optional_string("hello"); + message.set_optional_bool(true); + RunValidUnknownTextFormatTest("ScalarUnknownFields", message); + + message.Clear(); + message.mutable_nested_message()->set_c(111); + RunValidUnknownTextFormatTest("MessageUnknownFields", message); + + message.Clear(); + message.mutable_optionalgroup()->set_a(321); + RunValidUnknownTextFormatTest("GroupUnknownFields", message); + + message.add_repeated_int32(1); + message.add_repeated_int32(2); + message.add_repeated_int32(3); + RunValidUnknownTextFormatTest("RepeatedUnknownFields", message); + + // Any fields + RunValidTextFormatTest("AnyField", REQUIRED, + R"( + optional_any: { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] { + optional_int32: 12345 + } } - } - )"); - RunValidTextFormatTest("AnyFieldWithRawBytes", REQUIRED, - R"( - optional_any: { - type_url: "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3" - value: "\b\271`" - } - )"); - ExpectParseFailure("AnyFieldWithInvalidType", REQUIRED, - R"( - optional_any: { - [type.googleapis.com/unknown] { - optional_int32: 12345 + )"); + RunValidTextFormatTest("AnyFieldWithRawBytes", REQUIRED, + R"( + optional_any: { + type_url: "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3" + value: "\b\271`" } - } - )"); + )"); + ExpectParseFailure("AnyFieldWithInvalidType", REQUIRED, + R"( + optional_any: { + [type.googleapis.com/unknown] { + optional_int32: 12345 + } + } + )"); + + // Map fields + TestAllTypesProto3 prototype; + (*prototype.mutable_map_string_string())["c"] = "value"; + (*prototype.mutable_map_string_string())["b"] = "value"; + (*prototype.mutable_map_string_string())["a"] = "value"; + RunValidTextFormatTestWithMessage("AlphabeticallySortedMapStringKeys", + REQUIRED, + R"( + map_string_string { + key: "a" + value: "value" + } + map_string_string { + key: "b" + value: "value" + } + map_string_string { + key: "c" + value: "value" + } + )", + prototype); + + prototype.Clear(); + (*prototype.mutable_map_int32_int32())[3] = 0; + (*prototype.mutable_map_int32_int32())[2] = 0; + (*prototype.mutable_map_int32_int32())[1] = 0; + RunValidTextFormatTestWithMessage("AlphabeticallySortedMapIntKeys", + REQUIRED, + R"( + map_int32_int32 { + key: 1 + value: 0 + } + map_int32_int32 { + key: 2 + value: 0 + } + map_int32_int32 { + key: 3 + value: 0 + } + )", + prototype); + + prototype.Clear(); + (*prototype.mutable_map_bool_bool())[true] = false; + (*prototype.mutable_map_bool_bool())[false] = false; + RunValidTextFormatTestWithMessage("AlphabeticallySortedMapBoolKeys", + REQUIRED, + R"( + map_bool_bool { + key: false + value: false + } + map_bool_bool { + key: true + value: false + } + )", + prototype); + + prototype.Clear(); + ConformanceRequestSetting setting_map( + REQUIRED, conformance::TEXT_FORMAT, conformance::PROTOBUF, + conformance::TEXT_FORMAT_TEST, prototype, "DuplicateMapKey", R"( + map_string_nested_message { + key: "duplicate" + value: { a: 123 } + } + map_string_nested_message { + key: "duplicate" + value: { corecursive: {} } + } + )"); + // The last-specified value will be retained in a parsed map + RunValidInputTest(setting_map, R"( + map_string_nested_message { + key: "duplicate" + value: { corecursive: {} } + } + )"); + } + // Flag control performance tests to keep them internal and opt-in only + if (performance_) { + RunTextFormatPerformanceTests(); + } +} - // Map fields - TestAllTypesProto3 prototype; - (*prototype.mutable_map_string_string())["c"] = "value"; - (*prototype.mutable_map_string_string())["b"] = "value"; - (*prototype.mutable_map_string_string())["a"] = "value"; - RunValidTextFormatTestWithMessage("AlphabeticallySortedMapStringKeys", - REQUIRED, - R"( - map_string_string { - key: "a" - value: "value" - } - map_string_string { - key: "b" - value: "value" - } - map_string_string { - key: "c" - value: "value" - } - )", - prototype); +void TextFormatConformanceTestSuite::RunTextFormatPerformanceTests() { + TestTextFormatPerformanceMergeMessageWithRepeatedField("Bool", + "repeated_bool: true"); + TestTextFormatPerformanceMergeMessageWithRepeatedField( + "Double", "repeated_double: 123"); + TestTextFormatPerformanceMergeMessageWithRepeatedField( + "Int32", "repeated_uint32: 123"); + TestTextFormatPerformanceMergeMessageWithRepeatedField( + "Int64", "repeated_uint64: 123"); + TestTextFormatPerformanceMergeMessageWithRepeatedField( + "String", R"(repeated_string: "foo")"); + TestTextFormatPerformanceMergeMessageWithRepeatedField( + "Bytes", R"(repeated_bytes: "foo")"); +} - prototype.Clear(); - (*prototype.mutable_map_int32_int32())[3] = 0; - (*prototype.mutable_map_int32_int32())[2] = 0; - (*prototype.mutable_map_int32_int32())[1] = 0; - RunValidTextFormatTestWithMessage("AlphabeticallySortedMapIntKeys", REQUIRED, - R"( - map_int32_int32 { - key: 1 - value: 0 - } - map_int32_int32 { - key: 2 - value: 0 - } - map_int32_int32 { - key: 3 - value: 0 - } - )", - prototype); +// This is currently considered valid input by some languages but not others +void TextFormatConformanceTestSuite:: + TestTextFormatPerformanceMergeMessageWithRepeatedField( + const string& test_type_name, const string& message_field) { + string recursive_message = + absl::StrCat("recursive_message { ", message_field, " }"); - prototype.Clear(); - (*prototype.mutable_map_bool_bool())[true] = false; - (*prototype.mutable_map_bool_bool())[false] = false; - RunValidTextFormatTestWithMessage("AlphabeticallySortedMapBoolKeys", REQUIRED, - R"( - map_bool_bool { - key: false - value: false - } - map_bool_bool { - key: true - value: false - } - )", - prototype); + string input; + for (size_t i = 0; i < kPerformanceRepeatCount; i++) { + absl::StrAppend(&input, recursive_message); + } + + string expected = "recursive_message { "; + for (size_t i = 0; i < kPerformanceRepeatCount; i++) { + absl::StrAppend(&expected, message_field, " "); + } + absl::StrAppend(&expected, "}"); + + RunValidTextFormatTestProto2WithExpected( + absl::StrCat("TestTextFormatPerformanceMergeMessageWithRepeatedField", + test_type_name, "Proto2"), + RECOMMENDED, input, expected); + RunValidTextFormatTestWithExpected( + absl::StrCat("TestTextFormatPerformanceMergeMessageWithRepeatedField", + test_type_name, "Proto3"), + RECOMMENDED, input, expected); } } // namespace protobuf diff --git a/conformance/text_format_conformance_suite.h b/conformance/text_format_conformance_suite.h index d68f4aa..045fdc2 100644 --- a/conformance/text_format_conformance_suite.h +++ b/conformance/text_format_conformance_suite.h @@ -1,32 +1,9 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. 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 Inc. 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. +// 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 #ifndef TEXT_FORMAT_CONFORMANCE_SUITE_H_ #define TEXT_FORMAT_CONFORMANCE_SUITE_H_ @@ -41,15 +18,29 @@ class TextFormatConformanceTestSuite : public ConformanceTestSuite { TextFormatConformanceTestSuite(); private: - void RunSuiteImpl(); + void RunSuiteImpl() override; + void RunTextFormatPerformanceTests(); void RunValidTextFormatTest(const std::string& test_name, ConformanceLevel level, const std::string& input); void RunValidTextFormatTestProto2(const std::string& test_name, ConformanceLevel level, const std::string& input); + void RunValidTextFormatTestWithExpected(const std::string& test_name, + ConformanceLevel level, + const std::string& input, + const std::string& expected); + void RunValidTextFormatTestProto2WithExpected(const std::string& test_name, + ConformanceLevel level, + const std::string& input, + const std::string& expected); + void RunValidTextFormatTestWithMessage(const std::string& test_name, + ConformanceLevel level, + const std::string& input_text, + const Message& prototype); void RunValidTextFormatTestWithMessage(const std::string& test_name, ConformanceLevel level, const std::string& input_text, + const std::string& expected_text, const Message& prototype); void RunValidUnknownTextFormatTest(const std::string& test_name, const Message& message); @@ -61,6 +52,8 @@ class TextFormatConformanceTestSuite : public ConformanceTestSuite { bool ParseResponse(const conformance::ConformanceResponse& response, const ConformanceRequestSetting& setting, Message* test_message) override; + void TestTextFormatPerformanceMergeMessageWithRepeatedField( + const std::string& test_type_name, const std::string& message_field); }; } // namespace protobuf diff --git a/conformance/text_format_failure_list_cpp.txt b/conformance/text_format_failure_list_cpp.txt new file mode 100644 index 0000000..a25f04f --- /dev/null +++ b/conformance/text_format_failure_list_cpp.txt @@ -0,0 +1,20 @@ +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString +Required.Proto3.TextFormatInput.StringFieldBadUTF8Hex +Required.Proto3.TextFormatInput.StringFieldBadUTF8Octal +Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes +Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString diff --git a/conformance/text_format_failure_list_dart_upb.txt b/conformance/text_format_failure_list_dart_upb.txt new file mode 100644 index 0000000..e69de29 diff --git a/conformance/text_format_failure_list_java.txt b/conformance/text_format_failure_list_java.txt index 81433b4..793aae1 100644 --- a/conformance/text_format_failure_list_java.txt +++ b/conformance/text_format_failure_list_java.txt @@ -4,3 +4,6 @@ Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput Required.Proto3.TextFormatInput.AnyField.ProtobufOutput Required.Proto3.TextFormatInput.AnyField.TextFormatOutput + +Required.Proto3.TextFormatInput.StringFieldBadUTF8Hex +Required.Proto3.TextFormatInput.StringFieldBadUTF8Octal diff --git a/conformance/text_format_failure_list_java_lite.txt b/conformance/text_format_failure_list_java_lite.txt new file mode 100644 index 0000000..61f1a96 --- /dev/null +++ b/conformance/text_format_failure_list_java_lite.txt @@ -0,0 +1,5 @@ +# This is the list of conformance tests that are known to fail for the Java +# Lite TextFormat implementation right now. These should be fixed. +# +# By listing them here we can keep tabs on which ones are failing and be sure +# that we don't introduce regressions in other tests. diff --git a/conformance/text_format_failure_list_jruby.txt b/conformance/text_format_failure_list_jruby.txt new file mode 100644 index 0000000..404b64a --- /dev/null +++ b/conformance/text_format_failure_list_jruby.txt @@ -0,0 +1,8 @@ +Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput +Recommended.Proto3.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput +Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput +Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput +Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput +Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput +Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput +Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Print.TextFormatOutput diff --git a/conformance/text_format_failure_list_python.txt b/conformance/text_format_failure_list_python.txt index b2db95e..6bf7c1a 100644 --- a/conformance/text_format_failure_list_python.txt +++ b/conformance/text_format_failure_list_python.txt @@ -3,3 +3,32 @@ # TODO: These should be fixed. Required.Proto3.TextFormatInput.FloatFieldMaxValue.ProtobufOutput Required.Proto3.TextFormatInput.FloatFieldMaxValue.TextFormatOutput + +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput diff --git a/conformance/text_format_failure_list_python_cpp.txt b/conformance/text_format_failure_list_python_cpp.txt new file mode 100644 index 0000000..91fc2ea --- /dev/null +++ b/conformance/text_format_failure_list_python_cpp.txt @@ -0,0 +1,28 @@ +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes +Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes +Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput +Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput diff --git a/conformance/text_format_failure_list_rust_cc.txt b/conformance/text_format_failure_list_rust_cc.txt new file mode 100644 index 0000000..e69de29 diff --git a/conformance/text_format_failure_list_rust_upb.txt b/conformance/text_format_failure_list_rust_upb.txt new file mode 100644 index 0000000..e69de29 diff --git a/conformance/third_party/jsoncpp/json.h b/conformance/third_party/jsoncpp/json.h deleted file mode 100644 index 5639c92..0000000 --- a/conformance/third_party/jsoncpp/json.h +++ /dev/null @@ -1,2075 +0,0 @@ -/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/). -/// It is intended to be used with #include "json/json.h" - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - -/* -The JsonCpp library's source code, including accompanying documentation, -tests and demonstration applications, are licensed under the following -conditions... - -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, -this software is released into the Public Domain. - -In jurisdictions which do not recognize Public Domain property (e.g. Germany as of -2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is -released under the terms of the MIT License (see below). - -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual -Public Domain/MIT License conditions described here, as they choose. - -The MIT License is about as close to Public Domain as a license can get, and is -described in clear, concise terms at: - - http://en.wikipedia.org/wiki/MIT_License - -The full text of the MIT License follows: - -======================================================================== -Copyright (c) 2007-2010 Baptiste Lepilleur - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, copy, -modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -======================================================================== -(END LICENSE TEXT) - -The MIT license is compatible with both the GPL and commercial -software, affording one all of the rights of Public Domain with the -minor nuisance of being required to keep the above copyright notice -and license text in the source code. Note also that by accepting the -Public Domain "license" you can re-license your copy using whatever -license you like. - -*/ - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - - - - - -#ifndef JSON_AMALGATED_H_INCLUDED -# define JSON_AMALGATED_H_INCLUDED -/// If defined, indicates that the source file is amalgated -/// to prevent private header inclusion. -#define JSON_IS_AMALGAMATION - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/version.h -// ////////////////////////////////////////////////////////////////////// - -// DO NOT EDIT. This file (and "version") is generated by CMake. -// Run CMake configure step to update it. -#ifndef JSON_VERSION_H_INCLUDED -# define JSON_VERSION_H_INCLUDED - -# define JSONCPP_VERSION_STRING "1.6.5" -# define JSONCPP_VERSION_MAJOR 1 -# define JSONCPP_VERSION_MINOR 6 -# define JSONCPP_VERSION_PATCH 5 -# define JSONCPP_VERSION_QUALIFIER -# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) - -#endif // JSON_VERSION_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/version.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/config.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_CONFIG_H_INCLUDED -#define JSON_CONFIG_H_INCLUDED - -/// If defined, indicates that json library is embedded in CppTL library. -//# define JSON_IN_CPPTL 1 - -/// If defined, indicates that json may leverage CppTL library -//# define JSON_USE_CPPTL 1 -/// If defined, indicates that cpptl vector based map should be used instead of -/// std::map -/// as Value container. -//# define JSON_USE_CPPTL_SMALLMAP 1 - -// If non-zero, the library uses exceptions to report bad input instead of C -// assertion macros. The default is to use exceptions. -#ifndef JSON_USE_EXCEPTION -#define JSON_USE_EXCEPTION 1 -#endif - -/// If defined, indicates that the source file is amalgated -/// to prevent private header inclusion. -/// Remarks: it is automatically defined in the generated amalgated header. -// #define JSON_IS_AMALGAMATION - -#ifdef JSON_IN_CPPTL -#include -#ifndef JSON_USE_CPPTL -#define JSON_USE_CPPTL 1 -#endif -#endif - -#ifdef JSON_IN_CPPTL -#define JSON_API CPPTL_API -#elif defined(JSON_DLL_BUILD) -#if defined(_MSC_VER) -#define JSON_API __declspec(dllexport) -#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING -#endif // if defined(_MSC_VER) -#elif defined(JSON_DLL) -#if defined(_MSC_VER) -#define JSON_API __declspec(dllimport) -#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING -#endif // if defined(_MSC_VER) -#endif // ifdef JSON_IN_CPPTL -#if !defined(JSON_API) -#define JSON_API -#endif - -// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for -// integer -// Storages, and 64 bits integer support is disabled. -// #define JSON_NO_INT64 1 - -#if defined(_MSC_VER) // MSVC -# if _MSC_VER <= 1200 // MSVC 6 - // Microsoft Visual Studio 6 only support conversion from __int64 to double - // (no conversion from unsigned __int64). -# define JSON_USE_INT64_DOUBLE_CONVERSION 1 - // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' - // characters in the debug information) - // All projects I've ever seen with VS6 were using this globally (not bothering - // with pragma push/pop). -# pragma warning(disable : 4786) -# endif // MSVC 6 - -# if _MSC_VER >= 1500 // MSVC 2008 - /// Indicates that the following function is deprecated. -# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) -# endif - -#endif // defined(_MSC_VER) - - -#ifndef JSON_HAS_RVALUE_REFERENCES - -#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 -#define JSON_HAS_RVALUE_REFERENCES 1 -#endif // MSVC >= 2010 - -#ifdef __clang__ -#if __has_feature(cxx_rvalue_references) -#define JSON_HAS_RVALUE_REFERENCES 1 -#endif // has_feature - -#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) -#define JSON_HAS_RVALUE_REFERENCES 1 -#endif // GXX_EXPERIMENTAL - -#endif // __clang__ || __GNUC__ - -#endif // not defined JSON_HAS_RVALUE_REFERENCES - -#ifndef JSON_HAS_RVALUE_REFERENCES -#define JSON_HAS_RVALUE_REFERENCES 0 -#endif - -#ifdef __clang__ -#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) -# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) -# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) -# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) -# endif // GNUC version -#endif // __clang__ || __GNUC__ - -#if !defined(JSONCPP_DEPRECATED) -#define JSONCPP_DEPRECATED(message) -#endif // if !defined(JSONCPP_DEPRECATED) - -namespace Json { -typedef int Int; -typedef unsigned int UInt; -#if defined(JSON_NO_INT64) -typedef int LargestInt; -typedef unsigned int LargestUInt; -#undef JSON_HAS_INT64 -#else // if defined(JSON_NO_INT64) -// For Microsoft Visual use specific types as long long is not supported -#if defined(_MSC_VER) // Microsoft Visual Studio -typedef __int64 Int64; -typedef unsigned __int64 UInt64; -#else // if defined(_MSC_VER) // Other platforms, use long long -typedef long long int Int64; -typedef unsigned long long int UInt64; -#endif // if defined(_MSC_VER) -typedef Int64 LargestInt; -typedef UInt64 LargestUInt; -#define JSON_HAS_INT64 -#endif // if defined(JSON_NO_INT64) -} // end namespace Json - -#endif // JSON_CONFIG_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/config.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/forwards.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_FORWARDS_H_INCLUDED -#define JSON_FORWARDS_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "config.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - -// writer.h -class FastWriter; -class StyledWriter; - -// reader.h -class Reader; - -// features.h -class Features; - -// value.h -typedef unsigned int ArrayIndex; -class StaticString; -class Path; -class PathArgument; -class Value; -class ValueIteratorBase; -class ValueIterator; -class ValueConstIterator; - -} // namespace Json - -#endif // JSON_FORWARDS_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/forwards.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/features.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_FEATURES_H_INCLUDED -#define CPPTL_JSON_FEATURES_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "forwards.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - -/** \brief Configuration passed to reader and writer. - * This configuration object can be used to force the Reader or Writer - * to behave in a standard conforming way. - */ -class JSON_API Features { -public: - /** \brief A configuration that allows all features and assumes all strings - * are UTF-8. - * - C & C++ comments are allowed - * - Root object can be any JSON value - * - Assumes Value strings are encoded in UTF-8 - */ - static Features all(); - - /** \brief A configuration that is strictly compatible with the JSON - * specification. - * - Comments are forbidden. - * - Root object must be either an array or an object value. - * - Assumes Value strings are encoded in UTF-8 - */ - static Features strictMode(); - - /** \brief Initialize the configuration like JsonConfig::allFeatures; - */ - Features(); - - /// \c true if comments are allowed. Default: \c true. - bool allowComments_; - - /// \c true if root must be either an array or an object value. Default: \c - /// false. - bool strictRoot_; - - /// \c true if dropped null placeholders are allowed. Default: \c false. - bool allowDroppedNullPlaceholders_; - - /// \c true if numeric object key are allowed. Default: \c false. - bool allowNumericKeys_; -}; - -} // namespace Json - -#endif // CPPTL_JSON_FEATURES_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/features.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/value.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_H_INCLUDED -#define CPPTL_JSON_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "forwards.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include - -#ifndef JSON_USE_CPPTL_SMALLMAP -#include -#else -#include -#endif -#ifdef JSON_USE_CPPTL -#include -#endif - -// Disable warning C4251: : needs to have dll-interface to -// be used by... -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(push) -#pragma warning(disable : 4251) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -/** \brief JSON (JavaScript Object Notation). - */ -namespace Json { - -/** Base class for all exceptions we throw. - * - * We use nothing but these internally. Of course, STL can throw others. - */ -class JSON_API Exception : public std::exception { -public: - Exception(std::string const& msg); - ~Exception() throw() override; - char const* what() const throw() override; -protected: - std::string msg_; -}; - -/** Exceptions which the user cannot easily avoid. - * - * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input - * - * \remark derived from Json::Exception - */ -class JSON_API RuntimeError : public Exception { -public: - RuntimeError(std::string const& msg); -}; - -/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. - * - * These are precondition-violations (user bugs) and internal errors (our bugs). - * - * \remark derived from Json::Exception - */ -class JSON_API LogicError : public Exception { -public: - LogicError(std::string const& msg); -}; - -/// used internally -void throwRuntimeError(std::string const& msg); -/// used internally -void throwLogicError(std::string const& msg); - -/** \brief Type of the value held by a Value object. - */ -enum ValueType { - nullValue = 0, ///< 'null' value - intValue, ///< signed integer value - uintValue, ///< unsigned integer value - realValue, ///< double value - stringValue, ///< UTF-8 string value - booleanValue, ///< bool value - arrayValue, ///< array value (ordered list) - objectValue ///< object value (collection of name/value pairs). -}; - -enum CommentPlacement { - commentBefore = 0, ///< a comment placed on the line before a value - commentAfterOnSameLine, ///< a comment just after a value on the same line - commentAfter, ///< a comment on the line after a value (only make sense for - /// root value) - numberOfCommentPlacement -}; - -//# ifdef JSON_USE_CPPTL -// typedef CppTL::AnyEnumerator EnumMemberNames; -// typedef CppTL::AnyEnumerator EnumValues; -//# endif - -/** \brief Lightweight wrapper to tag static string. - * - * Value constructor and objectValue member assignement takes advantage of the - * StaticString and avoid the cost of string duplication when storing the - * string or the member name. - * - * Example of usage: - * \code - * Json::Value aValue( StaticString("some text") ); - * Json::Value object; - * static const StaticString code("code"); - * object[code] = 1234; - * \endcode - */ -class JSON_API StaticString { -public: - explicit StaticString(const char* czstring) : c_str_(czstring) {} - - operator const char*() const { return c_str_; } - - const char* c_str() const { return c_str_; } - -private: - const char* c_str_; -}; - -/** \brief Represents a JSON value. - * - * This class is a discriminated union wrapper that can represents a: - * - signed integer [range: Value::minInt - Value::maxInt] - * - unsigned integer (range: 0 - Value::maxUInt) - * - double - * - UTF-8 string - * - boolean - * - 'null' - * - an ordered list of Value - * - collection of name/value pairs (javascript object) - * - * The type of the held value is represented by a #ValueType and - * can be obtained using type(). - * - * Values of an #objectValue or #arrayValue can be accessed using operator[]() - * methods. - * Non-const methods will automatically create the a #nullValue element - * if it does not exist. - * The sequence of an #arrayValue will be automatically resized and initialized - * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. - * - * The get() methods can be used to obtain default value in the case the - * required element does not exist. - * - * It is possible to iterate over the list of a #objectValue values using - * the getMemberNames() method. - * - * \note #Value string-length fit in size_t, but keys must be < 2^30. - * (The reason is an implementation detail.) A #CharReader will raise an - * exception if a bound is exceeded to avoid security holes in your app, - * but the Value API does *not* check bounds. That is the responsibility - * of the caller. - */ -class JSON_API Value { - friend class ValueIteratorBase; -public: - typedef std::vector Members; - typedef ValueIterator iterator; - typedef ValueConstIterator const_iterator; - typedef Json::UInt UInt; - typedef Json::Int Int; -#if defined(JSON_HAS_INT64) - typedef Json::UInt64 UInt64; - typedef Json::Int64 Int64; -#endif // defined(JSON_HAS_INT64) - typedef Json::LargestInt LargestInt; - typedef Json::LargestUInt LargestUInt; - typedef Json::ArrayIndex ArrayIndex; - - static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value(). - static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null - /// Minimum signed integer value that can be stored in a Json::Value. - static const LargestInt minLargestInt; - /// Maximum signed integer value that can be stored in a Json::Value. - static const LargestInt maxLargestInt; - /// Maximum unsigned integer value that can be stored in a Json::Value. - static const LargestUInt maxLargestUInt; - - /// Minimum signed int value that can be stored in a Json::Value. - static const Int minInt; - /// Maximum signed int value that can be stored in a Json::Value. - static const Int maxInt; - /// Maximum unsigned int value that can be stored in a Json::Value. - static const UInt maxUInt; - -#if defined(JSON_HAS_INT64) - /// Minimum signed 64 bits int value that can be stored in a Json::Value. - static const Int64 minInt64; - /// Maximum signed 64 bits int value that can be stored in a Json::Value. - static const Int64 maxInt64; - /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. - static const UInt64 maxUInt64; -#endif // defined(JSON_HAS_INT64) - -private: -#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - class CZString { - public: - enum DuplicationPolicy { - noDuplication = 0, - duplicate, - duplicateOnCopy - }; - CZString(ArrayIndex index); - CZString(char const* str, unsigned length, DuplicationPolicy allocate); - CZString(CZString const& other); -#if JSON_HAS_RVALUE_REFERENCES - CZString(CZString&& other); -#endif - ~CZString(); - CZString& operator=(CZString other); - bool operator<(CZString const& other) const; - bool operator==(CZString const& other) const; - ArrayIndex index() const; - //const char* c_str() const; ///< \deprecated - char const* data() const; - unsigned length() const; - bool isStaticString() const; - - private: - void swap(CZString& other); - - struct StringStorage { - unsigned policy_: 2; - unsigned length_: 30; // 1GB max - }; - - char const* cstr_; // actually, a prefixed string, unless policy is noDup - union { - ArrayIndex index_; - StringStorage storage_; - }; - }; - -public: -#ifndef JSON_USE_CPPTL_SMALLMAP - typedef std::map ObjectValues; -#else - typedef CppTL::SmallMap ObjectValues; -#endif // ifndef JSON_USE_CPPTL_SMALLMAP -#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION - -public: - /** \brief Create a default Value of the given type. - - This is a very useful constructor. - To create an empty array, pass arrayValue. - To create an empty object, pass objectValue. - Another Value can then be set to this one by assignment. -This is useful since clear() and resize() will not alter types. - - Examples: -\code -Json::Value null_value; // null -Json::Value arr_value(Json::arrayValue); // [] -Json::Value obj_value(Json::objectValue); // {} -\endcode - */ - Value(ValueType type = nullValue); - Value(Int value); - Value(UInt value); -#if defined(JSON_HAS_INT64) - Value(Int64 value); - Value(UInt64 value); -#endif // if defined(JSON_HAS_INT64) - Value(double value); - Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.) - Value(const char* begin, const char* end); ///< Copy all, incl zeroes. - /** \brief Constructs a value from a static string. - - * Like other value string constructor but do not duplicate the string for - * internal storage. The given string must remain alive after the call to this - * constructor. - * \note This works only for null-terminated strings. (We cannot change the - * size of this class, so we have nowhere to store the length, - * which might be computed later for various operations.) - * - * Example of usage: - * \code - * static StaticString foo("some text"); - * Json::Value aValue(foo); - * \endcode - */ - Value(const StaticString& value); - Value(const std::string& value); ///< Copy data() til size(). Embedded zeroes too. -#ifdef JSON_USE_CPPTL - Value(const CppTL::ConstString& value); -#endif - Value(bool value); - /// Deep copy. - Value(const Value& other); -#if JSON_HAS_RVALUE_REFERENCES - /// Move constructor - Value(Value&& other); -#endif - ~Value(); - - /// Deep copy, then swap(other). - /// \note Over-write existing comments. To preserve comments, use #swapPayload(). - Value& operator=(Value other); - /// Swap everything. - void swap(Value& other); - /// Swap values but leave comments and source offsets in place. - void swapPayload(Value& other); - - ValueType type() const; - - /// Compare payload only, not comments etc. - bool operator<(const Value& other) const; - bool operator<=(const Value& other) const; - bool operator>=(const Value& other) const; - bool operator>(const Value& other) const; - bool operator==(const Value& other) const; - bool operator!=(const Value& other) const; - int compare(const Value& other) const; - - const char* asCString() const; ///< Embedded zeroes could cause you trouble! - std::string asString() const; ///< Embedded zeroes are possible. - /** Get raw char* of string-value. - * \return false if !string. (Seg-fault if str or end are NULL.) - */ - bool getString( - char const** begin, char const** end) const; -#ifdef JSON_USE_CPPTL - CppTL::ConstString asConstString() const; -#endif - Int asInt() const; - UInt asUInt() const; -#if defined(JSON_HAS_INT64) - Int64 asInt64() const; - UInt64 asUInt64() const; -#endif // if defined(JSON_HAS_INT64) - LargestInt asLargestInt() const; - LargestUInt asLargestUInt() const; - float asFloat() const; - double asDouble() const; - bool asBool() const; - - bool isNull() const; - bool isBool() const; - bool isInt() const; - bool isInt64() const; - bool isUInt() const; - bool isUInt64() const; - bool isIntegral() const; - bool isDouble() const; - bool isNumeric() const; - bool isString() const; - bool isArray() const; - bool isObject() const; - - bool isConvertibleTo(ValueType other) const; - - /// Number of values in array or object - ArrayIndex size() const; - - /// \brief Return true if empty array, empty object, or null; - /// otherwise, false. - bool empty() const; - - /// Return isNull() - bool operator!() const; - - /// Remove all object members and array elements. - /// \pre type() is arrayValue, objectValue, or nullValue - /// \post type() is unchanged - void clear(); - - /// Resize the array to size elements. - /// New elements are initialized to null. - /// May only be called on nullValue or arrayValue. - /// \pre type() is arrayValue or nullValue - /// \post type() is arrayValue - void resize(ArrayIndex size); - - /// Access an array element (zero based index ). - /// If the array contains less than index element, then null value are - /// inserted - /// in the array so that its size is index+1. - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - Value& operator[](ArrayIndex index); - - /// Access an array element (zero based index ). - /// If the array contains less than index element, then null value are - /// inserted - /// in the array so that its size is index+1. - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - Value& operator[](int index); - - /// Access an array element (zero based index ) - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - const Value& operator[](ArrayIndex index) const; - - /// Access an array element (zero based index ) - /// (You may need to say 'value[0u]' to get your compiler to distinguish - /// this from the operator[] which takes a string.) - const Value& operator[](int index) const; - - /// If the array contains at least index+1 elements, returns the element - /// value, - /// otherwise returns defaultValue. - Value get(ArrayIndex index, const Value& defaultValue) const; - /// Return true if index < size(). - bool isValidIndex(ArrayIndex index) const; - /// \brief Append value to array at the end. - /// - /// Equivalent to jsonvalue[jsonvalue.size()] = value; - Value& append(const Value& value); - - /// Access an object value by name, create a null member if it does not exist. - /// \note Because of our implementation, keys are limited to 2^30 -1 chars. - /// Exceeding that will cause an exception. - Value& operator[](const char* key); - /// Access an object value by name, returns null if there is no member with - /// that name. - const Value& operator[](const char* key) const; - /// Access an object value by name, create a null member if it does not exist. - /// \param key may contain embedded nulls. - Value& operator[](const std::string& key); - /// Access an object value by name, returns null if there is no member with - /// that name. - /// \param key may contain embedded nulls. - const Value& operator[](const std::string& key) const; - /** \brief Access an object value by name, create a null member if it does not - exist. - - * If the object has no entry for that name, then the member name used to store - * the new entry is not duplicated. - * Example of use: - * \code - * Json::Value object; - * static const StaticString code("code"); - * object[code] = 1234; - * \endcode - */ - Value& operator[](const StaticString& key); -#ifdef JSON_USE_CPPTL - /// Access an object value by name, create a null member if it does not exist. - Value& operator[](const CppTL::ConstString& key); - /// Access an object value by name, returns null if there is no member with - /// that name. - const Value& operator[](const CppTL::ConstString& key) const; -#endif - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - Value get(const char* key, const Value& defaultValue) const; - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - /// \note key may contain embedded nulls. - Value get(const char* begin, const char* end, const Value& defaultValue) const; - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - /// \param key may contain embedded nulls. - Value get(const std::string& key, const Value& defaultValue) const; -#ifdef JSON_USE_CPPTL - /// Return the member named key if it exist, defaultValue otherwise. - /// \note deep copy - Value get(const CppTL::ConstString& key, const Value& defaultValue) const; -#endif - /// Most general and efficient version of isMember()const, get()const, - /// and operator[]const - /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30 - Value const* find(char const* begin, char const* end) const; - /// Most general and efficient version of object-mutators. - /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30 - /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue. - Value const* demand(char const* begin, char const* end); - /// \brief Remove and return the named member. - /// - /// Do nothing if it did not exist. - /// \return the removed Value, or null. - /// \pre type() is objectValue or nullValue - /// \post type() is unchanged - /// \deprecated - Value removeMember(const char* key); - /// Same as removeMember(const char*) - /// \param key may contain embedded nulls. - /// \deprecated - Value removeMember(const std::string& key); - /// Same as removeMember(const char* begin, const char* end, Value* removed), - /// but 'key' is null-terminated. - bool removeMember(const char* key, Value* removed); - /** \brief Remove the named map member. - - Update 'removed' iff removed. - \param key may contain embedded nulls. - \return true iff removed (no exceptions) - */ - bool removeMember(std::string const& key, Value* removed); - /// Same as removeMember(std::string const& key, Value* removed) - bool removeMember(const char* begin, const char* end, Value* removed); - /** \brief Remove the indexed array element. - - O(n) expensive operations. - Update 'removed' iff removed. - \return true iff removed (no exceptions) - */ - bool removeIndex(ArrayIndex i, Value* removed); - - /// Return true if the object has a member named key. - /// \note 'key' must be null-terminated. - bool isMember(const char* key) const; - /// Return true if the object has a member named key. - /// \param key may contain embedded nulls. - bool isMember(const std::string& key) const; - /// Same as isMember(std::string const& key)const - bool isMember(const char* begin, const char* end) const; -#ifdef JSON_USE_CPPTL - /// Return true if the object has a member named key. - bool isMember(const CppTL::ConstString& key) const; -#endif - - /// \brief Return a list of the member names. - /// - /// If null, return an empty list. - /// \pre type() is objectValue or nullValue - /// \post if type() was nullValue, it remains nullValue - Members getMemberNames() const; - - //# ifdef JSON_USE_CPPTL - // EnumMemberNames enumMemberNames() const; - // EnumValues enumValues() const; - //# endif - - /// \deprecated Always pass len. - JSONCPP_DEPRECATED("Use setComment(std::string const&) instead.") - void setComment(const char* comment, CommentPlacement placement); - /// Comments must be //... or /* ... */ - void setComment(const char* comment, size_t len, CommentPlacement placement); - /// Comments must be //... or /* ... */ - void setComment(const std::string& comment, CommentPlacement placement); - bool hasComment(CommentPlacement placement) const; - /// Include delimiters and embedded newlines. - std::string getComment(CommentPlacement placement) const; - - std::string toStyledString() const; - - const_iterator begin() const; - const_iterator end() const; - - iterator begin(); - iterator end(); - - // Accessors for the [start, limit) range of bytes within the JSON text from - // which this value was parsed, if any. - void setOffsetStart(size_t start); - void setOffsetLimit(size_t limit); - size_t getOffsetStart() const; - size_t getOffsetLimit() const; - -private: - void initBasic(ValueType type, bool allocated = false); - - Value& resolveReference(const char* key); - Value& resolveReference(const char* key, const char* end); - - struct CommentInfo { - CommentInfo(); - ~CommentInfo(); - - void setComment(const char* text, size_t len); - - char* comment_; - }; - - // struct MemberNamesTransform - //{ - // typedef const char *result_type; - // const char *operator()( const CZString &name ) const - // { - // return name.c_str(); - // } - //}; - - union ValueHolder { - LargestInt int_; - LargestUInt uint_; - double real_; - bool bool_; - char* string_; // actually ptr to unsigned, followed by str, unless !allocated_ - ObjectValues* map_; - } value_; - ValueType type_ : 8; - unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. - // If not allocated_, string_ must be null-terminated. - CommentInfo* comments_; - - // [start, limit) byte offsets in the source JSON text from which this Value - // was extracted. - size_t start_; - size_t limit_; -}; - -/** \brief Experimental and untested: represents an element of the "path" to - * access a node. - */ -class JSON_API PathArgument { -public: - friend class Path; - - PathArgument(); - PathArgument(ArrayIndex index); - PathArgument(const char* key); - PathArgument(const std::string& key); - -private: - enum Kind { - kindNone = 0, - kindIndex, - kindKey - }; - std::string key_; - ArrayIndex index_; - Kind kind_; -}; - -/** \brief Experimental and untested: represents a "path" to access a node. - * - * Syntax: - * - "." => root node - * - ".[n]" => elements at index 'n' of root node (an array value) - * - ".name" => member named 'name' of root node (an object value) - * - ".name1.name2.name3" - * - ".[0][1][2].name1[3]" - * - ".%" => member name is provided as parameter - * - ".[%]" => index is provided as parameter - */ -class JSON_API Path { -public: - Path(const std::string& path, - const PathArgument& a1 = PathArgument(), - const PathArgument& a2 = PathArgument(), - const PathArgument& a3 = PathArgument(), - const PathArgument& a4 = PathArgument(), - const PathArgument& a5 = PathArgument()); - - const Value& resolve(const Value& root) const; - Value resolve(const Value& root, const Value& defaultValue) const; - /// Creates the "path" to access the specified node and returns a reference on - /// the node. - Value& make(Value& root) const; - -private: - typedef std::vector InArgs; - typedef std::vector Args; - - void makePath(const std::string& path, const InArgs& in); - void addPathInArg(const std::string& path, - const InArgs& in, - InArgs::const_iterator& itInArg, - PathArgument::Kind kind); - void invalidPath(const std::string& path, int location); - - Args args_; -}; - -/** \brief base class for Value iterators. - * - */ -class JSON_API ValueIteratorBase { -public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef unsigned int size_t; - typedef int difference_type; - typedef ValueIteratorBase SelfType; - - bool operator==(const SelfType& other) const { return isEqual(other); } - - bool operator!=(const SelfType& other) const { return !isEqual(other); } - - difference_type operator-(const SelfType& other) const { - return other.computeDistance(*this); - } - - /// Return either the index or the member name of the referenced value as a - /// Value. - Value key() const; - - /// Return the index of the referenced Value, or -1 if it is not an arrayValue. - UInt index() const; - - /// Return the member name of the referenced Value, or "" if it is not an - /// objectValue. - /// \note Avoid `c_str()` on result, as embedded zeroes are possible. - std::string name() const; - - /// Return the member name of the referenced Value. "" if it is not an - /// objectValue. - /// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls. - JSONCPP_DEPRECATED("Use `key = name();` instead.") - char const* memberName() const; - /// Return the member name of the referenced Value, or NULL if it is not an - /// objectValue. - /// \note Better version than memberName(). Allows embedded nulls. - char const* memberName(char const** end) const; - -protected: - Value& deref() const; - - void increment(); - - void decrement(); - - difference_type computeDistance(const SelfType& other) const; - - bool isEqual(const SelfType& other) const; - - void copy(const SelfType& other); - -private: - Value::ObjectValues::iterator current_; - // Indicates that iterator is for a null value. - bool isNull_; - -public: - // For some reason, BORLAND needs these at the end, rather - // than earlier. No idea why. - ValueIteratorBase(); - explicit ValueIteratorBase(const Value::ObjectValues::iterator& current); -}; - -/** \brief const iterator for object and array value. - * - */ -class JSON_API ValueConstIterator : public ValueIteratorBase { - friend class Value; - -public: - typedef const Value value_type; - //typedef unsigned int size_t; - //typedef int difference_type; - typedef const Value& reference; - typedef const Value* pointer; - typedef ValueConstIterator SelfType; - - ValueConstIterator(); - ValueConstIterator(ValueIterator const& other); - -private: -/*! \internal Use by Value to create an iterator. - */ - explicit ValueConstIterator(const Value::ObjectValues::iterator& current); -public: - SelfType& operator=(const ValueIteratorBase& other); - - SelfType operator++(int) { - SelfType temp(*this); - ++*this; - return temp; - } - - SelfType operator--(int) { - SelfType temp(*this); - --*this; - return temp; - } - - SelfType& operator--() { - decrement(); - return *this; - } - - SelfType& operator++() { - increment(); - return *this; - } - - reference operator*() const { return deref(); } - - pointer operator->() const { return &deref(); } -}; - -/** \brief Iterator for object and array value. - */ -class JSON_API ValueIterator : public ValueIteratorBase { - friend class Value; - -public: - typedef Value value_type; - typedef unsigned int size_t; - typedef int difference_type; - typedef Value& reference; - typedef Value* pointer; - typedef ValueIterator SelfType; - - ValueIterator(); - explicit ValueIterator(const ValueConstIterator& other); - ValueIterator(const ValueIterator& other); - -private: -/*! \internal Use by Value to create an iterator. - */ - explicit ValueIterator(const Value::ObjectValues::iterator& current); -public: - SelfType& operator=(const SelfType& other); - - SelfType operator++(int) { - SelfType temp(*this); - ++*this; - return temp; - } - - SelfType operator--(int) { - SelfType temp(*this); - --*this; - return temp; - } - - SelfType& operator--() { - decrement(); - return *this; - } - - SelfType& operator++() { - increment(); - return *this; - } - - reference operator*() const { return deref(); } - - pointer operator->() const { return &deref(); } -}; - -} // namespace Json - - -namespace std { -/// Specialize std::swap() for Json::Value. -template<> -inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); } -} - - -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(pop) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#endif // CPPTL_JSON_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/value.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/reader.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_READER_H_INCLUDED -#define CPPTL_JSON_READER_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "features.h" -#include "value.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include - -// Disable warning C4251: : needs to have dll-interface to -// be used by... -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(push) -#pragma warning(disable : 4251) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -namespace Json { - -/** \brief Unserialize a JSON document into a - *Value. - * - * \deprecated Use CharReader and CharReaderBuilder. - */ -class JSON_API Reader { -public: - typedef char Char; - typedef const Char* Location; - - /** \brief An error tagged with where in the JSON text it was encountered. - * - * The offsets give the [start, limit) range of bytes within the text. Note - * that this is bytes, not codepoints. - * - */ - struct StructuredError { - size_t offset_start; - size_t offset_limit; - std::string message; - }; - - /** \brief Constructs a Reader allowing all features - * for parsing. - */ - Reader(); - - /** \brief Constructs a Reader allowing the specified feature set - * for parsing. - */ - Reader(const Features& features); - - /** \brief Read a Value from a JSON - * document. - * \param document UTF-8 encoded string containing the document to read. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param collectComments \c true to collect comment and allow writing them - * back during - * serialization, \c false to discard comments. - * This parameter is ignored if - * Features::allowComments_ - * is \c false. - * \return \c true if the document was successfully parsed, \c false if an - * error occurred. - */ - bool - parse(const std::string& document, Value& root, bool collectComments = true); - - /** \brief Read a Value from a JSON - document. - * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the - document to read. - * \param endDoc Pointer on the end of the UTF-8 encoded string of the - document to read. - * Must be >= beginDoc. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param collectComments \c true to collect comment and allow writing them - back during - * serialization, \c false to discard comments. - * This parameter is ignored if - Features::allowComments_ - * is \c false. - * \return \c true if the document was successfully parsed, \c false if an - error occurred. - */ - bool parse(const char* beginDoc, - const char* endDoc, - Value& root, - bool collectComments = true); - - /// \brief Parse from input stream. - /// \see Json::operator>>(std::istream&, Json::Value&). - bool parse(std::istream& is, Value& root, bool collectComments = true); - - /** \brief Returns a user friendly string that list errors in the parsed - * document. - * \return Formatted error message with the list of errors with their location - * in - * the parsed document. An empty string is returned if no error - * occurred - * during parsing. - * \deprecated Use getFormattedErrorMessages() instead (typo fix). - */ - JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.") - std::string getFormatedErrorMessages() const; - - /** \brief Returns a user friendly string that list errors in the parsed - * document. - * \return Formatted error message with the list of errors with their location - * in - * the parsed document. An empty string is returned if no error - * occurred - * during parsing. - */ - std::string getFormattedErrorMessages() const; - - /** \brief Returns a vector of structured errors encounted while parsing. - * \return A (possibly empty) vector of StructuredError objects. Currently - * only one error can be returned, but the caller should tolerate - * multiple - * errors. This can occur if the parser recovers from a non-fatal - * parse error and then encounters additional errors. - */ - std::vector getStructuredErrors() const; - - /** \brief Add a semantic error message. - * \param value JSON Value location associated with the error - * \param message The error message. - * \return \c true if the error was successfully added, \c false if the - * Value offset exceeds the document size. - */ - bool pushError(const Value& value, const std::string& message); - - /** \brief Add a semantic error message with extra context. - * \param value JSON Value location associated with the error - * \param message The error message. - * \param extra Additional JSON Value location to contextualize the error - * \return \c true if the error was successfully added, \c false if either - * Value offset exceeds the document size. - */ - bool pushError(const Value& value, const std::string& message, const Value& extra); - - /** \brief Return whether there are any errors. - * \return \c true if there are no errors to report \c false if - * errors have occurred. - */ - bool good() const; - -private: - enum TokenType { - tokenEndOfStream = 0, - tokenObjectBegin, - tokenObjectEnd, - tokenArrayBegin, - tokenArrayEnd, - tokenString, - tokenNumber, - tokenTrue, - tokenFalse, - tokenNull, - tokenArraySeparator, - tokenMemberSeparator, - tokenComment, - tokenError - }; - - class Token { - public: - TokenType type_; - Location start_; - Location end_; - }; - - class ErrorInfo { - public: - Token token_; - std::string message_; - Location extra_; - }; - - typedef std::deque Errors; - - bool readToken(Token& token); - void skipSpaces(); - bool match(Location pattern, int patternLength); - bool readComment(); - bool readCStyleComment(); - bool readCppStyleComment(); - bool readString(); - void readNumber(); - bool readValue(); - bool readObject(Token& token); - bool readArray(Token& token); - bool decodeNumber(Token& token); - bool decodeNumber(Token& token, Value& decoded); - bool decodeString(Token& token); - bool decodeString(Token& token, std::string& decoded); - bool decodeDouble(Token& token); - bool decodeDouble(Token& token, Value& decoded); - bool decodeUnicodeCodePoint(Token& token, - Location& current, - Location end, - unsigned int& unicode); - bool decodeUnicodeEscapeSequence(Token& token, - Location& current, - Location end, - unsigned int& unicode); - bool addError(const std::string& message, Token& token, Location extra = 0); - bool recoverFromError(TokenType skipUntilToken); - bool addErrorAndRecover(const std::string& message, - Token& token, - TokenType skipUntilToken); - void skipUntilSpace(); - Value& currentValue(); - Char getNextChar(); - void - getLocationLineAndColumn(Location location, int& line, int& column) const; - std::string getLocationLineAndColumn(Location location) const; - void addComment(Location begin, Location end, CommentPlacement placement); - void skipCommentTokens(Token& token); - - typedef std::stack Nodes; - Nodes nodes_; - Errors errors_; - std::string document_; - Location begin_; - Location end_; - Location current_; - Location lastValueEnd_; - Value* lastValue_; - std::string commentsBefore_; - Features features_; - bool collectComments_; -}; // Reader - -/** Interface for reading JSON from a char array. - */ -class JSON_API CharReader { -public: - virtual ~CharReader() {} - /** \brief Read a Value from a JSON - document. - * The document must be a UTF-8 encoded string containing the document to read. - * - * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the - document to read. - * \param endDoc Pointer on the end of the UTF-8 encoded string of the - document to read. - * Must be >= beginDoc. - * \param root [out] Contains the root value of the document if it was - * successfully parsed. - * \param errs [out] Formatted error messages (if not NULL) - * a user friendly string that lists errors in the parsed - * document. - * \return \c true if the document was successfully parsed, \c false if an - error occurred. - */ - virtual bool parse( - char const* beginDoc, char const* endDoc, - Value* root, std::string* errs) = 0; - - class JSON_API Factory { - public: - virtual ~Factory() {} - /** \brief Allocate a CharReader via operator new(). - * \throw std::exception if something goes wrong (e.g. invalid settings) - */ - virtual CharReader* newCharReader() const = 0; - }; // Factory -}; // CharReader - -/** \brief Build a CharReader implementation. - -Usage: -\code - using namespace Json; - CharReaderBuilder builder; - builder["collectComments"] = false; - Value value; - std::string errs; - bool ok = parseFromStream(builder, std::cin, &value, &errs); -\endcode -*/ -class JSON_API CharReaderBuilder : public CharReader::Factory { -public: - // Note: We use a Json::Value so that we can add data-members to this class - // without a major version bump. - /** Configuration of this builder. - These are case-sensitive. - Available settings (case-sensitive): - - `"collectComments": false or true` - - true to collect comment and allow writing them - back during serialization, false to discard comments. - This parameter is ignored if allowComments is false. - - `"allowComments": false or true` - - true if comments are allowed. - - `"strictRoot": false or true` - - true if root must be either an array or an object value - - `"allowDroppedNullPlaceholders": false or true` - - true if dropped null placeholders are allowed. (See StreamWriterBuilder.) - - `"allowNumericKeys": false or true` - - true if numeric object keys are allowed. - - `"allowSingleQuotes": false or true` - - true if '' are allowed for strings (both keys and values) - - `"stackLimit": integer` - - Exceeding stackLimit (recursive depth of `readValue()`) will - cause an exception. - - This is a security issue (seg-faults caused by deeply nested JSON), - so the default is low. - - `"failIfExtra": false or true` - - If true, `parse()` returns false when extra non-whitespace trails - the JSON value in the input string. - - `"rejectDupKeys": false or true` - - If true, `parse()` returns false when a key is duplicated within an object. - - `"allowSpecialFloats": false or true` - - If true, special float values (NaNs and infinities) are allowed - and their values are lossfree restorable. - - You can examine 'settings_` yourself - to see the defaults. You can also write and read them just like any - JSON Value. - \sa setDefaults() - */ - Json::Value settings_; - - CharReaderBuilder(); - ~CharReaderBuilder() override; - - CharReader* newCharReader() const override; - - /** \return true if 'settings' are legal and consistent; - * otherwise, indicate bad settings via 'invalid'. - */ - bool validate(Json::Value* invalid) const; - - /** A simple way to update a specific setting. - */ - Value& operator[](std::string key); - - /** Called by ctor, but you can use this to reset settings_. - * \pre 'settings' != NULL (but Json::null is fine) - * \remark Defaults: - * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults - */ - static void setDefaults(Json::Value* settings); - /** Same as old Features::strictMode(). - * \pre 'settings' != NULL (but Json::null is fine) - * \remark Defaults: - * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode - */ - static void strictMode(Json::Value* settings); -}; - -/** Consume entire stream and use its begin/end. - * Someday we might have a real StreamReader, but for now this - * is convenient. - */ -bool JSON_API parseFromStream( - CharReader::Factory const&, - std::istream&, - Value* root, std::string* errs); - -/** \brief Read from 'sin' into 'root'. - - Always keep comments from the input JSON. - - This can be used to read a file into a particular sub-object. - For example: - \code - Json::Value root; - cin >> root["dir"]["file"]; - cout << root; - \endcode - Result: - \verbatim - { - "dir": { - "file": { - // The input stream JSON would be nested here. - } - } - } - \endverbatim - \throw std::exception on parse error. - \see Json::operator<<() -*/ -JSON_API std::istream& operator>>(std::istream&, Value&); - -} // namespace Json - -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(pop) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#endif // CPPTL_JSON_READER_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/reader.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/writer.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef JSON_WRITER_H_INCLUDED -#define JSON_WRITER_H_INCLUDED - -#if !defined(JSON_IS_AMALGAMATION) -#include "value.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include - -// Disable warning C4251: : needs to have dll-interface to -// be used by... -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(push) -#pragma warning(disable : 4251) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -namespace Json { - -class Value; - -/** - -Usage: -\code - using namespace Json; - void writeToStdout(StreamWriter::Factory const& factory, Value const& value) { - std::unique_ptr const writer( - factory.newStreamWriter()); - writer->write(value, &std::cout); - std::cout << std::endl; // add lf and flush - } -\endcode -*/ -class JSON_API StreamWriter { -protected: - std::ostream* sout_; // not owned; will not delete -public: - StreamWriter(); - virtual ~StreamWriter(); - /** Write Value into document as configured in sub-class. - Do not take ownership of sout, but maintain a reference during function. - \pre sout != NULL - \return zero on success (For now, we always return zero, so check the stream instead.) - \throw std::exception possibly, depending on configuration - */ - virtual int write(Value const& root, std::ostream* sout) = 0; - - /** \brief A simple abstract factory. - */ - class JSON_API Factory { - public: - virtual ~Factory(); - /** \brief Allocate a CharReader via operator new(). - * \throw std::exception if something goes wrong (e.g. invalid settings) - */ - virtual StreamWriter* newStreamWriter() const = 0; - }; // Factory -}; // StreamWriter - -/** \brief Write into stringstream, then return string, for convenience. - * A StreamWriter will be created from the factory, used, and then deleted. - */ -std::string JSON_API writeString(StreamWriter::Factory const& factory, Value const& root); - - -/** \brief Build a StreamWriter implementation. - -Usage: -\code - using namespace Json; - Value value = ...; - StreamWriterBuilder builder; - builder["commentStyle"] = "None"; - builder["indentation"] = " "; // or whatever you like - std::unique_ptr writer( - builder.newStreamWriter()); - writer->write(value, &std::cout); - std::cout << std::endl; // add lf and flush -\endcode -*/ -class JSON_API StreamWriterBuilder : public StreamWriter::Factory { -public: - // Note: We use a Json::Value so that we can add data-members to this class - // without a major version bump. - /** Configuration of this builder. - Available settings (case-sensitive): - - "commentStyle": "None" or "All" - - "indentation": "" - - "enableYAMLCompatibility": false or true - - slightly change the whitespace around colons - - "dropNullPlaceholders": false or true - - Drop the "null" string from the writer's output for nullValues. - Strictly speaking, this is not valid JSON. But when the output is being - fed to a browser's Javascript, it makes for smaller output and the - browser can handle the output just fine. - - "useSpecialFloats": false or true - - If true, outputs non-finite floating point values in the following way: - NaN values as "NaN", positive infinity as "Infinity", and negative infinity - as "-Infinity". - - You can examine 'settings_` yourself - to see the defaults. You can also write and read them just like any - JSON Value. - \sa setDefaults() - */ - Json::Value settings_; - - StreamWriterBuilder(); - ~StreamWriterBuilder() override; - - /** - * \throw std::exception if something goes wrong (e.g. invalid settings) - */ - StreamWriter* newStreamWriter() const override; - - /** \return true if 'settings' are legal and consistent; - * otherwise, indicate bad settings via 'invalid'. - */ - bool validate(Json::Value* invalid) const; - /** A simple way to update a specific setting. - */ - Value& operator[](std::string key); - - /** Called by ctor, but you can use this to reset settings_. - * \pre 'settings' != NULL (but Json::null is fine) - * \remark Defaults: - * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults - */ - static void setDefaults(Json::Value* settings); -}; - -/** \brief Abstract class for writers. - * \deprecated Use StreamWriter. (And really, this is an implementation detail.) - */ -class JSON_API Writer { -public: - virtual ~Writer(); - - virtual std::string write(const Value& root) = 0; -}; - -/** \brief Outputs a Value in JSON format - *without formatting (not human friendly). - * - * The JSON document is written in a single line. It is not intended for 'human' - *consumption, - * but may be useful to support feature such as RPC where bandwidth is limited. - * \sa Reader, Value - * \deprecated Use StreamWriterBuilder. - */ -class JSON_API FastWriter : public Writer { - -public: - FastWriter(); - ~FastWriter() override {} - - void enableYAMLCompatibility(); - - /** \brief Drop the "null" string from the writer's output for nullValues. - * Strictly speaking, this is not valid JSON. But when the output is being - * fed to a browser's Javascript, it makes for smaller output and the - * browser can handle the output just fine. - */ - void dropNullPlaceholders(); - - void omitEndingLineFeed(); - -public: // overridden from Writer - std::string write(const Value& root) override; - -private: - void writeValue(const Value& value); - - std::string document_; - bool yamlCompatiblityEnabled_; - bool dropNullPlaceholders_; - bool omitEndingLineFeed_; -}; - -/** \brief Writes a Value in JSON format in a - *human friendly way. - * - * The rules for line break and indent are as follow: - * - Object value: - * - if empty then print {} without indent and line break - * - if not empty the print '{', line break & indent, print one value per - *line - * and then unindent and line break and print '}'. - * - Array value: - * - if empty then print [] without indent and line break - * - if the array contains no object value, empty array or some other value - *types, - * and all the values fit on one lines, then print the array on a single - *line. - * - otherwise, it the values do not fit on one line, or the array contains - * object or non empty array, then print one value per line. - * - * If the Value have comments then they are outputed according to their - *#CommentPlacement. - * - * \sa Reader, Value, Value::setComment() - * \deprecated Use StreamWriterBuilder. - */ -class JSON_API StyledWriter : public Writer { -public: - StyledWriter(); - ~StyledWriter() override {} - -public: // overridden from Writer - /** \brief Serialize a Value in JSON format. - * \param root Value to serialize. - * \return String containing the JSON document that represents the root value. - */ - std::string write(const Value& root) override; - -private: - void writeValue(const Value& value); - void writeArrayValue(const Value& value); - bool isMultineArray(const Value& value); - void pushValue(const std::string& value); - void writeIndent(); - void writeWithIndent(const std::string& value); - void indent(); - void unindent(); - void writeCommentBeforeValue(const Value& root); - void writeCommentAfterValueOnSameLine(const Value& root); - bool hasCommentForValue(const Value& value); - static std::string normalizeEOL(const std::string& text); - - typedef std::vector ChildValues; - - ChildValues childValues_; - std::string document_; - std::string indentString_; - int rightMargin_; - int indentSize_; - bool addChildValues_; -}; - -/** \brief Writes a Value in JSON format in a - human friendly way, - to a stream rather than to a string. - * - * The rules for line break and indent are as follow: - * - Object value: - * - if empty then print {} without indent and line break - * - if not empty the print '{', line break & indent, print one value per - line - * and then unindent and line break and print '}'. - * - Array value: - * - if empty then print [] without indent and line break - * - if the array contains no object value, empty array or some other value - types, - * and all the values fit on one lines, then print the array on a single - line. - * - otherwise, it the values do not fit on one line, or the array contains - * object or non empty array, then print one value per line. - * - * If the Value have comments then they are outputed according to their - #CommentPlacement. - * - * \param indentation Each level will be indented by this amount extra. - * \sa Reader, Value, Value::setComment() - * \deprecated Use StreamWriterBuilder. - */ -class JSON_API StyledStreamWriter { -public: - StyledStreamWriter(std::string indentation = "\t"); - ~StyledStreamWriter() {} - -public: - /** \brief Serialize a Value in JSON format. - * \param out Stream to write to. (Can be ostringstream, e.g.) - * \param root Value to serialize. - * \note There is no point in deriving from Writer, since write() should not - * return a value. - */ - void write(std::ostream& out, const Value& root); - -private: - void writeValue(const Value& value); - void writeArrayValue(const Value& value); - bool isMultineArray(const Value& value); - void pushValue(const std::string& value); - void writeIndent(); - void writeWithIndent(const std::string& value); - void indent(); - void unindent(); - void writeCommentBeforeValue(const Value& root); - void writeCommentAfterValueOnSameLine(const Value& root); - bool hasCommentForValue(const Value& value); - static std::string normalizeEOL(const std::string& text); - - typedef std::vector ChildValues; - - ChildValues childValues_; - std::ostream* document_; - std::string indentString_; - int rightMargin_; - std::string indentation_; - bool addChildValues_ : 1; - bool indented_ : 1; -}; - -#if defined(JSON_HAS_INT64) -std::string JSON_API valueToString(Int value); -std::string JSON_API valueToString(UInt value); -#endif // if defined(JSON_HAS_INT64) -std::string JSON_API valueToString(LargestInt value); -std::string JSON_API valueToString(LargestUInt value); -std::string JSON_API valueToString(double value); -std::string JSON_API valueToString(bool value); -std::string JSON_API valueToQuotedString(const char* value); - -/// \brief Output using the StyledStreamWriter. -/// \see Json::operator>>() -JSON_API std::ostream& operator<<(std::ostream&, const Value& root); - -} // namespace Json - -#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) -#pragma warning(pop) -#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) - -#endif // JSON_WRITER_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/writer.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: include/json/assertions.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED -#define CPPTL_JSON_ASSERTIONS_H_INCLUDED - -#include -#include - -#if !defined(JSON_IS_AMALGAMATION) -#include "config.h" -#endif // if !defined(JSON_IS_AMALGAMATION) - -/** It should not be possible for a maliciously designed file to - * cause an abort() or seg-fault, so these macros are used only - * for pre-condition violations and internal logic errors. - */ -#if JSON_USE_EXCEPTION - -// @todo <= add detail about condition in exception -# define JSON_ASSERT(condition) \ - {if (!(condition)) {Json::throwLogicError( "assert json failed" );}} - -# define JSON_FAIL_MESSAGE(message) \ - { \ - std::ostringstream oss; oss << message; \ - Json::throwLogicError(oss.str()); \ - abort(); \ - } - -#else // JSON_USE_EXCEPTION - -# define JSON_ASSERT(condition) assert(condition) - -// The call to assert() will show the failure message in debug builds. In -// release builds we abort, for a core-dump or debugger. -# define JSON_FAIL_MESSAGE(message) \ - { \ - std::ostringstream oss; oss << message; \ - assert(false && oss.str().c_str()); \ - abort(); \ - } - - -#endif - -#define JSON_ASSERT_MESSAGE(condition, message) \ - if (!(condition)) { \ - JSON_FAIL_MESSAGE(message); \ - } - -#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: include/json/assertions.h -// ////////////////////////////////////////////////////////////////////// - - - - - -#endif //ifndef JSON_AMALGATED_H_INCLUDED diff --git a/conformance/third_party/jsoncpp/jsoncpp.cpp b/conformance/third_party/jsoncpp/jsoncpp.cpp deleted file mode 100644 index d313d05..0000000 --- a/conformance/third_party/jsoncpp/jsoncpp.cpp +++ /dev/null @@ -1,5192 +0,0 @@ -/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/). -/// It is intended to be used with #include "json/json.h" - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - -/* -The JsonCpp library's source code, including accompanying documentation, -tests and demonstration applications, are licensed under the following -conditions... - -The author (Baptiste Lepilleur) explicitly disclaims copyright in all -jurisdictions which recognize such a disclaimer. In such jurisdictions, -this software is released into the Public Domain. - -In jurisdictions which do not recognize Public Domain property (e.g. Germany as of -2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is -released under the terms of the MIT License (see below). - -In jurisdictions which recognize Public Domain property, the user of this -software may choose to accept it either as 1) Public Domain, 2) under the -conditions of the MIT License (see below), or 3) under the terms of dual -Public Domain/MIT License conditions described here, as they choose. - -The MIT License is about as close to Public Domain as a license can get, and is -described in clear, concise terms at: - - http://en.wikipedia.org/wiki/MIT_License - -The full text of the MIT License follows: - -======================================================================== -Copyright (c) 2007-2010 Baptiste Lepilleur - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, copy, -modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -======================================================================== -(END LICENSE TEXT) - -The MIT license is compatible with both the GPL and commercial -software, affording one all of the rights of Public Domain with the -minor nuisance of being required to keep the above copyright notice -and license text in the source code. Note also that by accepting the -Public Domain "license" you can re-license your copy using whatever -license you like. - -*/ - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: LICENSE -// ////////////////////////////////////////////////////////////////////// - - - - - - -#include "third_party/jsoncpp/json.h" - -#ifndef JSON_IS_AMALGAMATION -#error "Compile with -I PATH_TO_JSON_DIRECTORY" -#endif - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_tool.h -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED -#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED - -/* This header provides common string manipulation support, such as UTF-8, - * portable conversion from/to string... - * - * It is an internal header that must not be exposed. - */ - -namespace Json { - -/// Converts a unicode code-point to UTF-8. -static inline std::string codePointToUTF8(unsigned int cp) { - std::string result; - - // based on description from http://en.wikipedia.org/wiki/UTF-8 - - if (cp <= 0x7f) { - result.resize(1); - result[0] = static_cast(cp); - } else if (cp <= 0x7FF) { - result.resize(2); - result[1] = static_cast(0x80 | (0x3f & cp)); - result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); - } else if (cp <= 0xFFFF) { - result.resize(3); - result[2] = static_cast(0x80 | (0x3f & cp)); - result[1] = static_cast(0x80 | (0x3f & (cp >> 6))); - result[0] = static_cast(0xE0 | (0xf & (cp >> 12))); - } else if (cp <= 0x10FFFF) { - result.resize(4); - result[3] = static_cast(0x80 | (0x3f & cp)); - result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); - result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); - result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); - } - - return result; -} - -/// Returns true if ch is a control character (in range [1,31]). -static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; } - -enum { - /// Constant that specify the size of the buffer that must be passed to - /// uintToString. - uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 -}; - -// Defines a char buffer for use with uintToString(). -typedef char UIntToStringBuffer[uintToStringBufferSize]; - -/** Converts an unsigned integer to string. - * @param value Unsigned interger to convert to string - * @param current Input/Output string buffer. - * Must have at least uintToStringBufferSize chars free. - */ -static inline void uintToString(LargestUInt value, char*& current) { - *--current = 0; - do { - *--current = static_cast(value % 10U + static_cast('0')); - value /= 10; - } while (value != 0); -} - -/** Change ',' to '.' everywhere in buffer. - * - * We had a sophisticated way, but it did not work in WinCE. - * @see https://github.com/open-source-parsers/jsoncpp/pull/9 - */ -static inline void fixNumericLocale(char* begin, char* end) { - while (begin < end) { - if (*begin == ',') { - *begin = '.'; - } - ++begin; - } -} - -} // namespace Json { - -#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_tool.h -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_reader.cpp -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2011 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include "json_tool.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_MSC_VER) -#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above -#define snprintf sprintf_s -#elif _MSC_VER >= 1900 // VC++ 14.0 and above -#define snprintf std::snprintf -#else -#define snprintf _snprintf -#endif -#elif defined(__ANDROID__) || defined(__QNXNTO__) -#define snprintf snprintf -#elif __cplusplus >= 201103L -#define snprintf std::snprintf -#endif - -#if defined(__QNXNTO__) -#define sscanf std::sscanf -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 -// Disable warning about strdup being deprecated. -#pragma warning(disable : 4996) -#endif - -static int const stackLimit_g = 1000; -static int stackDepth_g = 0; // see readValue() - -namespace Json { - -#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) -typedef std::unique_ptr CharReaderPtr; -#else -typedef std::auto_ptr CharReaderPtr; -#endif - -// Implementation of class Features -// //////////////////////////////// - -Features::Features() - : allowComments_(true), strictRoot_(false), - allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {} - -Features Features::all() { return Features(); } - -Features Features::strictMode() { - Features features; - features.allowComments_ = false; - features.strictRoot_ = true; - features.allowDroppedNullPlaceholders_ = false; - features.allowNumericKeys_ = false; - return features; -} - -// Implementation of class Reader -// //////////////////////////////// - -static bool containsNewLine(Reader::Location begin, Reader::Location end) { - for (; begin < end; ++begin) - if (*begin == '\n' || *begin == '\r') - return true; - return false; -} - -// Class Reader -// ////////////////////////////////////////////////////////////////// - -Reader::Reader() - : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), - lastValue_(), commentsBefore_(), features_(Features::all()), - collectComments_() {} - -Reader::Reader(const Features& features) - : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), - lastValue_(), commentsBefore_(), features_(features), collectComments_() { -} - -bool -Reader::parse(const std::string& document, Value& root, bool collectComments) { - document_ = document; - const char* begin = document_.c_str(); - const char* end = begin + document_.length(); - return parse(begin, end, root, collectComments); -} - -bool Reader::parse(std::istream& sin, Value& root, bool collectComments) { - // std::istream_iterator begin(sin); - // std::istream_iterator end; - // Those would allow streamed input from a file, if parse() were a - // template function. - - // Since std::string is reference-counted, this at least does not - // create an extra copy. - std::string doc; - std::getline(sin, doc, (char)EOF); - return parse(doc, root, collectComments); -} - -bool Reader::parse(const char* beginDoc, - const char* endDoc, - Value& root, - bool collectComments) { - if (!features_.allowComments_) { - collectComments = false; - } - - begin_ = beginDoc; - end_ = endDoc; - collectComments_ = collectComments; - current_ = begin_; - lastValueEnd_ = 0; - lastValue_ = 0; - commentsBefore_ = ""; - errors_.clear(); - while (!nodes_.empty()) - nodes_.pop(); - nodes_.push(&root); - - stackDepth_g = 0; // Yes, this is bad coding, but options are limited. - bool successful = readValue(); - Token token; - skipCommentTokens(token); - if (collectComments_ && !commentsBefore_.empty()) - root.setComment(commentsBefore_, commentAfter); - if (features_.strictRoot_) { - if (!root.isArray() && !root.isObject()) { - // Set error location to start of doc, ideally should be first token found - // in doc - token.type_ = tokenError; - token.start_ = beginDoc; - token.end_ = endDoc; - addError( - "A valid JSON document must be either an array or an object value.", - token); - return false; - } - } - return successful; -} - -bool Reader::readValue() { - // This is a non-reentrant way to support a stackLimit. Terrible! - // But this deprecated class has a security problem: Bad input can - // cause a seg-fault. This seems like a fair, binary-compatible way - // to prevent the problem. - if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue()."); - ++stackDepth_g; - - Token token; - skipCommentTokens(token); - bool successful = true; - - if (collectComments_ && !commentsBefore_.empty()) { - currentValue().setComment(commentsBefore_, commentBefore); - commentsBefore_ = ""; - } - - switch (token.type_) { - case tokenObjectBegin: - successful = readObject(token); - currentValue().setOffsetLimit(current_ - begin_); - break; - case tokenArrayBegin: - successful = readArray(token); - currentValue().setOffsetLimit(current_ - begin_); - break; - case tokenNumber: - successful = decodeNumber(token); - break; - case tokenString: - successful = decodeString(token); - break; - case tokenTrue: - { - Value v(true); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenFalse: - { - Value v(false); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenNull: - { - Value v; - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenArraySeparator: - case tokenObjectEnd: - case tokenArrayEnd: - if (features_.allowDroppedNullPlaceholders_) { - // "Un-read" the current token and mark the current value as a null - // token. - current_--; - Value v; - currentValue().swapPayload(v); - currentValue().setOffsetStart(current_ - begin_ - 1); - currentValue().setOffsetLimit(current_ - begin_); - break; - } // Else, fall through... - default: - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return addError("Syntax error: value, object or array expected.", token); - } - - if (collectComments_) { - lastValueEnd_ = current_; - lastValue_ = ¤tValue(); - } - - --stackDepth_g; - return successful; -} - -void Reader::skipCommentTokens(Token& token) { - if (features_.allowComments_) { - do { - readToken(token); - } while (token.type_ == tokenComment); - } else { - readToken(token); - } -} - -bool Reader::readToken(Token& token) { - skipSpaces(); - token.start_ = current_; - Char c = getNextChar(); - bool ok = true; - switch (c) { - case '{': - token.type_ = tokenObjectBegin; - break; - case '}': - token.type_ = tokenObjectEnd; - break; - case '[': - token.type_ = tokenArrayBegin; - break; - case ']': - token.type_ = tokenArrayEnd; - break; - case '"': - token.type_ = tokenString; - ok = readString(); - break; - case '/': - token.type_ = tokenComment; - ok = readComment(); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '-': - token.type_ = tokenNumber; - readNumber(); - break; - case 't': - token.type_ = tokenTrue; - ok = match("rue", 3); - break; - case 'f': - token.type_ = tokenFalse; - ok = match("alse", 4); - break; - case 'n': - token.type_ = tokenNull; - ok = match("ull", 3); - break; - case ',': - token.type_ = tokenArraySeparator; - break; - case ':': - token.type_ = tokenMemberSeparator; - break; - case 0: - token.type_ = tokenEndOfStream; - break; - default: - ok = false; - break; - } - if (!ok) - token.type_ = tokenError; - token.end_ = current_; - return true; -} - -void Reader::skipSpaces() { - while (current_ != end_) { - Char c = *current_; - if (c == ' ' || c == '\t' || c == '\r' || c == '\n') - ++current_; - else - break; - } -} - -bool Reader::match(Location pattern, int patternLength) { - if (end_ - current_ < patternLength) - return false; - int index = patternLength; - while (index--) - if (current_[index] != pattern[index]) - return false; - current_ += patternLength; - return true; -} - -bool Reader::readComment() { - Location commentBegin = current_ - 1; - Char c = getNextChar(); - bool successful = false; - if (c == '*') - successful = readCStyleComment(); - else if (c == '/') - successful = readCppStyleComment(); - if (!successful) - return false; - - if (collectComments_) { - CommentPlacement placement = commentBefore; - if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { - if (c != '*' || !containsNewLine(commentBegin, current_)) - placement = commentAfterOnSameLine; - } - - addComment(commentBegin, current_, placement); - } - return true; -} - -static std::string normalizeEOL(Reader::Location begin, Reader::Location end) { - std::string normalized; - normalized.reserve(end - begin); - Reader::Location current = begin; - while (current != end) { - char c = *current++; - if (c == '\r') { - if (current != end && *current == '\n') - // convert dos EOL - ++current; - // convert Mac EOL - normalized += '\n'; - } else { - normalized += c; - } - } - return normalized; -} - -void -Reader::addComment(Location begin, Location end, CommentPlacement placement) { - assert(collectComments_); - const std::string& normalized = normalizeEOL(begin, end); - if (placement == commentAfterOnSameLine) { - assert(lastValue_ != 0); - lastValue_->setComment(normalized, placement); - } else { - commentsBefore_ += normalized; - } -} - -bool Reader::readCStyleComment() { - while (current_ != end_) { - Char c = getNextChar(); - if (c == '*' && *current_ == '/') - break; - } - return getNextChar() == '/'; -} - -bool Reader::readCppStyleComment() { - while (current_ != end_) { - Char c = getNextChar(); - if (c == '\n') - break; - if (c == '\r') { - // Consume DOS EOL. It will be normalized in addComment. - if (current_ != end_ && *current_ == '\n') - getNextChar(); - // Break on Moc OS 9 EOL. - break; - } - } - return true; -} - -void Reader::readNumber() { - const char *p = current_; - char c = '0'; // stopgap for already consumed character - // integral part - while (c >= '0' && c <= '9') - c = (current_ = p) < end_ ? *p++ : 0; - // fractional part - if (c == '.') { - c = (current_ = p) < end_ ? *p++ : 0; - while (c >= '0' && c <= '9') - c = (current_ = p) < end_ ? *p++ : 0; - } - // exponential part - if (c == 'e' || c == 'E') { - c = (current_ = p) < end_ ? *p++ : 0; - if (c == '+' || c == '-') - c = (current_ = p) < end_ ? *p++ : 0; - while (c >= '0' && c <= '9') - c = (current_ = p) < end_ ? *p++ : 0; - } -} - -bool Reader::readString() { - Char c = 0; - while (current_ != end_) { - c = getNextChar(); - if (c == '\\') - getNextChar(); - else if (c == '"') - break; - } - return c == '"'; -} - -bool Reader::readObject(Token& tokenStart) { - Token tokenName; - std::string name; - Value init(objectValue); - currentValue().swapPayload(init); - currentValue().setOffsetStart(tokenStart.start_ - begin_); - while (readToken(tokenName)) { - bool initialTokenOk = true; - while (tokenName.type_ == tokenComment && initialTokenOk) - initialTokenOk = readToken(tokenName); - if (!initialTokenOk) - break; - if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object - return true; - name = ""; - if (tokenName.type_ == tokenString) { - if (!decodeString(tokenName, name)) - return recoverFromError(tokenObjectEnd); - } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { - Value numberName; - if (!decodeNumber(tokenName, numberName)) - return recoverFromError(tokenObjectEnd); - name = numberName.asString(); - } else { - break; - } - - Token colon; - if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { - return addErrorAndRecover( - "Missing ':' after object member name", colon, tokenObjectEnd); - } - Value& value = currentValue()[name]; - nodes_.push(&value); - bool ok = readValue(); - nodes_.pop(); - if (!ok) // error already set - return recoverFromError(tokenObjectEnd); - - Token comma; - if (!readToken(comma) || - (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && - comma.type_ != tokenComment)) { - return addErrorAndRecover( - "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); - } - bool finalizeTokenOk = true; - while (comma.type_ == tokenComment && finalizeTokenOk) - finalizeTokenOk = readToken(comma); - if (comma.type_ == tokenObjectEnd) - return true; - } - return addErrorAndRecover( - "Missing '}' or object member name", tokenName, tokenObjectEnd); -} - -bool Reader::readArray(Token& tokenStart) { - Value init(arrayValue); - currentValue().swapPayload(init); - currentValue().setOffsetStart(tokenStart.start_ - begin_); - skipSpaces(); - if (*current_ == ']') // empty array - { - Token endArray; - readToken(endArray); - return true; - } - int index = 0; - for (;;) { - Value& value = currentValue()[index++]; - nodes_.push(&value); - bool ok = readValue(); - nodes_.pop(); - if (!ok) // error already set - return recoverFromError(tokenArrayEnd); - - Token token; - // Accept Comment after last item in the array. - ok = readToken(token); - while (token.type_ == tokenComment && ok) { - ok = readToken(token); - } - bool badTokenType = - (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); - if (!ok || badTokenType) { - return addErrorAndRecover( - "Missing ',' or ']' in array declaration", token, tokenArrayEnd); - } - if (token.type_ == tokenArrayEnd) - break; - } - return true; -} - -bool Reader::decodeNumber(Token& token) { - Value decoded; - if (!decodeNumber(token, decoded)) - return false; - currentValue().swapPayload(decoded); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return true; -} - -bool Reader::decodeNumber(Token& token, Value& decoded) { - // Attempts to parse the number as an integer. If the number is - // larger than the maximum supported value of an integer then - // we decode the number as a double. - Location current = token.start_; - bool isNegative = *current == '-'; - if (isNegative) - ++current; - // TODO: Help the compiler do the div and mod at compile time or get rid of them. - Value::LargestUInt maxIntegerValue = - isNegative ? Value::LargestUInt(Value::maxLargestInt) + 1 - : Value::maxLargestUInt; - Value::LargestUInt threshold = maxIntegerValue / 10; - Value::LargestUInt value = 0; - while (current < token.end_) { - Char c = *current++; - if (c < '0' || c > '9') - return decodeDouble(token, decoded); - Value::UInt digit(c - '0'); - if (value >= threshold) { - // We've hit or exceeded the max value divided by 10 (rounded down). If - // a) we've only just touched the limit, b) this is the last digit, and - // c) it's small enough to fit in that rounding delta, we're okay. - // Otherwise treat this number as a double to avoid overflow. - if (value > threshold || current != token.end_ || - digit > maxIntegerValue % 10) { - return decodeDouble(token, decoded); - } - } - value = value * 10 + digit; - } - if (isNegative && value == maxIntegerValue) - decoded = Value::minLargestInt; - else if (isNegative) - decoded = -Value::LargestInt(value); - else if (value <= Value::LargestUInt(Value::maxInt)) - decoded = Value::LargestInt(value); - else - decoded = value; - return true; -} - -bool Reader::decodeDouble(Token& token) { - Value decoded; - if (!decodeDouble(token, decoded)) - return false; - currentValue().swapPayload(decoded); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return true; -} - -bool Reader::decodeDouble(Token& token, Value& decoded) { - double value = 0; - std::string buffer(token.start_, token.end_); - std::istringstream is(buffer); - if (!(is >> value)) - return addError("'" + std::string(token.start_, token.end_) + - "' is not a number.", - token); - decoded = value; - return true; -} - -bool Reader::decodeString(Token& token) { - std::string decoded_string; - if (!decodeString(token, decoded_string)) - return false; - Value decoded(decoded_string); - currentValue().swapPayload(decoded); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return true; -} - -bool Reader::decodeString(Token& token, std::string& decoded) { - decoded.reserve(token.end_ - token.start_ - 2); - Location current = token.start_ + 1; // skip '"' - Location end = token.end_ - 1; // do not include '"' - while (current != end) { - Char c = *current++; - if (c == '"') - break; - else if (c == '\\') { - if (current == end) - return addError("Empty escape sequence in string", token, current); - Char escape = *current++; - switch (escape) { - case '"': - decoded += '"'; - break; - case '/': - decoded += '/'; - break; - case '\\': - decoded += '\\'; - break; - case 'b': - decoded += '\b'; - break; - case 'f': - decoded += '\f'; - break; - case 'n': - decoded += '\n'; - break; - case 'r': - decoded += '\r'; - break; - case 't': - decoded += '\t'; - break; - case 'u': { - unsigned int unicode; - if (!decodeUnicodeCodePoint(token, current, end, unicode)) - return false; - decoded += codePointToUTF8(unicode); - } break; - default: - return addError("Bad escape sequence in string", token, current); - } - } else { - decoded += c; - } - } - return true; -} - -bool Reader::decodeUnicodeCodePoint(Token& token, - Location& current, - Location end, - unsigned int& unicode) { - - if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) - return false; - if (unicode >= 0xD800 && unicode <= 0xDBFF) { - // surrogate pairs - if (end - current < 6) - return addError( - "additional six characters expected to parse unicode surrogate pair.", - token, - current); - unsigned int surrogatePair; - if (*(current++) == '\\' && *(current++) == 'u') { - if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { - unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); - } else - return false; - } else - return addError("expecting another \\u token to begin the second half of " - "a unicode surrogate pair", - token, - current); - } - return true; -} - -bool Reader::decodeUnicodeEscapeSequence(Token& token, - Location& current, - Location end, - unsigned int& unicode) { - if (end - current < 4) - return addError( - "Bad unicode escape sequence in string: four digits expected.", - token, - current); - unicode = 0; - for (int index = 0; index < 4; ++index) { - Char c = *current++; - unicode *= 16; - if (c >= '0' && c <= '9') - unicode += c - '0'; - else if (c >= 'a' && c <= 'f') - unicode += c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - unicode += c - 'A' + 10; - else - return addError( - "Bad unicode escape sequence in string: hexadecimal digit expected.", - token, - current); - } - return true; -} - -bool -Reader::addError(const std::string& message, Token& token, Location extra) { - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = extra; - errors_.push_back(info); - return false; -} - -bool Reader::recoverFromError(TokenType skipUntilToken) { - int errorCount = int(errors_.size()); - Token skip; - for (;;) { - if (!readToken(skip)) - errors_.resize(errorCount); // discard errors caused by recovery - if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) - break; - } - errors_.resize(errorCount); - return false; -} - -bool Reader::addErrorAndRecover(const std::string& message, - Token& token, - TokenType skipUntilToken) { - addError(message, token); - return recoverFromError(skipUntilToken); -} - -Value& Reader::currentValue() { return *(nodes_.top()); } - -Reader::Char Reader::getNextChar() { - if (current_ == end_) - return 0; - return *current_++; -} - -void Reader::getLocationLineAndColumn(Location location, - int& line, - int& column) const { - Location current = begin_; - Location lastLineStart = current; - line = 0; - while (current < location && current != end_) { - Char c = *current++; - if (c == '\r') { - if (*current == '\n') - ++current; - lastLineStart = current; - ++line; - } else if (c == '\n') { - lastLineStart = current; - ++line; - } - } - // column & line start at 1 - column = int(location - lastLineStart) + 1; - ++line; -} - -std::string Reader::getLocationLineAndColumn(Location location) const { - int line, column; - getLocationLineAndColumn(location, line, column); - char buffer[18 + 16 + 16 + 1]; - snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); - return buffer; -} - -// Deprecated. Preserved for backward compatibility -std::string Reader::getFormatedErrorMessages() const { - return getFormattedErrorMessages(); -} - -std::string Reader::getFormattedErrorMessages() const { - std::string formattedMessage; - for (Errors::const_iterator itError = errors_.begin(); - itError != errors_.end(); - ++itError) { - const ErrorInfo& error = *itError; - formattedMessage += - "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; - formattedMessage += " " + error.message_ + "\n"; - if (error.extra_) - formattedMessage += - "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n"; - } - return formattedMessage; -} - -std::vector Reader::getStructuredErrors() const { - std::vector allErrors; - for (Errors::const_iterator itError = errors_.begin(); - itError != errors_.end(); - ++itError) { - const ErrorInfo& error = *itError; - Reader::StructuredError structured; - structured.offset_start = error.token_.start_ - begin_; - structured.offset_limit = error.token_.end_ - begin_; - structured.message = error.message_; - allErrors.push_back(structured); - } - return allErrors; -} - -bool Reader::pushError(const Value& value, const std::string& message) { - size_t length = end_ - begin_; - if(value.getOffsetStart() > length - || value.getOffsetLimit() > length) - return false; - Token token; - token.type_ = tokenError; - token.start_ = begin_ + value.getOffsetStart(); - token.end_ = end_ + value.getOffsetLimit(); - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = 0; - errors_.push_back(info); - return true; -} - -bool Reader::pushError(const Value& value, const std::string& message, const Value& extra) { - size_t length = end_ - begin_; - if(value.getOffsetStart() > length - || value.getOffsetLimit() > length - || extra.getOffsetLimit() > length) - return false; - Token token; - token.type_ = tokenError; - token.start_ = begin_ + value.getOffsetStart(); - token.end_ = begin_ + value.getOffsetLimit(); - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = begin_ + extra.getOffsetStart(); - errors_.push_back(info); - return true; -} - -bool Reader::good() const { - return !errors_.size(); -} - -// exact copy of Features -class OurFeatures { -public: - static OurFeatures all(); - bool allowComments_; - bool strictRoot_; - bool allowDroppedNullPlaceholders_; - bool allowNumericKeys_; - bool allowSingleQuotes_; - bool failIfExtra_; - bool rejectDupKeys_; - bool allowSpecialFloats_; - int stackLimit_; -}; // OurFeatures - -// exact copy of Implementation of class Features -// //////////////////////////////// - -OurFeatures OurFeatures::all() { return OurFeatures(); } - -// Implementation of class Reader -// //////////////////////////////// - -// exact copy of Reader, renamed to OurReader -class OurReader { -public: - typedef char Char; - typedef const Char* Location; - struct StructuredError { - size_t offset_start; - size_t offset_limit; - std::string message; - }; - - OurReader(OurFeatures const& features); - bool parse(const char* beginDoc, - const char* endDoc, - Value& root, - bool collectComments = true); - std::string getFormattedErrorMessages() const; - std::vector getStructuredErrors() const; - bool pushError(const Value& value, const std::string& message); - bool pushError(const Value& value, const std::string& message, const Value& extra); - bool good() const; - -private: - OurReader(OurReader const&); // no impl - void operator=(OurReader const&); // no impl - - enum TokenType { - tokenEndOfStream = 0, - tokenObjectBegin, - tokenObjectEnd, - tokenArrayBegin, - tokenArrayEnd, - tokenString, - tokenNumber, - tokenTrue, - tokenFalse, - tokenNull, - tokenNaN, - tokenPosInf, - tokenNegInf, - tokenArraySeparator, - tokenMemberSeparator, - tokenComment, - tokenError - }; - - class Token { - public: - TokenType type_; - Location start_; - Location end_; - }; - - class ErrorInfo { - public: - Token token_; - std::string message_; - Location extra_; - }; - - typedef std::deque Errors; - - bool readToken(Token& token); - void skipSpaces(); - bool match(Location pattern, int patternLength); - bool readComment(); - bool readCStyleComment(); - bool readCppStyleComment(); - bool readString(); - bool readStringSingleQuote(); - bool readNumber(bool checkInf); - bool readValue(); - bool readObject(Token& token); - bool readArray(Token& token); - bool decodeNumber(Token& token); - bool decodeNumber(Token& token, Value& decoded); - bool decodeString(Token& token); - bool decodeString(Token& token, std::string& decoded); - bool decodeDouble(Token& token); - bool decodeDouble(Token& token, Value& decoded); - bool decodeUnicodeCodePoint(Token& token, - Location& current, - Location end, - unsigned int& unicode); - bool decodeUnicodeEscapeSequence(Token& token, - Location& current, - Location end, - unsigned int& unicode); - bool addError(const std::string& message, Token& token, Location extra = 0); - bool recoverFromError(TokenType skipUntilToken); - bool addErrorAndRecover(const std::string& message, - Token& token, - TokenType skipUntilToken); - void skipUntilSpace(); - Value& currentValue(); - Char getNextChar(); - void - getLocationLineAndColumn(Location location, int& line, int& column) const; - std::string getLocationLineAndColumn(Location location) const; - void addComment(Location begin, Location end, CommentPlacement placement); - void skipCommentTokens(Token& token); - - typedef std::stack Nodes; - Nodes nodes_; - Errors errors_; - std::string document_; - Location begin_; - Location end_; - Location current_; - Location lastValueEnd_; - Value* lastValue_; - std::string commentsBefore_; - int stackDepth_; - - OurFeatures const features_; - bool collectComments_; -}; // OurReader - -// complete copy of Read impl, for OurReader - -OurReader::OurReader(OurFeatures const& features) - : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), - lastValue_(), commentsBefore_(), - stackDepth_(0), - features_(features), collectComments_() { -} - -bool OurReader::parse(const char* beginDoc, - const char* endDoc, - Value& root, - bool collectComments) { - if (!features_.allowComments_) { - collectComments = false; - } - - begin_ = beginDoc; - end_ = endDoc; - collectComments_ = collectComments; - current_ = begin_; - lastValueEnd_ = 0; - lastValue_ = 0; - commentsBefore_ = ""; - errors_.clear(); - while (!nodes_.empty()) - nodes_.pop(); - nodes_.push(&root); - - stackDepth_ = 0; - bool successful = readValue(); - Token token; - skipCommentTokens(token); - if (features_.failIfExtra_) { - if (token.type_ != tokenError && token.type_ != tokenEndOfStream) { - addError("Extra non-whitespace after JSON value.", token); - return false; - } - } - if (collectComments_ && !commentsBefore_.empty()) - root.setComment(commentsBefore_, commentAfter); - if (features_.strictRoot_) { - if (!root.isArray() && !root.isObject()) { - // Set error location to start of doc, ideally should be first token found - // in doc - token.type_ = tokenError; - token.start_ = beginDoc; - token.end_ = endDoc; - addError( - "A valid JSON document must be either an array or an object value.", - token); - return false; - } - } - return successful; -} - -bool OurReader::readValue() { - if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue()."); - ++stackDepth_; - Token token; - skipCommentTokens(token); - bool successful = true; - - if (collectComments_ && !commentsBefore_.empty()) { - currentValue().setComment(commentsBefore_, commentBefore); - commentsBefore_ = ""; - } - - switch (token.type_) { - case tokenObjectBegin: - successful = readObject(token); - currentValue().setOffsetLimit(current_ - begin_); - break; - case tokenArrayBegin: - successful = readArray(token); - currentValue().setOffsetLimit(current_ - begin_); - break; - case tokenNumber: - successful = decodeNumber(token); - break; - case tokenString: - successful = decodeString(token); - break; - case tokenTrue: - { - Value v(true); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenFalse: - { - Value v(false); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenNull: - { - Value v; - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenNaN: - { - Value v(std::numeric_limits::quiet_NaN()); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenPosInf: - { - Value v(std::numeric_limits::infinity()); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenNegInf: - { - Value v(-std::numeric_limits::infinity()); - currentValue().swapPayload(v); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - } - break; - case tokenArraySeparator: - case tokenObjectEnd: - case tokenArrayEnd: - if (features_.allowDroppedNullPlaceholders_) { - // "Un-read" the current token and mark the current value as a null - // token. - current_--; - Value v; - currentValue().swapPayload(v); - currentValue().setOffsetStart(current_ - begin_ - 1); - currentValue().setOffsetLimit(current_ - begin_); - break; - } // else, fall through ... - default: - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return addError("Syntax error: value, object or array expected.", token); - } - - if (collectComments_) { - lastValueEnd_ = current_; - lastValue_ = ¤tValue(); - } - - --stackDepth_; - return successful; -} - -void OurReader::skipCommentTokens(Token& token) { - if (features_.allowComments_) { - do { - readToken(token); - } while (token.type_ == tokenComment); - } else { - readToken(token); - } -} - -bool OurReader::readToken(Token& token) { - skipSpaces(); - token.start_ = current_; - Char c = getNextChar(); - bool ok = true; - switch (c) { - case '{': - token.type_ = tokenObjectBegin; - break; - case '}': - token.type_ = tokenObjectEnd; - break; - case '[': - token.type_ = tokenArrayBegin; - break; - case ']': - token.type_ = tokenArrayEnd; - break; - case '"': - token.type_ = tokenString; - ok = readString(); - break; - case '\'': - if (features_.allowSingleQuotes_) { - token.type_ = tokenString; - ok = readStringSingleQuote(); - break; - } // else continue - case '/': - token.type_ = tokenComment; - ok = readComment(); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - token.type_ = tokenNumber; - readNumber(false); - break; - case '-': - if (readNumber(true)) { - token.type_ = tokenNumber; - } else { - token.type_ = tokenNegInf; - ok = features_.allowSpecialFloats_ && match("nfinity", 7); - } - break; - case 't': - token.type_ = tokenTrue; - ok = match("rue", 3); - break; - case 'f': - token.type_ = tokenFalse; - ok = match("alse", 4); - break; - case 'n': - token.type_ = tokenNull; - ok = match("ull", 3); - break; - case 'N': - if (features_.allowSpecialFloats_) { - token.type_ = tokenNaN; - ok = match("aN", 2); - } else { - ok = false; - } - break; - case 'I': - if (features_.allowSpecialFloats_) { - token.type_ = tokenPosInf; - ok = match("nfinity", 7); - } else { - ok = false; - } - break; - case ',': - token.type_ = tokenArraySeparator; - break; - case ':': - token.type_ = tokenMemberSeparator; - break; - case 0: - token.type_ = tokenEndOfStream; - break; - default: - ok = false; - break; - } - if (!ok) - token.type_ = tokenError; - token.end_ = current_; - return true; -} - -void OurReader::skipSpaces() { - while (current_ != end_) { - Char c = *current_; - if (c == ' ' || c == '\t' || c == '\r' || c == '\n') - ++current_; - else - break; - } -} - -bool OurReader::match(Location pattern, int patternLength) { - if (end_ - current_ < patternLength) - return false; - int index = patternLength; - while (index--) - if (current_[index] != pattern[index]) - return false; - current_ += patternLength; - return true; -} - -bool OurReader::readComment() { - Location commentBegin = current_ - 1; - Char c = getNextChar(); - bool successful = false; - if (c == '*') - successful = readCStyleComment(); - else if (c == '/') - successful = readCppStyleComment(); - if (!successful) - return false; - - if (collectComments_) { - CommentPlacement placement = commentBefore; - if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { - if (c != '*' || !containsNewLine(commentBegin, current_)) - placement = commentAfterOnSameLine; - } - - addComment(commentBegin, current_, placement); - } - return true; -} - -void -OurReader::addComment(Location begin, Location end, CommentPlacement placement) { - assert(collectComments_); - const std::string& normalized = normalizeEOL(begin, end); - if (placement == commentAfterOnSameLine) { - assert(lastValue_ != 0); - lastValue_->setComment(normalized, placement); - } else { - commentsBefore_ += normalized; - } -} - -bool OurReader::readCStyleComment() { - while (current_ != end_) { - Char c = getNextChar(); - if (c == '*' && *current_ == '/') - break; - } - return getNextChar() == '/'; -} - -bool OurReader::readCppStyleComment() { - while (current_ != end_) { - Char c = getNextChar(); - if (c == '\n') - break; - if (c == '\r') { - // Consume DOS EOL. It will be normalized in addComment. - if (current_ != end_ && *current_ == '\n') - getNextChar(); - // Break on Moc OS 9 EOL. - break; - } - } - return true; -} - -bool OurReader::readNumber(bool checkInf) { - const char *p = current_; - if (checkInf && p != end_ && *p == 'I') { - current_ = ++p; - return false; - } - char c = '0'; // stopgap for already consumed character - // integral part - while (c >= '0' && c <= '9') - c = (current_ = p) < end_ ? *p++ : 0; - // fractional part - if (c == '.') { - c = (current_ = p) < end_ ? *p++ : 0; - while (c >= '0' && c <= '9') - c = (current_ = p) < end_ ? *p++ : 0; - } - // exponential part - if (c == 'e' || c == 'E') { - c = (current_ = p) < end_ ? *p++ : 0; - if (c == '+' || c == '-') - c = (current_ = p) < end_ ? *p++ : 0; - while (c >= '0' && c <= '9') - c = (current_ = p) < end_ ? *p++ : 0; - } - return true; -} -bool OurReader::readString() { - Char c = 0; - while (current_ != end_) { - c = getNextChar(); - if (c == '\\') - getNextChar(); - else if (c == '"') - break; - } - return c == '"'; -} - - -bool OurReader::readStringSingleQuote() { - Char c = 0; - while (current_ != end_) { - c = getNextChar(); - if (c == '\\') - getNextChar(); - else if (c == '\'') - break; - } - return c == '\''; -} - -bool OurReader::readObject(Token& tokenStart) { - Token tokenName; - std::string name; - Value init(objectValue); - currentValue().swapPayload(init); - currentValue().setOffsetStart(tokenStart.start_ - begin_); - while (readToken(tokenName)) { - bool initialTokenOk = true; - while (tokenName.type_ == tokenComment && initialTokenOk) - initialTokenOk = readToken(tokenName); - if (!initialTokenOk) - break; - if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object - return true; - name = ""; - if (tokenName.type_ == tokenString) { - if (!decodeString(tokenName, name)) - return recoverFromError(tokenObjectEnd); - } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { - Value numberName; - if (!decodeNumber(tokenName, numberName)) - return recoverFromError(tokenObjectEnd); - name = numberName.asString(); - } else { - break; - } - - Token colon; - if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { - return addErrorAndRecover( - "Missing ':' after object member name", colon, tokenObjectEnd); - } - if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30"); - if (features_.rejectDupKeys_ && currentValue().isMember(name)) { - std::string msg = "Duplicate key: '" + name + "'"; - return addErrorAndRecover( - msg, tokenName, tokenObjectEnd); - } - Value& value = currentValue()[name]; - nodes_.push(&value); - bool ok = readValue(); - nodes_.pop(); - if (!ok) // error already set - return recoverFromError(tokenObjectEnd); - - Token comma; - if (!readToken(comma) || - (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && - comma.type_ != tokenComment)) { - return addErrorAndRecover( - "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); - } - bool finalizeTokenOk = true; - while (comma.type_ == tokenComment && finalizeTokenOk) - finalizeTokenOk = readToken(comma); - if (comma.type_ == tokenObjectEnd) - return true; - } - return addErrorAndRecover( - "Missing '}' or object member name", tokenName, tokenObjectEnd); -} - -bool OurReader::readArray(Token& tokenStart) { - Value init(arrayValue); - currentValue().swapPayload(init); - currentValue().setOffsetStart(tokenStart.start_ - begin_); - skipSpaces(); - if (*current_ == ']') // empty array - { - Token endArray; - readToken(endArray); - return true; - } - int index = 0; - for (;;) { - Value& value = currentValue()[index++]; - nodes_.push(&value); - bool ok = readValue(); - nodes_.pop(); - if (!ok) // error already set - return recoverFromError(tokenArrayEnd); - - Token token; - // Accept Comment after last item in the array. - ok = readToken(token); - while (token.type_ == tokenComment && ok) { - ok = readToken(token); - } - bool badTokenType = - (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); - if (!ok || badTokenType) { - return addErrorAndRecover( - "Missing ',' or ']' in array declaration", token, tokenArrayEnd); - } - if (token.type_ == tokenArrayEnd) - break; - } - return true; -} - -bool OurReader::decodeNumber(Token& token) { - Value decoded; - if (!decodeNumber(token, decoded)) - return false; - currentValue().swapPayload(decoded); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return true; -} - -bool OurReader::decodeNumber(Token& token, Value& decoded) { - // Attempts to parse the number as an integer. If the number is - // larger than the maximum supported value of an integer then - // we decode the number as a double. - Location current = token.start_; - bool isNegative = *current == '-'; - if (isNegative) - ++current; - // TODO: Help the compiler do the div and mod at compile time or get rid of them. - Value::LargestUInt maxIntegerValue = - isNegative ? Value::LargestUInt(-Value::minLargestInt) - : Value::maxLargestUInt; - Value::LargestUInt threshold = maxIntegerValue / 10; - Value::LargestUInt value = 0; - while (current < token.end_) { - Char c = *current++; - if (c < '0' || c > '9') - return decodeDouble(token, decoded); - Value::UInt digit(c - '0'); - if (value >= threshold) { - // We've hit or exceeded the max value divided by 10 (rounded down). If - // a) we've only just touched the limit, b) this is the last digit, and - // c) it's small enough to fit in that rounding delta, we're okay. - // Otherwise treat this number as a double to avoid overflow. - if (value > threshold || current != token.end_ || - digit > maxIntegerValue % 10) { - return decodeDouble(token, decoded); - } - } - value = value * 10 + digit; - } - if (isNegative) - decoded = -Value::LargestInt(value); - else if (value <= Value::LargestUInt(Value::maxInt)) - decoded = Value::LargestInt(value); - else - decoded = value; - return true; -} - -bool OurReader::decodeDouble(Token& token) { - Value decoded; - if (!decodeDouble(token, decoded)) - return false; - currentValue().swapPayload(decoded); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return true; -} - -bool OurReader::decodeDouble(Token& token, Value& decoded) { - double value = 0; - const int bufferSize = 32; - int count; - int length = int(token.end_ - token.start_); - - // Sanity check to avoid buffer overflow exploits. - if (length < 0) { - return addError("Unable to parse token length", token); - } - - // Avoid using a string constant for the format control string given to - // sscanf, as this can cause hard to debug crashes on OS X. See here for more - // info: - // - // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html - char format[] = "%lf"; - - if (length <= bufferSize) { - Char buffer[bufferSize + 1]; - memcpy(buffer, token.start_, length); - buffer[length] = 0; - count = sscanf(buffer, format, &value); - } else { - std::string buffer(token.start_, token.end_); - count = sscanf(buffer.c_str(), format, &value); - } - - if (count != 1) - return addError("'" + std::string(token.start_, token.end_) + - "' is not a number.", - token); - decoded = value; - return true; -} - -bool OurReader::decodeString(Token& token) { - std::string decoded_string; - if (!decodeString(token, decoded_string)) - return false; - Value decoded(decoded_string); - currentValue().swapPayload(decoded); - currentValue().setOffsetStart(token.start_ - begin_); - currentValue().setOffsetLimit(token.end_ - begin_); - return true; -} - -bool OurReader::decodeString(Token& token, std::string& decoded) { - decoded.reserve(token.end_ - token.start_ - 2); - Location current = token.start_ + 1; // skip '"' - Location end = token.end_ - 1; // do not include '"' - while (current != end) { - Char c = *current++; - if (c == '"') - break; - else if (c == '\\') { - if (current == end) - return addError("Empty escape sequence in string", token, current); - Char escape = *current++; - switch (escape) { - case '"': - decoded += '"'; - break; - case '/': - decoded += '/'; - break; - case '\\': - decoded += '\\'; - break; - case 'b': - decoded += '\b'; - break; - case 'f': - decoded += '\f'; - break; - case 'n': - decoded += '\n'; - break; - case 'r': - decoded += '\r'; - break; - case 't': - decoded += '\t'; - break; - case 'u': { - unsigned int unicode; - if (!decodeUnicodeCodePoint(token, current, end, unicode)) - return false; - decoded += codePointToUTF8(unicode); - } break; - default: - return addError("Bad escape sequence in string", token, current); - } - } else { - decoded += c; - } - } - return true; -} - -bool OurReader::decodeUnicodeCodePoint(Token& token, - Location& current, - Location end, - unsigned int& unicode) { - - if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) - return false; - if (unicode >= 0xD800 && unicode <= 0xDBFF) { - // surrogate pairs - if (end - current < 6) - return addError( - "additional six characters expected to parse unicode surrogate pair.", - token, - current); - unsigned int surrogatePair; - if (*(current++) == '\\' && *(current++) == 'u') { - if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { - unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); - } else - return false; - } else - return addError("expecting another \\u token to begin the second half of " - "a unicode surrogate pair", - token, - current); - } - return true; -} - -bool OurReader::decodeUnicodeEscapeSequence(Token& token, - Location& current, - Location end, - unsigned int& unicode) { - if (end - current < 4) - return addError( - "Bad unicode escape sequence in string: four digits expected.", - token, - current); - unicode = 0; - for (int index = 0; index < 4; ++index) { - Char c = *current++; - unicode *= 16; - if (c >= '0' && c <= '9') - unicode += c - '0'; - else if (c >= 'a' && c <= 'f') - unicode += c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - unicode += c - 'A' + 10; - else - return addError( - "Bad unicode escape sequence in string: hexadecimal digit expected.", - token, - current); - } - return true; -} - -bool -OurReader::addError(const std::string& message, Token& token, Location extra) { - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = extra; - errors_.push_back(info); - return false; -} - -bool OurReader::recoverFromError(TokenType skipUntilToken) { - int errorCount = int(errors_.size()); - Token skip; - for (;;) { - if (!readToken(skip)) - errors_.resize(errorCount); // discard errors caused by recovery - if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) - break; - } - errors_.resize(errorCount); - return false; -} - -bool OurReader::addErrorAndRecover(const std::string& message, - Token& token, - TokenType skipUntilToken) { - addError(message, token); - return recoverFromError(skipUntilToken); -} - -Value& OurReader::currentValue() { return *(nodes_.top()); } - -OurReader::Char OurReader::getNextChar() { - if (current_ == end_) - return 0; - return *current_++; -} - -void OurReader::getLocationLineAndColumn(Location location, - int& line, - int& column) const { - Location current = begin_; - Location lastLineStart = current; - line = 0; - while (current < location && current != end_) { - Char c = *current++; - if (c == '\r') { - if (*current == '\n') - ++current; - lastLineStart = current; - ++line; - } else if (c == '\n') { - lastLineStart = current; - ++line; - } - } - // column & line start at 1 - column = int(location - lastLineStart) + 1; - ++line; -} - -std::string OurReader::getLocationLineAndColumn(Location location) const { - int line, column; - getLocationLineAndColumn(location, line, column); - char buffer[18 + 16 + 16 + 1]; - snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); - return buffer; -} - -std::string OurReader::getFormattedErrorMessages() const { - std::string formattedMessage; - for (Errors::const_iterator itError = errors_.begin(); - itError != errors_.end(); - ++itError) { - const ErrorInfo& error = *itError; - formattedMessage += - "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; - formattedMessage += " " + error.message_ + "\n"; - if (error.extra_) - formattedMessage += - "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n"; - } - return formattedMessage; -} - -std::vector OurReader::getStructuredErrors() const { - std::vector allErrors; - for (Errors::const_iterator itError = errors_.begin(); - itError != errors_.end(); - ++itError) { - const ErrorInfo& error = *itError; - OurReader::StructuredError structured; - structured.offset_start = error.token_.start_ - begin_; - structured.offset_limit = error.token_.end_ - begin_; - structured.message = error.message_; - allErrors.push_back(structured); - } - return allErrors; -} - -bool OurReader::pushError(const Value& value, const std::string& message) { - size_t length = end_ - begin_; - if(value.getOffsetStart() > length - || value.getOffsetLimit() > length) - return false; - Token token; - token.type_ = tokenError; - token.start_ = begin_ + value.getOffsetStart(); - token.end_ = end_ + value.getOffsetLimit(); - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = 0; - errors_.push_back(info); - return true; -} - -bool OurReader::pushError(const Value& value, const std::string& message, const Value& extra) { - size_t length = end_ - begin_; - if(value.getOffsetStart() > length - || value.getOffsetLimit() > length - || extra.getOffsetLimit() > length) - return false; - Token token; - token.type_ = tokenError; - token.start_ = begin_ + value.getOffsetStart(); - token.end_ = begin_ + value.getOffsetLimit(); - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = begin_ + extra.getOffsetStart(); - errors_.push_back(info); - return true; -} - -bool OurReader::good() const { - return !errors_.size(); -} - - -class OurCharReader : public CharReader { - bool const collectComments_; - OurReader reader_; -public: - OurCharReader( - bool collectComments, - OurFeatures const& features) - : collectComments_(collectComments) - , reader_(features) - {} - bool parse( - char const* beginDoc, char const* endDoc, - Value* root, std::string* errs) override { - bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_); - if (errs) { - *errs = reader_.getFormattedErrorMessages(); - } - return ok; - } -}; - -CharReaderBuilder::CharReaderBuilder() -{ - setDefaults(&settings_); -} -CharReaderBuilder::~CharReaderBuilder() -{} -CharReader* CharReaderBuilder::newCharReader() const -{ - bool collectComments = settings_["collectComments"].asBool(); - OurFeatures features = OurFeatures::all(); - features.allowComments_ = settings_["allowComments"].asBool(); - features.strictRoot_ = settings_["strictRoot"].asBool(); - features.allowDroppedNullPlaceholders_ = settings_["allowDroppedNullPlaceholders"].asBool(); - features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool(); - features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool(); - features.stackLimit_ = settings_["stackLimit"].asInt(); - features.failIfExtra_ = settings_["failIfExtra"].asBool(); - features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool(); - features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool(); - return new OurCharReader(collectComments, features); -} -static void getValidReaderKeys(std::set* valid_keys) -{ - valid_keys->clear(); - valid_keys->insert("collectComments"); - valid_keys->insert("allowComments"); - valid_keys->insert("strictRoot"); - valid_keys->insert("allowDroppedNullPlaceholders"); - valid_keys->insert("allowNumericKeys"); - valid_keys->insert("allowSingleQuotes"); - valid_keys->insert("stackLimit"); - valid_keys->insert("failIfExtra"); - valid_keys->insert("rejectDupKeys"); - valid_keys->insert("allowSpecialFloats"); -} -bool CharReaderBuilder::validate(Json::Value* invalid) const -{ - Json::Value my_invalid; - if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL - Json::Value& inv = *invalid; - std::set valid_keys; - getValidReaderKeys(&valid_keys); - Value::Members keys = settings_.getMemberNames(); - size_t n = keys.size(); - for (size_t i = 0; i < n; ++i) { - std::string const& key = keys[i]; - if (valid_keys.find(key) == valid_keys.end()) { - inv[key] = settings_[key]; - } - } - return 0u == inv.size(); -} -Value& CharReaderBuilder::operator[](std::string key) -{ - return settings_[key]; -} -// static -void CharReaderBuilder::strictMode(Json::Value* settings) -{ -//! [CharReaderBuilderStrictMode] - (*settings)["allowComments"] = false; - (*settings)["strictRoot"] = true; - (*settings)["allowDroppedNullPlaceholders"] = false; - (*settings)["allowNumericKeys"] = false; - (*settings)["allowSingleQuotes"] = false; - (*settings)["stackLimit"] = 1000; - (*settings)["failIfExtra"] = true; - (*settings)["rejectDupKeys"] = true; - (*settings)["allowSpecialFloats"] = false; -//! [CharReaderBuilderStrictMode] -} -// static -void CharReaderBuilder::setDefaults(Json::Value* settings) -{ -//! [CharReaderBuilderDefaults] - (*settings)["collectComments"] = true; - (*settings)["allowComments"] = true; - (*settings)["strictRoot"] = false; - (*settings)["allowDroppedNullPlaceholders"] = false; - (*settings)["allowNumericKeys"] = false; - (*settings)["allowSingleQuotes"] = false; - (*settings)["stackLimit"] = 1000; - (*settings)["failIfExtra"] = false; - (*settings)["rejectDupKeys"] = false; - (*settings)["allowSpecialFloats"] = false; -//! [CharReaderBuilderDefaults] -} - -////////////////////////////////// -// global functions - -bool parseFromStream( - CharReader::Factory const& fact, std::istream& sin, - Value* root, std::string* errs) -{ - std::ostringstream ssin; - ssin << sin.rdbuf(); - std::string doc = ssin.str(); - char const* begin = doc.data(); - char const* end = begin + doc.size(); - // Note that we do not actually need a null-terminator. - CharReaderPtr const reader(fact.newCharReader()); - return reader->parse(begin, end, root, errs); -} - -std::istream& operator>>(std::istream& sin, Value& root) { - CharReaderBuilder b; - std::string errs; - bool ok = parseFromStream(b, sin, &root, &errs); - if (!ok) { - fprintf(stderr, - "Error from reader: %s", - errs.c_str()); - - throwRuntimeError(errs); - } - return sin; -} - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_reader.cpp -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_valueiterator.inl -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2007-2010 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -// included by json_value.cpp - -namespace Json { - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class ValueIteratorBase -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -ValueIteratorBase::ValueIteratorBase() - : current_(), isNull_(true) { -} - -ValueIteratorBase::ValueIteratorBase( - const Value::ObjectValues::iterator& current) - : current_(current), isNull_(false) {} - -Value& ValueIteratorBase::deref() const { - return current_->second; -} - -void ValueIteratorBase::increment() { - ++current_; -} - -void ValueIteratorBase::decrement() { - --current_; -} - -ValueIteratorBase::difference_type -ValueIteratorBase::computeDistance(const SelfType& other) const { -#ifdef JSON_USE_CPPTL_SMALLMAP - return other.current_ - current_; -#else - // Iterator for null value are initialized using the default - // constructor, which initialize current_ to the default - // std::map::iterator. As begin() and end() are two instance - // of the default std::map::iterator, they can not be compared. - // To allow this, we handle this comparison specifically. - if (isNull_ && other.isNull_) { - return 0; - } - - // Usage of std::distance is not portable (does not compile with Sun Studio 12 - // RogueWave STL, - // which is the one used by default). - // Using a portable hand-made version for non random iterator instead: - // return difference_type( std::distance( current_, other.current_ ) ); - difference_type myDistance = 0; - for (Value::ObjectValues::iterator it = current_; it != other.current_; - ++it) { - ++myDistance; - } - return myDistance; -#endif -} - -bool ValueIteratorBase::isEqual(const SelfType& other) const { - if (isNull_) { - return other.isNull_; - } - return current_ == other.current_; -} - -void ValueIteratorBase::copy(const SelfType& other) { - current_ = other.current_; - isNull_ = other.isNull_; -} - -Value ValueIteratorBase::key() const { - const Value::CZString czstring = (*current_).first; - if (czstring.data()) { - if (czstring.isStaticString()) - return Value(StaticString(czstring.data())); - return Value(czstring.data(), czstring.data() + czstring.length()); - } - return Value(czstring.index()); -} - -UInt ValueIteratorBase::index() const { - const Value::CZString czstring = (*current_).first; - if (!czstring.data()) - return czstring.index(); - return Value::UInt(-1); -} - -std::string ValueIteratorBase::name() const { - char const* keey; - char const* end; - keey = memberName(&end); - if (!keey) return std::string(); - return std::string(keey, end); -} - -char const* ValueIteratorBase::memberName() const { - const char* cname = (*current_).first.data(); - return cname ? cname : ""; -} - -char const* ValueIteratorBase::memberName(char const** end) const { - const char* cname = (*current_).first.data(); - if (!cname) { - *end = NULL; - return NULL; - } - *end = cname + (*current_).first.length(); - return cname; -} - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class ValueConstIterator -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -ValueConstIterator::ValueConstIterator() {} - -ValueConstIterator::ValueConstIterator( - const Value::ObjectValues::iterator& current) - : ValueIteratorBase(current) {} - -ValueConstIterator::ValueConstIterator(ValueIterator const& other) - : ValueIteratorBase(other) {} - -ValueConstIterator& ValueConstIterator:: -operator=(const ValueIteratorBase& other) { - copy(other); - return *this; -} - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class ValueIterator -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -ValueIterator::ValueIterator() {} - -ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) - : ValueIteratorBase(current) {} - -ValueIterator::ValueIterator(const ValueConstIterator& other) - : ValueIteratorBase(other) { - throwRuntimeError("ConstIterator to Iterator should never be allowed."); -} - -ValueIterator::ValueIterator(const ValueIterator& other) - : ValueIteratorBase(other) {} - -ValueIterator& ValueIterator::operator=(const SelfType& other) { - copy(other); - return *this; -} - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_valueiterator.inl -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_value.cpp -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2011 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include -#ifdef JSON_USE_CPPTL -#include -#endif -#include // size_t -#include // min() - -#define JSON_ASSERT_UNREACHABLE assert(false) - -namespace Json { - -// This is a walkaround to avoid the static initialization of Value::null. -// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of -// 8 (instead of 4) as a bit of future-proofing. -#if defined(__ARMEL__) -#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) -#else -#define ALIGNAS(byte_alignment) -#endif -static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 }; -const unsigned char& kNullRef = kNull[0]; -const Value& Value::null = reinterpret_cast(kNullRef); -const Value& Value::nullRef = null; - -const Int Value::minInt = Int(~(UInt(-1) / 2)); -const Int Value::maxInt = Int(UInt(-1) / 2); -const UInt Value::maxUInt = UInt(-1); -#if defined(JSON_HAS_INT64) -const Int64 Value::minInt64 = Int64(~(UInt64(-1) / 2)); -const Int64 Value::maxInt64 = Int64(UInt64(-1) / 2); -const UInt64 Value::maxUInt64 = UInt64(-1); -// The constant is hard-coded because some compiler have trouble -// converting Value::maxUInt64 to a double correctly (AIX/xlC). -// Assumes that UInt64 is a 64 bits integer. -static const double maxUInt64AsDouble = 18446744073709551615.0; -#endif // defined(JSON_HAS_INT64) -const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2)); -const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2); -const LargestUInt Value::maxLargestUInt = LargestUInt(-1); - -#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) -template -static inline bool InRange(double d, T min, U max) { - return d >= min && d <= max; -} -#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) -static inline double integerToDouble(Json::UInt64 value) { - return static_cast(Int64(value / 2)) * 2.0 + Int64(value & 1); -} - -template static inline double integerToDouble(T value) { - return static_cast(value); -} - -template -static inline bool InRange(double d, T min, U max) { - return d >= integerToDouble(min) && d <= integerToDouble(max); -} -#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - -/** Duplicates the specified string value. - * @param value Pointer to the string to duplicate. Must be zero-terminated if - * length is "unknown". - * @param length Length of the value. if equals to unknown, then it will be - * computed using strlen(value). - * @return Pointer on the duplicate instance of string. - */ -static inline char* duplicateStringValue(const char* value, - size_t length) { - // Avoid an integer overflow in the call to malloc below by limiting length - // to a sane value. - if (length >= (size_t)Value::maxInt) - length = Value::maxInt - 1; - - char* newString = static_cast(malloc(length + 1)); - if (newString == NULL) { - throwRuntimeError( - "in Json::Value::duplicateStringValue(): " - "Failed to allocate string value buffer"); - } - memcpy(newString, value, length); - newString[length] = 0; - return newString; -} - -/* Record the length as a prefix. - */ -static inline char* duplicateAndPrefixStringValue( - const char* value, - unsigned int length) -{ - // Avoid an integer overflow in the call to malloc below by limiting length - // to a sane value. - JSON_ASSERT_MESSAGE(length <= (unsigned)Value::maxInt - sizeof(unsigned) - 1U, - "in Json::Value::duplicateAndPrefixStringValue(): " - "length too big for prefixing"); - unsigned actualLength = length + static_cast(sizeof(unsigned)) + 1U; - char* newString = static_cast(malloc(actualLength)); - if (newString == 0) { - throwRuntimeError( - "in Json::Value::duplicateAndPrefixStringValue(): " - "Failed to allocate string value buffer"); - } - *reinterpret_cast(newString) = length; - memcpy(newString + sizeof(unsigned), value, length); - newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later - return newString; -} -inline static void decodePrefixedString( - bool isPrefixed, char const* prefixed, - unsigned* length, char const** value) -{ - if (!isPrefixed) { - *length = static_cast(strlen(prefixed)); - *value = prefixed; - } else { - *length = *reinterpret_cast(prefixed); - *value = prefixed + sizeof(unsigned); - } -} -/** Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue(). - */ -static inline void releaseStringValue(char* value) { free(value); } - -} // namespace Json - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ValueInternals... -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -#if !defined(JSON_IS_AMALGAMATION) - -#include "json_valueiterator.inl" -#endif // if !defined(JSON_IS_AMALGAMATION) - -namespace Json { - -Exception::Exception(std::string const& msg) - : msg_(msg) -{} -Exception::~Exception() throw() -{} -char const* Exception::what() const throw() -{ - return msg_.c_str(); -} -RuntimeError::RuntimeError(std::string const& msg) - : Exception(msg) -{} -LogicError::LogicError(std::string const& msg) - : Exception(msg) -{} -void throwRuntimeError(std::string const& msg) -{ - throw RuntimeError(msg); -} -void throwLogicError(std::string const& msg) -{ - throw LogicError(msg); -} - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::CommentInfo -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -Value::CommentInfo::CommentInfo() : comment_(0) {} - -Value::CommentInfo::~CommentInfo() { - if (comment_) - releaseStringValue(comment_); -} - -void Value::CommentInfo::setComment(const char* text, size_t len) { - if (comment_) { - releaseStringValue(comment_); - comment_ = 0; - } - JSON_ASSERT(text != 0); - JSON_ASSERT_MESSAGE( - text[0] == '\0' || text[0] == '/', - "in Json::Value::setComment(): Comments must start with /"); - // It seems that /**/ style comments are acceptable as well. - comment_ = duplicateStringValue(text, len); -} - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::CZString -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -// Notes: policy_ indicates if the string was allocated when -// a string is stored. - -Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {} - -Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate) - : cstr_(str) { - // allocate != duplicate - storage_.policy_ = allocate & 0x3; - storage_.length_ = ulength & 0x3FFFFFFF; -} - -Value::CZString::CZString(const CZString& other) - : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0 - ? duplicateStringValue(other.cstr_, other.storage_.length_) - : other.cstr_) { - storage_.policy_ = (other.cstr_ - ? (static_cast(other.storage_.policy_) == noDuplication - ? noDuplication : duplicate) - : static_cast(other.storage_.policy_)); - storage_.length_ = other.storage_.length_; -} - -#if JSON_HAS_RVALUE_REFERENCES -Value::CZString::CZString(CZString&& other) - : cstr_(other.cstr_), index_(other.index_) { - other.cstr_ = nullptr; -} -#endif - -Value::CZString::~CZString() { - if (cstr_ && storage_.policy_ == duplicate) - releaseStringValue(const_cast(cstr_)); -} - -void Value::CZString::swap(CZString& other) { - std::swap(cstr_, other.cstr_); - std::swap(index_, other.index_); -} - -Value::CZString& Value::CZString::operator=(CZString other) { - swap(other); - return *this; -} - -bool Value::CZString::operator<(const CZString& other) const { - if (!cstr_) return index_ < other.index_; - //return strcmp(cstr_, other.cstr_) < 0; - // Assume both are strings. - unsigned this_len = this->storage_.length_; - unsigned other_len = other.storage_.length_; - unsigned min_len = std::min(this_len, other_len); - int comp = memcmp(this->cstr_, other.cstr_, min_len); - if (comp < 0) return true; - if (comp > 0) return false; - return (this_len < other_len); -} - -bool Value::CZString::operator==(const CZString& other) const { - if (!cstr_) return index_ == other.index_; - //return strcmp(cstr_, other.cstr_) == 0; - // Assume both are strings. - unsigned this_len = this->storage_.length_; - unsigned other_len = other.storage_.length_; - if (this_len != other_len) return false; - int comp = memcmp(this->cstr_, other.cstr_, this_len); - return comp == 0; -} - -ArrayIndex Value::CZString::index() const { return index_; } - -//const char* Value::CZString::c_str() const { return cstr_; } -const char* Value::CZString::data() const { return cstr_; } -unsigned Value::CZString::length() const { return storage_.length_; } -bool Value::CZString::isStaticString() const { return storage_.policy_ == noDuplication; } - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::Value -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -/*! \internal Default constructor initialization must be equivalent to: - * memset( this, 0, sizeof(Value) ) - * This optimization is used in ValueInternalMap fast allocator. - */ -Value::Value(ValueType vtype) { - initBasic(vtype); - switch (vtype) { - case nullValue: - break; - case intValue: - case uintValue: - value_.int_ = 0; - break; - case realValue: - value_.real_ = 0.0; - break; - case stringValue: - value_.string_ = 0; - break; - case arrayValue: - case objectValue: - value_.map_ = new ObjectValues(); - break; - case booleanValue: - value_.bool_ = false; - break; - default: - JSON_ASSERT_UNREACHABLE; - } -} - -Value::Value(Int value) { - initBasic(intValue); - value_.int_ = value; -} - -Value::Value(UInt value) { - initBasic(uintValue); - value_.uint_ = value; -} -#if defined(JSON_HAS_INT64) -Value::Value(Int64 value) { - initBasic(intValue); - value_.int_ = value; -} -Value::Value(UInt64 value) { - initBasic(uintValue); - value_.uint_ = value; -} -#endif // defined(JSON_HAS_INT64) - -Value::Value(double value) { - initBasic(realValue); - value_.real_ = value; -} - -Value::Value(const char* value) { - initBasic(stringValue, true); - value_.string_ = duplicateAndPrefixStringValue(value, static_cast(strlen(value))); -} - -Value::Value(const char* beginValue, const char* endValue) { - initBasic(stringValue, true); - value_.string_ = - duplicateAndPrefixStringValue(beginValue, static_cast(endValue - beginValue)); -} - -Value::Value(const std::string& value) { - initBasic(stringValue, true); - value_.string_ = - duplicateAndPrefixStringValue(value.data(), static_cast(value.length())); -} - -Value::Value(const StaticString& value) { - initBasic(stringValue); - value_.string_ = const_cast(value.c_str()); -} - -#ifdef JSON_USE_CPPTL -Value::Value(const CppTL::ConstString& value) { - initBasic(stringValue, true); - value_.string_ = duplicateAndPrefixStringValue(value, static_cast(value.length())); -} -#endif - -Value::Value(bool value) { - initBasic(booleanValue); - value_.bool_ = value; -} - -Value::Value(Value const& other) - : type_(other.type_), allocated_(false) - , - comments_(0), start_(other.start_), limit_(other.limit_) -{ - switch (type_) { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - value_ = other.value_; - break; - case stringValue: - if (other.value_.string_ && other.allocated_) { - unsigned len; - char const* str; - decodePrefixedString(other.allocated_, other.value_.string_, - &len, &str); - value_.string_ = duplicateAndPrefixStringValue(str, len); - allocated_ = true; - } else { - value_.string_ = other.value_.string_; - allocated_ = false; - } - break; - case arrayValue: - case objectValue: - value_.map_ = new ObjectValues(*other.value_.map_); - break; - default: - JSON_ASSERT_UNREACHABLE; - } - if (other.comments_) { - comments_ = new CommentInfo[numberOfCommentPlacement]; - for (int comment = 0; comment < numberOfCommentPlacement; ++comment) { - const CommentInfo& otherComment = other.comments_[comment]; - if (otherComment.comment_) - comments_[comment].setComment( - otherComment.comment_, strlen(otherComment.comment_)); - } - } -} - -#if JSON_HAS_RVALUE_REFERENCES -// Move constructor -Value::Value(Value&& other) { - initBasic(nullValue); - swap(other); -} -#endif - -Value::~Value() { - switch (type_) { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - break; - case stringValue: - if (allocated_) - releaseStringValue(value_.string_); - break; - case arrayValue: - case objectValue: - delete value_.map_; - break; - default: - JSON_ASSERT_UNREACHABLE; - } - - if (comments_) - delete[] comments_; -} - -Value& Value::operator=(Value other) { - swap(other); - return *this; -} - -void Value::swapPayload(Value& other) { - ValueType temp = type_; - type_ = other.type_; - other.type_ = temp; - std::swap(value_, other.value_); - int temp2 = allocated_; - allocated_ = other.allocated_; - other.allocated_ = temp2 & 0x1; -} - -void Value::swap(Value& other) { - swapPayload(other); - std::swap(comments_, other.comments_); - std::swap(start_, other.start_); - std::swap(limit_, other.limit_); -} - -ValueType Value::type() const { return type_; } - -int Value::compare(const Value& other) const { - if (*this < other) - return -1; - if (*this > other) - return 1; - return 0; -} - -bool Value::operator<(const Value& other) const { - int typeDelta = type_ - other.type_; - if (typeDelta) - return typeDelta < 0 ? true : false; - switch (type_) { - case nullValue: - return false; - case intValue: - return value_.int_ < other.value_.int_; - case uintValue: - return value_.uint_ < other.value_.uint_; - case realValue: - return value_.real_ < other.value_.real_; - case booleanValue: - return value_.bool_ < other.value_.bool_; - case stringValue: - { - if ((value_.string_ == 0) || (other.value_.string_ == 0)) { - if (other.value_.string_) return true; - else return false; - } - unsigned this_len; - unsigned other_len; - char const* this_str; - char const* other_str; - decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); - decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); - unsigned min_len = std::min(this_len, other_len); - int comp = memcmp(this_str, other_str, min_len); - if (comp < 0) return true; - if (comp > 0) return false; - return (this_len < other_len); - } - case arrayValue: - case objectValue: { - int delta = int(value_.map_->size() - other.value_.map_->size()); - if (delta) - return delta < 0; - return (*value_.map_) < (*other.value_.map_); - } - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable -} - -bool Value::operator<=(const Value& other) const { return !(other < *this); } - -bool Value::operator>=(const Value& other) const { return !(*this < other); } - -bool Value::operator>(const Value& other) const { return other < *this; } - -bool Value::operator==(const Value& other) const { - // if ( type_ != other.type_ ) - // GCC 2.95.3 says: - // attempt to take address of bit-field structure member `Json::Value::type_' - // Beats me, but a temp solves the problem. - int temp = other.type_; - if (type_ != temp) - return false; - switch (type_) { - case nullValue: - return true; - case intValue: - return value_.int_ == other.value_.int_; - case uintValue: - return value_.uint_ == other.value_.uint_; - case realValue: - return value_.real_ == other.value_.real_; - case booleanValue: - return value_.bool_ == other.value_.bool_; - case stringValue: - { - if ((value_.string_ == 0) || (other.value_.string_ == 0)) { - return (value_.string_ == other.value_.string_); - } - unsigned this_len; - unsigned other_len; - char const* this_str; - char const* other_str; - decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); - decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); - if (this_len != other_len) return false; - int comp = memcmp(this_str, other_str, this_len); - return comp == 0; - } - case arrayValue: - case objectValue: - return value_.map_->size() == other.value_.map_->size() && - (*value_.map_) == (*other.value_.map_); - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable -} - -bool Value::operator!=(const Value& other) const { return !(*this == other); } - -const char* Value::asCString() const { - JSON_ASSERT_MESSAGE(type_ == stringValue, - "in Json::Value::asCString(): requires stringValue"); - if (value_.string_ == 0) return 0; - unsigned this_len; - char const* this_str; - decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); - return this_str; -} - -bool Value::getString(char const** str, char const** cend) const { - if (type_ != stringValue) return false; - if (value_.string_ == 0) return false; - unsigned length; - decodePrefixedString(this->allocated_, this->value_.string_, &length, str); - *cend = *str + length; - return true; -} - -std::string Value::asString() const { - switch (type_) { - case nullValue: - return ""; - case stringValue: - { - if (value_.string_ == 0) return ""; - unsigned this_len; - char const* this_str; - decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); - return std::string(this_str, this_len); - } - case booleanValue: - return value_.bool_ ? "true" : "false"; - case intValue: - return valueToString(value_.int_); - case uintValue: - return valueToString(value_.uint_); - case realValue: - return valueToString(value_.real_); - default: - JSON_FAIL_MESSAGE("Type is not convertible to string"); - } -} - -#ifdef JSON_USE_CPPTL -CppTL::ConstString Value::asConstString() const { - unsigned len; - char const* str; - decodePrefixedString(allocated_, value_.string_, - &len, &str); - return CppTL::ConstString(str, len); -} -#endif - -Value::Int Value::asInt() const { - switch (type_) { - case intValue: - JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range"); - return Int(value_.int_); - case uintValue: - JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range"); - return Int(value_.uint_); - case realValue: - JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt), - "double out of Int range"); - return Int(value_.real_); - case nullValue: - return 0; - case booleanValue: - return value_.bool_ ? 1 : 0; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to Int."); -} - -Value::UInt Value::asUInt() const { - switch (type_) { - case intValue: - JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range"); - return UInt(value_.int_); - case uintValue: - JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range"); - return UInt(value_.uint_); - case realValue: - JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt), - "double out of UInt range"); - return UInt(value_.real_); - case nullValue: - return 0; - case booleanValue: - return value_.bool_ ? 1 : 0; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to UInt."); -} - -#if defined(JSON_HAS_INT64) - -Value::Int64 Value::asInt64() const { - switch (type_) { - case intValue: - return Int64(value_.int_); - case uintValue: - JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); - return Int64(value_.uint_); - case realValue: - JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), - "double out of Int64 range"); - return Int64(value_.real_); - case nullValue: - return 0; - case booleanValue: - return value_.bool_ ? 1 : 0; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to Int64."); -} - -Value::UInt64 Value::asUInt64() const { - switch (type_) { - case intValue: - JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); - return UInt64(value_.int_); - case uintValue: - return UInt64(value_.uint_); - case realValue: - JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), - "double out of UInt64 range"); - return UInt64(value_.real_); - case nullValue: - return 0; - case booleanValue: - return value_.bool_ ? 1 : 0; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); -} -#endif // if defined(JSON_HAS_INT64) - -LargestInt Value::asLargestInt() const { -#if defined(JSON_NO_INT64) - return asInt(); -#else - return asInt64(); -#endif -} - -LargestUInt Value::asLargestUInt() const { -#if defined(JSON_NO_INT64) - return asUInt(); -#else - return asUInt64(); -#endif -} - -double Value::asDouble() const { - switch (type_) { - case intValue: - return static_cast(value_.int_); - case uintValue: -#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return static_cast(value_.uint_); -#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return integerToDouble(value_.uint_); -#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - case realValue: - return value_.real_; - case nullValue: - return 0.0; - case booleanValue: - return value_.bool_ ? 1.0 : 0.0; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to double."); -} - -float Value::asFloat() const { - switch (type_) { - case intValue: - return static_cast(value_.int_); - case uintValue: -#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return static_cast(value_.uint_); -#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - return integerToDouble(value_.uint_); -#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) - case realValue: - return static_cast(value_.real_); - case nullValue: - return 0.0; - case booleanValue: - return value_.bool_ ? 1.0f : 0.0f; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to float."); -} - -bool Value::asBool() const { - switch (type_) { - case booleanValue: - return value_.bool_; - case nullValue: - return false; - case intValue: - return value_.int_ ? true : false; - case uintValue: - return value_.uint_ ? true : false; - case realValue: - // This is kind of strange. Not recommended. - return (value_.real_ != 0.0) ? true : false; - default: - break; - } - JSON_FAIL_MESSAGE("Value is not convertible to bool."); -} - -bool Value::isConvertibleTo(ValueType other) const { - switch (other) { - case nullValue: - return (isNumeric() && asDouble() == 0.0) || - (type_ == booleanValue && value_.bool_ == false) || - (type_ == stringValue && asString() == "") || - (type_ == arrayValue && value_.map_->size() == 0) || - (type_ == objectValue && value_.map_->size() == 0) || - type_ == nullValue; - case intValue: - return isInt() || - (type_ == realValue && InRange(value_.real_, minInt, maxInt)) || - type_ == booleanValue || type_ == nullValue; - case uintValue: - return isUInt() || - (type_ == realValue && InRange(value_.real_, 0, maxUInt)) || - type_ == booleanValue || type_ == nullValue; - case realValue: - return isNumeric() || type_ == booleanValue || type_ == nullValue; - case booleanValue: - return isNumeric() || type_ == booleanValue || type_ == nullValue; - case stringValue: - return isNumeric() || type_ == booleanValue || type_ == stringValue || - type_ == nullValue; - case arrayValue: - return type_ == arrayValue || type_ == nullValue; - case objectValue: - return type_ == objectValue || type_ == nullValue; - } - JSON_ASSERT_UNREACHABLE; - return false; -} - -/// Number of values in array or object -ArrayIndex Value::size() const { - switch (type_) { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - case stringValue: - return 0; - case arrayValue: // size of the array is highest index + 1 - if (!value_.map_->empty()) { - ObjectValues::const_iterator itLast = value_.map_->end(); - --itLast; - return (*itLast).first.index() + 1; - } - return 0; - case objectValue: - return ArrayIndex(value_.map_->size()); - } - JSON_ASSERT_UNREACHABLE; - return 0; // unreachable; -} - -bool Value::empty() const { - if (isNull() || isArray() || isObject()) - return size() == 0u; - else - return false; -} - -bool Value::operator!() const { return isNull(); } - -void Value::clear() { - JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue || - type_ == objectValue, - "in Json::Value::clear(): requires complex value"); - start_ = 0; - limit_ = 0; - switch (type_) { - case arrayValue: - case objectValue: - value_.map_->clear(); - break; - default: - break; - } -} - -void Value::resize(ArrayIndex newSize) { - JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, - "in Json::Value::resize(): requires arrayValue"); - if (type_ == nullValue) - *this = Value(arrayValue); - ArrayIndex oldSize = size(); - if (newSize == 0) - clear(); - else if (newSize > oldSize) - (*this)[newSize - 1]; - else { - for (ArrayIndex index = newSize; index < oldSize; ++index) { - value_.map_->erase(index); - } - assert(size() == newSize); - } -} - -Value& Value::operator[](ArrayIndex index) { - JSON_ASSERT_MESSAGE( - type_ == nullValue || type_ == arrayValue, - "in Json::Value::operator[](ArrayIndex): requires arrayValue"); - if (type_ == nullValue) - *this = Value(arrayValue); - CZString key(index); - ObjectValues::iterator it = value_.map_->lower_bound(key); - if (it != value_.map_->end() && (*it).first == key) - return (*it).second; - - ObjectValues::value_type defaultValue(key, nullRef); - it = value_.map_->insert(it, defaultValue); - return (*it).second; -} - -Value& Value::operator[](int index) { - JSON_ASSERT_MESSAGE( - index >= 0, - "in Json::Value::operator[](int index): index cannot be negative"); - return (*this)[ArrayIndex(index)]; -} - -const Value& Value::operator[](ArrayIndex index) const { - JSON_ASSERT_MESSAGE( - type_ == nullValue || type_ == arrayValue, - "in Json::Value::operator[](ArrayIndex)const: requires arrayValue"); - if (type_ == nullValue) - return nullRef; - CZString key(index); - ObjectValues::const_iterator it = value_.map_->find(key); - if (it == value_.map_->end()) - return nullRef; - return (*it).second; -} - -const Value& Value::operator[](int index) const { - JSON_ASSERT_MESSAGE( - index >= 0, - "in Json::Value::operator[](int index) const: index cannot be negative"); - return (*this)[ArrayIndex(index)]; -} - -void Value::initBasic(ValueType vtype, bool allocated) { - type_ = vtype; - allocated_ = allocated; - comments_ = 0; - start_ = 0; - limit_ = 0; -} - -// Access an object value by name, create a null member if it does not exist. -// @pre Type of '*this' is object or null. -// @param key is null-terminated. -Value& Value::resolveReference(const char* key) { - JSON_ASSERT_MESSAGE( - type_ == nullValue || type_ == objectValue, - "in Json::Value::resolveReference(): requires objectValue"); - if (type_ == nullValue) - *this = Value(objectValue); - CZString actualKey( - key, static_cast(strlen(key)), CZString::noDuplication); // NOTE! - ObjectValues::iterator it = value_.map_->lower_bound(actualKey); - if (it != value_.map_->end() && (*it).first == actualKey) - return (*it).second; - - ObjectValues::value_type defaultValue(actualKey, nullRef); - it = value_.map_->insert(it, defaultValue); - Value& value = (*it).second; - return value; -} - -// @param key is not null-terminated. -Value& Value::resolveReference(char const* key, char const* cend) -{ - JSON_ASSERT_MESSAGE( - type_ == nullValue || type_ == objectValue, - "in Json::Value::resolveReference(key, end): requires objectValue"); - if (type_ == nullValue) - *this = Value(objectValue); - CZString actualKey( - key, static_cast(cend-key), CZString::duplicateOnCopy); - ObjectValues::iterator it = value_.map_->lower_bound(actualKey); - if (it != value_.map_->end() && (*it).first == actualKey) - return (*it).second; - - ObjectValues::value_type defaultValue(actualKey, nullRef); - it = value_.map_->insert(it, defaultValue); - Value& value = (*it).second; - return value; -} - -Value Value::get(ArrayIndex index, const Value& defaultValue) const { - const Value* value = &((*this)[index]); - return value == &nullRef ? defaultValue : *value; -} - -bool Value::isValidIndex(ArrayIndex index) const { return index < size(); } - -Value const* Value::find(char const* key, char const* cend) const -{ - JSON_ASSERT_MESSAGE( - type_ == nullValue || type_ == objectValue, - "in Json::Value::find(key, end, found): requires objectValue or nullValue"); - if (type_ == nullValue) return NULL; - CZString actualKey(key, static_cast(cend-key), CZString::noDuplication); - ObjectValues::const_iterator it = value_.map_->find(actualKey); - if (it == value_.map_->end()) return NULL; - return &(*it).second; -} -const Value& Value::operator[](const char* key) const -{ - Value const* found = find(key, key + strlen(key)); - if (!found) return nullRef; - return *found; -} -Value const& Value::operator[](std::string const& key) const -{ - Value const* found = find(key.data(), key.data() + key.length()); - if (!found) return nullRef; - return *found; -} - -Value& Value::operator[](const char* key) { - return resolveReference(key, key + strlen(key)); -} - -Value& Value::operator[](const std::string& key) { - return resolveReference(key.data(), key.data() + key.length()); -} - -Value& Value::operator[](const StaticString& key) { - return resolveReference(key.c_str()); -} - -#ifdef JSON_USE_CPPTL -Value& Value::operator[](const CppTL::ConstString& key) { - return resolveReference(key.c_str(), key.end_c_str()); -} -Value const& Value::operator[](CppTL::ConstString const& key) const -{ - Value const* found = find(key.c_str(), key.end_c_str()); - if (!found) return nullRef; - return *found; -} -#endif - -Value& Value::append(const Value& value) { return (*this)[size()] = value; } - -Value Value::get(char const* key, char const* cend, Value const& defaultValue) const -{ - Value const* found = find(key, cend); - return !found ? defaultValue : *found; -} -Value Value::get(char const* key, Value const& defaultValue) const -{ - return get(key, key + strlen(key), defaultValue); -} -Value Value::get(std::string const& key, Value const& defaultValue) const -{ - return get(key.data(), key.data() + key.length(), defaultValue); -} - - -bool Value::removeMember(const char* key, const char* cend, Value* removed) -{ - if (type_ != objectValue) { - return false; - } - CZString actualKey(key, static_cast(cend-key), CZString::noDuplication); - ObjectValues::iterator it = value_.map_->find(actualKey); - if (it == value_.map_->end()) - return false; - *removed = it->second; - value_.map_->erase(it); - return true; -} -bool Value::removeMember(const char* key, Value* removed) -{ - return removeMember(key, key + strlen(key), removed); -} -bool Value::removeMember(std::string const& key, Value* removed) -{ - return removeMember(key.data(), key.data() + key.length(), removed); -} -Value Value::removeMember(const char* key) -{ - JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue, - "in Json::Value::removeMember(): requires objectValue"); - if (type_ == nullValue) - return nullRef; - - Value removed; // null - removeMember(key, key + strlen(key), &removed); - return removed; // still null if removeMember() did nothing -} -Value Value::removeMember(const std::string& key) -{ - return removeMember(key.c_str()); -} - -bool Value::removeIndex(ArrayIndex index, Value* removed) { - if (type_ != arrayValue) { - return false; - } - CZString key(index); - ObjectValues::iterator it = value_.map_->find(key); - if (it == value_.map_->end()) { - return false; - } - *removed = it->second; - ArrayIndex oldSize = size(); - // shift left all items left, into the place of the "removed" - for (ArrayIndex i = index; i < (oldSize - 1); ++i){ - CZString keey(i); - (*value_.map_)[keey] = (*this)[i + 1]; - } - // erase the last one ("leftover") - CZString keyLast(oldSize - 1); - ObjectValues::iterator itLast = value_.map_->find(keyLast); - value_.map_->erase(itLast); - return true; -} - -#ifdef JSON_USE_CPPTL -Value Value::get(const CppTL::ConstString& key, - const Value& defaultValue) const { - return get(key.c_str(), key.end_c_str(), defaultValue); -} -#endif - -bool Value::isMember(char const* key, char const* cend) const -{ - Value const* value = find(key, cend); - return NULL != value; -} -bool Value::isMember(char const* key) const -{ - return isMember(key, key + strlen(key)); -} -bool Value::isMember(std::string const& key) const -{ - return isMember(key.data(), key.data() + key.length()); -} - -#ifdef JSON_USE_CPPTL -bool Value::isMember(const CppTL::ConstString& key) const { - return isMember(key.c_str(), key.end_c_str()); -} -#endif - -Value::Members Value::getMemberNames() const { - JSON_ASSERT_MESSAGE( - type_ == nullValue || type_ == objectValue, - "in Json::Value::getMemberNames(), value must be objectValue"); - if (type_ == nullValue) - return Value::Members(); - Members members; - members.reserve(value_.map_->size()); - ObjectValues::const_iterator it = value_.map_->begin(); - ObjectValues::const_iterator itEnd = value_.map_->end(); - for (; it != itEnd; ++it) { - members.push_back(std::string((*it).first.data(), - (*it).first.length())); - } - return members; -} -// -//# ifdef JSON_USE_CPPTL -// EnumMemberNames -// Value::enumMemberNames() const -//{ -// if ( type_ == objectValue ) -// { -// return CppTL::Enum::any( CppTL::Enum::transform( -// CppTL::Enum::keys( *(value_.map_), CppTL::Type() ), -// MemberNamesTransform() ) ); -// } -// return EnumMemberNames(); -//} -// -// -// EnumValues -// Value::enumValues() const -//{ -// if ( type_ == objectValue || type_ == arrayValue ) -// return CppTL::Enum::anyValues( *(value_.map_), -// CppTL::Type() ); -// return EnumValues(); -//} -// -//# endif - -static bool IsIntegral(double d) { - double integral_part; - return modf(d, &integral_part) == 0.0; -} - -bool Value::isNull() const { return type_ == nullValue; } - -bool Value::isBool() const { return type_ == booleanValue; } - -bool Value::isInt() const { - switch (type_) { - case intValue: - return value_.int_ >= minInt && value_.int_ <= maxInt; - case uintValue: - return value_.uint_ <= UInt(maxInt); - case realValue: - return value_.real_ >= minInt && value_.real_ <= maxInt && - IsIntegral(value_.real_); - default: - break; - } - return false; -} - -bool Value::isUInt() const { - switch (type_) { - case intValue: - return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt); - case uintValue: - return value_.uint_ <= maxUInt; - case realValue: - return value_.real_ >= 0 && value_.real_ <= maxUInt && - IsIntegral(value_.real_); - default: - break; - } - return false; -} - -bool Value::isInt64() const { -#if defined(JSON_HAS_INT64) - switch (type_) { - case intValue: - return true; - case uintValue: - return value_.uint_ <= UInt64(maxInt64); - case realValue: - // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a - // double, so double(maxInt64) will be rounded up to 2^63. Therefore we - // require the value to be strictly less than the limit. - return value_.real_ >= double(minInt64) && - value_.real_ < double(maxInt64) && IsIntegral(value_.real_); - default: - break; - } -#endif // JSON_HAS_INT64 - return false; -} - -bool Value::isUInt64() const { -#if defined(JSON_HAS_INT64) - switch (type_) { - case intValue: - return value_.int_ >= 0; - case uintValue: - return true; - case realValue: - // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a - // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we - // require the value to be strictly less than the limit. - return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble && - IsIntegral(value_.real_); - default: - break; - } -#endif // JSON_HAS_INT64 - return false; -} - -bool Value::isIntegral() const { -#if defined(JSON_HAS_INT64) - return isInt64() || isUInt64(); -#else - return isInt() || isUInt(); -#endif -} - -bool Value::isDouble() const { return type_ == realValue || isIntegral(); } - -bool Value::isNumeric() const { return isIntegral() || isDouble(); } - -bool Value::isString() const { return type_ == stringValue; } - -bool Value::isArray() const { return type_ == arrayValue; } - -bool Value::isObject() const { return type_ == objectValue; } - -void Value::setComment(const char* comment, size_t len, CommentPlacement placement) { - if (!comments_) - comments_ = new CommentInfo[numberOfCommentPlacement]; - if ((len > 0) && (comment[len-1] == '\n')) { - // Always discard trailing newline, to aid indentation. - len -= 1; - } - comments_[placement].setComment(comment, len); -} - -void Value::setComment(const char* comment, CommentPlacement placement) { - setComment(comment, strlen(comment), placement); -} - -void Value::setComment(const std::string& comment, CommentPlacement placement) { - setComment(comment.c_str(), comment.length(), placement); -} - -bool Value::hasComment(CommentPlacement placement) const { - return comments_ != 0 && comments_[placement].comment_ != 0; -} - -std::string Value::getComment(CommentPlacement placement) const { - if (hasComment(placement)) - return comments_[placement].comment_; - return ""; -} - -void Value::setOffsetStart(size_t start) { start_ = start; } - -void Value::setOffsetLimit(size_t limit) { limit_ = limit; } - -size_t Value::getOffsetStart() const { return start_; } - -size_t Value::getOffsetLimit() const { return limit_; } - -std::string Value::toStyledString() const { - StyledWriter writer; - return writer.write(*this); -} - -Value::const_iterator Value::begin() const { - switch (type_) { - case arrayValue: - case objectValue: - if (value_.map_) - return const_iterator(value_.map_->begin()); - break; - default: - break; - } - return const_iterator(); -} - -Value::const_iterator Value::end() const { - switch (type_) { - case arrayValue: - case objectValue: - if (value_.map_) - return const_iterator(value_.map_->end()); - break; - default: - break; - } - return const_iterator(); -} - -Value::iterator Value::begin() { - switch (type_) { - case arrayValue: - case objectValue: - if (value_.map_) - return iterator(value_.map_->begin()); - break; - default: - break; - } - return iterator(); -} - -Value::iterator Value::end() { - switch (type_) { - case arrayValue: - case objectValue: - if (value_.map_) - return iterator(value_.map_->end()); - break; - default: - break; - } - return iterator(); -} - -// class PathArgument -// ////////////////////////////////////////////////////////////////// - -PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {} - -PathArgument::PathArgument(ArrayIndex index) - : key_(), index_(index), kind_(kindIndex) {} - -PathArgument::PathArgument(const char* key) - : key_(key), index_(), kind_(kindKey) {} - -PathArgument::PathArgument(const std::string& key) - : key_(key.c_str()), index_(), kind_(kindKey) {} - -// class Path -// ////////////////////////////////////////////////////////////////// - -Path::Path(const std::string& path, - const PathArgument& a1, - const PathArgument& a2, - const PathArgument& a3, - const PathArgument& a4, - const PathArgument& a5) { - InArgs in; - in.push_back(&a1); - in.push_back(&a2); - in.push_back(&a3); - in.push_back(&a4); - in.push_back(&a5); - makePath(path, in); -} - -void Path::makePath(const std::string& path, const InArgs& in) { - const char* current = path.c_str(); - const char* end = current + path.length(); - InArgs::const_iterator itInArg = in.begin(); - while (current != end) { - if (*current == '[') { - ++current; - if (*current == '%') - addPathInArg(path, in, itInArg, PathArgument::kindIndex); - else { - ArrayIndex index = 0; - for (; current != end && *current >= '0' && *current <= '9'; ++current) - index = index * 10 + ArrayIndex(*current - '0'); - args_.push_back(index); - } - if (current == end || *current++ != ']') - invalidPath(path, int(current - path.c_str())); - } else if (*current == '%') { - addPathInArg(path, in, itInArg, PathArgument::kindKey); - ++current; - } else if (*current == '.') { - ++current; - } else { - const char* beginName = current; - while (current != end && !strchr("[.", *current)) - ++current; - args_.push_back(std::string(beginName, current)); - } - } -} - -void Path::addPathInArg(const std::string& /*path*/, - const InArgs& in, - InArgs::const_iterator& itInArg, - PathArgument::Kind kind) { - if (itInArg == in.end()) { - // Error: missing argument %d - } else if ((*itInArg)->kind_ != kind) { - // Error: bad argument type - } else { - args_.push_back(**itInArg); - } -} - -void Path::invalidPath(const std::string& /*path*/, int /*location*/) { - // Error: invalid path. -} - -const Value& Path::resolve(const Value& root) const { - const Value* node = &root; - for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { - const PathArgument& arg = *it; - if (arg.kind_ == PathArgument::kindIndex) { - if (!node->isArray() || !node->isValidIndex(arg.index_)) { - // Error: unable to resolve path (array value expected at position... - } - node = &((*node)[arg.index_]); - } else if (arg.kind_ == PathArgument::kindKey) { - if (!node->isObject()) { - // Error: unable to resolve path (object value expected at position...) - } - node = &((*node)[arg.key_]); - if (node == &Value::nullRef) { - // Error: unable to resolve path (object has no member named '' at - // position...) - } - } - } - return *node; -} - -Value Path::resolve(const Value& root, const Value& defaultValue) const { - const Value* node = &root; - for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { - const PathArgument& arg = *it; - if (arg.kind_ == PathArgument::kindIndex) { - if (!node->isArray() || !node->isValidIndex(arg.index_)) - return defaultValue; - node = &((*node)[arg.index_]); - } else if (arg.kind_ == PathArgument::kindKey) { - if (!node->isObject()) - return defaultValue; - node = &((*node)[arg.key_]); - if (node == &Value::nullRef) - return defaultValue; - } - } - return *node; -} - -Value& Path::make(Value& root) const { - Value* node = &root; - for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { - const PathArgument& arg = *it; - if (arg.kind_ == PathArgument::kindIndex) { - if (!node->isArray()) { - // Error: node is not an array at position ... - } - node = &((*node)[arg.index_]); - } else if (arg.kind_ == PathArgument::kindKey) { - if (!node->isObject()) { - // Error: node is not an object at position... - } - node = &((*node)[arg.key_]); - } - } - return *node; -} - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_value.cpp -// ////////////////////////////////////////////////////////////////////// - - - - - - -// ////////////////////////////////////////////////////////////////////// -// Beginning of content of file: src/lib_json/json_writer.cpp -// ////////////////////////////////////////////////////////////////////// - -// Copyright 2011 Baptiste Lepilleur -// Distributed under MIT license, or public domain if desired and -// recognized in your jurisdiction. -// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE - -#if !defined(JSON_IS_AMALGAMATION) -#include -#include "json_tool.h" -#endif // if !defined(JSON_IS_AMALGAMATION) -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0 -#include -#define isfinite _finite -#elif defined(__sun) && defined(__SVR4) //Solaris -#if !defined(isfinite) -#include -#define isfinite finite -#endif -#elif defined(_AIX) -#if !defined(isfinite) -#include -#define isfinite finite -#endif -#elif defined(__hpux) -#if !defined(isfinite) -#if defined(__ia64) && !defined(finite) -#define isfinite(x) ((sizeof(x) == sizeof(float) ? \ - _Isfinitef(x) : _IsFinite(x))) -#else -#include -#define isfinite finite -#endif -#endif -#else -#include -#if !(defined(__QNXNTO__)) // QNX already defines isfinite -#define isfinite std::isfinite -#endif -#endif - -#if defined(_MSC_VER) -#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above -#define snprintf sprintf_s -#elif _MSC_VER >= 1900 // VC++ 14.0 and above -#define snprintf std::snprintf -#else -#define snprintf _snprintf -#endif -#elif defined(__ANDROID__) || defined(__QNXNTO__) -#define snprintf snprintf -#elif __cplusplus >= 201103L -#define snprintf std::snprintf -#endif - -#if defined(__BORLANDC__) -#include -#define isfinite _finite -#define snprintf _snprintf -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 -// Disable warning about strdup being deprecated. -#pragma warning(disable : 4996) -#endif - -namespace Json { - -#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) -typedef std::unique_ptr StreamWriterPtr; -#else -typedef std::auto_ptr StreamWriterPtr; -#endif - -static bool containsControlCharacter(const char* str) { - while (*str) { - if (isControlCharacter(*(str++))) - return true; - } - return false; -} - -static bool containsControlCharacter0(const char* str, unsigned len) { - char const* end = str + len; - while (end != str) { - if (isControlCharacter(*str) || 0==*str) - return true; - ++str; - } - return false; -} - -std::string valueToString(LargestInt value) { - UIntToStringBuffer buffer; - char* current = buffer + sizeof(buffer); - if (value == Value::minLargestInt) { - uintToString(LargestUInt(Value::maxLargestInt) + 1, current); - *--current = '-'; - } else if (value < 0) { - uintToString(LargestUInt(-value), current); - *--current = '-'; - } else { - uintToString(LargestUInt(value), current); - } - assert(current >= buffer); - return current; -} - -std::string valueToString(LargestUInt value) { - UIntToStringBuffer buffer; - char* current = buffer + sizeof(buffer); - uintToString(value, current); - assert(current >= buffer); - return current; -} - -#if defined(JSON_HAS_INT64) - -std::string valueToString(Int value) { - return valueToString(LargestInt(value)); -} - -std::string valueToString(UInt value) { - return valueToString(LargestUInt(value)); -} - -#endif // # if defined(JSON_HAS_INT64) - -std::string valueToString(double value, bool useSpecialFloats, unsigned int precision) { - // Allocate a buffer that is more than large enough to store the 16 digits of - // precision requested below. - char buffer[32]; - int len = -1; - - char formatString[6]; - sprintf(formatString, "%%.%dg", precision); - - // Print into the buffer. We need not request the alternative representation - // that always has a decimal point because JSON doesn't distinguish the - // concepts of reals and integers. - if (isfinite(value)) { - len = snprintf(buffer, sizeof(buffer), formatString, value); - } else { - // IEEE standard states that NaN values will not compare to themselves - if (value != value) { - len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null"); - } else if (value < 0) { - len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999"); - } else { - len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999"); - } - // For those, we do not need to call fixNumLoc, but it is fast. - } - assert(len >= 0); - fixNumericLocale(buffer, buffer + len); - return buffer; -} - -std::string valueToString(double value) { return valueToString(value, false, 17); } - -std::string valueToString(bool value) { return value ? "true" : "false"; } - -std::string valueToQuotedString(const char* value) { - if (value == NULL) - return ""; - // Not sure how to handle unicode... - if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && - !containsControlCharacter(value)) - return std::string("\"") + value + "\""; - // We have to walk value and escape any special characters. - // Appending to std::string is not efficient, but this should be rare. - // (Note: forward slashes are *not* rare, but I am not escaping them.) - std::string::size_type maxsize = - strlen(value) * 2 + 3; // allescaped+quotes+NULL - std::string result; - result.reserve(maxsize); // to avoid lots of mallocs - result += "\""; - for (const char* c = value; *c != 0; ++c) { - switch (*c) { - case '\"': - result += "\\\""; - break; - case '\\': - result += "\\\\"; - break; - case '\b': - result += "\\b"; - break; - case '\f': - result += "\\f"; - break; - case '\n': - result += "\\n"; - break; - case '\r': - result += "\\r"; - break; - case '\t': - result += "\\t"; - break; - // case '/': - // Even though \/ is considered a legal escape in JSON, a bare - // slash is also legal, so I see no reason to escape it. - // (I hope I am not misunderstanding something. - // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); - result += oss.str(); - } else { - result += *c; - } - break; - } - } - result += "\""; - return result; -} - -// https://github.com/upcaste/upcaste/blob/master/src/upcore/src/cstring/strnpbrk.cpp -static char const* strnpbrk(char const* s, char const* accept, size_t n) { - assert((s || !n) && accept); - - char const* const end = s + n; - for (char const* cur = s; cur < end; ++cur) { - int const c = *cur; - for (char const* a = accept; *a; ++a) { - if (*a == c) { - return cur; - } - } - } - return NULL; -} -static std::string valueToQuotedStringN(const char* value, unsigned length) { - if (value == NULL) - return ""; - // Not sure how to handle unicode... - if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL && - !containsControlCharacter0(value, length)) - return std::string("\"") + value + "\""; - // We have to walk value and escape any special characters. - // Appending to std::string is not efficient, but this should be rare. - // (Note: forward slashes are *not* rare, but I am not escaping them.) - std::string::size_type maxsize = - length * 2 + 3; // allescaped+quotes+NULL - std::string result; - result.reserve(maxsize); // to avoid lots of mallocs - result += "\""; - char const* end = value + length; - for (const char* c = value; c != end; ++c) { - switch (*c) { - case '\"': - result += "\\\""; - break; - case '\\': - result += "\\\\"; - break; - case '\b': - result += "\\b"; - break; - case '\f': - result += "\\f"; - break; - case '\n': - result += "\\n"; - break; - case '\r': - result += "\\r"; - break; - case '\t': - result += "\\t"; - break; - // case '/': - // Even though \/ is considered a legal escape in JSON, a bare - // slash is also legal, so I see no reason to escape it. - // (I hope I am not misunderstanding something.) - // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); - result += oss.str(); - } else { - result += *c; - } - break; - } - } - result += "\""; - return result; -} - -// Class Writer -// ////////////////////////////////////////////////////////////////// -Writer::~Writer() {} - -// Class FastWriter -// ////////////////////////////////////////////////////////////////// - -FastWriter::FastWriter() - : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false), - omitEndingLineFeed_(false) {} - -void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; } - -void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; } - -void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; } - -std::string FastWriter::write(const Value& root) { - document_ = ""; - writeValue(root); - if (!omitEndingLineFeed_) - document_ += "\n"; - return document_; -} - -void FastWriter::writeValue(const Value& value) { - switch (value.type()) { - case nullValue: - if (!dropNullPlaceholders_) - document_ += "null"; - break; - case intValue: - document_ += valueToString(value.asLargestInt()); - break; - case uintValue: - document_ += valueToString(value.asLargestUInt()); - break; - case realValue: - document_ += valueToString(value.asDouble()); - break; - case stringValue: - { - // Is NULL possible for value.string_? - char const* str; - char const* end; - bool ok = value.getString(&str, &end); - if (ok) document_ += valueToQuotedStringN(str, static_cast(end-str)); - break; - } - case booleanValue: - document_ += valueToString(value.asBool()); - break; - case arrayValue: { - document_ += '['; - int size = value.size(); - for (int index = 0; index < size; ++index) { - if (index > 0) - document_ += ','; - writeValue(value[index]); - } - document_ += ']'; - } break; - case objectValue: { - Value::Members members(value.getMemberNames()); - document_ += '{'; - for (Value::Members::iterator it = members.begin(); it != members.end(); - ++it) { - const std::string& name = *it; - if (it != members.begin()) - document_ += ','; - document_ += valueToQuotedStringN(name.data(), static_cast(name.length())); - document_ += yamlCompatiblityEnabled_ ? ": " : ":"; - writeValue(value[name]); - } - document_ += '}'; - } break; - } -} - -// Class StyledWriter -// ////////////////////////////////////////////////////////////////// - -StyledWriter::StyledWriter() - : rightMargin_(74), indentSize_(3), addChildValues_() {} - -std::string StyledWriter::write(const Value& root) { - document_ = ""; - addChildValues_ = false; - indentString_ = ""; - writeCommentBeforeValue(root); - writeValue(root); - writeCommentAfterValueOnSameLine(root); - document_ += "\n"; - return document_; -} - -void StyledWriter::writeValue(const Value& value) { - switch (value.type()) { - case nullValue: - pushValue("null"); - break; - case intValue: - pushValue(valueToString(value.asLargestInt())); - break; - case uintValue: - pushValue(valueToString(value.asLargestUInt())); - break; - case realValue: - pushValue(valueToString(value.asDouble())); - break; - case stringValue: - { - // Is NULL possible for value.string_? - char const* str; - char const* end; - bool ok = value.getString(&str, &end); - if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); - else pushValue(""); - break; - } - case booleanValue: - pushValue(valueToString(value.asBool())); - break; - case arrayValue: - writeArrayValue(value); - break; - case objectValue: { - Value::Members members(value.getMemberNames()); - if (members.empty()) - pushValue("{}"); - else { - writeWithIndent("{"); - indent(); - Value::Members::iterator it = members.begin(); - for (;;) { - const std::string& name = *it; - const Value& childValue = value[name]; - writeCommentBeforeValue(childValue); - writeWithIndent(valueToQuotedString(name.c_str())); - document_ += " : "; - writeValue(childValue); - if (++it == members.end()) { - writeCommentAfterValueOnSameLine(childValue); - break; - } - document_ += ','; - writeCommentAfterValueOnSameLine(childValue); - } - unindent(); - writeWithIndent("}"); - } - } break; - } -} - -void StyledWriter::writeArrayValue(const Value& value) { - unsigned size = value.size(); - if (size == 0) - pushValue("[]"); - else { - bool isArrayMultiLine = isMultineArray(value); - if (isArrayMultiLine) { - writeWithIndent("["); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index = 0; - for (;;) { - const Value& childValue = value[index]; - writeCommentBeforeValue(childValue); - if (hasChildValue) - writeWithIndent(childValues_[index]); - else { - writeIndent(); - writeValue(childValue); - } - if (++index == size) { - writeCommentAfterValueOnSameLine(childValue); - break; - } - document_ += ','; - writeCommentAfterValueOnSameLine(childValue); - } - unindent(); - writeWithIndent("]"); - } else // output on a single line - { - assert(childValues_.size() == size); - document_ += "[ "; - for (unsigned index = 0; index < size; ++index) { - if (index > 0) - document_ += ", "; - document_ += childValues_[index]; - } - document_ += " ]"; - } - } -} - -bool StyledWriter::isMultineArray(const Value& value) { - int size = value.size(); - bool isMultiLine = size * 3 >= rightMargin_; - childValues_.clear(); - for (int index = 0; index < size && !isMultiLine; ++index) { - const Value& childValue = value[index]; - isMultiLine = ((childValue.isArray() || childValue.isObject()) && - childValue.size() > 0); - } - if (!isMultiLine) // check if line length > max line length - { - childValues_.reserve(size); - addChildValues_ = true; - int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' - for (int index = 0; index < size; ++index) { - if (hasCommentForValue(value[index])) { - isMultiLine = true; - } - writeValue(value[index]); - lineLength += int(childValues_[index].length()); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - -void StyledWriter::pushValue(const std::string& value) { - if (addChildValues_) - childValues_.push_back(value); - else - document_ += value; -} - -void StyledWriter::writeIndent() { - if (!document_.empty()) { - char last = document_[document_.length() - 1]; - if (last == ' ') // already indented - return; - if (last != '\n') // Comments may add new-line - document_ += '\n'; - } - document_ += indentString_; -} - -void StyledWriter::writeWithIndent(const std::string& value) { - writeIndent(); - document_ += value; -} - -void StyledWriter::indent() { indentString_ += std::string(indentSize_, ' '); } - -void StyledWriter::unindent() { - assert(int(indentString_.size()) >= indentSize_); - indentString_.resize(indentString_.size() - indentSize_); -} - -void StyledWriter::writeCommentBeforeValue(const Value& root) { - if (!root.hasComment(commentBefore)) - return; - - document_ += "\n"; - writeIndent(); - const std::string& comment = root.getComment(commentBefore); - std::string::const_iterator iter = comment.begin(); - while (iter != comment.end()) { - document_ += *iter; - if (*iter == '\n' && - (iter != comment.end() && *(iter + 1) == '/')) - writeIndent(); - ++iter; - } - - // Comments are stripped of trailing newlines, so add one here - document_ += "\n"; -} - -void StyledWriter::writeCommentAfterValueOnSameLine(const Value& root) { - if (root.hasComment(commentAfterOnSameLine)) - document_ += " " + root.getComment(commentAfterOnSameLine); - - if (root.hasComment(commentAfter)) { - document_ += "\n"; - document_ += root.getComment(commentAfter); - document_ += "\n"; - } -} - -bool StyledWriter::hasCommentForValue(const Value& value) { - return value.hasComment(commentBefore) || - value.hasComment(commentAfterOnSameLine) || - value.hasComment(commentAfter); -} - -// Class StyledStreamWriter -// ////////////////////////////////////////////////////////////////// - -StyledStreamWriter::StyledStreamWriter(std::string indentation) - : document_(NULL), rightMargin_(74), indentation_(indentation), - addChildValues_() {} - -void StyledStreamWriter::write(std::ostream& out, const Value& root) { - document_ = &out; - addChildValues_ = false; - indentString_ = ""; - indented_ = true; - writeCommentBeforeValue(root); - if (!indented_) writeIndent(); - indented_ = true; - writeValue(root); - writeCommentAfterValueOnSameLine(root); - *document_ << "\n"; - document_ = NULL; // Forget the stream, for safety. -} - -void StyledStreamWriter::writeValue(const Value& value) { - switch (value.type()) { - case nullValue: - pushValue("null"); - break; - case intValue: - pushValue(valueToString(value.asLargestInt())); - break; - case uintValue: - pushValue(valueToString(value.asLargestUInt())); - break; - case realValue: - pushValue(valueToString(value.asDouble())); - break; - case stringValue: - { - // Is NULL possible for value.string_? - char const* str; - char const* end; - bool ok = value.getString(&str, &end); - if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); - else pushValue(""); - break; - } - case booleanValue: - pushValue(valueToString(value.asBool())); - break; - case arrayValue: - writeArrayValue(value); - break; - case objectValue: { - Value::Members members(value.getMemberNames()); - if (members.empty()) - pushValue("{}"); - else { - writeWithIndent("{"); - indent(); - Value::Members::iterator it = members.begin(); - for (;;) { - const std::string& name = *it; - const Value& childValue = value[name]; - writeCommentBeforeValue(childValue); - writeWithIndent(valueToQuotedString(name.c_str())); - *document_ << " : "; - writeValue(childValue); - if (++it == members.end()) { - writeCommentAfterValueOnSameLine(childValue); - break; - } - *document_ << ","; - writeCommentAfterValueOnSameLine(childValue); - } - unindent(); - writeWithIndent("}"); - } - } break; - } -} - -void StyledStreamWriter::writeArrayValue(const Value& value) { - unsigned size = value.size(); - if (size == 0) - pushValue("[]"); - else { - bool isArrayMultiLine = isMultineArray(value); - if (isArrayMultiLine) { - writeWithIndent("["); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index = 0; - for (;;) { - const Value& childValue = value[index]; - writeCommentBeforeValue(childValue); - if (hasChildValue) - writeWithIndent(childValues_[index]); - else { - if (!indented_) writeIndent(); - indented_ = true; - writeValue(childValue); - indented_ = false; - } - if (++index == size) { - writeCommentAfterValueOnSameLine(childValue); - break; - } - *document_ << ","; - writeCommentAfterValueOnSameLine(childValue); - } - unindent(); - writeWithIndent("]"); - } else // output on a single line - { - assert(childValues_.size() == size); - *document_ << "[ "; - for (unsigned index = 0; index < size; ++index) { - if (index > 0) - *document_ << ", "; - *document_ << childValues_[index]; - } - *document_ << " ]"; - } - } -} - -bool StyledStreamWriter::isMultineArray(const Value& value) { - int size = value.size(); - bool isMultiLine = size * 3 >= rightMargin_; - childValues_.clear(); - for (int index = 0; index < size && !isMultiLine; ++index) { - const Value& childValue = value[index]; - isMultiLine = ((childValue.isArray() || childValue.isObject()) && - childValue.size() > 0); - } - if (!isMultiLine) // check if line length > max line length - { - childValues_.reserve(size); - addChildValues_ = true; - int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' - for (int index = 0; index < size; ++index) { - if (hasCommentForValue(value[index])) { - isMultiLine = true; - } - writeValue(value[index]); - lineLength += int(childValues_[index].length()); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - -void StyledStreamWriter::pushValue(const std::string& value) { - if (addChildValues_) - childValues_.push_back(value); - else - *document_ << value; -} - -void StyledStreamWriter::writeIndent() { - // blep intended this to look at the so-far-written string - // to determine whether we are already indented, but - // with a stream we cannot do that. So we rely on some saved state. - // The caller checks indented_. - *document_ << '\n' << indentString_; -} - -void StyledStreamWriter::writeWithIndent(const std::string& value) { - if (!indented_) writeIndent(); - *document_ << value; - indented_ = false; -} - -void StyledStreamWriter::indent() { indentString_ += indentation_; } - -void StyledStreamWriter::unindent() { - assert(indentString_.size() >= indentation_.size()); - indentString_.resize(indentString_.size() - indentation_.size()); -} - -void StyledStreamWriter::writeCommentBeforeValue(const Value& root) { - if (!root.hasComment(commentBefore)) - return; - - if (!indented_) writeIndent(); - const std::string& comment = root.getComment(commentBefore); - std::string::const_iterator iter = comment.begin(); - while (iter != comment.end()) { - *document_ << *iter; - if (*iter == '\n' && - (iter != comment.end() && *(iter + 1) == '/')) - // writeIndent(); // would include newline - *document_ << indentString_; - ++iter; - } - indented_ = false; -} - -void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value& root) { - if (root.hasComment(commentAfterOnSameLine)) - *document_ << ' ' << root.getComment(commentAfterOnSameLine); - - if (root.hasComment(commentAfter)) { - writeIndent(); - *document_ << root.getComment(commentAfter); - } - indented_ = false; -} - -bool StyledStreamWriter::hasCommentForValue(const Value& value) { - return value.hasComment(commentBefore) || - value.hasComment(commentAfterOnSameLine) || - value.hasComment(commentAfter); -} - -////////////////////////// -// BuiltStyledStreamWriter - -/// Scoped enums are not available until C++11. -struct CommentStyle { - /// Decide whether to write comments. - enum Enum { - None, ///< Drop all comments. - Most, ///< Recover odd behavior of previous versions (not implemented yet). - All ///< Keep all comments. - }; -}; - -struct BuiltStyledStreamWriter : public StreamWriter -{ - BuiltStyledStreamWriter( - std::string const& indentation, - CommentStyle::Enum cs, - std::string const& colonSymbol, - std::string const& nullSymbol, - std::string const& endingLineFeedSymbol, - bool useSpecialFloats, - unsigned int precision); - int write(Value const& root, std::ostream* sout) override; -private: - void writeValue(Value const& value); - void writeArrayValue(Value const& value); - bool isMultineArray(Value const& value); - void pushValue(std::string const& value); - void writeIndent(); - void writeWithIndent(std::string const& value); - void indent(); - void unindent(); - void writeCommentBeforeValue(Value const& root); - void writeCommentAfterValueOnSameLine(Value const& root); - static bool hasCommentForValue(const Value& value); - - typedef std::vector ChildValues; - - ChildValues childValues_; - std::string indentString_; - int rightMargin_; - std::string indentation_; - CommentStyle::Enum cs_; - std::string colonSymbol_; - std::string nullSymbol_; - std::string endingLineFeedSymbol_; - bool addChildValues_ : 1; - bool indented_ : 1; - bool useSpecialFloats_ : 1; - unsigned int precision_; -}; -BuiltStyledStreamWriter::BuiltStyledStreamWriter( - std::string const& indentation, - CommentStyle::Enum cs, - std::string const& colonSymbol, - std::string const& nullSymbol, - std::string const& endingLineFeedSymbol, - bool useSpecialFloats, - unsigned int precision) - : rightMargin_(74) - , indentation_(indentation) - , cs_(cs) - , colonSymbol_(colonSymbol) - , nullSymbol_(nullSymbol) - , endingLineFeedSymbol_(endingLineFeedSymbol) - , addChildValues_(false) - , indented_(false) - , useSpecialFloats_(useSpecialFloats) - , precision_(precision) -{ -} -int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout) -{ - sout_ = sout; - addChildValues_ = false; - indented_ = true; - indentString_ = ""; - writeCommentBeforeValue(root); - if (!indented_) writeIndent(); - indented_ = true; - writeValue(root); - writeCommentAfterValueOnSameLine(root); - *sout_ << endingLineFeedSymbol_; - sout_ = NULL; - return 0; -} -void BuiltStyledStreamWriter::writeValue(Value const& value) { - switch (value.type()) { - case nullValue: - pushValue(nullSymbol_); - break; - case intValue: - pushValue(valueToString(value.asLargestInt())); - break; - case uintValue: - pushValue(valueToString(value.asLargestUInt())); - break; - case realValue: - pushValue(valueToString(value.asDouble(), useSpecialFloats_, precision_)); - break; - case stringValue: - { - // Is NULL is possible for value.string_? - char const* str; - char const* end; - bool ok = value.getString(&str, &end); - if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); - else pushValue(""); - break; - } - case booleanValue: - pushValue(valueToString(value.asBool())); - break; - case arrayValue: - writeArrayValue(value); - break; - case objectValue: { - Value::Members members(value.getMemberNames()); - if (members.empty()) - pushValue("{}"); - else { - writeWithIndent("{"); - indent(); - Value::Members::iterator it = members.begin(); - for (;;) { - std::string const& name = *it; - Value const& childValue = value[name]; - writeCommentBeforeValue(childValue); - writeWithIndent(valueToQuotedStringN(name.data(), static_cast(name.length()))); - *sout_ << colonSymbol_; - writeValue(childValue); - if (++it == members.end()) { - writeCommentAfterValueOnSameLine(childValue); - break; - } - *sout_ << ","; - writeCommentAfterValueOnSameLine(childValue); - } - unindent(); - writeWithIndent("}"); - } - } break; - } -} - -void BuiltStyledStreamWriter::writeArrayValue(Value const& value) { - unsigned size = value.size(); - if (size == 0) - pushValue("[]"); - else { - bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value); - if (isMultiLine) { - writeWithIndent("["); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index = 0; - for (;;) { - Value const& childValue = value[index]; - writeCommentBeforeValue(childValue); - if (hasChildValue) - writeWithIndent(childValues_[index]); - else { - if (!indented_) writeIndent(); - indented_ = true; - writeValue(childValue); - indented_ = false; - } - if (++index == size) { - writeCommentAfterValueOnSameLine(childValue); - break; - } - *sout_ << ","; - writeCommentAfterValueOnSameLine(childValue); - } - unindent(); - writeWithIndent("]"); - } else // output on a single line - { - assert(childValues_.size() == size); - *sout_ << "["; - if (!indentation_.empty()) *sout_ << " "; - for (unsigned index = 0; index < size; ++index) { - if (index > 0) - *sout_ << ", "; - *sout_ << childValues_[index]; - } - if (!indentation_.empty()) *sout_ << " "; - *sout_ << "]"; - } - } -} - -bool BuiltStyledStreamWriter::isMultineArray(Value const& value) { - int size = value.size(); - bool isMultiLine = size * 3 >= rightMargin_; - childValues_.clear(); - for (int index = 0; index < size && !isMultiLine; ++index) { - Value const& childValue = value[index]; - isMultiLine = ((childValue.isArray() || childValue.isObject()) && - childValue.size() > 0); - } - if (!isMultiLine) // check if line length > max line length - { - childValues_.reserve(size); - addChildValues_ = true; - int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' - for (int index = 0; index < size; ++index) { - if (hasCommentForValue(value[index])) { - isMultiLine = true; - } - writeValue(value[index]); - lineLength += int(childValues_[index].length()); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - -void BuiltStyledStreamWriter::pushValue(std::string const& value) { - if (addChildValues_) - childValues_.push_back(value); - else - *sout_ << value; -} - -void BuiltStyledStreamWriter::writeIndent() { - // blep intended this to look at the so-far-written string - // to determine whether we are already indented, but - // with a stream we cannot do that. So we rely on some saved state. - // The caller checks indented_. - - if (!indentation_.empty()) { - // In this case, drop newlines too. - *sout_ << '\n' << indentString_; - } -} - -void BuiltStyledStreamWriter::writeWithIndent(std::string const& value) { - if (!indented_) writeIndent(); - *sout_ << value; - indented_ = false; -} - -void BuiltStyledStreamWriter::indent() { indentString_ += indentation_; } - -void BuiltStyledStreamWriter::unindent() { - assert(indentString_.size() >= indentation_.size()); - indentString_.resize(indentString_.size() - indentation_.size()); -} - -void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) { - if (cs_ == CommentStyle::None) return; - if (!root.hasComment(commentBefore)) - return; - - if (!indented_) writeIndent(); - const std::string& comment = root.getComment(commentBefore); - std::string::const_iterator iter = comment.begin(); - while (iter != comment.end()) { - *sout_ << *iter; - if (*iter == '\n' && - (iter != comment.end() && *(iter + 1) == '/')) - // writeIndent(); // would write extra newline - *sout_ << indentString_; - ++iter; - } - indented_ = false; -} - -void BuiltStyledStreamWriter::writeCommentAfterValueOnSameLine(Value const& root) { - if (cs_ == CommentStyle::None) return; - if (root.hasComment(commentAfterOnSameLine)) - *sout_ << " " + root.getComment(commentAfterOnSameLine); - - if (root.hasComment(commentAfter)) { - writeIndent(); - *sout_ << root.getComment(commentAfter); - } -} - -// static -bool BuiltStyledStreamWriter::hasCommentForValue(const Value& value) { - return value.hasComment(commentBefore) || - value.hasComment(commentAfterOnSameLine) || - value.hasComment(commentAfter); -} - -/////////////// -// StreamWriter - -StreamWriter::StreamWriter() - : sout_(NULL) -{ -} -StreamWriter::~StreamWriter() -{ -} -StreamWriter::Factory::~Factory() -{} -StreamWriterBuilder::StreamWriterBuilder() -{ - setDefaults(&settings_); -} -StreamWriterBuilder::~StreamWriterBuilder() -{} -StreamWriter* StreamWriterBuilder::newStreamWriter() const -{ - std::string indentation = settings_["indentation"].asString(); - std::string cs_str = settings_["commentStyle"].asString(); - bool eyc = settings_["enableYAMLCompatibility"].asBool(); - bool dnp = settings_["dropNullPlaceholders"].asBool(); - bool usf = settings_["useSpecialFloats"].asBool(); - unsigned int pre = settings_["precision"].asUInt(); - CommentStyle::Enum cs = CommentStyle::All; - if (cs_str == "All") { - cs = CommentStyle::All; - } else if (cs_str == "None") { - cs = CommentStyle::None; - } else { - throwRuntimeError("commentStyle must be 'All' or 'None'"); - } - std::string colonSymbol = " : "; - if (eyc) { - colonSymbol = ": "; - } else if (indentation.empty()) { - colonSymbol = ":"; - } - std::string nullSymbol = "null"; - if (dnp) { - nullSymbol = ""; - } - if (pre > 17) pre = 17; - std::string endingLineFeedSymbol = ""; - return new BuiltStyledStreamWriter( - indentation, cs, - colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre); -} -static void getValidWriterKeys(std::set* valid_keys) -{ - valid_keys->clear(); - valid_keys->insert("indentation"); - valid_keys->insert("commentStyle"); - valid_keys->insert("enableYAMLCompatibility"); - valid_keys->insert("dropNullPlaceholders"); - valid_keys->insert("useSpecialFloats"); - valid_keys->insert("precision"); -} -bool StreamWriterBuilder::validate(Json::Value* invalid) const -{ - Json::Value my_invalid; - if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL - Json::Value& inv = *invalid; - std::set valid_keys; - getValidWriterKeys(&valid_keys); - Value::Members keys = settings_.getMemberNames(); - size_t n = keys.size(); - for (size_t i = 0; i < n; ++i) { - std::string const& key = keys[i]; - if (valid_keys.find(key) == valid_keys.end()) { - inv[key] = settings_[key]; - } - } - return 0u == inv.size(); -} -Value& StreamWriterBuilder::operator[](std::string key) -{ - return settings_[key]; -} -// static -void StreamWriterBuilder::setDefaults(Json::Value* settings) -{ - //! [StreamWriterBuilderDefaults] - (*settings)["commentStyle"] = "All"; - (*settings)["indentation"] = "\t"; - (*settings)["enableYAMLCompatibility"] = false; - (*settings)["dropNullPlaceholders"] = false; - (*settings)["useSpecialFloats"] = false; - (*settings)["precision"] = 17; - //! [StreamWriterBuilderDefaults] -} - -std::string writeString(StreamWriter::Factory const& builder, Value const& root) { - std::ostringstream sout; - StreamWriterPtr const writer(builder.newStreamWriter()); - writer->write(root, &sout); - return sout.str(); -} - -std::ostream& operator<<(std::ostream& sout, Value const& root) { - StreamWriterBuilder builder; - StreamWriterPtr const writer(builder.newStreamWriter()); - writer->write(root, &sout); - return sout; -} - -} // namespace Json - -// ////////////////////////////////////////////////////////////////////// -// End of content of file: src/lib_json/json_writer.cpp -// ////////////////////////////////////////////////////////////////////// - - - - - diff --git a/conformance/update_failure_list.py b/conformance/update_failure_list.py index ad42ed3..639a8c2 100755 --- a/conformance/update_failure_list.py +++ b/conformance/update_failure_list.py @@ -1,33 +1,10 @@ #!/usr/bin/env python # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. 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 Inc. 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. +# 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 """Script to update a failure list file to add/remove failures. diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs deleted file mode 100644 index 042f69e..0000000 --- a/csharp/src/AddressBook/Addressbook.cs +++ /dev/null @@ -1,758 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: addressbook.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.Examples.AddressBook { - - /// Holder for reflection information generated from addressbook.proto - public static partial class AddressbookReflection { - - #region Descriptor - /// File descriptor for addressbook.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static AddressbookReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwaH2dvb2dsZS9wcm90b2J1", - "Zi90aW1lc3RhbXAucHJvdG8ihwIKBlBlcnNvbhIMCgRuYW1lGAEgASgJEgoK", - "AmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25lcxgEIAMoCzIcLnR1", - "dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchIwCgxsYXN0X3VwZGF0ZWQYBSAB", - "KAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wGkcKC1Bob25lTnVtYmVy", - "Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy", - "c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N", - "RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy", - "EC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3JpYWxCEUFk", - "ZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1wbGVzLkFk", - "ZHJlc3NCb29rYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// [START messages] - /// - public sealed partial class Person : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Person()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Person() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Person(Person other) : this() { - name_ = other.name_; - id_ = other.id_; - email_ = other.email_; - phones_ = other.phones_.Clone(); - lastUpdated_ = other.lastUpdated_ != null ? other.lastUpdated_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Person Clone() { - return new Person(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 2; - private int id_; - /// - /// Unique ID number for this person. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Id { - get { return id_; } - set { - id_ = value; - } - } - - /// Field number for the "email" field. - public const int EmailFieldNumber = 3; - private string email_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Email { - get { return email_; } - set { - email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "phones" field. - public const int PhonesFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_phones_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser); - private readonly pbc::RepeatedField phones_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Phones { - get { return phones_; } - } - - /// Field number for the "last_updated" field. - public const int LastUpdatedFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.Timestamp lastUpdated_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp LastUpdated { - get { return lastUpdated_; } - set { - lastUpdated_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Person); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Person other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Id != other.Id) return false; - if (Email != other.Email) return false; - if(!phones_.Equals(other.phones_)) return false; - if (!object.Equals(LastUpdated, other.LastUpdated)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Id != 0) hash ^= Id.GetHashCode(); - if (Email.Length != 0) hash ^= Email.GetHashCode(); - hash ^= phones_.GetHashCode(); - if (lastUpdated_ != null) hash ^= LastUpdated.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Id != 0) { - output.WriteRawTag(16); - output.WriteInt32(Id); - } - if (Email.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Email); - } - phones_.WriteTo(output, _repeated_phones_codec); - if (lastUpdated_ != null) { - output.WriteRawTag(42); - output.WriteMessage(LastUpdated); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Id != 0) { - output.WriteRawTag(16); - output.WriteInt32(Id); - } - if (Email.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Email); - } - phones_.WriteTo(ref output, _repeated_phones_codec); - if (lastUpdated_ != null) { - output.WriteRawTag(42); - output.WriteMessage(LastUpdated); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Id != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); - } - if (Email.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); - } - size += phones_.CalculateSize(_repeated_phones_codec); - if (lastUpdated_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(LastUpdated); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Person other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Id != 0) { - Id = other.Id; - } - if (other.Email.Length != 0) { - Email = other.Email; - } - phones_.Add(other.phones_); - if (other.lastUpdated_ != null) { - if (lastUpdated_ == null) { - LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - LastUpdated.MergeFrom(other.LastUpdated); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Id = input.ReadInt32(); - break; - } - case 26: { - Email = input.ReadString(); - break; - } - case 34: { - phones_.AddEntriesFrom(input, _repeated_phones_codec); - break; - } - case 42: { - if (lastUpdated_ == null) { - LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(LastUpdated); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Id = input.ReadInt32(); - break; - } - case 26: { - Email = input.ReadString(); - break; - } - case 34: { - phones_.AddEntriesFrom(ref input, _repeated_phones_codec); - break; - } - case 42: { - if (lastUpdated_ == null) { - LastUpdated = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(LastUpdated); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the Person message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public enum PhoneType { - [pbr::OriginalName("MOBILE")] Mobile = 0, - [pbr::OriginalName("HOME")] Home = 1, - [pbr::OriginalName("WORK")] Work = 2, - } - - public sealed partial class PhoneNumber : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PhoneNumber()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Examples.AddressBook.Person.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PhoneNumber() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PhoneNumber(PhoneNumber other) : this() { - number_ = other.number_; - type_ = other.type_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PhoneNumber Clone() { - return new PhoneNumber(this); - } - - /// Field number for the "number" field. - public const int NumberFieldNumber = 1; - private string number_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Number { - get { return number_; } - set { - number_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 2; - private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type { - get { return type_; } - set { - type_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as PhoneNumber); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(PhoneNumber other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Number != other.Number) return false; - if (Type != other.Type) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Number.Length != 0) hash ^= Number.GetHashCode(); - if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) hash ^= Type.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Number.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Number); - } - if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Number.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Number); - } - if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Number.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Number); - } - if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(PhoneNumber other) { - if (other == null) { - return; - } - if (other.Number.Length != 0) { - Number = other.Number; - } - if (other.Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) { - Type = other.Type; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Number = input.ReadString(); - break; - } - case 16: { - Type = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Number = input.ReadString(); - break; - } - case 16: { - Type = (global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Our address book file is just one of these. - /// - public sealed partial class AddressBook : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddressBook()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressBook() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressBook(AddressBook other) : this() { - people_ = other.people_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressBook Clone() { - return new AddressBook(this); - } - - /// Field number for the "people" field. - public const int PeopleFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_people_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser); - private readonly pbc::RepeatedField people_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField People { - get { return people_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AddressBook); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AddressBook other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!people_.Equals(other.people_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= people_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - people_.WriteTo(output, _repeated_people_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - people_.WriteTo(ref output, _repeated_people_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += people_.CalculateSize(_repeated_people_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AddressBook other) { - if (other == null) { - return; - } - people_.Add(other.people_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - people_.AddEntriesFrom(input, _repeated_people_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - people_.AddEntriesFrom(ref input, _repeated_people_codec); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs deleted file mode 100644 index f26d181..0000000 --- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs +++ /dev/null @@ -1,1503 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: conformance.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Conformance { - - /// Holder for reflection information generated from conformance.proto - public static partial class ConformanceReflection { - - #region Descriptor - /// File descriptor for conformance.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ConformanceReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UiHQoKRmFpbHVyZVNl", - "dBIPCgdmYWlsdXJlGAEgAygJIuMCChJDb25mb3JtYW5jZVJlcXVlc3QSGgoQ", - "cHJvdG9idWZfcGF5bG9hZBgBIAEoDEgAEhYKDGpzb25fcGF5bG9hZBgCIAEo", - "CUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEhYKDHRleHRfcGF5bG9hZBgI", - "IAEoCUgAEjgKF3JlcXVlc3RlZF9vdXRwdXRfZm9ybWF0GAMgASgOMhcuY29u", - "Zm9ybWFuY2UuV2lyZUZvcm1hdBIUCgxtZXNzYWdlX3R5cGUYBCABKAkSMAoN", - "dGVzdF9jYXRlZ29yeRgFIAEoDjIZLmNvbmZvcm1hbmNlLlRlc3RDYXRlZ29y", - "eRI+ChVqc3BiX2VuY29kaW5nX29wdGlvbnMYBiABKAsyHy5jb25mb3JtYW5j", - "ZS5Kc3BiRW5jb2RpbmdDb25maWcSHAoUcHJpbnRfdW5rbm93bl9maWVsZHMY", - "CSABKAhCCQoHcGF5bG9hZCLhAQoTQ29uZm9ybWFuY2VSZXNwb25zZRIVCgtw", - "YXJzZV9lcnJvchgBIAEoCUgAEhkKD3NlcmlhbGl6ZV9lcnJvchgGIAEoCUgA", - "EhcKDXJ1bnRpbWVfZXJyb3IYAiABKAlIABIaChBwcm90b2J1Zl9wYXlsb2Fk", - "GAMgASgMSAASFgoManNvbl9wYXlsb2FkGAQgASgJSAASEQoHc2tpcHBlZBgF", - "IAEoCUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEhYKDHRleHRfcGF5bG9h", - "ZBgIIAEoCUgAQggKBnJlc3VsdCI3ChJKc3BiRW5jb2RpbmdDb25maWcSIQoZ", - "dXNlX2pzcGJfYXJyYXlfYW55X2Zvcm1hdBgBIAEoCCpQCgpXaXJlRm9ybWF0", - "Eg8KC1VOU1BFQ0lGSUVEEAASDAoIUFJPVE9CVUYQARIICgRKU09OEAISCAoE", - "SlNQQhADEg8KC1RFWFRfRk9STUFUEAQqjwEKDFRlc3RDYXRlZ29yeRIUChBV", - "TlNQRUNJRklFRF9URVNUEAASDwoLQklOQVJZX1RFU1QQARINCglKU09OX1RF", - "U1QQAhIkCiBKU09OX0lHTk9SRV9VTktOT1dOX1BBUlNJTkdfVEVTVBADEg0K", - "CUpTUEJfVEVTVBAEEhQKEFRFWFRfRk9STUFUX1RFU1QQBUIhCh9jb20uZ29v", - "Z2xlLnByb3RvYnVmLmNvbmZvcm1hbmNlYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "TextPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions", "PrintUnknownFields" }, new[]{ "Payload" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload", "TextPayload" }, new[]{ "Result" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - public enum WireFormat { - [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0, - [pbr::OriginalName("PROTOBUF")] Protobuf = 1, - [pbr::OriginalName("JSON")] Json = 2, - /// - /// Google internal only. Opensource testees just skip it. - /// - [pbr::OriginalName("JSPB")] Jspb = 3, - [pbr::OriginalName("TEXT_FORMAT")] TextFormat = 4, - } - - public enum TestCategory { - [pbr::OriginalName("UNSPECIFIED_TEST")] UnspecifiedTest = 0, - /// - /// Test binary wire format. - /// - [pbr::OriginalName("BINARY_TEST")] BinaryTest = 1, - /// - /// Test json wire format. - /// - [pbr::OriginalName("JSON_TEST")] JsonTest = 2, - /// - /// Similar to JSON_TEST. However, during parsing json, testee should ignore - /// unknown fields. This feature is optional. Each implementation can descide - /// whether to support it. See - /// https://developers.google.com/protocol-buffers/docs/proto3#json_options - /// for more detail. - /// - [pbr::OriginalName("JSON_IGNORE_UNKNOWN_PARSING_TEST")] JsonIgnoreUnknownParsingTest = 3, - /// - /// Test jspb wire format. Google internal only. Opensource testees just skip it. - /// - [pbr::OriginalName("JSPB_TEST")] JspbTest = 4, - /// - /// Test text format. For cpp, java and python, testees can already deal with - /// this type. Testees of other languages can simply skip it. - /// - [pbr::OriginalName("TEXT_FORMAT_TEST")] TextFormatTest = 5, - } - - #endregion - - #region Messages - /// - /// The conformance runner will request a list of failures as the first request. - /// This will be known by message_type == "conformance.FailureSet", a conformance - /// test should return a serialized FailureSet in protobuf_payload. - /// - public sealed partial class FailureSet : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FailureSet()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailureSet() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailureSet(FailureSet other) : this() { - failure_ = other.failure_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FailureSet Clone() { - return new FailureSet(this); - } - - /// Field number for the "failure" field. - public const int FailureFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_failure_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField failure_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Failure { - get { return failure_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FailureSet); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FailureSet other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!failure_.Equals(other.failure_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= failure_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - failure_.WriteTo(output, _repeated_failure_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - failure_.WriteTo(ref output, _repeated_failure_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += failure_.CalculateSize(_repeated_failure_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FailureSet other) { - if (other == null) { - return; - } - failure_.Add(other.failure_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - failure_.AddEntriesFrom(input, _repeated_failure_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - failure_.AddEntriesFrom(ref input, _repeated_failure_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Represents a single test case's input. The testee should: - /// - /// 1. parse this proto (which should always succeed) - /// 2. parse the protobuf or JSON payload in "payload" (which may fail) - /// 3. if the parse succeeded, serialize the message in the requested format. - /// - public sealed partial class ConformanceRequest : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConformanceRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConformanceRequest(ConformanceRequest other) : this() { - requestedOutputFormat_ = other.requestedOutputFormat_; - messageType_ = other.messageType_; - testCategory_ = other.testCategory_; - jspbEncodingOptions_ = other.jspbEncodingOptions_ != null ? other.jspbEncodingOptions_.Clone() : null; - printUnknownFields_ = other.printUnknownFields_; - switch (other.PayloadCase) { - case PayloadOneofCase.ProtobufPayload: - ProtobufPayload = other.ProtobufPayload; - break; - case PayloadOneofCase.JsonPayload: - JsonPayload = other.JsonPayload; - break; - case PayloadOneofCase.JspbPayload: - JspbPayload = other.JspbPayload; - break; - case PayloadOneofCase.TextPayload: - TextPayload = other.TextPayload; - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConformanceRequest Clone() { - return new ConformanceRequest(this); - } - - /// Field number for the "protobuf_payload" field. - public const int ProtobufPayloadFieldNumber = 1; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ProtobufPayload { - get { return payloadCase_ == PayloadOneofCase.ProtobufPayload ? (pb::ByteString) payload_ : pb::ByteString.Empty; } - set { - payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - payloadCase_ = PayloadOneofCase.ProtobufPayload; - } - } - - /// Field number for the "json_payload" field. - public const int JsonPayloadFieldNumber = 2; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JsonPayload { - get { return payloadCase_ == PayloadOneofCase.JsonPayload ? (string) payload_ : ""; } - set { - payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - payloadCase_ = PayloadOneofCase.JsonPayload; - } - } - - /// Field number for the "jspb_payload" field. - public const int JspbPayloadFieldNumber = 7; - /// - /// Google internal only. Opensource testees just skip it. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JspbPayload { - get { return payloadCase_ == PayloadOneofCase.JspbPayload ? (string) payload_ : ""; } - set { - payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - payloadCase_ = PayloadOneofCase.JspbPayload; - } - } - - /// Field number for the "text_payload" field. - public const int TextPayloadFieldNumber = 8; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TextPayload { - get { return payloadCase_ == PayloadOneofCase.TextPayload ? (string) payload_ : ""; } - set { - payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - payloadCase_ = PayloadOneofCase.TextPayload; - } - } - - /// Field number for the "requested_output_format" field. - public const int RequestedOutputFormatFieldNumber = 3; - private global::Conformance.WireFormat requestedOutputFormat_ = global::Conformance.WireFormat.Unspecified; - /// - /// Which format should the testee serialize its message to? - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Conformance.WireFormat RequestedOutputFormat { - get { return requestedOutputFormat_; } - set { - requestedOutputFormat_ = value; - } - } - - /// Field number for the "message_type" field. - public const int MessageTypeFieldNumber = 4; - private string messageType_ = ""; - /// - /// The full name for the test message to use; for the moment, either: - /// protobuf_test_messages.proto3.TestAllTypesProto3 or - /// protobuf_test_messages.proto2.TestAllTypesProto2. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string MessageType { - get { return messageType_; } - set { - messageType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "test_category" field. - public const int TestCategoryFieldNumber = 5; - private global::Conformance.TestCategory testCategory_ = global::Conformance.TestCategory.UnspecifiedTest; - /// - /// Each test is given a specific test category. Some category may need - /// spedific support in testee programs. Refer to the definition of TestCategory - /// for more information. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Conformance.TestCategory TestCategory { - get { return testCategory_; } - set { - testCategory_ = value; - } - } - - /// Field number for the "jspb_encoding_options" field. - public const int JspbEncodingOptionsFieldNumber = 6; - private global::Conformance.JspbEncodingConfig jspbEncodingOptions_; - /// - /// Specify details for how to encode jspb. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Conformance.JspbEncodingConfig JspbEncodingOptions { - get { return jspbEncodingOptions_; } - set { - jspbEncodingOptions_ = value; - } - } - - /// Field number for the "print_unknown_fields" field. - public const int PrintUnknownFieldsFieldNumber = 9; - private bool printUnknownFields_; - /// - /// This can be used in json and text format. If true, testee should print - /// unknown fields instead of ignore. This feature is optional. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool PrintUnknownFields { - get { return printUnknownFields_; } - set { - printUnknownFields_ = value; - } - } - - private object payload_; - /// Enum of possible cases for the "payload" oneof. - public enum PayloadOneofCase { - None = 0, - ProtobufPayload = 1, - JsonPayload = 2, - JspbPayload = 7, - TextPayload = 8, - } - private PayloadOneofCase payloadCase_ = PayloadOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PayloadOneofCase PayloadCase { - get { return payloadCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPayload() { - payloadCase_ = PayloadOneofCase.None; - payload_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ConformanceRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ConformanceRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ProtobufPayload != other.ProtobufPayload) return false; - if (JsonPayload != other.JsonPayload) return false; - if (JspbPayload != other.JspbPayload) return false; - if (TextPayload != other.TextPayload) return false; - if (RequestedOutputFormat != other.RequestedOutputFormat) return false; - if (MessageType != other.MessageType) return false; - if (TestCategory != other.TestCategory) return false; - if (!object.Equals(JspbEncodingOptions, other.JspbEncodingOptions)) return false; - if (PrintUnknownFields != other.PrintUnknownFields) return false; - if (PayloadCase != other.PayloadCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (payloadCase_ == PayloadOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode(); - if (payloadCase_ == PayloadOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode(); - if (payloadCase_ == PayloadOneofCase.JspbPayload) hash ^= JspbPayload.GetHashCode(); - if (payloadCase_ == PayloadOneofCase.TextPayload) hash ^= TextPayload.GetHashCode(); - if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) hash ^= RequestedOutputFormat.GetHashCode(); - if (MessageType.Length != 0) hash ^= MessageType.GetHashCode(); - if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) hash ^= TestCategory.GetHashCode(); - if (jspbEncodingOptions_ != null) hash ^= JspbEncodingOptions.GetHashCode(); - if (PrintUnknownFields != false) hash ^= PrintUnknownFields.GetHashCode(); - hash ^= (int) payloadCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { - output.WriteRawTag(10); - output.WriteBytes(ProtobufPayload); - } - if (payloadCase_ == PayloadOneofCase.JsonPayload) { - output.WriteRawTag(18); - output.WriteString(JsonPayload); - } - if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) { - output.WriteRawTag(24); - output.WriteEnum((int) RequestedOutputFormat); - } - if (MessageType.Length != 0) { - output.WriteRawTag(34); - output.WriteString(MessageType); - } - if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) { - output.WriteRawTag(40); - output.WriteEnum((int) TestCategory); - } - if (jspbEncodingOptions_ != null) { - output.WriteRawTag(50); - output.WriteMessage(JspbEncodingOptions); - } - if (payloadCase_ == PayloadOneofCase.JspbPayload) { - output.WriteRawTag(58); - output.WriteString(JspbPayload); - } - if (payloadCase_ == PayloadOneofCase.TextPayload) { - output.WriteRawTag(66); - output.WriteString(TextPayload); - } - if (PrintUnknownFields != false) { - output.WriteRawTag(72); - output.WriteBool(PrintUnknownFields); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { - output.WriteRawTag(10); - output.WriteBytes(ProtobufPayload); - } - if (payloadCase_ == PayloadOneofCase.JsonPayload) { - output.WriteRawTag(18); - output.WriteString(JsonPayload); - } - if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) { - output.WriteRawTag(24); - output.WriteEnum((int) RequestedOutputFormat); - } - if (MessageType.Length != 0) { - output.WriteRawTag(34); - output.WriteString(MessageType); - } - if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) { - output.WriteRawTag(40); - output.WriteEnum((int) TestCategory); - } - if (jspbEncodingOptions_ != null) { - output.WriteRawTag(50); - output.WriteMessage(JspbEncodingOptions); - } - if (payloadCase_ == PayloadOneofCase.JspbPayload) { - output.WriteRawTag(58); - output.WriteString(JspbPayload); - } - if (payloadCase_ == PayloadOneofCase.TextPayload) { - output.WriteRawTag(66); - output.WriteString(TextPayload); - } - if (PrintUnknownFields != false) { - output.WriteRawTag(72); - output.WriteBool(PrintUnknownFields); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ProtobufPayload); - } - if (payloadCase_ == PayloadOneofCase.JsonPayload) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonPayload); - } - if (payloadCase_ == PayloadOneofCase.JspbPayload) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JspbPayload); - } - if (payloadCase_ == PayloadOneofCase.TextPayload) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TextPayload); - } - if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) RequestedOutputFormat); - } - if (MessageType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MessageType); - } - if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) TestCategory); - } - if (jspbEncodingOptions_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(JspbEncodingOptions); - } - if (PrintUnknownFields != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ConformanceRequest other) { - if (other == null) { - return; - } - if (other.RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) { - RequestedOutputFormat = other.RequestedOutputFormat; - } - if (other.MessageType.Length != 0) { - MessageType = other.MessageType; - } - if (other.TestCategory != global::Conformance.TestCategory.UnspecifiedTest) { - TestCategory = other.TestCategory; - } - if (other.jspbEncodingOptions_ != null) { - if (jspbEncodingOptions_ == null) { - JspbEncodingOptions = new global::Conformance.JspbEncodingConfig(); - } - JspbEncodingOptions.MergeFrom(other.JspbEncodingOptions); - } - if (other.PrintUnknownFields != false) { - PrintUnknownFields = other.PrintUnknownFields; - } - switch (other.PayloadCase) { - case PayloadOneofCase.ProtobufPayload: - ProtobufPayload = other.ProtobufPayload; - break; - case PayloadOneofCase.JsonPayload: - JsonPayload = other.JsonPayload; - break; - case PayloadOneofCase.JspbPayload: - JspbPayload = other.JspbPayload; - break; - case PayloadOneofCase.TextPayload: - TextPayload = other.TextPayload; - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - ProtobufPayload = input.ReadBytes(); - break; - } - case 18: { - JsonPayload = input.ReadString(); - break; - } - case 24: { - RequestedOutputFormat = (global::Conformance.WireFormat) input.ReadEnum(); - break; - } - case 34: { - MessageType = input.ReadString(); - break; - } - case 40: { - TestCategory = (global::Conformance.TestCategory) input.ReadEnum(); - break; - } - case 50: { - if (jspbEncodingOptions_ == null) { - JspbEncodingOptions = new global::Conformance.JspbEncodingConfig(); - } - input.ReadMessage(JspbEncodingOptions); - break; - } - case 58: { - JspbPayload = input.ReadString(); - break; - } - case 66: { - TextPayload = input.ReadString(); - break; - } - case 72: { - PrintUnknownFields = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - ProtobufPayload = input.ReadBytes(); - break; - } - case 18: { - JsonPayload = input.ReadString(); - break; - } - case 24: { - RequestedOutputFormat = (global::Conformance.WireFormat) input.ReadEnum(); - break; - } - case 34: { - MessageType = input.ReadString(); - break; - } - case 40: { - TestCategory = (global::Conformance.TestCategory) input.ReadEnum(); - break; - } - case 50: { - if (jspbEncodingOptions_ == null) { - JspbEncodingOptions = new global::Conformance.JspbEncodingConfig(); - } - input.ReadMessage(JspbEncodingOptions); - break; - } - case 58: { - JspbPayload = input.ReadString(); - break; - } - case 66: { - TextPayload = input.ReadString(); - break; - } - case 72: { - PrintUnknownFields = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// Represents a single test case's output. - /// - public sealed partial class ConformanceResponse : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConformanceResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConformanceResponse(ConformanceResponse other) : this() { - switch (other.ResultCase) { - case ResultOneofCase.ParseError: - ParseError = other.ParseError; - break; - case ResultOneofCase.SerializeError: - SerializeError = other.SerializeError; - break; - case ResultOneofCase.RuntimeError: - RuntimeError = other.RuntimeError; - break; - case ResultOneofCase.ProtobufPayload: - ProtobufPayload = other.ProtobufPayload; - break; - case ResultOneofCase.JsonPayload: - JsonPayload = other.JsonPayload; - break; - case ResultOneofCase.Skipped: - Skipped = other.Skipped; - break; - case ResultOneofCase.JspbPayload: - JspbPayload = other.JspbPayload; - break; - case ResultOneofCase.TextPayload: - TextPayload = other.TextPayload; - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConformanceResponse Clone() { - return new ConformanceResponse(this); - } - - /// Field number for the "parse_error" field. - public const int ParseErrorFieldNumber = 1; - /// - /// This string should be set to indicate parsing failed. The string can - /// provide more information about the parse error if it is available. - /// - /// Setting this string does not necessarily mean the testee failed the - /// test. Some of the test cases are intentionally invalid input. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ParseError { - get { return resultCase_ == ResultOneofCase.ParseError ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.ParseError; - } - } - - /// Field number for the "serialize_error" field. - public const int SerializeErrorFieldNumber = 6; - /// - /// If the input was successfully parsed but errors occurred when - /// serializing it to the requested output format, set the error message in - /// this field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerializeError { - get { return resultCase_ == ResultOneofCase.SerializeError ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.SerializeError; - } - } - - /// Field number for the "runtime_error" field. - public const int RuntimeErrorFieldNumber = 2; - /// - /// This should be set if some other error occurred. This will always - /// indicate that the test failed. The string can provide more information - /// about the failure. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RuntimeError { - get { return resultCase_ == ResultOneofCase.RuntimeError ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.RuntimeError; - } - } - - /// Field number for the "protobuf_payload" field. - public const int ProtobufPayloadFieldNumber = 3; - /// - /// If the input was successfully parsed and the requested output was - /// protobuf, serialize it to protobuf and set it in this field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ProtobufPayload { - get { return resultCase_ == ResultOneofCase.ProtobufPayload ? (pb::ByteString) result_ : pb::ByteString.Empty; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.ProtobufPayload; - } - } - - /// Field number for the "json_payload" field. - public const int JsonPayloadFieldNumber = 4; - /// - /// If the input was successfully parsed and the requested output was JSON, - /// serialize to JSON and set it in this field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JsonPayload { - get { return resultCase_ == ResultOneofCase.JsonPayload ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.JsonPayload; - } - } - - /// Field number for the "skipped" field. - public const int SkippedFieldNumber = 5; - /// - /// For when the testee skipped the test, likely because a certain feature - /// wasn't supported, like JSON input/output. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Skipped { - get { return resultCase_ == ResultOneofCase.Skipped ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.Skipped; - } - } - - /// Field number for the "jspb_payload" field. - public const int JspbPayloadFieldNumber = 7; - /// - /// If the input was successfully parsed and the requested output was JSPB, - /// serialize to JSPB and set it in this field. JSPB is google internal only - /// format. Opensource testees can just skip it. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JspbPayload { - get { return resultCase_ == ResultOneofCase.JspbPayload ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.JspbPayload; - } - } - - /// Field number for the "text_payload" field. - public const int TextPayloadFieldNumber = 8; - /// - /// If the input was successfully parsed and the requested output was - /// TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TextPayload { - get { return resultCase_ == ResultOneofCase.TextPayload ? (string) result_ : ""; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - resultCase_ = ResultOneofCase.TextPayload; - } - } - - private object result_; - /// Enum of possible cases for the "result" oneof. - public enum ResultOneofCase { - None = 0, - ParseError = 1, - SerializeError = 6, - RuntimeError = 2, - ProtobufPayload = 3, - JsonPayload = 4, - Skipped = 5, - JspbPayload = 7, - TextPayload = 8, - } - private ResultOneofCase resultCase_ = ResultOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResultOneofCase ResultCase { - get { return resultCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearResult() { - resultCase_ = ResultOneofCase.None; - result_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ConformanceResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ConformanceResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ParseError != other.ParseError) return false; - if (SerializeError != other.SerializeError) return false; - if (RuntimeError != other.RuntimeError) return false; - if (ProtobufPayload != other.ProtobufPayload) return false; - if (JsonPayload != other.JsonPayload) return false; - if (Skipped != other.Skipped) return false; - if (JspbPayload != other.JspbPayload) return false; - if (TextPayload != other.TextPayload) return false; - if (ResultCase != other.ResultCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (resultCase_ == ResultOneofCase.ParseError) hash ^= ParseError.GetHashCode(); - if (resultCase_ == ResultOneofCase.SerializeError) hash ^= SerializeError.GetHashCode(); - if (resultCase_ == ResultOneofCase.RuntimeError) hash ^= RuntimeError.GetHashCode(); - if (resultCase_ == ResultOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode(); - if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode(); - if (resultCase_ == ResultOneofCase.Skipped) hash ^= Skipped.GetHashCode(); - if (resultCase_ == ResultOneofCase.JspbPayload) hash ^= JspbPayload.GetHashCode(); - if (resultCase_ == ResultOneofCase.TextPayload) hash ^= TextPayload.GetHashCode(); - hash ^= (int) resultCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (resultCase_ == ResultOneofCase.ParseError) { - output.WriteRawTag(10); - output.WriteString(ParseError); - } - if (resultCase_ == ResultOneofCase.RuntimeError) { - output.WriteRawTag(18); - output.WriteString(RuntimeError); - } - if (resultCase_ == ResultOneofCase.ProtobufPayload) { - output.WriteRawTag(26); - output.WriteBytes(ProtobufPayload); - } - if (resultCase_ == ResultOneofCase.JsonPayload) { - output.WriteRawTag(34); - output.WriteString(JsonPayload); - } - if (resultCase_ == ResultOneofCase.Skipped) { - output.WriteRawTag(42); - output.WriteString(Skipped); - } - if (resultCase_ == ResultOneofCase.SerializeError) { - output.WriteRawTag(50); - output.WriteString(SerializeError); - } - if (resultCase_ == ResultOneofCase.JspbPayload) { - output.WriteRawTag(58); - output.WriteString(JspbPayload); - } - if (resultCase_ == ResultOneofCase.TextPayload) { - output.WriteRawTag(66); - output.WriteString(TextPayload); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (resultCase_ == ResultOneofCase.ParseError) { - output.WriteRawTag(10); - output.WriteString(ParseError); - } - if (resultCase_ == ResultOneofCase.RuntimeError) { - output.WriteRawTag(18); - output.WriteString(RuntimeError); - } - if (resultCase_ == ResultOneofCase.ProtobufPayload) { - output.WriteRawTag(26); - output.WriteBytes(ProtobufPayload); - } - if (resultCase_ == ResultOneofCase.JsonPayload) { - output.WriteRawTag(34); - output.WriteString(JsonPayload); - } - if (resultCase_ == ResultOneofCase.Skipped) { - output.WriteRawTag(42); - output.WriteString(Skipped); - } - if (resultCase_ == ResultOneofCase.SerializeError) { - output.WriteRawTag(50); - output.WriteString(SerializeError); - } - if (resultCase_ == ResultOneofCase.JspbPayload) { - output.WriteRawTag(58); - output.WriteString(JspbPayload); - } - if (resultCase_ == ResultOneofCase.TextPayload) { - output.WriteRawTag(66); - output.WriteString(TextPayload); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (resultCase_ == ResultOneofCase.ParseError) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ParseError); - } - if (resultCase_ == ResultOneofCase.SerializeError) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerializeError); - } - if (resultCase_ == ResultOneofCase.RuntimeError) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RuntimeError); - } - if (resultCase_ == ResultOneofCase.ProtobufPayload) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ProtobufPayload); - } - if (resultCase_ == ResultOneofCase.JsonPayload) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonPayload); - } - if (resultCase_ == ResultOneofCase.Skipped) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Skipped); - } - if (resultCase_ == ResultOneofCase.JspbPayload) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JspbPayload); - } - if (resultCase_ == ResultOneofCase.TextPayload) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TextPayload); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ConformanceResponse other) { - if (other == null) { - return; - } - switch (other.ResultCase) { - case ResultOneofCase.ParseError: - ParseError = other.ParseError; - break; - case ResultOneofCase.SerializeError: - SerializeError = other.SerializeError; - break; - case ResultOneofCase.RuntimeError: - RuntimeError = other.RuntimeError; - break; - case ResultOneofCase.ProtobufPayload: - ProtobufPayload = other.ProtobufPayload; - break; - case ResultOneofCase.JsonPayload: - JsonPayload = other.JsonPayload; - break; - case ResultOneofCase.Skipped: - Skipped = other.Skipped; - break; - case ResultOneofCase.JspbPayload: - JspbPayload = other.JspbPayload; - break; - case ResultOneofCase.TextPayload: - TextPayload = other.TextPayload; - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - ParseError = input.ReadString(); - break; - } - case 18: { - RuntimeError = input.ReadString(); - break; - } - case 26: { - ProtobufPayload = input.ReadBytes(); - break; - } - case 34: { - JsonPayload = input.ReadString(); - break; - } - case 42: { - Skipped = input.ReadString(); - break; - } - case 50: { - SerializeError = input.ReadString(); - break; - } - case 58: { - JspbPayload = input.ReadString(); - break; - } - case 66: { - TextPayload = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - ParseError = input.ReadString(); - break; - } - case 18: { - RuntimeError = input.ReadString(); - break; - } - case 26: { - ProtobufPayload = input.ReadBytes(); - break; - } - case 34: { - JsonPayload = input.ReadString(); - break; - } - case 42: { - Skipped = input.ReadString(); - break; - } - case 50: { - SerializeError = input.ReadString(); - break; - } - case 58: { - JspbPayload = input.ReadString(); - break; - } - case 66: { - TextPayload = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Encoding options for jspb format. - /// - public sealed partial class JspbEncodingConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JspbEncodingConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public JspbEncodingConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public JspbEncodingConfig(JspbEncodingConfig other) : this() { - useJspbArrayAnyFormat_ = other.useJspbArrayAnyFormat_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public JspbEncodingConfig Clone() { - return new JspbEncodingConfig(this); - } - - /// Field number for the "use_jspb_array_any_format" field. - public const int UseJspbArrayAnyFormatFieldNumber = 1; - private bool useJspbArrayAnyFormat_; - /// - /// Encode the value field of Any as jspb array if true, otherwise binary. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool UseJspbArrayAnyFormat { - get { return useJspbArrayAnyFormat_; } - set { - useJspbArrayAnyFormat_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as JspbEncodingConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(JspbEncodingConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (UseJspbArrayAnyFormat != other.UseJspbArrayAnyFormat) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (UseJspbArrayAnyFormat != false) hash ^= UseJspbArrayAnyFormat.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (UseJspbArrayAnyFormat != false) { - output.WriteRawTag(8); - output.WriteBool(UseJspbArrayAnyFormat); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (UseJspbArrayAnyFormat != false) { - output.WriteRawTag(8); - output.WriteBool(UseJspbArrayAnyFormat); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (UseJspbArrayAnyFormat != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(JspbEncodingConfig other) { - if (other == null) { - return; - } - if (other.UseJspbArrayAnyFormat != false) { - UseJspbArrayAnyFormat = other.UseJspbArrayAnyFormat; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - UseJspbArrayAnyFormat = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - UseJspbArrayAnyFormat = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs b/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs deleted file mode 100644 index 8436066..0000000 --- a/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs +++ /dev/null @@ -1,147 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. 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 Inc. 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. -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Google.Protobuf.Collections -{ - /// - /// Read-only wrapper around another dictionary. - /// - internal sealed class ReadOnlyDictionary : IDictionary - { - private readonly IDictionary wrapped; - - public ReadOnlyDictionary(IDictionary wrapped) - { - this.wrapped = wrapped; - } - - public void Add(TKey key, TValue value) - { - throw new InvalidOperationException(); - } - - public bool ContainsKey(TKey key) - { - return wrapped.ContainsKey(key); - } - - public ICollection Keys - { - get { return wrapped.Keys; } - } - - public bool Remove(TKey key) - { - throw new InvalidOperationException(); - } - - public bool TryGetValue(TKey key, out TValue value) - { - return wrapped.TryGetValue(key, out value); - } - - public ICollection Values - { - get { return wrapped.Values; } - } - - public TValue this[TKey key] - { - get { return wrapped[key]; } - set { throw new InvalidOperationException(); } - } - - public void Add(KeyValuePair item) - { - throw new InvalidOperationException(); - } - - public void Clear() - { - throw new InvalidOperationException(); - } - - public bool Contains(KeyValuePair item) - { - return wrapped.Contains(item); - } - - public void CopyTo(KeyValuePair[] array, int arrayIndex) - { - wrapped.CopyTo(array, arrayIndex); - } - - public int Count - { - get { return wrapped.Count; } - } - - public bool IsReadOnly - { - get { return true; } - } - - public bool Remove(KeyValuePair item) - { - throw new InvalidOperationException(); - } - - public IEnumerator> GetEnumerator() - { - return wrapped.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return ((IEnumerable) wrapped).GetEnumerator(); - } - - public override bool Equals(object obj) - { - return wrapped.Equals(obj); - } - - public override int GetHashCode() - { - return wrapped.GetHashCode(); - } - - public override string ToString() - { - return wrapped.ToString(); - } - } -} \ No newline at end of file diff --git a/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs b/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs deleted file mode 100644 index 7b946cb..0000000 --- a/csharp/src/Google.Protobuf/Compatibility/MethodInfoExtensions.cs +++ /dev/null @@ -1,47 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2017 Google Inc. 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 Inc. 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. -#endregion - -#if NET35 -using System; -using System.Reflection; - -namespace Google.Protobuf.Compatibility -{ - // .NET Core (at least netstandard1.0) doesn't have Delegate.CreateDelegate, and .NET 3.5 doesn't have - // MethodInfo.CreateDelegate. Proxy from one to the other on .NET 3.5... - internal static class MethodInfoExtensions - { - internal static Delegate CreateDelegate(this MethodInfo method, Type type) => - Delegate.CreateDelegate(type, method); - } -} -#endif diff --git a/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs b/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs deleted file mode 100644 index bf4bf22..0000000 --- a/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs +++ /dev/null @@ -1,66 +0,0 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 Google Inc. 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 Inc. 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. -#endregion - -#if NET35 -using System; -using System.IO; - -namespace Google.Protobuf.Compatibility -{ - /// - /// Extension methods for in order to provide - /// backwards compatibility with .NET 3.5 - /// - public static class StreamExtensions - { - // 81920 seems to be the default buffer size used in .NET 4.5.1 - private const int BUFFER_SIZE = 81920; - - /// - /// Write the contents of the current stream to the destination stream - /// - public static void CopyTo(this Stream source, Stream destination) - { - if (destination == null) - { - throw new ArgumentNullException(nameof(destination)); - } - - byte[] buffer = new byte[BUFFER_SIZE]; - int numBytesRead; - while ((numBytesRead = source.Read(buffer, 0, buffer.Length)) > 0) { - destination.Write(buffer, 0, numBytesRead); - } - } - } -} -#endif diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs deleted file mode 100644 index df92228..0000000 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ /dev/null @@ -1,10296 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/descriptor.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.Reflection { - - /// Holder for reflection information generated from google/protobuf/descriptor.proto - public static partial class DescriptorReflection { - - #region Descriptor - /// File descriptor for google/protobuf/descriptor.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static DescriptorReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bxIPZ29vZ2xlLnBy", - "b3RvYnVmIkcKEUZpbGVEZXNjcmlwdG9yU2V0EjIKBGZpbGUYASADKAsyJC5n", - "b29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90byLbAwoTRmlsZURl", - "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg8KB3BhY2thZ2UYAiABKAkS", - "EgoKZGVwZW5kZW5jeRgDIAMoCRIZChFwdWJsaWNfZGVwZW5kZW5jeRgKIAMo", - "BRIXCg93ZWFrX2RlcGVuZGVuY3kYCyADKAUSNgoMbWVzc2FnZV90eXBlGAQg", - "AygLMiAuZ29vZ2xlLnByb3RvYnVmLkRlc2NyaXB0b3JQcm90bxI3CgllbnVt", - "X3R5cGUYBSADKAsyJC5nb29nbGUucHJvdG9idWYuRW51bURlc2NyaXB0b3JQ", - "cm90bxI4CgdzZXJ2aWNlGAYgAygLMicuZ29vZ2xlLnByb3RvYnVmLlNlcnZp", - "Y2VEZXNjcmlwdG9yUHJvdG8SOAoJZXh0ZW5zaW9uGAcgAygLMiUuZ29vZ2xl", - "LnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvEi0KB29wdGlvbnMYCCAB", - "KAsyHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMSOQoQc291cmNlX2Nv", - "ZGVfaW5mbxgJIAEoCzIfLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb2RlSW5m", - "bxIOCgZzeW50YXgYDCABKAkiqQUKD0Rlc2NyaXB0b3JQcm90bxIMCgRuYW1l", - "GAEgASgJEjQKBWZpZWxkGAIgAygLMiUuZ29vZ2xlLnByb3RvYnVmLkZpZWxk", - "RGVzY3JpcHRvclByb3RvEjgKCWV4dGVuc2lvbhgGIAMoCzIlLmdvb2dsZS5w", - "cm90b2J1Zi5GaWVsZERlc2NyaXB0b3JQcm90bxI1CgtuZXN0ZWRfdHlwZRgD", - "IAMoCzIgLmdvb2dsZS5wcm90b2J1Zi5EZXNjcmlwdG9yUHJvdG8SNwoJZW51", - "bV90eXBlGAQgAygLMiQuZ29vZ2xlLnByb3RvYnVmLkVudW1EZXNjcmlwdG9y", - "UHJvdG8SSAoPZXh0ZW5zaW9uX3JhbmdlGAUgAygLMi8uZ29vZ2xlLnByb3Rv", - "YnVmLkRlc2NyaXB0b3JQcm90by5FeHRlbnNpb25SYW5nZRI5CgpvbmVvZl9k", - "ZWNsGAggAygLMiUuZ29vZ2xlLnByb3RvYnVmLk9uZW9mRGVzY3JpcHRvclBy", - "b3RvEjAKB29wdGlvbnMYByABKAsyHy5nb29nbGUucHJvdG9idWYuTWVzc2Fn", - "ZU9wdGlvbnMSRgoOcmVzZXJ2ZWRfcmFuZ2UYCSADKAsyLi5nb29nbGUucHJv", - "dG9idWYuRGVzY3JpcHRvclByb3RvLlJlc2VydmVkUmFuZ2USFQoNcmVzZXJ2", - "ZWRfbmFtZRgKIAMoCRplCg5FeHRlbnNpb25SYW5nZRINCgVzdGFydBgBIAEo", - "BRILCgNlbmQYAiABKAUSNwoHb3B0aW9ucxgDIAEoCzImLmdvb2dsZS5wcm90", - "b2J1Zi5FeHRlbnNpb25SYW5nZU9wdGlvbnMaKwoNUmVzZXJ2ZWRSYW5nZRIN", - "CgVzdGFydBgBIAEoBRILCgNlbmQYAiABKAUiZwoVRXh0ZW5zaW9uUmFuZ2VP", - "cHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2ds", - "ZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIi1QUK", - "FEZpZWxkRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSDgoGbnVtYmVy", - "GAMgASgFEjoKBWxhYmVsGAQgASgOMisuZ29vZ2xlLnByb3RvYnVmLkZpZWxk", - "RGVzY3JpcHRvclByb3RvLkxhYmVsEjgKBHR5cGUYBSABKA4yKi5nb29nbGUu", - "cHJvdG9idWYuRmllbGREZXNjcmlwdG9yUHJvdG8uVHlwZRIRCgl0eXBlX25h", - "bWUYBiABKAkSEAoIZXh0ZW5kZWUYAiABKAkSFQoNZGVmYXVsdF92YWx1ZRgH", - "IAEoCRITCgtvbmVvZl9pbmRleBgJIAEoBRIRCglqc29uX25hbWUYCiABKAkS", - "LgoHb3B0aW9ucxgIIAEoCzIdLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlv", - "bnMSFwoPcHJvdG8zX29wdGlvbmFsGBEgASgIIrYCCgRUeXBlEg8KC1RZUEVf", - "RE9VQkxFEAESDgoKVFlQRV9GTE9BVBACEg4KClRZUEVfSU5UNjQQAxIPCgtU", - "WVBFX1VJTlQ2NBAEEg4KClRZUEVfSU5UMzIQBRIQCgxUWVBFX0ZJWEVENjQQ", - "BhIQCgxUWVBFX0ZJWEVEMzIQBxINCglUWVBFX0JPT0wQCBIPCgtUWVBFX1NU", - "UklORxAJEg4KClRZUEVfR1JPVVAQChIQCgxUWVBFX01FU1NBR0UQCxIOCgpU", - "WVBFX0JZVEVTEAwSDwoLVFlQRV9VSU5UMzIQDRINCglUWVBFX0VOVU0QDhIR", - "Cg1UWVBFX1NGSVhFRDMyEA8SEQoNVFlQRV9TRklYRUQ2NBAQEg8KC1RZUEVf", - "U0lOVDMyEBESDwoLVFlQRV9TSU5UNjQQEiJDCgVMYWJlbBISCg5MQUJFTF9P", - "UFRJT05BTBABEhIKDkxBQkVMX1JFUVVJUkVEEAISEgoOTEFCRUxfUkVQRUFU", - "RUQQAyJUChRPbmVvZkRlc2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEi4K", - "B29wdGlvbnMYAiABKAsyHS5nb29nbGUucHJvdG9idWYuT25lb2ZPcHRpb25z", - "IqQCChNFbnVtRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSOAoFdmFs", - "dWUYAiADKAsyKS5nb29nbGUucHJvdG9idWYuRW51bVZhbHVlRGVzY3JpcHRv", - "clByb3RvEi0KB29wdGlvbnMYAyABKAsyHC5nb29nbGUucHJvdG9idWYuRW51", - "bU9wdGlvbnMSTgoOcmVzZXJ2ZWRfcmFuZ2UYBCADKAsyNi5nb29nbGUucHJv", - "dG9idWYuRW51bURlc2NyaXB0b3JQcm90by5FbnVtUmVzZXJ2ZWRSYW5nZRIV", - "Cg1yZXNlcnZlZF9uYW1lGAUgAygJGi8KEUVudW1SZXNlcnZlZFJhbmdlEg0K", - "BXN0YXJ0GAEgASgFEgsKA2VuZBgCIAEoBSJsChhFbnVtVmFsdWVEZXNjcmlw", - "dG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIOCgZudW1iZXIYAiABKAUSMgoHb3B0", - "aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVPcHRpb25z", - "IpABChZTZXJ2aWNlRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSNgoG", - "bWV0aG9kGAIgAygLMiYuZ29vZ2xlLnByb3RvYnVmLk1ldGhvZERlc2NyaXB0", - "b3JQcm90bxIwCgdvcHRpb25zGAMgASgLMh8uZ29vZ2xlLnByb3RvYnVmLlNl", - "cnZpY2VPcHRpb25zIsEBChVNZXRob2REZXNjcmlwdG9yUHJvdG8SDAoEbmFt", - "ZRgBIAEoCRISCgppbnB1dF90eXBlGAIgASgJEhMKC291dHB1dF90eXBlGAMg", - "ASgJEi8KB29wdGlvbnMYBCABKAsyHi5nb29nbGUucHJvdG9idWYuTWV0aG9k", - "T3B0aW9ucxIfChBjbGllbnRfc3RyZWFtaW5nGAUgASgIOgVmYWxzZRIfChBz", - "ZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVmYWxzZSKlBgoLRmlsZU9wdGlvbnMS", - "FAoMamF2YV9wYWNrYWdlGAEgASgJEhwKFGphdmFfb3V0ZXJfY2xhc3NuYW1l", - "GAggASgJEiIKE2phdmFfbXVsdGlwbGVfZmlsZXMYCiABKAg6BWZhbHNlEikK", - "HWphdmFfZ2VuZXJhdGVfZXF1YWxzX2FuZF9oYXNoGBQgASgIQgIYARIlChZq", - "YXZhX3N0cmluZ19jaGVja191dGY4GBsgASgIOgVmYWxzZRJGCgxvcHRpbWl6", - "ZV9mb3IYCSABKA4yKS5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMuT3B0", - "aW1pemVNb2RlOgVTUEVFRBISCgpnb19wYWNrYWdlGAsgASgJEiIKE2NjX2dl", - "bmVyaWNfc2VydmljZXMYECABKAg6BWZhbHNlEiQKFWphdmFfZ2VuZXJpY19z", - "ZXJ2aWNlcxgRIAEoCDoFZmFsc2USIgoTcHlfZ2VuZXJpY19zZXJ2aWNlcxgS", - "IAEoCDoFZmFsc2USIwoUcGhwX2dlbmVyaWNfc2VydmljZXMYKiABKAg6BWZh", - "bHNlEhkKCmRlcHJlY2F0ZWQYFyABKAg6BWZhbHNlEh4KEGNjX2VuYWJsZV9h", - "cmVuYXMYHyABKAg6BHRydWUSGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkS", - "GAoQY3NoYXJwX25hbWVzcGFjZRglIAEoCRIUCgxzd2lmdF9wcmVmaXgYJyAB", - "KAkSGAoQcGhwX2NsYXNzX3ByZWZpeBgoIAEoCRIVCg1waHBfbmFtZXNwYWNl", - "GCkgASgJEh4KFnBocF9tZXRhZGF0YV9uYW1lc3BhY2UYLCABKAkSFAoMcnVi", - "eV9wYWNrYWdlGC0gASgJEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMo", - "CzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uIjoKDE9w", - "dGltaXplTW9kZRIJCgVTUEVFRBABEg0KCUNPREVfU0laRRACEhAKDExJVEVf", - "UlVOVElNRRADKgkI6AcQgICAgAJKBAgmECci8gEKDk1lc3NhZ2VPcHRpb25z", - "EiYKF21lc3NhZ2Vfc2V0X3dpcmVfZm9ybWF0GAEgASgIOgVmYWxzZRIuCh9u", - "b19zdGFuZGFyZF9kZXNjcmlwdG9yX2FjY2Vzc29yGAIgASgIOgVmYWxzZRIZ", - "CgpkZXByZWNhdGVkGAMgASgIOgVmYWxzZRIRCgltYXBfZW50cnkYByABKAgS", - "QwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3Rv", - "YnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAkoECAgQCUoECAkQ", - "CiKeAwoMRmllbGRPcHRpb25zEjoKBWN0eXBlGAEgASgOMiMuZ29vZ2xlLnBy", - "b3RvYnVmLkZpZWxkT3B0aW9ucy5DVHlwZToGU1RSSU5HEg4KBnBhY2tlZBgC", - "IAEoCBI/CgZqc3R5cGUYBiABKA4yJC5nb29nbGUucHJvdG9idWYuRmllbGRP", - "cHRpb25zLkpTVHlwZToJSlNfTk9STUFMEhMKBGxhenkYBSABKAg6BWZhbHNl", - "EhkKCmRlcHJlY2F0ZWQYAyABKAg6BWZhbHNlEhMKBHdlYWsYCiABKAg6BWZh", - "bHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5w", - "cm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uIi8KBUNUeXBlEgoKBlNUUklO", - "RxAAEggKBENPUkQQARIQCgxTVFJJTkdfUElFQ0UQAiI1CgZKU1R5cGUSDQoJ", - "SlNfTk9STUFMEAASDQoJSlNfU1RSSU5HEAESDQoJSlNfTlVNQkVSEAIqCQjo", - "BxCAgICAAkoECAQQBSJeCgxPbmVvZk9wdGlvbnMSQwoUdW5pbnRlcnByZXRl", - "ZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0", - "ZWRPcHRpb24qCQjoBxCAgICAAiKTAQoLRW51bU9wdGlvbnMSEwoLYWxsb3df", - "YWxpYXMYAiABKAgSGQoKZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USQwoUdW5p", - "bnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVu", - "aW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAkoECAUQBiJ9ChBFbnVtVmFs", - "dWVPcHRpb25zEhkKCmRlcHJlY2F0ZWQYASABKAg6BWZhbHNlEkMKFHVuaW50", - "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", - "dGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIiewoOU2VydmljZU9wdGlvbnMS", - "GQoKZGVwcmVjYXRlZBghIAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9v", - "cHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRP", - "cHRpb24qCQjoBxCAgICAAiKtAgoNTWV0aG9kT3B0aW9ucxIZCgpkZXByZWNh", - "dGVkGCEgASgIOgVmYWxzZRJfChFpZGVtcG90ZW5jeV9sZXZlbBgiIAEoDjIv", - "Lmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zLklkZW1wb3RlbmN5TGV2", - "ZWw6E0lERU1QT1RFTkNZX1VOS05PV04SQwoUdW5pbnRlcnByZXRlZF9vcHRp", - "b24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRp", - "b24iUAoQSWRlbXBvdGVuY3lMZXZlbBIXChNJREVNUE9URU5DWV9VTktOT1dO", - "EAASEwoPTk9fU0lERV9FRkZFQ1RTEAESDgoKSURFTVBPVEVOVBACKgkI6AcQ", - "gICAgAIingIKE1VuaW50ZXJwcmV0ZWRPcHRpb24SOwoEbmFtZRgCIAMoCzIt", - "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uLk5hbWVQYXJ0", - "EhgKEGlkZW50aWZpZXJfdmFsdWUYAyABKAkSGgoScG9zaXRpdmVfaW50X3Zh", - "bHVlGAQgASgEEhoKEm5lZ2F0aXZlX2ludF92YWx1ZRgFIAEoAxIUCgxkb3Vi", - "bGVfdmFsdWUYBiABKAESFAoMc3RyaW5nX3ZhbHVlGAcgASgMEhcKD2FnZ3Jl", - "Z2F0ZV92YWx1ZRgIIAEoCRozCghOYW1lUGFydBIRCgluYW1lX3BhcnQYASAC", - "KAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigIItUBCg5Tb3VyY2VDb2RlSW5mbxI6", - "Cghsb2NhdGlvbhgBIAMoCzIoLmdvb2dsZS5wcm90b2J1Zi5Tb3VyY2VDb2Rl", - "SW5mby5Mb2NhdGlvbhqGAQoITG9jYXRpb24SEAoEcGF0aBgBIAMoBUICEAES", - "EAoEc3BhbhgCIAMoBUICEAESGAoQbGVhZGluZ19jb21tZW50cxgDIAEoCRIZ", - "ChF0cmFpbGluZ19jb21tZW50cxgEIAEoCRIhChlsZWFkaW5nX2RldGFjaGVk", - "X2NvbW1lbnRzGAYgAygJIqcBChFHZW5lcmF0ZWRDb2RlSW5mbxJBCgphbm5v", - "dGF0aW9uGAEgAygLMi0uZ29vZ2xlLnByb3RvYnVmLkdlbmVyYXRlZENvZGVJ", - "bmZvLkFubm90YXRpb24aTwoKQW5ub3RhdGlvbhIQCgRwYXRoGAEgAygFQgIQ", - "ARITCgtzb3VyY2VfZmlsZRgCIAEoCRINCgViZWdpbhgDIAEoBRILCgNlbmQY", - "BCABKAVCjwEKE2NvbS5nb29nbGUucHJvdG9idWZCEERlc2NyaXB0b3JQcm90", - "b3NIAVo+Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHJvdG9jLWdlbi1n", - "by9kZXNjcmlwdG9yO2Rlc2NyaXB0b3L4AQGiAgNHUEKqAhpHb29nbGUuUHJv", - "dG9idWYuUmVmbGVjdGlvbg==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorSet), global::Google.Protobuf.Reflection.FileDescriptorSet.Parser, new[]{ "File" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileDescriptorProto), global::Google.Protobuf.Reflection.FileDescriptorProto.Parser, new[]{ "Name", "Package", "Dependency", "PublicDependency", "WeakDependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto), global::Google.Protobuf.Reflection.DescriptorProto.Parser, new[]{ "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "OneofDecl", "Options", "ReservedRange", "ReservedName" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser, new[]{ "Start", "End", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange), global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser, new[]{ "Start", "End" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ExtensionRangeOptions), global::Google.Protobuf.Reflection.ExtensionRangeOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto), global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser, new[]{ "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "OneofIndex", "JsonName", "Options", "Proto3Optional" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type), typeof(global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options", "ReservedRange", "ReservedName" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange), global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser, new[]{ "Start", "End" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueDescriptorProto), global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser, new[]{ "Name", "Number", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceDescriptorProto), global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser, new[]{ "Name", "Method", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodDescriptorProto), global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser, new[]{ "Name", "InputType", "OutputType", "Options", "ClientStreaming", "ServerStreaming" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "PhpMetadataNamespace", "RubyPackage", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "IdempotencyLevel", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null, null)}) - })); - } - #endregion - - } - #region Messages - /// - /// The protocol compiler can output a FileDescriptorSet containing the .proto - /// files it parses. - /// - public sealed partial class FileDescriptorSet : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorSet()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileDescriptorSet() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileDescriptorSet(FileDescriptorSet other) : this() { - file_ = other.file_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileDescriptorSet Clone() { - return new FileDescriptorSet(this); - } - - /// Field number for the "file" field. - public const int FileFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_file_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser); - private readonly pbc::RepeatedField file_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField File { - get { return file_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FileDescriptorSet); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FileDescriptorSet other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!file_.Equals(other.file_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= file_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - file_.WriteTo(output, _repeated_file_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - file_.WriteTo(ref output, _repeated_file_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += file_.CalculateSize(_repeated_file_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FileDescriptorSet other) { - if (other == null) { - return; - } - file_.Add(other.file_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - file_.AddEntriesFrom(input, _repeated_file_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - file_.AddEntriesFrom(ref input, _repeated_file_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Describes a complete .proto file. - /// - public sealed partial class FileDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileDescriptorProto(FileDescriptorProto other) : this() { - name_ = other.name_; - package_ = other.package_; - dependency_ = other.dependency_.Clone(); - publicDependency_ = other.publicDependency_.Clone(); - weakDependency_ = other.weakDependency_.Clone(); - messageType_ = other.messageType_.Clone(); - enumType_ = other.enumType_.Clone(); - service_ = other.service_.Clone(); - extension_ = other.extension_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; - sourceCodeInfo_ = other.sourceCodeInfo_ != null ? other.sourceCodeInfo_.Clone() : null; - syntax_ = other.syntax_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileDescriptorProto Clone() { - return new FileDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - /// - /// file name, relative to root of source tree - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "package" field. - public const int PackageFieldNumber = 2; - private readonly static string PackageDefaultValue = ""; - - private string package_; - /// - /// e.g. "foo", "foo.bar", etc. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Package { - get { return package_ ?? PackageDefaultValue; } - set { - package_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "package" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPackage { - get { return package_ != null; } - } - /// Clears the value of the "package" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPackage() { - package_ = null; - } - - /// Field number for the "dependency" field. - public const int DependencyFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_dependency_codec - = pb::FieldCodec.ForString(26); - private readonly pbc::RepeatedField dependency_ = new pbc::RepeatedField(); - /// - /// Names of files imported by this file. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dependency { - get { return dependency_; } - } - - /// Field number for the "public_dependency" field. - public const int PublicDependencyFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_publicDependency_codec - = pb::FieldCodec.ForInt32(80); - private readonly pbc::RepeatedField publicDependency_ = new pbc::RepeatedField(); - /// - /// Indexes of the public imported files in the dependency list above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField PublicDependency { - get { return publicDependency_; } - } - - /// Field number for the "weak_dependency" field. - public const int WeakDependencyFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_weakDependency_codec - = pb::FieldCodec.ForInt32(88); - private readonly pbc::RepeatedField weakDependency_ = new pbc::RepeatedField(); - /// - /// Indexes of the weak imported files in the dependency list. - /// For Google-internal migration only. Do not use. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField WeakDependency { - get { return weakDependency_; } - } - - /// Field number for the "message_type" field. - public const int MessageTypeFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_messageType_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser); - private readonly pbc::RepeatedField messageType_ = new pbc::RepeatedField(); - /// - /// All top-level definitions in this file. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField MessageType { - get { return messageType_; } - } - - /// Field number for the "enum_type" field. - public const int EnumTypeFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_enumType_codec - = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser); - private readonly pbc::RepeatedField enumType_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField EnumType { - get { return enumType_; } - } - - /// Field number for the "service" field. - public const int ServiceFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_service_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser); - private readonly pbc::RepeatedField service_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Service { - get { return service_; } - } - - /// Field number for the "extension" field. - public const int ExtensionFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_extension_codec - = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); - private readonly pbc::RepeatedField extension_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Extension { - get { return extension_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 8; - private global::Google.Protobuf.Reflection.FileOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FileOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - /// Field number for the "source_code_info" field. - public const int SourceCodeInfoFieldNumber = 9; - private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_; - /// - /// This field contains optional information about the original source code. - /// You may safely remove this entire field without harming runtime - /// functionality of the descriptors -- the information is needed only by - /// development tools. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo { - get { return sourceCodeInfo_; } - set { - sourceCodeInfo_ = value; - } - } - - /// Field number for the "syntax" field. - public const int SyntaxFieldNumber = 12; - private readonly static string SyntaxDefaultValue = ""; - - private string syntax_; - /// - /// The syntax of the proto file. - /// The supported values are "proto2" and "proto3". - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Syntax { - get { return syntax_ ?? SyntaxDefaultValue; } - set { - syntax_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "syntax" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSyntax { - get { return syntax_ != null; } - } - /// Clears the value of the "syntax" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSyntax() { - syntax_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FileDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FileDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Package != other.Package) return false; - if(!dependency_.Equals(other.dependency_)) return false; - if(!publicDependency_.Equals(other.publicDependency_)) return false; - if(!weakDependency_.Equals(other.weakDependency_)) return false; - if(!messageType_.Equals(other.messageType_)) return false; - if(!enumType_.Equals(other.enumType_)) return false; - if(!service_.Equals(other.service_)) return false; - if(!extension_.Equals(other.extension_)) return false; - if (!object.Equals(Options, other.Options)) return false; - if (!object.Equals(SourceCodeInfo, other.SourceCodeInfo)) return false; - if (Syntax != other.Syntax) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - if (HasPackage) hash ^= Package.GetHashCode(); - hash ^= dependency_.GetHashCode(); - hash ^= publicDependency_.GetHashCode(); - hash ^= weakDependency_.GetHashCode(); - hash ^= messageType_.GetHashCode(); - hash ^= enumType_.GetHashCode(); - hash ^= service_.GetHashCode(); - hash ^= extension_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode(); - if (HasSyntax) hash ^= Syntax.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasPackage) { - output.WriteRawTag(18); - output.WriteString(Package); - } - dependency_.WriteTo(output, _repeated_dependency_codec); - messageType_.WriteTo(output, _repeated_messageType_codec); - enumType_.WriteTo(output, _repeated_enumType_codec); - service_.WriteTo(output, _repeated_service_codec); - extension_.WriteTo(output, _repeated_extension_codec); - if (options_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Options); - } - if (sourceCodeInfo_ != null) { - output.WriteRawTag(74); - output.WriteMessage(SourceCodeInfo); - } - publicDependency_.WriteTo(output, _repeated_publicDependency_codec); - weakDependency_.WriteTo(output, _repeated_weakDependency_codec); - if (HasSyntax) { - output.WriteRawTag(98); - output.WriteString(Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasPackage) { - output.WriteRawTag(18); - output.WriteString(Package); - } - dependency_.WriteTo(ref output, _repeated_dependency_codec); - messageType_.WriteTo(ref output, _repeated_messageType_codec); - enumType_.WriteTo(ref output, _repeated_enumType_codec); - service_.WriteTo(ref output, _repeated_service_codec); - extension_.WriteTo(ref output, _repeated_extension_codec); - if (options_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Options); - } - if (sourceCodeInfo_ != null) { - output.WriteRawTag(74); - output.WriteMessage(SourceCodeInfo); - } - publicDependency_.WriteTo(ref output, _repeated_publicDependency_codec); - weakDependency_.WriteTo(ref output, _repeated_weakDependency_codec); - if (HasSyntax) { - output.WriteRawTag(98); - output.WriteString(Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (HasPackage) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Package); - } - size += dependency_.CalculateSize(_repeated_dependency_codec); - size += publicDependency_.CalculateSize(_repeated_publicDependency_codec); - size += weakDependency_.CalculateSize(_repeated_weakDependency_codec); - size += messageType_.CalculateSize(_repeated_messageType_codec); - size += enumType_.CalculateSize(_repeated_enumType_codec); - size += service_.CalculateSize(_repeated_service_codec); - size += extension_.CalculateSize(_repeated_extension_codec); - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (sourceCodeInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceCodeInfo); - } - if (HasSyntax) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Syntax); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FileDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - if (other.HasPackage) { - Package = other.Package; - } - dependency_.Add(other.dependency_); - publicDependency_.Add(other.publicDependency_); - weakDependency_.Add(other.weakDependency_); - messageType_.Add(other.messageType_); - enumType_.Add(other.enumType_); - service_.Add(other.service_); - extension_.Add(other.extension_); - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.FileOptions(); - } - Options.MergeFrom(other.Options); - } - if (other.sourceCodeInfo_ != null) { - if (sourceCodeInfo_ == null) { - SourceCodeInfo = new global::Google.Protobuf.Reflection.SourceCodeInfo(); - } - SourceCodeInfo.MergeFrom(other.SourceCodeInfo); - } - if (other.HasSyntax) { - Syntax = other.Syntax; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Package = input.ReadString(); - break; - } - case 26: { - dependency_.AddEntriesFrom(input, _repeated_dependency_codec); - break; - } - case 34: { - messageType_.AddEntriesFrom(input, _repeated_messageType_codec); - break; - } - case 42: { - enumType_.AddEntriesFrom(input, _repeated_enumType_codec); - break; - } - case 50: { - service_.AddEntriesFrom(input, _repeated_service_codec); - break; - } - case 58: { - extension_.AddEntriesFrom(input, _repeated_extension_codec); - break; - } - case 66: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.FileOptions(); - } - input.ReadMessage(Options); - break; - } - case 74: { - if (sourceCodeInfo_ == null) { - SourceCodeInfo = new global::Google.Protobuf.Reflection.SourceCodeInfo(); - } - input.ReadMessage(SourceCodeInfo); - break; - } - case 82: - case 80: { - publicDependency_.AddEntriesFrom(input, _repeated_publicDependency_codec); - break; - } - case 90: - case 88: { - weakDependency_.AddEntriesFrom(input, _repeated_weakDependency_codec); - break; - } - case 98: { - Syntax = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Package = input.ReadString(); - break; - } - case 26: { - dependency_.AddEntriesFrom(ref input, _repeated_dependency_codec); - break; - } - case 34: { - messageType_.AddEntriesFrom(ref input, _repeated_messageType_codec); - break; - } - case 42: { - enumType_.AddEntriesFrom(ref input, _repeated_enumType_codec); - break; - } - case 50: { - service_.AddEntriesFrom(ref input, _repeated_service_codec); - break; - } - case 58: { - extension_.AddEntriesFrom(ref input, _repeated_extension_codec); - break; - } - case 66: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.FileOptions(); - } - input.ReadMessage(Options); - break; - } - case 74: { - if (sourceCodeInfo_ == null) { - SourceCodeInfo = new global::Google.Protobuf.Reflection.SourceCodeInfo(); - } - input.ReadMessage(SourceCodeInfo); - break; - } - case 82: - case 80: { - publicDependency_.AddEntriesFrom(ref input, _repeated_publicDependency_codec); - break; - } - case 90: - case 88: { - weakDependency_.AddEntriesFrom(ref input, _repeated_weakDependency_codec); - break; - } - case 98: { - Syntax = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Describes a message type. - /// - public sealed partial class DescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DescriptorProto(DescriptorProto other) : this() { - name_ = other.name_; - field_ = other.field_.Clone(); - extension_ = other.extension_.Clone(); - nestedType_ = other.nestedType_.Clone(); - enumType_ = other.enumType_.Clone(); - extensionRange_ = other.extensionRange_.Clone(); - oneofDecl_ = other.oneofDecl_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; - reservedRange_ = other.reservedRange_.Clone(); - reservedName_ = other.reservedName_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DescriptorProto Clone() { - return new DescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "field" field. - public const int FieldFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_field_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); - private readonly pbc::RepeatedField field_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Field { - get { return field_; } - } - - /// Field number for the "extension" field. - public const int ExtensionFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_extension_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); - private readonly pbc::RepeatedField extension_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Extension { - get { return extension_; } - } - - /// Field number for the "nested_type" field. - public const int NestedTypeFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_nestedType_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.Reflection.DescriptorProto.Parser); - private readonly pbc::RepeatedField nestedType_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NestedType { - get { return nestedType_; } - } - - /// Field number for the "enum_type" field. - public const int EnumTypeFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_enumType_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser); - private readonly pbc::RepeatedField enumType_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField EnumType { - get { return enumType_; } - } - - /// Field number for the "extension_range" field. - public const int ExtensionRangeFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_extensionRange_codec - = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser); - private readonly pbc::RepeatedField extensionRange_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ExtensionRange { - get { return extensionRange_; } - } - - /// Field number for the "oneof_decl" field. - public const int OneofDeclFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_oneofDecl_codec - = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser); - private readonly pbc::RepeatedField oneofDecl_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField OneofDecl { - get { return oneofDecl_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 7; - private global::Google.Protobuf.Reflection.MessageOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.MessageOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - /// Field number for the "reserved_range" field. - public const int ReservedRangeFieldNumber = 9; - private static readonly pb::FieldCodec _repeated_reservedRange_codec - = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser); - private readonly pbc::RepeatedField reservedRange_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ReservedRange { - get { return reservedRange_; } - } - - /// Field number for the "reserved_name" field. - public const int ReservedNameFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_reservedName_codec - = pb::FieldCodec.ForString(82); - private readonly pbc::RepeatedField reservedName_ = new pbc::RepeatedField(); - /// - /// Reserved field names, which may not be used by fields in the same message. - /// A given name may only be reserved once. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ReservedName { - get { return reservedName_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!field_.Equals(other.field_)) return false; - if(!extension_.Equals(other.extension_)) return false; - if(!nestedType_.Equals(other.nestedType_)) return false; - if(!enumType_.Equals(other.enumType_)) return false; - if(!extensionRange_.Equals(other.extensionRange_)) return false; - if(!oneofDecl_.Equals(other.oneofDecl_)) return false; - if (!object.Equals(Options, other.Options)) return false; - if(!reservedRange_.Equals(other.reservedRange_)) return false; - if(!reservedName_.Equals(other.reservedName_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - hash ^= field_.GetHashCode(); - hash ^= extension_.GetHashCode(); - hash ^= nestedType_.GetHashCode(); - hash ^= enumType_.GetHashCode(); - hash ^= extensionRange_.GetHashCode(); - hash ^= oneofDecl_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - hash ^= reservedRange_.GetHashCode(); - hash ^= reservedName_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - field_.WriteTo(output, _repeated_field_codec); - nestedType_.WriteTo(output, _repeated_nestedType_codec); - enumType_.WriteTo(output, _repeated_enumType_codec); - extensionRange_.WriteTo(output, _repeated_extensionRange_codec); - extension_.WriteTo(output, _repeated_extension_codec); - if (options_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Options); - } - oneofDecl_.WriteTo(output, _repeated_oneofDecl_codec); - reservedRange_.WriteTo(output, _repeated_reservedRange_codec); - reservedName_.WriteTo(output, _repeated_reservedName_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - field_.WriteTo(ref output, _repeated_field_codec); - nestedType_.WriteTo(ref output, _repeated_nestedType_codec); - enumType_.WriteTo(ref output, _repeated_enumType_codec); - extensionRange_.WriteTo(ref output, _repeated_extensionRange_codec); - extension_.WriteTo(ref output, _repeated_extension_codec); - if (options_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Options); - } - oneofDecl_.WriteTo(ref output, _repeated_oneofDecl_codec); - reservedRange_.WriteTo(ref output, _repeated_reservedRange_codec); - reservedName_.WriteTo(ref output, _repeated_reservedName_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += field_.CalculateSize(_repeated_field_codec); - size += extension_.CalculateSize(_repeated_extension_codec); - size += nestedType_.CalculateSize(_repeated_nestedType_codec); - size += enumType_.CalculateSize(_repeated_enumType_codec); - size += extensionRange_.CalculateSize(_repeated_extensionRange_codec); - size += oneofDecl_.CalculateSize(_repeated_oneofDecl_codec); - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); - size += reservedName_.CalculateSize(_repeated_reservedName_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - field_.Add(other.field_); - extension_.Add(other.extension_); - nestedType_.Add(other.nestedType_); - enumType_.Add(other.enumType_); - extensionRange_.Add(other.extensionRange_); - oneofDecl_.Add(other.oneofDecl_); - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.MessageOptions(); - } - Options.MergeFrom(other.Options); - } - reservedRange_.Add(other.reservedRange_); - reservedName_.Add(other.reservedName_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - field_.AddEntriesFrom(input, _repeated_field_codec); - break; - } - case 26: { - nestedType_.AddEntriesFrom(input, _repeated_nestedType_codec); - break; - } - case 34: { - enumType_.AddEntriesFrom(input, _repeated_enumType_codec); - break; - } - case 42: { - extensionRange_.AddEntriesFrom(input, _repeated_extensionRange_codec); - break; - } - case 50: { - extension_.AddEntriesFrom(input, _repeated_extension_codec); - break; - } - case 58: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.MessageOptions(); - } - input.ReadMessage(Options); - break; - } - case 66: { - oneofDecl_.AddEntriesFrom(input, _repeated_oneofDecl_codec); - break; - } - case 74: { - reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec); - break; - } - case 82: { - reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - field_.AddEntriesFrom(ref input, _repeated_field_codec); - break; - } - case 26: { - nestedType_.AddEntriesFrom(ref input, _repeated_nestedType_codec); - break; - } - case 34: { - enumType_.AddEntriesFrom(ref input, _repeated_enumType_codec); - break; - } - case 42: { - extensionRange_.AddEntriesFrom(ref input, _repeated_extensionRange_codec); - break; - } - case 50: { - extension_.AddEntriesFrom(ref input, _repeated_extension_codec); - break; - } - case 58: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.MessageOptions(); - } - input.ReadMessage(Options); - break; - } - case 66: { - oneofDecl_.AddEntriesFrom(ref input, _repeated_oneofDecl_codec); - break; - } - case 74: { - reservedRange_.AddEntriesFrom(ref input, _repeated_reservedRange_codec); - break; - } - case 82: { - reservedName_.AddEntriesFrom(ref input, _repeated_reservedName_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the DescriptorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class ExtensionRange : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRange()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExtensionRange() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExtensionRange(ExtensionRange other) : this() { - _hasBits0 = other._hasBits0; - start_ = other.start_; - end_ = other.end_; - options_ = other.options_ != null ? other.options_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExtensionRange Clone() { - return new ExtensionRange(this); - } - - /// Field number for the "start" field. - public const int StartFieldNumber = 1; - private readonly static int StartDefaultValue = 0; - - private int start_; - /// - /// Inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Start { - get { if ((_hasBits0 & 1) != 0) { return start_; } else { return StartDefaultValue; } } - set { - _hasBits0 |= 1; - start_ = value; - } - } - /// Gets whether the "start" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasStart { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "start" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearStart() { - _hasBits0 &= ~1; - } - - /// Field number for the "end" field. - public const int EndFieldNumber = 2; - private readonly static int EndDefaultValue = 0; - - private int end_; - /// - /// Exclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int End { - get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } - set { - _hasBits0 |= 2; - end_ = value; - } - } - /// Gets whether the "end" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasEnd { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "end" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearEnd() { - _hasBits0 &= ~2; - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.Reflection.ExtensionRangeOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.ExtensionRangeOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ExtensionRange); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ExtensionRange other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Start != other.Start) return false; - if (End != other.End) return false; - if (!object.Equals(Options, other.Options)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasStart) hash ^= Start.GetHashCode(); - if (HasEnd) hash ^= End.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasStart) { - output.WriteRawTag(8); - output.WriteInt32(Start); - } - if (HasEnd) { - output.WriteRawTag(16); - output.WriteInt32(End); - } - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasStart) { - output.WriteRawTag(8); - output.WriteInt32(Start); - } - if (HasEnd) { - output.WriteRawTag(16); - output.WriteInt32(End); - } - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasStart) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); - } - if (HasEnd) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); - } - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ExtensionRange other) { - if (other == null) { - return; - } - if (other.HasStart) { - Start = other.Start; - } - if (other.HasEnd) { - End = other.End; - } - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); - } - Options.MergeFrom(other.Options); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Start = input.ReadInt32(); - break; - } - case 16: { - End = input.ReadInt32(); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Start = input.ReadInt32(); - break; - } - case 16: { - End = input.ReadInt32(); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.ExtensionRangeOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - } - #endif - - } - - /// - /// Range of reserved tag numbers. Reserved tag numbers may not be used by - /// fields or extension ranges in the same message. Reserved ranges may - /// not overlap. - /// - public sealed partial class ReservedRange : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedRange()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReservedRange() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReservedRange(ReservedRange other) : this() { - _hasBits0 = other._hasBits0; - start_ = other.start_; - end_ = other.end_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReservedRange Clone() { - return new ReservedRange(this); - } - - /// Field number for the "start" field. - public const int StartFieldNumber = 1; - private readonly static int StartDefaultValue = 0; - - private int start_; - /// - /// Inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Start { - get { if ((_hasBits0 & 1) != 0) { return start_; } else { return StartDefaultValue; } } - set { - _hasBits0 |= 1; - start_ = value; - } - } - /// Gets whether the "start" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasStart { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "start" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearStart() { - _hasBits0 &= ~1; - } - - /// Field number for the "end" field. - public const int EndFieldNumber = 2; - private readonly static int EndDefaultValue = 0; - - private int end_; - /// - /// Exclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int End { - get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } - set { - _hasBits0 |= 2; - end_ = value; - } - } - /// Gets whether the "end" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasEnd { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "end" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearEnd() { - _hasBits0 &= ~2; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReservedRange); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReservedRange other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Start != other.Start) return false; - if (End != other.End) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasStart) hash ^= Start.GetHashCode(); - if (HasEnd) hash ^= End.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasStart) { - output.WriteRawTag(8); - output.WriteInt32(Start); - } - if (HasEnd) { - output.WriteRawTag(16); - output.WriteInt32(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasStart) { - output.WriteRawTag(8); - output.WriteInt32(Start); - } - if (HasEnd) { - output.WriteRawTag(16); - output.WriteInt32(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasStart) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); - } - if (HasEnd) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReservedRange other) { - if (other == null) { - return; - } - if (other.HasStart) { - Start = other.Start; - } - if (other.HasEnd) { - End = other.End; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Start = input.ReadInt32(); - break; - } - case 16: { - End = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Start = input.ReadInt32(); - break; - } - case 16: { - End = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - public sealed partial class ExtensionRangeOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRangeOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExtensionRangeOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExtensionRangeOptions(ExtensionRangeOptions other) : this() { - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExtensionRangeOptions Clone() { - return new ExtensionRangeOptions(this); - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ExtensionRangeOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ExtensionRangeOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ExtensionRangeOptions other) { - if (other == null) { - return; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - } - - /// - /// Describes a field within a message. - /// - public sealed partial class FieldDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldDescriptorProto(FieldDescriptorProto other) : this() { - _hasBits0 = other._hasBits0; - name_ = other.name_; - number_ = other.number_; - label_ = other.label_; - type_ = other.type_; - typeName_ = other.typeName_; - extendee_ = other.extendee_; - defaultValue_ = other.defaultValue_; - oneofIndex_ = other.oneofIndex_; - jsonName_ = other.jsonName_; - options_ = other.options_ != null ? other.options_.Clone() : null; - proto3Optional_ = other.proto3Optional_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldDescriptorProto Clone() { - return new FieldDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "number" field. - public const int NumberFieldNumber = 3; - private readonly static int NumberDefaultValue = 0; - - private int number_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Number { - get { if ((_hasBits0 & 1) != 0) { return number_; } else { return NumberDefaultValue; } } - set { - _hasBits0 |= 1; - number_ = value; - } - } - /// Gets whether the "number" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNumber { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "number" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNumber() { - _hasBits0 &= ~1; - } - - /// Field number for the "label" field. - public const int LabelFieldNumber = 4; - private readonly static global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label LabelDefaultValue = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label.Optional; - - private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label { - get { if ((_hasBits0 & 2) != 0) { return label_; } else { return LabelDefaultValue; } } - set { - _hasBits0 |= 2; - label_ = value; - } - } - /// Gets whether the "label" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLabel { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "label" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLabel() { - _hasBits0 &= ~2; - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 5; - private readonly static global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type TypeDefaultValue = global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type.Double; - - private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_; - /// - /// If type_name is set, this need not be set. If both this and type_name - /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type { - get { if ((_hasBits0 & 4) != 0) { return type_; } else { return TypeDefaultValue; } } - set { - _hasBits0 |= 4; - type_ = value; - } - } - /// Gets whether the "type" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasType { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "type" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearType() { - _hasBits0 &= ~4; - } - - /// Field number for the "type_name" field. - public const int TypeNameFieldNumber = 6; - private readonly static string TypeNameDefaultValue = ""; - - private string typeName_; - /// - /// For message and enum types, this is the name of the type. If the name - /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - /// rules are used to find the type (i.e. first the nested types within this - /// message are searched, then within the parent, on up to the root - /// namespace). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TypeName { - get { return typeName_ ?? TypeNameDefaultValue; } - set { - typeName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "type_name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasTypeName { - get { return typeName_ != null; } - } - /// Clears the value of the "type_name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearTypeName() { - typeName_ = null; - } - - /// Field number for the "extendee" field. - public const int ExtendeeFieldNumber = 2; - private readonly static string ExtendeeDefaultValue = ""; - - private string extendee_; - /// - /// For extensions, this is the name of the type being extended. It is - /// resolved in the same manner as type_name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Extendee { - get { return extendee_ ?? ExtendeeDefaultValue; } - set { - extendee_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "extendee" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasExtendee { - get { return extendee_ != null; } - } - /// Clears the value of the "extendee" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearExtendee() { - extendee_ = null; - } - - /// Field number for the "default_value" field. - public const int DefaultValueFieldNumber = 7; - private readonly static string DefaultValueDefaultValue = ""; - - private string defaultValue_; - /// - /// For numeric types, contains the original text representation of the value. - /// For booleans, "true" or "false". - /// For strings, contains the default text contents (not escaped in any way). - /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. - /// TODO(kenton): Base-64 encode? - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DefaultValue { - get { return defaultValue_ ?? DefaultValueDefaultValue; } - set { - defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "default_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDefaultValue { - get { return defaultValue_ != null; } - } - /// Clears the value of the "default_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDefaultValue() { - defaultValue_ = null; - } - - /// Field number for the "oneof_index" field. - public const int OneofIndexFieldNumber = 9; - private readonly static int OneofIndexDefaultValue = 0; - - private int oneofIndex_; - /// - /// If set, gives the index of a oneof in the containing type's oneof_decl - /// list. This field is a member of that oneof. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int OneofIndex { - get { if ((_hasBits0 & 8) != 0) { return oneofIndex_; } else { return OneofIndexDefaultValue; } } - set { - _hasBits0 |= 8; - oneofIndex_ = value; - } - } - /// Gets whether the "oneof_index" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOneofIndex { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "oneof_index" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOneofIndex() { - _hasBits0 &= ~8; - } - - /// Field number for the "json_name" field. - public const int JsonNameFieldNumber = 10; - private readonly static string JsonNameDefaultValue = ""; - - private string jsonName_; - /// - /// JSON name of this field. The value is set by protocol compiler. If the - /// user has set a "json_name" option on this field, that option's value - /// will be used. Otherwise, it's deduced from the field's name by converting - /// it to camelCase. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JsonName { - get { return jsonName_ ?? JsonNameDefaultValue; } - set { - jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "json_name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJsonName { - get { return jsonName_ != null; } - } - /// Clears the value of the "json_name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJsonName() { - jsonName_ = null; - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 8; - private global::Google.Protobuf.Reflection.FieldOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FieldOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - /// Field number for the "proto3_optional" field. - public const int Proto3OptionalFieldNumber = 17; - private readonly static bool Proto3OptionalDefaultValue = false; - - private bool proto3Optional_; - /// - /// If true, this is a proto3 "optional". When a proto3 field is optional, it - /// tracks presence regardless of field type. - /// - /// When proto3_optional is true, this field must be belong to a oneof to - /// signal to old proto3 clients that presence is tracked for this field. This - /// oneof is known as a "synthetic" oneof, and this field must be its sole - /// member (each proto3 optional field gets its own synthetic oneof). Synthetic - /// oneofs exist in the descriptor only, and do not generate any API. Synthetic - /// oneofs must be ordered after all "real" oneofs. - /// - /// For message fields, proto3_optional doesn't create any semantic change, - /// since non-repeated message fields always track presence. However it still - /// indicates the semantic detail of whether the user wrote "optional" or not. - /// This can be useful for round-tripping the .proto file. For consistency we - /// give message fields a synthetic oneof also, even though it is not required - /// to track presence. This is especially important because the parser can't - /// tell if a field is a message or an enum, so it must always create a - /// synthetic oneof. - /// - /// Proto2 optional fields do not set this flag, because they already indicate - /// optional with `LABEL_OPTIONAL`. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Proto3Optional { - get { if ((_hasBits0 & 16) != 0) { return proto3Optional_; } else { return Proto3OptionalDefaultValue; } } - set { - _hasBits0 |= 16; - proto3Optional_ = value; - } - } - /// Gets whether the "proto3_optional" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasProto3Optional { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "proto3_optional" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearProto3Optional() { - _hasBits0 &= ~16; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FieldDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FieldDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Number != other.Number) return false; - if (Label != other.Label) return false; - if (Type != other.Type) return false; - if (TypeName != other.TypeName) return false; - if (Extendee != other.Extendee) return false; - if (DefaultValue != other.DefaultValue) return false; - if (OneofIndex != other.OneofIndex) return false; - if (JsonName != other.JsonName) return false; - if (!object.Equals(Options, other.Options)) return false; - if (Proto3Optional != other.Proto3Optional) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - if (HasNumber) hash ^= Number.GetHashCode(); - if (HasLabel) hash ^= Label.GetHashCode(); - if (HasType) hash ^= Type.GetHashCode(); - if (HasTypeName) hash ^= TypeName.GetHashCode(); - if (HasExtendee) hash ^= Extendee.GetHashCode(); - if (HasDefaultValue) hash ^= DefaultValue.GetHashCode(); - if (HasOneofIndex) hash ^= OneofIndex.GetHashCode(); - if (HasJsonName) hash ^= JsonName.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (HasProto3Optional) hash ^= Proto3Optional.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasExtendee) { - output.WriteRawTag(18); - output.WriteString(Extendee); - } - if (HasNumber) { - output.WriteRawTag(24); - output.WriteInt32(Number); - } - if (HasLabel) { - output.WriteRawTag(32); - output.WriteEnum((int) Label); - } - if (HasType) { - output.WriteRawTag(40); - output.WriteEnum((int) Type); - } - if (HasTypeName) { - output.WriteRawTag(50); - output.WriteString(TypeName); - } - if (HasDefaultValue) { - output.WriteRawTag(58); - output.WriteString(DefaultValue); - } - if (options_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Options); - } - if (HasOneofIndex) { - output.WriteRawTag(72); - output.WriteInt32(OneofIndex); - } - if (HasJsonName) { - output.WriteRawTag(82); - output.WriteString(JsonName); - } - if (HasProto3Optional) { - output.WriteRawTag(136, 1); - output.WriteBool(Proto3Optional); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasExtendee) { - output.WriteRawTag(18); - output.WriteString(Extendee); - } - if (HasNumber) { - output.WriteRawTag(24); - output.WriteInt32(Number); - } - if (HasLabel) { - output.WriteRawTag(32); - output.WriteEnum((int) Label); - } - if (HasType) { - output.WriteRawTag(40); - output.WriteEnum((int) Type); - } - if (HasTypeName) { - output.WriteRawTag(50); - output.WriteString(TypeName); - } - if (HasDefaultValue) { - output.WriteRawTag(58); - output.WriteString(DefaultValue); - } - if (options_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Options); - } - if (HasOneofIndex) { - output.WriteRawTag(72); - output.WriteInt32(OneofIndex); - } - if (HasJsonName) { - output.WriteRawTag(82); - output.WriteString(JsonName); - } - if (HasProto3Optional) { - output.WriteRawTag(136, 1); - output.WriteBool(Proto3Optional); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (HasNumber) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); - } - if (HasLabel) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Label); - } - if (HasType) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - if (HasTypeName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeName); - } - if (HasExtendee) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Extendee); - } - if (HasDefaultValue) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue); - } - if (HasOneofIndex) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex); - } - if (HasJsonName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName); - } - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (HasProto3Optional) { - size += 2 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FieldDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - if (other.HasNumber) { - Number = other.Number; - } - if (other.HasLabel) { - Label = other.Label; - } - if (other.HasType) { - Type = other.Type; - } - if (other.HasTypeName) { - TypeName = other.TypeName; - } - if (other.HasExtendee) { - Extendee = other.Extendee; - } - if (other.HasDefaultValue) { - DefaultValue = other.DefaultValue; - } - if (other.HasOneofIndex) { - OneofIndex = other.OneofIndex; - } - if (other.HasJsonName) { - JsonName = other.JsonName; - } - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.FieldOptions(); - } - Options.MergeFrom(other.Options); - } - if (other.HasProto3Optional) { - Proto3Optional = other.Proto3Optional; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Extendee = input.ReadString(); - break; - } - case 24: { - Number = input.ReadInt32(); - break; - } - case 32: { - Label = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum(); - break; - } - case 40: { - Type = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum(); - break; - } - case 50: { - TypeName = input.ReadString(); - break; - } - case 58: { - DefaultValue = input.ReadString(); - break; - } - case 66: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.FieldOptions(); - } - input.ReadMessage(Options); - break; - } - case 72: { - OneofIndex = input.ReadInt32(); - break; - } - case 82: { - JsonName = input.ReadString(); - break; - } - case 136: { - Proto3Optional = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Extendee = input.ReadString(); - break; - } - case 24: { - Number = input.ReadInt32(); - break; - } - case 32: { - Label = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label) input.ReadEnum(); - break; - } - case 40: { - Type = (global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type) input.ReadEnum(); - break; - } - case 50: { - TypeName = input.ReadString(); - break; - } - case 58: { - DefaultValue = input.ReadString(); - break; - } - case 66: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.FieldOptions(); - } - input.ReadMessage(Options); - break; - } - case 72: { - OneofIndex = input.ReadInt32(); - break; - } - case 82: { - JsonName = input.ReadString(); - break; - } - case 136: { - Proto3Optional = input.ReadBool(); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the FieldDescriptorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public enum Type { - /// - /// 0 is reserved for errors. - /// Order is weird for historical reasons. - /// - [pbr::OriginalName("TYPE_DOUBLE")] Double = 1, - [pbr::OriginalName("TYPE_FLOAT")] Float = 2, - /// - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - /// negative values are likely. - /// - [pbr::OriginalName("TYPE_INT64")] Int64 = 3, - [pbr::OriginalName("TYPE_UINT64")] Uint64 = 4, - /// - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - /// negative values are likely. - /// - [pbr::OriginalName("TYPE_INT32")] Int32 = 5, - [pbr::OriginalName("TYPE_FIXED64")] Fixed64 = 6, - [pbr::OriginalName("TYPE_FIXED32")] Fixed32 = 7, - [pbr::OriginalName("TYPE_BOOL")] Bool = 8, - [pbr::OriginalName("TYPE_STRING")] String = 9, - /// - /// Tag-delimited aggregate. - /// Group type is deprecated and not supported in proto3. However, Proto3 - /// implementations should still be able to parse the group wire format and - /// treat group fields as unknown fields. - /// - [pbr::OriginalName("TYPE_GROUP")] Group = 10, - /// - /// Length-delimited aggregate. - /// - [pbr::OriginalName("TYPE_MESSAGE")] Message = 11, - /// - /// New in version 2. - /// - [pbr::OriginalName("TYPE_BYTES")] Bytes = 12, - [pbr::OriginalName("TYPE_UINT32")] Uint32 = 13, - [pbr::OriginalName("TYPE_ENUM")] Enum = 14, - [pbr::OriginalName("TYPE_SFIXED32")] Sfixed32 = 15, - [pbr::OriginalName("TYPE_SFIXED64")] Sfixed64 = 16, - /// - /// Uses ZigZag encoding. - /// - [pbr::OriginalName("TYPE_SINT32")] Sint32 = 17, - /// - /// Uses ZigZag encoding. - /// - [pbr::OriginalName("TYPE_SINT64")] Sint64 = 18, - } - - public enum Label { - /// - /// 0 is reserved for errors - /// - [pbr::OriginalName("LABEL_OPTIONAL")] Optional = 1, - [pbr::OriginalName("LABEL_REQUIRED")] Required = 2, - [pbr::OriginalName("LABEL_REPEATED")] Repeated = 3, - } - - } - #endregion - - } - - /// - /// Describes a oneof. - /// - public sealed partial class OneofDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OneofDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OneofDescriptorProto(OneofDescriptorProto other) : this() { - name_ = other.name_; - options_ = other.options_ != null ? other.options_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OneofDescriptorProto Clone() { - return new OneofDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 2; - private global::Google.Protobuf.Reflection.OneofOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.OneofOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OneofDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OneofDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (!object.Equals(Options, other.Options)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (options_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (options_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OneofDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.OneofOptions(); - } - Options.MergeFrom(other.Options); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.OneofOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.OneofOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - } - #endif - - } - - /// - /// Describes an enum type. - /// - public sealed partial class EnumDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumDescriptorProto(EnumDescriptorProto other) : this() { - name_ = other.name_; - value_ = other.value_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; - reservedRange_ = other.reservedRange_.Clone(); - reservedName_ = other.reservedName_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumDescriptorProto Clone() { - return new EnumDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.Reflection.EnumOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.EnumOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - /// Field number for the "reserved_range" field. - public const int ReservedRangeFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_reservedRange_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Types.EnumReservedRange.Parser); - private readonly pbc::RepeatedField reservedRange_ = new pbc::RepeatedField(); - /// - /// Range of reserved numeric values. Reserved numeric values may not be used - /// by enum values in the same enum declaration. Reserved ranges may not - /// overlap. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ReservedRange { - get { return reservedRange_; } - } - - /// Field number for the "reserved_name" field. - public const int ReservedNameFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_reservedName_codec - = pb::FieldCodec.ForString(42); - private readonly pbc::RepeatedField reservedName_ = new pbc::RepeatedField(); - /// - /// Reserved enum value names, which may not be reused. A given name may only - /// be reserved once. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ReservedName { - get { return reservedName_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!value_.Equals(other.value_)) return false; - if (!object.Equals(Options, other.Options)) return false; - if(!reservedRange_.Equals(other.reservedRange_)) return false; - if(!reservedName_.Equals(other.reservedName_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - hash ^= value_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - hash ^= reservedRange_.GetHashCode(); - hash ^= reservedName_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - value_.WriteTo(output, _repeated_value_codec); - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - reservedRange_.WriteTo(output, _repeated_reservedRange_codec); - reservedName_.WriteTo(output, _repeated_reservedName_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - value_.WriteTo(ref output, _repeated_value_codec); - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - reservedRange_.WriteTo(ref output, _repeated_reservedRange_codec); - reservedName_.WriteTo(ref output, _repeated_reservedName_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += value_.CalculateSize(_repeated_value_codec); - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - size += reservedRange_.CalculateSize(_repeated_reservedRange_codec); - size += reservedName_.CalculateSize(_repeated_reservedName_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - value_.Add(other.value_); - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.EnumOptions(); - } - Options.MergeFrom(other.Options); - } - reservedRange_.Add(other.reservedRange_); - reservedName_.Add(other.reservedName_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.EnumOptions(); - } - input.ReadMessage(Options); - break; - } - case 34: { - reservedRange_.AddEntriesFrom(input, _repeated_reservedRange_codec); - break; - } - case 42: { - reservedName_.AddEntriesFrom(input, _repeated_reservedName_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - value_.AddEntriesFrom(ref input, _repeated_value_codec); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.EnumOptions(); - } - input.ReadMessage(Options); - break; - } - case 34: { - reservedRange_.AddEntriesFrom(ref input, _repeated_reservedRange_codec); - break; - } - case 42: { - reservedName_.AddEntriesFrom(ref input, _repeated_reservedName_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the EnumDescriptorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Range of reserved numeric values. Reserved values may not be used by - /// entries in the same enum. Reserved ranges may not overlap. - /// - /// Note that this is distinct from DescriptorProto.ReservedRange in that it - /// is inclusive such that it can appropriately represent the entire int32 - /// domain. - /// - public sealed partial class EnumReservedRange : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumReservedRange()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.EnumDescriptorProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumReservedRange() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumReservedRange(EnumReservedRange other) : this() { - _hasBits0 = other._hasBits0; - start_ = other.start_; - end_ = other.end_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumReservedRange Clone() { - return new EnumReservedRange(this); - } - - /// Field number for the "start" field. - public const int StartFieldNumber = 1; - private readonly static int StartDefaultValue = 0; - - private int start_; - /// - /// Inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Start { - get { if ((_hasBits0 & 1) != 0) { return start_; } else { return StartDefaultValue; } } - set { - _hasBits0 |= 1; - start_ = value; - } - } - /// Gets whether the "start" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasStart { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "start" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearStart() { - _hasBits0 &= ~1; - } - - /// Field number for the "end" field. - public const int EndFieldNumber = 2; - private readonly static int EndDefaultValue = 0; - - private int end_; - /// - /// Inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int End { - get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } - set { - _hasBits0 |= 2; - end_ = value; - } - } - /// Gets whether the "end" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasEnd { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "end" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearEnd() { - _hasBits0 &= ~2; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumReservedRange); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumReservedRange other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Start != other.Start) return false; - if (End != other.End) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasStart) hash ^= Start.GetHashCode(); - if (HasEnd) hash ^= End.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasStart) { - output.WriteRawTag(8); - output.WriteInt32(Start); - } - if (HasEnd) { - output.WriteRawTag(16); - output.WriteInt32(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasStart) { - output.WriteRawTag(8); - output.WriteInt32(Start); - } - if (HasEnd) { - output.WriteRawTag(16); - output.WriteInt32(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasStart) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Start); - } - if (HasEnd) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumReservedRange other) { - if (other == null) { - return; - } - if (other.HasStart) { - Start = other.Start; - } - if (other.HasEnd) { - End = other.End; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Start = input.ReadInt32(); - break; - } - case 16: { - End = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Start = input.ReadInt32(); - break; - } - case 16: { - End = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Describes a value within an enum. - /// - public sealed partial class EnumValueDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValueDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() { - _hasBits0 = other._hasBits0; - name_ = other.name_; - number_ = other.number_; - options_ = other.options_ != null ? other.options_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValueDescriptorProto Clone() { - return new EnumValueDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "number" field. - public const int NumberFieldNumber = 2; - private readonly static int NumberDefaultValue = 0; - - private int number_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Number { - get { if ((_hasBits0 & 1) != 0) { return number_; } else { return NumberDefaultValue; } } - set { - _hasBits0 |= 1; - number_ = value; - } - } - /// Gets whether the "number" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNumber { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "number" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNumber() { - _hasBits0 &= ~1; - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.Reflection.EnumValueOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.EnumValueOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumValueDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumValueDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Number != other.Number) return false; - if (!object.Equals(Options, other.Options)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - if (HasNumber) hash ^= Number.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasNumber) { - output.WriteRawTag(16); - output.WriteInt32(Number); - } - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasNumber) { - output.WriteRawTag(16); - output.WriteInt32(Number); - } - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (HasNumber) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); - } - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumValueDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - if (other.HasNumber) { - Number = other.Number; - } - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.EnumValueOptions(); - } - Options.MergeFrom(other.Options); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Number = input.ReadInt32(); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.EnumValueOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Number = input.ReadInt32(); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.EnumValueOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - } - #endif - - } - - /// - /// Describes a service. - /// - public sealed partial class ServiceDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServiceDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServiceDescriptorProto(ServiceDescriptorProto other) : this() { - name_ = other.name_; - method_ = other.method_.Clone(); - options_ = other.options_ != null ? other.options_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServiceDescriptorProto Clone() { - return new ServiceDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "method" field. - public const int MethodFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_method_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser); - private readonly pbc::RepeatedField method_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Method { - get { return method_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private global::Google.Protobuf.Reflection.ServiceOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.ServiceOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ServiceDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ServiceDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!method_.Equals(other.method_)) return false; - if (!object.Equals(Options, other.Options)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - hash ^= method_.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - method_.WriteTo(output, _repeated_method_codec); - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - method_.WriteTo(ref output, _repeated_method_codec); - if (options_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Options); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += method_.CalculateSize(_repeated_method_codec); - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ServiceDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - method_.Add(other.method_); - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.ServiceOptions(); - } - Options.MergeFrom(other.Options); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - method_.AddEntriesFrom(input, _repeated_method_codec); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.ServiceOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - method_.AddEntriesFrom(ref input, _repeated_method_codec); - break; - } - case 26: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.ServiceOptions(); - } - input.ReadMessage(Options); - break; - } - } - } - } - #endif - - } - - /// - /// Describes a method of a service. - /// - public sealed partial class MethodDescriptorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodDescriptorProto()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodDescriptorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodDescriptorProto(MethodDescriptorProto other) : this() { - _hasBits0 = other._hasBits0; - name_ = other.name_; - inputType_ = other.inputType_; - outputType_ = other.outputType_; - options_ = other.options_ != null ? other.options_.Clone() : null; - clientStreaming_ = other.clientStreaming_; - serverStreaming_ = other.serverStreaming_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodDescriptorProto Clone() { - return new MethodDescriptorProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private readonly static string NameDefaultValue = ""; - - private string name_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_ ?? NameDefaultValue; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasName { - get { return name_ != null; } - } - /// Clears the value of the "name" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearName() { - name_ = null; - } - - /// Field number for the "input_type" field. - public const int InputTypeFieldNumber = 2; - private readonly static string InputTypeDefaultValue = ""; - - private string inputType_; - /// - /// Input and output type names. These are resolved in the same way as - /// FieldDescriptorProto.type_name, but must refer to a message type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string InputType { - get { return inputType_ ?? InputTypeDefaultValue; } - set { - inputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "input_type" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasInputType { - get { return inputType_ != null; } - } - /// Clears the value of the "input_type" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearInputType() { - inputType_ = null; - } - - /// Field number for the "output_type" field. - public const int OutputTypeFieldNumber = 3; - private readonly static string OutputTypeDefaultValue = ""; - - private string outputType_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string OutputType { - get { return outputType_ ?? OutputTypeDefaultValue; } - set { - outputType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "output_type" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOutputType { - get { return outputType_ != null; } - } - /// Clears the value of the "output_type" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOutputType() { - outputType_ = null; - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 4; - private global::Google.Protobuf.Reflection.MethodOptions options_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.MethodOptions Options { - get { return options_; } - set { - options_ = value; - } - } - - /// Field number for the "client_streaming" field. - public const int ClientStreamingFieldNumber = 5; - private readonly static bool ClientStreamingDefaultValue = false; - - private bool clientStreaming_; - /// - /// Identifies if client streams multiple client messages - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool ClientStreaming { - get { if ((_hasBits0 & 1) != 0) { return clientStreaming_; } else { return ClientStreamingDefaultValue; } } - set { - _hasBits0 |= 1; - clientStreaming_ = value; - } - } - /// Gets whether the "client_streaming" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasClientStreaming { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "client_streaming" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearClientStreaming() { - _hasBits0 &= ~1; - } - - /// Field number for the "server_streaming" field. - public const int ServerStreamingFieldNumber = 6; - private readonly static bool ServerStreamingDefaultValue = false; - - private bool serverStreaming_; - /// - /// Identifies if server streams multiple server messages - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool ServerStreaming { - get { if ((_hasBits0 & 2) != 0) { return serverStreaming_; } else { return ServerStreamingDefaultValue; } } - set { - _hasBits0 |= 2; - serverStreaming_ = value; - } - } - /// Gets whether the "server_streaming" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasServerStreaming { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "server_streaming" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearServerStreaming() { - _hasBits0 &= ~2; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MethodDescriptorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MethodDescriptorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (InputType != other.InputType) return false; - if (OutputType != other.OutputType) return false; - if (!object.Equals(Options, other.Options)) return false; - if (ClientStreaming != other.ClientStreaming) return false; - if (ServerStreaming != other.ServerStreaming) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasName) hash ^= Name.GetHashCode(); - if (HasInputType) hash ^= InputType.GetHashCode(); - if (HasOutputType) hash ^= OutputType.GetHashCode(); - if (options_ != null) hash ^= Options.GetHashCode(); - if (HasClientStreaming) hash ^= ClientStreaming.GetHashCode(); - if (HasServerStreaming) hash ^= ServerStreaming.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasInputType) { - output.WriteRawTag(18); - output.WriteString(InputType); - } - if (HasOutputType) { - output.WriteRawTag(26); - output.WriteString(OutputType); - } - if (options_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Options); - } - if (HasClientStreaming) { - output.WriteRawTag(40); - output.WriteBool(ClientStreaming); - } - if (HasServerStreaming) { - output.WriteRawTag(48); - output.WriteBool(ServerStreaming); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasName) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (HasInputType) { - output.WriteRawTag(18); - output.WriteString(InputType); - } - if (HasOutputType) { - output.WriteRawTag(26); - output.WriteString(OutputType); - } - if (options_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Options); - } - if (HasClientStreaming) { - output.WriteRawTag(40); - output.WriteBool(ClientStreaming); - } - if (HasServerStreaming) { - output.WriteRawTag(48); - output.WriteBool(ServerStreaming); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasName) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (HasInputType) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(InputType); - } - if (HasOutputType) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OutputType); - } - if (options_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); - } - if (HasClientStreaming) { - size += 1 + 1; - } - if (HasServerStreaming) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MethodDescriptorProto other) { - if (other == null) { - return; - } - if (other.HasName) { - Name = other.Name; - } - if (other.HasInputType) { - InputType = other.InputType; - } - if (other.HasOutputType) { - OutputType = other.OutputType; - } - if (other.options_ != null) { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.MethodOptions(); - } - Options.MergeFrom(other.Options); - } - if (other.HasClientStreaming) { - ClientStreaming = other.ClientStreaming; - } - if (other.HasServerStreaming) { - ServerStreaming = other.ServerStreaming; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - InputType = input.ReadString(); - break; - } - case 26: { - OutputType = input.ReadString(); - break; - } - case 34: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.MethodOptions(); - } - input.ReadMessage(Options); - break; - } - case 40: { - ClientStreaming = input.ReadBool(); - break; - } - case 48: { - ServerStreaming = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - InputType = input.ReadString(); - break; - } - case 26: { - OutputType = input.ReadString(); - break; - } - case 34: { - if (options_ == null) { - Options = new global::Google.Protobuf.Reflection.MethodOptions(); - } - input.ReadMessage(Options); - break; - } - case 40: { - ClientStreaming = input.ReadBool(); - break; - } - case 48: { - ServerStreaming = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - public sealed partial class FileOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileOptions(FileOptions other) : this() { - _hasBits0 = other._hasBits0; - javaPackage_ = other.javaPackage_; - javaOuterClassname_ = other.javaOuterClassname_; - javaMultipleFiles_ = other.javaMultipleFiles_; - javaGenerateEqualsAndHash_ = other.javaGenerateEqualsAndHash_; - javaStringCheckUtf8_ = other.javaStringCheckUtf8_; - optimizeFor_ = other.optimizeFor_; - goPackage_ = other.goPackage_; - ccGenericServices_ = other.ccGenericServices_; - javaGenericServices_ = other.javaGenericServices_; - pyGenericServices_ = other.pyGenericServices_; - phpGenericServices_ = other.phpGenericServices_; - deprecated_ = other.deprecated_; - ccEnableArenas_ = other.ccEnableArenas_; - objcClassPrefix_ = other.objcClassPrefix_; - csharpNamespace_ = other.csharpNamespace_; - swiftPrefix_ = other.swiftPrefix_; - phpClassPrefix_ = other.phpClassPrefix_; - phpNamespace_ = other.phpNamespace_; - phpMetadataNamespace_ = other.phpMetadataNamespace_; - rubyPackage_ = other.rubyPackage_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FileOptions Clone() { - return new FileOptions(this); - } - - /// Field number for the "java_package" field. - public const int JavaPackageFieldNumber = 1; - private readonly static string JavaPackageDefaultValue = ""; - - private string javaPackage_; - /// - /// Sets the Java package where classes generated from this .proto will be - /// placed. By default, the proto package is used, but this is often - /// inappropriate because proto packages do not normally start with backwards - /// domain names. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JavaPackage { - get { return javaPackage_ ?? JavaPackageDefaultValue; } - set { - javaPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "java_package" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJavaPackage { - get { return javaPackage_ != null; } - } - /// Clears the value of the "java_package" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJavaPackage() { - javaPackage_ = null; - } - - /// Field number for the "java_outer_classname" field. - public const int JavaOuterClassnameFieldNumber = 8; - private readonly static string JavaOuterClassnameDefaultValue = ""; - - private string javaOuterClassname_; - /// - /// If set, all the classes from the .proto file are wrapped in a single - /// outer class with the given name. This applies to both Proto1 - /// (equivalent to the old "--one_java_file" option) and Proto2 (where - /// a .proto always translates to a single class, but you may want to - /// explicitly choose the class name). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JavaOuterClassname { - get { return javaOuterClassname_ ?? JavaOuterClassnameDefaultValue; } - set { - javaOuterClassname_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "java_outer_classname" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJavaOuterClassname { - get { return javaOuterClassname_ != null; } - } - /// Clears the value of the "java_outer_classname" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJavaOuterClassname() { - javaOuterClassname_ = null; - } - - /// Field number for the "java_multiple_files" field. - public const int JavaMultipleFilesFieldNumber = 10; - private readonly static bool JavaMultipleFilesDefaultValue = false; - - private bool javaMultipleFiles_; - /// - /// If set true, then the Java code generator will generate a separate .java - /// file for each top-level message, enum, and service defined in the .proto - /// file. Thus, these types will *not* be nested inside the outer class - /// named by java_outer_classname. However, the outer class will still be - /// generated to contain the file's getDescriptor() method as well as any - /// top-level extensions defined in the file. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool JavaMultipleFiles { - get { if ((_hasBits0 & 2) != 0) { return javaMultipleFiles_; } else { return JavaMultipleFilesDefaultValue; } } - set { - _hasBits0 |= 2; - javaMultipleFiles_ = value; - } - } - /// Gets whether the "java_multiple_files" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJavaMultipleFiles { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "java_multiple_files" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJavaMultipleFiles() { - _hasBits0 &= ~2; - } - - /// Field number for the "java_generate_equals_and_hash" field. - public const int JavaGenerateEqualsAndHashFieldNumber = 20; - private readonly static bool JavaGenerateEqualsAndHashDefaultValue = false; - - private bool javaGenerateEqualsAndHash_; - /// - /// This option does nothing. - /// - [global::System.ObsoleteAttribute] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool JavaGenerateEqualsAndHash { - get { if ((_hasBits0 & 32) != 0) { return javaGenerateEqualsAndHash_; } else { return JavaGenerateEqualsAndHashDefaultValue; } } - set { - _hasBits0 |= 32; - javaGenerateEqualsAndHash_ = value; - } - } - /// Gets whether the "java_generate_equals_and_hash" field is set - [global::System.ObsoleteAttribute] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJavaGenerateEqualsAndHash { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "java_generate_equals_and_hash" field - [global::System.ObsoleteAttribute] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJavaGenerateEqualsAndHash() { - _hasBits0 &= ~32; - } - - /// Field number for the "java_string_check_utf8" field. - public const int JavaStringCheckUtf8FieldNumber = 27; - private readonly static bool JavaStringCheckUtf8DefaultValue = false; - - private bool javaStringCheckUtf8_; - /// - /// If set true, then the Java2 code generator will generate code that - /// throws an exception whenever an attempt is made to assign a non-UTF-8 - /// byte sequence to a string field. - /// Message reflection will do the same. - /// However, an extension field still accepts non-UTF-8 byte sequences. - /// This option has no effect on when used with the lite runtime. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool JavaStringCheckUtf8 { - get { if ((_hasBits0 & 128) != 0) { return javaStringCheckUtf8_; } else { return JavaStringCheckUtf8DefaultValue; } } - set { - _hasBits0 |= 128; - javaStringCheckUtf8_ = value; - } - } - /// Gets whether the "java_string_check_utf8" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJavaStringCheckUtf8 { - get { return (_hasBits0 & 128) != 0; } - } - /// Clears the value of the "java_string_check_utf8" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJavaStringCheckUtf8() { - _hasBits0 &= ~128; - } - - /// Field number for the "optimize_for" field. - public const int OptimizeForFieldNumber = 9; - private readonly static global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeForDefaultValue = global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode.Speed; - - private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor { - get { if ((_hasBits0 & 1) != 0) { return optimizeFor_; } else { return OptimizeForDefaultValue; } } - set { - _hasBits0 |= 1; - optimizeFor_ = value; - } - } - /// Gets whether the "optimize_for" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasOptimizeFor { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "optimize_for" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearOptimizeFor() { - _hasBits0 &= ~1; - } - - /// Field number for the "go_package" field. - public const int GoPackageFieldNumber = 11; - private readonly static string GoPackageDefaultValue = ""; - - private string goPackage_; - /// - /// Sets the Go package where structs generated from this .proto will be - /// placed. If omitted, the Go package will be derived from the following: - /// - The basename of the package import path, if provided. - /// - Otherwise, the package statement in the .proto file, if present. - /// - Otherwise, the basename of the .proto file, without extension. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string GoPackage { - get { return goPackage_ ?? GoPackageDefaultValue; } - set { - goPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "go_package" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasGoPackage { - get { return goPackage_ != null; } - } - /// Clears the value of the "go_package" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearGoPackage() { - goPackage_ = null; - } - - /// Field number for the "cc_generic_services" field. - public const int CcGenericServicesFieldNumber = 16; - private readonly static bool CcGenericServicesDefaultValue = false; - - private bool ccGenericServices_; - /// - /// Should generic services be generated in each language? "Generic" services - /// are not specific to any particular RPC system. They are generated by the - /// main code generators in each language (without additional plugins). - /// Generic services were the only kind of service generation supported by - /// early versions of google.protobuf. - /// - /// Generic services are now considered deprecated in favor of using plugins - /// that generate code specific to your particular RPC system. Therefore, - /// these default to false. Old code which depends on generic services should - /// explicitly set them to true. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool CcGenericServices { - get { if ((_hasBits0 & 4) != 0) { return ccGenericServices_; } else { return CcGenericServicesDefaultValue; } } - set { - _hasBits0 |= 4; - ccGenericServices_ = value; - } - } - /// Gets whether the "cc_generic_services" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasCcGenericServices { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "cc_generic_services" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearCcGenericServices() { - _hasBits0 &= ~4; - } - - /// Field number for the "java_generic_services" field. - public const int JavaGenericServicesFieldNumber = 17; - private readonly static bool JavaGenericServicesDefaultValue = false; - - private bool javaGenericServices_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool JavaGenericServices { - get { if ((_hasBits0 & 8) != 0) { return javaGenericServices_; } else { return JavaGenericServicesDefaultValue; } } - set { - _hasBits0 |= 8; - javaGenericServices_ = value; - } - } - /// Gets whether the "java_generic_services" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJavaGenericServices { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "java_generic_services" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJavaGenericServices() { - _hasBits0 &= ~8; - } - - /// Field number for the "py_generic_services" field. - public const int PyGenericServicesFieldNumber = 18; - private readonly static bool PyGenericServicesDefaultValue = false; - - private bool pyGenericServices_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool PyGenericServices { - get { if ((_hasBits0 & 16) != 0) { return pyGenericServices_; } else { return PyGenericServicesDefaultValue; } } - set { - _hasBits0 |= 16; - pyGenericServices_ = value; - } - } - /// Gets whether the "py_generic_services" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPyGenericServices { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "py_generic_services" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPyGenericServices() { - _hasBits0 &= ~16; - } - - /// Field number for the "php_generic_services" field. - public const int PhpGenericServicesFieldNumber = 42; - private readonly static bool PhpGenericServicesDefaultValue = false; - - private bool phpGenericServices_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool PhpGenericServices { - get { if ((_hasBits0 & 512) != 0) { return phpGenericServices_; } else { return PhpGenericServicesDefaultValue; } } - set { - _hasBits0 |= 512; - phpGenericServices_ = value; - } - } - /// Gets whether the "php_generic_services" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPhpGenericServices { - get { return (_hasBits0 & 512) != 0; } - } - /// Clears the value of the "php_generic_services" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPhpGenericServices() { - _hasBits0 &= ~512; - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 23; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this file deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for everything in the file, or it will be completely ignored; in the very - /// least, this is a formalization for deprecating files. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 64) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 64; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 64) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~64; - } - - /// Field number for the "cc_enable_arenas" field. - public const int CcEnableArenasFieldNumber = 31; - private readonly static bool CcEnableArenasDefaultValue = true; - - private bool ccEnableArenas_; - /// - /// Enables the use of arenas for the proto messages in this file. This applies - /// only to generated classes for C++. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool CcEnableArenas { - get { if ((_hasBits0 & 256) != 0) { return ccEnableArenas_; } else { return CcEnableArenasDefaultValue; } } - set { - _hasBits0 |= 256; - ccEnableArenas_ = value; - } - } - /// Gets whether the "cc_enable_arenas" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasCcEnableArenas { - get { return (_hasBits0 & 256) != 0; } - } - /// Clears the value of the "cc_enable_arenas" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearCcEnableArenas() { - _hasBits0 &= ~256; - } - - /// Field number for the "objc_class_prefix" field. - public const int ObjcClassPrefixFieldNumber = 36; - private readonly static string ObjcClassPrefixDefaultValue = ""; - - private string objcClassPrefix_; - /// - /// Sets the objective c class prefix which is prepended to all objective c - /// generated classes from this .proto. There is no default. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ObjcClassPrefix { - get { return objcClassPrefix_ ?? ObjcClassPrefixDefaultValue; } - set { - objcClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "objc_class_prefix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasObjcClassPrefix { - get { return objcClassPrefix_ != null; } - } - /// Clears the value of the "objc_class_prefix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearObjcClassPrefix() { - objcClassPrefix_ = null; - } - - /// Field number for the "csharp_namespace" field. - public const int CsharpNamespaceFieldNumber = 37; - private readonly static string CsharpNamespaceDefaultValue = ""; - - private string csharpNamespace_; - /// - /// Namespace for generated classes; defaults to the package. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string CsharpNamespace { - get { return csharpNamespace_ ?? CsharpNamespaceDefaultValue; } - set { - csharpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "csharp_namespace" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasCsharpNamespace { - get { return csharpNamespace_ != null; } - } - /// Clears the value of the "csharp_namespace" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearCsharpNamespace() { - csharpNamespace_ = null; - } - - /// Field number for the "swift_prefix" field. - public const int SwiftPrefixFieldNumber = 39; - private readonly static string SwiftPrefixDefaultValue = ""; - - private string swiftPrefix_; - /// - /// By default Swift generators will take the proto package and CamelCase it - /// replacing '.' with underscore and use that to prefix the types/symbols - /// defined. When this options is provided, they will use this value instead - /// to prefix the types/symbols defined. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SwiftPrefix { - get { return swiftPrefix_ ?? SwiftPrefixDefaultValue; } - set { - swiftPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "swift_prefix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSwiftPrefix { - get { return swiftPrefix_ != null; } - } - /// Clears the value of the "swift_prefix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSwiftPrefix() { - swiftPrefix_ = null; - } - - /// Field number for the "php_class_prefix" field. - public const int PhpClassPrefixFieldNumber = 40; - private readonly static string PhpClassPrefixDefaultValue = ""; - - private string phpClassPrefix_; - /// - /// Sets the php class prefix which is prepended to all php generated classes - /// from this .proto. Default is empty. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string PhpClassPrefix { - get { return phpClassPrefix_ ?? PhpClassPrefixDefaultValue; } - set { - phpClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "php_class_prefix" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPhpClassPrefix { - get { return phpClassPrefix_ != null; } - } - /// Clears the value of the "php_class_prefix" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPhpClassPrefix() { - phpClassPrefix_ = null; - } - - /// Field number for the "php_namespace" field. - public const int PhpNamespaceFieldNumber = 41; - private readonly static string PhpNamespaceDefaultValue = ""; - - private string phpNamespace_; - /// - /// Use this option to change the namespace of php generated classes. Default - /// is empty. When this option is empty, the package name will be used for - /// determining the namespace. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string PhpNamespace { - get { return phpNamespace_ ?? PhpNamespaceDefaultValue; } - set { - phpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "php_namespace" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPhpNamespace { - get { return phpNamespace_ != null; } - } - /// Clears the value of the "php_namespace" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPhpNamespace() { - phpNamespace_ = null; - } - - /// Field number for the "php_metadata_namespace" field. - public const int PhpMetadataNamespaceFieldNumber = 44; - private readonly static string PhpMetadataNamespaceDefaultValue = ""; - - private string phpMetadataNamespace_; - /// - /// Use this option to change the namespace of php generated metadata classes. - /// Default is empty. When this option is empty, the proto file name will be - /// used for determining the namespace. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string PhpMetadataNamespace { - get { return phpMetadataNamespace_ ?? PhpMetadataNamespaceDefaultValue; } - set { - phpMetadataNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "php_metadata_namespace" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPhpMetadataNamespace { - get { return phpMetadataNamespace_ != null; } - } - /// Clears the value of the "php_metadata_namespace" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPhpMetadataNamespace() { - phpMetadataNamespace_ = null; - } - - /// Field number for the "ruby_package" field. - public const int RubyPackageFieldNumber = 45; - private readonly static string RubyPackageDefaultValue = ""; - - private string rubyPackage_; - /// - /// Use this option to change the package of ruby generated classes. Default - /// is empty. When this option is not set, the package name will be used for - /// determining the ruby package. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RubyPackage { - get { return rubyPackage_ ?? RubyPackageDefaultValue; } - set { - rubyPackage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "ruby_package" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasRubyPackage { - get { return rubyPackage_ != null; } - } - /// Clears the value of the "ruby_package" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearRubyPackage() { - rubyPackage_ = null; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. - /// See the documentation for the "Options" section above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FileOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FileOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (JavaPackage != other.JavaPackage) return false; - if (JavaOuterClassname != other.JavaOuterClassname) return false; - if (JavaMultipleFiles != other.JavaMultipleFiles) return false; - if (JavaGenerateEqualsAndHash != other.JavaGenerateEqualsAndHash) return false; - if (JavaStringCheckUtf8 != other.JavaStringCheckUtf8) return false; - if (OptimizeFor != other.OptimizeFor) return false; - if (GoPackage != other.GoPackage) return false; - if (CcGenericServices != other.CcGenericServices) return false; - if (JavaGenericServices != other.JavaGenericServices) return false; - if (PyGenericServices != other.PyGenericServices) return false; - if (PhpGenericServices != other.PhpGenericServices) return false; - if (Deprecated != other.Deprecated) return false; - if (CcEnableArenas != other.CcEnableArenas) return false; - if (ObjcClassPrefix != other.ObjcClassPrefix) return false; - if (CsharpNamespace != other.CsharpNamespace) return false; - if (SwiftPrefix != other.SwiftPrefix) return false; - if (PhpClassPrefix != other.PhpClassPrefix) return false; - if (PhpNamespace != other.PhpNamespace) return false; - if (PhpMetadataNamespace != other.PhpMetadataNamespace) return false; - if (RubyPackage != other.RubyPackage) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasJavaPackage) hash ^= JavaPackage.GetHashCode(); - if (HasJavaOuterClassname) hash ^= JavaOuterClassname.GetHashCode(); - if (HasJavaMultipleFiles) hash ^= JavaMultipleFiles.GetHashCode(); - if (HasJavaGenerateEqualsAndHash) hash ^= JavaGenerateEqualsAndHash.GetHashCode(); - if (HasJavaStringCheckUtf8) hash ^= JavaStringCheckUtf8.GetHashCode(); - if (HasOptimizeFor) hash ^= OptimizeFor.GetHashCode(); - if (HasGoPackage) hash ^= GoPackage.GetHashCode(); - if (HasCcGenericServices) hash ^= CcGenericServices.GetHashCode(); - if (HasJavaGenericServices) hash ^= JavaGenericServices.GetHashCode(); - if (HasPyGenericServices) hash ^= PyGenericServices.GetHashCode(); - if (HasPhpGenericServices) hash ^= PhpGenericServices.GetHashCode(); - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - if (HasCcEnableArenas) hash ^= CcEnableArenas.GetHashCode(); - if (HasObjcClassPrefix) hash ^= ObjcClassPrefix.GetHashCode(); - if (HasCsharpNamespace) hash ^= CsharpNamespace.GetHashCode(); - if (HasSwiftPrefix) hash ^= SwiftPrefix.GetHashCode(); - if (HasPhpClassPrefix) hash ^= PhpClassPrefix.GetHashCode(); - if (HasPhpNamespace) hash ^= PhpNamespace.GetHashCode(); - if (HasPhpMetadataNamespace) hash ^= PhpMetadataNamespace.GetHashCode(); - if (HasRubyPackage) hash ^= RubyPackage.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasJavaPackage) { - output.WriteRawTag(10); - output.WriteString(JavaPackage); - } - if (HasJavaOuterClassname) { - output.WriteRawTag(66); - output.WriteString(JavaOuterClassname); - } - if (HasOptimizeFor) { - output.WriteRawTag(72); - output.WriteEnum((int) OptimizeFor); - } - if (HasJavaMultipleFiles) { - output.WriteRawTag(80); - output.WriteBool(JavaMultipleFiles); - } - if (HasGoPackage) { - output.WriteRawTag(90); - output.WriteString(GoPackage); - } - if (HasCcGenericServices) { - output.WriteRawTag(128, 1); - output.WriteBool(CcGenericServices); - } - if (HasJavaGenericServices) { - output.WriteRawTag(136, 1); - output.WriteBool(JavaGenericServices); - } - if (HasPyGenericServices) { - output.WriteRawTag(144, 1); - output.WriteBool(PyGenericServices); - } - if (HasJavaGenerateEqualsAndHash) { - output.WriteRawTag(160, 1); - output.WriteBool(JavaGenerateEqualsAndHash); - } - if (HasDeprecated) { - output.WriteRawTag(184, 1); - output.WriteBool(Deprecated); - } - if (HasJavaStringCheckUtf8) { - output.WriteRawTag(216, 1); - output.WriteBool(JavaStringCheckUtf8); - } - if (HasCcEnableArenas) { - output.WriteRawTag(248, 1); - output.WriteBool(CcEnableArenas); - } - if (HasObjcClassPrefix) { - output.WriteRawTag(162, 2); - output.WriteString(ObjcClassPrefix); - } - if (HasCsharpNamespace) { - output.WriteRawTag(170, 2); - output.WriteString(CsharpNamespace); - } - if (HasSwiftPrefix) { - output.WriteRawTag(186, 2); - output.WriteString(SwiftPrefix); - } - if (HasPhpClassPrefix) { - output.WriteRawTag(194, 2); - output.WriteString(PhpClassPrefix); - } - if (HasPhpNamespace) { - output.WriteRawTag(202, 2); - output.WriteString(PhpNamespace); - } - if (HasPhpGenericServices) { - output.WriteRawTag(208, 2); - output.WriteBool(PhpGenericServices); - } - if (HasPhpMetadataNamespace) { - output.WriteRawTag(226, 2); - output.WriteString(PhpMetadataNamespace); - } - if (HasRubyPackage) { - output.WriteRawTag(234, 2); - output.WriteString(RubyPackage); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasJavaPackage) { - output.WriteRawTag(10); - output.WriteString(JavaPackage); - } - if (HasJavaOuterClassname) { - output.WriteRawTag(66); - output.WriteString(JavaOuterClassname); - } - if (HasOptimizeFor) { - output.WriteRawTag(72); - output.WriteEnum((int) OptimizeFor); - } - if (HasJavaMultipleFiles) { - output.WriteRawTag(80); - output.WriteBool(JavaMultipleFiles); - } - if (HasGoPackage) { - output.WriteRawTag(90); - output.WriteString(GoPackage); - } - if (HasCcGenericServices) { - output.WriteRawTag(128, 1); - output.WriteBool(CcGenericServices); - } - if (HasJavaGenericServices) { - output.WriteRawTag(136, 1); - output.WriteBool(JavaGenericServices); - } - if (HasPyGenericServices) { - output.WriteRawTag(144, 1); - output.WriteBool(PyGenericServices); - } - if (HasJavaGenerateEqualsAndHash) { - output.WriteRawTag(160, 1); - output.WriteBool(JavaGenerateEqualsAndHash); - } - if (HasDeprecated) { - output.WriteRawTag(184, 1); - output.WriteBool(Deprecated); - } - if (HasJavaStringCheckUtf8) { - output.WriteRawTag(216, 1); - output.WriteBool(JavaStringCheckUtf8); - } - if (HasCcEnableArenas) { - output.WriteRawTag(248, 1); - output.WriteBool(CcEnableArenas); - } - if (HasObjcClassPrefix) { - output.WriteRawTag(162, 2); - output.WriteString(ObjcClassPrefix); - } - if (HasCsharpNamespace) { - output.WriteRawTag(170, 2); - output.WriteString(CsharpNamespace); - } - if (HasSwiftPrefix) { - output.WriteRawTag(186, 2); - output.WriteString(SwiftPrefix); - } - if (HasPhpClassPrefix) { - output.WriteRawTag(194, 2); - output.WriteString(PhpClassPrefix); - } - if (HasPhpNamespace) { - output.WriteRawTag(202, 2); - output.WriteString(PhpNamespace); - } - if (HasPhpGenericServices) { - output.WriteRawTag(208, 2); - output.WriteBool(PhpGenericServices); - } - if (HasPhpMetadataNamespace) { - output.WriteRawTag(226, 2); - output.WriteString(PhpMetadataNamespace); - } - if (HasRubyPackage) { - output.WriteRawTag(234, 2); - output.WriteString(RubyPackage); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasJavaPackage) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaPackage); - } - if (HasJavaOuterClassname) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JavaOuterClassname); - } - if (HasJavaMultipleFiles) { - size += 1 + 1; - } - if (HasJavaGenerateEqualsAndHash) { - size += 2 + 1; - } - if (HasJavaStringCheckUtf8) { - size += 2 + 1; - } - if (HasOptimizeFor) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) OptimizeFor); - } - if (HasGoPackage) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(GoPackage); - } - if (HasCcGenericServices) { - size += 2 + 1; - } - if (HasJavaGenericServices) { - size += 2 + 1; - } - if (HasPyGenericServices) { - size += 2 + 1; - } - if (HasPhpGenericServices) { - size += 2 + 1; - } - if (HasDeprecated) { - size += 2 + 1; - } - if (HasCcEnableArenas) { - size += 2 + 1; - } - if (HasObjcClassPrefix) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(ObjcClassPrefix); - } - if (HasCsharpNamespace) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(CsharpNamespace); - } - if (HasSwiftPrefix) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(SwiftPrefix); - } - if (HasPhpClassPrefix) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpClassPrefix); - } - if (HasPhpNamespace) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace); - } - if (HasPhpMetadataNamespace) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpMetadataNamespace); - } - if (HasRubyPackage) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(RubyPackage); - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FileOptions other) { - if (other == null) { - return; - } - if (other.HasJavaPackage) { - JavaPackage = other.JavaPackage; - } - if (other.HasJavaOuterClassname) { - JavaOuterClassname = other.JavaOuterClassname; - } - if (other.HasJavaMultipleFiles) { - JavaMultipleFiles = other.JavaMultipleFiles; - } - if (other.HasJavaGenerateEqualsAndHash) { - JavaGenerateEqualsAndHash = other.JavaGenerateEqualsAndHash; - } - if (other.HasJavaStringCheckUtf8) { - JavaStringCheckUtf8 = other.JavaStringCheckUtf8; - } - if (other.HasOptimizeFor) { - OptimizeFor = other.OptimizeFor; - } - if (other.HasGoPackage) { - GoPackage = other.GoPackage; - } - if (other.HasCcGenericServices) { - CcGenericServices = other.CcGenericServices; - } - if (other.HasJavaGenericServices) { - JavaGenericServices = other.JavaGenericServices; - } - if (other.HasPyGenericServices) { - PyGenericServices = other.PyGenericServices; - } - if (other.HasPhpGenericServices) { - PhpGenericServices = other.PhpGenericServices; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - if (other.HasCcEnableArenas) { - CcEnableArenas = other.CcEnableArenas; - } - if (other.HasObjcClassPrefix) { - ObjcClassPrefix = other.ObjcClassPrefix; - } - if (other.HasCsharpNamespace) { - CsharpNamespace = other.CsharpNamespace; - } - if (other.HasSwiftPrefix) { - SwiftPrefix = other.SwiftPrefix; - } - if (other.HasPhpClassPrefix) { - PhpClassPrefix = other.PhpClassPrefix; - } - if (other.HasPhpNamespace) { - PhpNamespace = other.PhpNamespace; - } - if (other.HasPhpMetadataNamespace) { - PhpMetadataNamespace = other.PhpMetadataNamespace; - } - if (other.HasRubyPackage) { - RubyPackage = other.RubyPackage; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 10: { - JavaPackage = input.ReadString(); - break; - } - case 66: { - JavaOuterClassname = input.ReadString(); - break; - } - case 72: { - OptimizeFor = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum(); - break; - } - case 80: { - JavaMultipleFiles = input.ReadBool(); - break; - } - case 90: { - GoPackage = input.ReadString(); - break; - } - case 128: { - CcGenericServices = input.ReadBool(); - break; - } - case 136: { - JavaGenericServices = input.ReadBool(); - break; - } - case 144: { - PyGenericServices = input.ReadBool(); - break; - } - case 160: { - JavaGenerateEqualsAndHash = input.ReadBool(); - break; - } - case 184: { - Deprecated = input.ReadBool(); - break; - } - case 216: { - JavaStringCheckUtf8 = input.ReadBool(); - break; - } - case 248: { - CcEnableArenas = input.ReadBool(); - break; - } - case 290: { - ObjcClassPrefix = input.ReadString(); - break; - } - case 298: { - CsharpNamespace = input.ReadString(); - break; - } - case 314: { - SwiftPrefix = input.ReadString(); - break; - } - case 322: { - PhpClassPrefix = input.ReadString(); - break; - } - case 330: { - PhpNamespace = input.ReadString(); - break; - } - case 336: { - PhpGenericServices = input.ReadBool(); - break; - } - case 354: { - PhpMetadataNamespace = input.ReadString(); - break; - } - case 362: { - RubyPackage = input.ReadString(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 10: { - JavaPackage = input.ReadString(); - break; - } - case 66: { - JavaOuterClassname = input.ReadString(); - break; - } - case 72: { - OptimizeFor = (global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) input.ReadEnum(); - break; - } - case 80: { - JavaMultipleFiles = input.ReadBool(); - break; - } - case 90: { - GoPackage = input.ReadString(); - break; - } - case 128: { - CcGenericServices = input.ReadBool(); - break; - } - case 136: { - JavaGenericServices = input.ReadBool(); - break; - } - case 144: { - PyGenericServices = input.ReadBool(); - break; - } - case 160: { - JavaGenerateEqualsAndHash = input.ReadBool(); - break; - } - case 184: { - Deprecated = input.ReadBool(); - break; - } - case 216: { - JavaStringCheckUtf8 = input.ReadBool(); - break; - } - case 248: { - CcEnableArenas = input.ReadBool(); - break; - } - case 290: { - ObjcClassPrefix = input.ReadString(); - break; - } - case 298: { - CsharpNamespace = input.ReadString(); - break; - } - case 314: { - SwiftPrefix = input.ReadString(); - break; - } - case 322: { - PhpClassPrefix = input.ReadString(); - break; - } - case 330: { - PhpNamespace = input.ReadString(); - break; - } - case 336: { - PhpGenericServices = input.ReadBool(); - break; - } - case 354: { - PhpMetadataNamespace = input.ReadString(); - break; - } - case 362: { - RubyPackage = input.ReadString(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - #region Nested types - /// Container for nested types declared in the FileOptions message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Generated classes can be optimized for speed or code size. - /// - public enum OptimizeMode { - /// - /// Generate complete code for parsing, serialization, - /// - [pbr::OriginalName("SPEED")] Speed = 1, - /// - /// etc. - /// - [pbr::OriginalName("CODE_SIZE")] CodeSize = 2, - /// - /// Generate code using MessageLite and the lite runtime. - /// - [pbr::OriginalName("LITE_RUNTIME")] LiteRuntime = 3, - } - - } - #endregion - - } - - public sealed partial class MessageOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageOptions(MessageOptions other) : this() { - _hasBits0 = other._hasBits0; - messageSetWireFormat_ = other.messageSetWireFormat_; - noStandardDescriptorAccessor_ = other.noStandardDescriptorAccessor_; - deprecated_ = other.deprecated_; - mapEntry_ = other.mapEntry_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MessageOptions Clone() { - return new MessageOptions(this); - } - - /// Field number for the "message_set_wire_format" field. - public const int MessageSetWireFormatFieldNumber = 1; - private readonly static bool MessageSetWireFormatDefaultValue = false; - - private bool messageSetWireFormat_; - /// - /// Set true to use the old proto1 MessageSet wire format for extensions. - /// This is provided for backwards-compatibility with the MessageSet wire - /// format. You should not use this for any other reason: It's less - /// efficient, has fewer features, and is more complicated. - /// - /// The message must be defined exactly as follows: - /// message Foo { - /// option message_set_wire_format = true; - /// extensions 4 to max; - /// } - /// Note that the message cannot have any defined fields; MessageSets only - /// have extensions. - /// - /// All extensions of your type must be singular messages; e.g. they cannot - /// be int32s, enums, or repeated messages. - /// - /// Because this is an option, the above two restrictions are not enforced by - /// the protocol compiler. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool MessageSetWireFormat { - get { if ((_hasBits0 & 1) != 0) { return messageSetWireFormat_; } else { return MessageSetWireFormatDefaultValue; } } - set { - _hasBits0 |= 1; - messageSetWireFormat_ = value; - } - } - /// Gets whether the "message_set_wire_format" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMessageSetWireFormat { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "message_set_wire_format" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMessageSetWireFormat() { - _hasBits0 &= ~1; - } - - /// Field number for the "no_standard_descriptor_accessor" field. - public const int NoStandardDescriptorAccessorFieldNumber = 2; - private readonly static bool NoStandardDescriptorAccessorDefaultValue = false; - - private bool noStandardDescriptorAccessor_; - /// - /// Disables the generation of the standard "descriptor()" accessor, which can - /// conflict with a field of the same name. This is meant to make migration - /// from proto1 easier; new code should avoid fields named "descriptor". - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool NoStandardDescriptorAccessor { - get { if ((_hasBits0 & 2) != 0) { return noStandardDescriptorAccessor_; } else { return NoStandardDescriptorAccessorDefaultValue; } } - set { - _hasBits0 |= 2; - noStandardDescriptorAccessor_ = value; - } - } - /// Gets whether the "no_standard_descriptor_accessor" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNoStandardDescriptorAccessor { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "no_standard_descriptor_accessor" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNoStandardDescriptorAccessor() { - _hasBits0 &= ~2; - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 3; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this message deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the message, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating messages. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 4) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 4; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~4; - } - - /// Field number for the "map_entry" field. - public const int MapEntryFieldNumber = 7; - private readonly static bool MapEntryDefaultValue = false; - - private bool mapEntry_; - /// - /// Whether the message is an automatically generated map entry type for the - /// maps field. - /// - /// For maps fields: - /// map<KeyType, ValueType> map_field = 1; - /// The parsed descriptor looks like: - /// message MapFieldEntry { - /// option map_entry = true; - /// optional KeyType key = 1; - /// optional ValueType value = 2; - /// } - /// repeated MapFieldEntry map_field = 1; - /// - /// Implementations may choose not to generate the map_entry=true message, but - /// use a native map in the target language to hold the keys and values. - /// The reflection APIs in such implementations still need to work as - /// if the field is a repeated message field. - /// - /// NOTE: Do not set the option in .proto files. Always use the maps syntax - /// instead. The option should only be implicitly set by the proto compiler - /// parser. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool MapEntry { - get { if ((_hasBits0 & 8) != 0) { return mapEntry_; } else { return MapEntryDefaultValue; } } - set { - _hasBits0 |= 8; - mapEntry_ = value; - } - } - /// Gets whether the "map_entry" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasMapEntry { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "map_entry" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearMapEntry() { - _hasBits0 &= ~8; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MessageOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MessageOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MessageSetWireFormat != other.MessageSetWireFormat) return false; - if (NoStandardDescriptorAccessor != other.NoStandardDescriptorAccessor) return false; - if (Deprecated != other.Deprecated) return false; - if (MapEntry != other.MapEntry) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasMessageSetWireFormat) hash ^= MessageSetWireFormat.GetHashCode(); - if (HasNoStandardDescriptorAccessor) hash ^= NoStandardDescriptorAccessor.GetHashCode(); - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - if (HasMapEntry) hash ^= MapEntry.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasMessageSetWireFormat) { - output.WriteRawTag(8); - output.WriteBool(MessageSetWireFormat); - } - if (HasNoStandardDescriptorAccessor) { - output.WriteRawTag(16); - output.WriteBool(NoStandardDescriptorAccessor); - } - if (HasDeprecated) { - output.WriteRawTag(24); - output.WriteBool(Deprecated); - } - if (HasMapEntry) { - output.WriteRawTag(56); - output.WriteBool(MapEntry); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasMessageSetWireFormat) { - output.WriteRawTag(8); - output.WriteBool(MessageSetWireFormat); - } - if (HasNoStandardDescriptorAccessor) { - output.WriteRawTag(16); - output.WriteBool(NoStandardDescriptorAccessor); - } - if (HasDeprecated) { - output.WriteRawTag(24); - output.WriteBool(Deprecated); - } - if (HasMapEntry) { - output.WriteRawTag(56); - output.WriteBool(MapEntry); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasMessageSetWireFormat) { - size += 1 + 1; - } - if (HasNoStandardDescriptorAccessor) { - size += 1 + 1; - } - if (HasDeprecated) { - size += 1 + 1; - } - if (HasMapEntry) { - size += 1 + 1; - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MessageOptions other) { - if (other == null) { - return; - } - if (other.HasMessageSetWireFormat) { - MessageSetWireFormat = other.MessageSetWireFormat; - } - if (other.HasNoStandardDescriptorAccessor) { - NoStandardDescriptorAccessor = other.NoStandardDescriptorAccessor; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - if (other.HasMapEntry) { - MapEntry = other.MapEntry; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 8: { - MessageSetWireFormat = input.ReadBool(); - break; - } - case 16: { - NoStandardDescriptorAccessor = input.ReadBool(); - break; - } - case 24: { - Deprecated = input.ReadBool(); - break; - } - case 56: { - MapEntry = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 8: { - MessageSetWireFormat = input.ReadBool(); - break; - } - case 16: { - NoStandardDescriptorAccessor = input.ReadBool(); - break; - } - case 24: { - Deprecated = input.ReadBool(); - break; - } - case 56: { - MapEntry = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - } - - public sealed partial class FieldOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldOptions(FieldOptions other) : this() { - _hasBits0 = other._hasBits0; - ctype_ = other.ctype_; - packed_ = other.packed_; - jstype_ = other.jstype_; - lazy_ = other.lazy_; - deprecated_ = other.deprecated_; - weak_ = other.weak_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldOptions Clone() { - return new FieldOptions(this); - } - - /// Field number for the "ctype" field. - public const int CtypeFieldNumber = 1; - private readonly static global::Google.Protobuf.Reflection.FieldOptions.Types.CType CtypeDefaultValue = global::Google.Protobuf.Reflection.FieldOptions.Types.CType.String; - - private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_; - /// - /// The ctype option instructs the C++ code generator to use a different - /// representation of the field than it normally would. See the specific - /// options below. This option is not yet implemented in the open source - /// release -- sorry, we'll try to include it in a future version! - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype { - get { if ((_hasBits0 & 1) != 0) { return ctype_; } else { return CtypeDefaultValue; } } - set { - _hasBits0 |= 1; - ctype_ = value; - } - } - /// Gets whether the "ctype" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasCtype { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "ctype" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearCtype() { - _hasBits0 &= ~1; - } - - /// Field number for the "packed" field. - public const int PackedFieldNumber = 2; - private readonly static bool PackedDefaultValue = false; - - private bool packed_; - /// - /// The packed option can be enabled for repeated primitive fields to enable - /// a more efficient representation on the wire. Rather than repeatedly - /// writing the tag and type for each element, the entire array is encoded as - /// a single length-delimited blob. In proto3, only explicit setting it to - /// false will avoid using packed encoding. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Packed { - get { if ((_hasBits0 & 2) != 0) { return packed_; } else { return PackedDefaultValue; } } - set { - _hasBits0 |= 2; - packed_ = value; - } - } - /// Gets whether the "packed" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPacked { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "packed" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPacked() { - _hasBits0 &= ~2; - } - - /// Field number for the "jstype" field. - public const int JstypeFieldNumber = 6; - private readonly static global::Google.Protobuf.Reflection.FieldOptions.Types.JSType JstypeDefaultValue = global::Google.Protobuf.Reflection.FieldOptions.Types.JSType.JsNormal; - - private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_; - /// - /// The jstype option determines the JavaScript type used for values of the - /// field. The option is permitted only for 64 bit integral and fixed types - /// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - /// is represented as JavaScript string, which avoids loss of precision that - /// can happen when a large value is converted to a floating point JavaScript. - /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - /// use the JavaScript "number" type. The behavior of the default option - /// JS_NORMAL is implementation dependent. - /// - /// This option is an enum to permit additional types to be added, e.g. - /// goog.math.Integer. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype { - get { if ((_hasBits0 & 16) != 0) { return jstype_; } else { return JstypeDefaultValue; } } - set { - _hasBits0 |= 16; - jstype_ = value; - } - } - /// Gets whether the "jstype" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasJstype { - get { return (_hasBits0 & 16) != 0; } - } - /// Clears the value of the "jstype" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearJstype() { - _hasBits0 &= ~16; - } - - /// Field number for the "lazy" field. - public const int LazyFieldNumber = 5; - private readonly static bool LazyDefaultValue = false; - - private bool lazy_; - /// - /// Should this field be parsed lazily? Lazy applies only to message-type - /// fields. It means that when the outer message is initially parsed, the - /// inner message's contents will not be parsed but instead stored in encoded - /// form. The inner message will actually be parsed when it is first accessed. - /// - /// This is only a hint. Implementations are free to choose whether to use - /// eager or lazy parsing regardless of the value of this option. However, - /// setting this option true suggests that the protocol author believes that - /// using lazy parsing on this field is worth the additional bookkeeping - /// overhead typically needed to implement it. - /// - /// This option does not affect the public interface of any generated code; - /// all method signatures remain the same. Furthermore, thread-safety of the - /// interface is not affected by this option; const methods remain safe to - /// call from multiple threads concurrently, while non-const methods continue - /// to require exclusive access. - /// - /// Note that implementations may choose not to check required fields within - /// a lazy sub-message. That is, calling IsInitialized() on the outer message - /// may return true even if the inner message has missing required fields. - /// This is necessary because otherwise the inner message would have to be - /// parsed in order to perform the check, defeating the purpose of lazy - /// parsing. An implementation which chooses not to check required fields - /// must be consistent about it. That is, for any particular sub-message, the - /// implementation must either *always* check its required fields, or *never* - /// check its required fields, regardless of whether or not the message has - /// been parsed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Lazy { - get { if ((_hasBits0 & 8) != 0) { return lazy_; } else { return LazyDefaultValue; } } - set { - _hasBits0 |= 8; - lazy_ = value; - } - } - /// Gets whether the "lazy" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLazy { - get { return (_hasBits0 & 8) != 0; } - } - /// Clears the value of the "lazy" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLazy() { - _hasBits0 &= ~8; - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 3; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this field deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for accessors, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating fields. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 4) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 4; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~4; - } - - /// Field number for the "weak" field. - public const int WeakFieldNumber = 10; - private readonly static bool WeakDefaultValue = false; - - private bool weak_; - /// - /// For Google-internal migration only. Do not use. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Weak { - get { if ((_hasBits0 & 32) != 0) { return weak_; } else { return WeakDefaultValue; } } - set { - _hasBits0 |= 32; - weak_ = value; - } - } - /// Gets whether the "weak" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasWeak { - get { return (_hasBits0 & 32) != 0; } - } - /// Clears the value of the "weak" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearWeak() { - _hasBits0 &= ~32; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FieldOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FieldOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Ctype != other.Ctype) return false; - if (Packed != other.Packed) return false; - if (Jstype != other.Jstype) return false; - if (Lazy != other.Lazy) return false; - if (Deprecated != other.Deprecated) return false; - if (Weak != other.Weak) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasCtype) hash ^= Ctype.GetHashCode(); - if (HasPacked) hash ^= Packed.GetHashCode(); - if (HasJstype) hash ^= Jstype.GetHashCode(); - if (HasLazy) hash ^= Lazy.GetHashCode(); - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - if (HasWeak) hash ^= Weak.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasCtype) { - output.WriteRawTag(8); - output.WriteEnum((int) Ctype); - } - if (HasPacked) { - output.WriteRawTag(16); - output.WriteBool(Packed); - } - if (HasDeprecated) { - output.WriteRawTag(24); - output.WriteBool(Deprecated); - } - if (HasLazy) { - output.WriteRawTag(40); - output.WriteBool(Lazy); - } - if (HasJstype) { - output.WriteRawTag(48); - output.WriteEnum((int) Jstype); - } - if (HasWeak) { - output.WriteRawTag(80); - output.WriteBool(Weak); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasCtype) { - output.WriteRawTag(8); - output.WriteEnum((int) Ctype); - } - if (HasPacked) { - output.WriteRawTag(16); - output.WriteBool(Packed); - } - if (HasDeprecated) { - output.WriteRawTag(24); - output.WriteBool(Deprecated); - } - if (HasLazy) { - output.WriteRawTag(40); - output.WriteBool(Lazy); - } - if (HasJstype) { - output.WriteRawTag(48); - output.WriteEnum((int) Jstype); - } - if (HasWeak) { - output.WriteRawTag(80); - output.WriteBool(Weak); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasCtype) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Ctype); - } - if (HasPacked) { - size += 1 + 1; - } - if (HasJstype) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Jstype); - } - if (HasLazy) { - size += 1 + 1; - } - if (HasDeprecated) { - size += 1 + 1; - } - if (HasWeak) { - size += 1 + 1; - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FieldOptions other) { - if (other == null) { - return; - } - if (other.HasCtype) { - Ctype = other.Ctype; - } - if (other.HasPacked) { - Packed = other.Packed; - } - if (other.HasJstype) { - Jstype = other.Jstype; - } - if (other.HasLazy) { - Lazy = other.Lazy; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - if (other.HasWeak) { - Weak = other.Weak; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 8: { - Ctype = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); - break; - } - case 16: { - Packed = input.ReadBool(); - break; - } - case 24: { - Deprecated = input.ReadBool(); - break; - } - case 40: { - Lazy = input.ReadBool(); - break; - } - case 48: { - Jstype = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum(); - break; - } - case 80: { - Weak = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 8: { - Ctype = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); - break; - } - case 16: { - Packed = input.ReadBool(); - break; - } - case 24: { - Deprecated = input.ReadBool(); - break; - } - case 40: { - Lazy = input.ReadBool(); - break; - } - case 48: { - Jstype = (global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) input.ReadEnum(); - break; - } - case 80: { - Weak = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - #region Nested types - /// Container for nested types declared in the FieldOptions message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public enum CType { - /// - /// Default mode. - /// - [pbr::OriginalName("STRING")] String = 0, - [pbr::OriginalName("CORD")] Cord = 1, - [pbr::OriginalName("STRING_PIECE")] StringPiece = 2, - } - - public enum JSType { - /// - /// Use the default type. - /// - [pbr::OriginalName("JS_NORMAL")] JsNormal = 0, - /// - /// Use JavaScript strings. - /// - [pbr::OriginalName("JS_STRING")] JsString = 1, - /// - /// Use JavaScript numbers. - /// - [pbr::OriginalName("JS_NUMBER")] JsNumber = 2, - } - - } - #endregion - - } - - public sealed partial class OneofOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OneofOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OneofOptions(OneofOptions other) : this() { - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OneofOptions Clone() { - return new OneofOptions(this); - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OneofOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OneofOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OneofOptions other) { - if (other == null) { - return; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - } - - public sealed partial class EnumOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumOptions(EnumOptions other) : this() { - _hasBits0 = other._hasBits0; - allowAlias_ = other.allowAlias_; - deprecated_ = other.deprecated_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumOptions Clone() { - return new EnumOptions(this); - } - - /// Field number for the "allow_alias" field. - public const int AllowAliasFieldNumber = 2; - private readonly static bool AllowAliasDefaultValue = false; - - private bool allowAlias_; - /// - /// Set this option to true to allow mapping different tag names to the same - /// value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool AllowAlias { - get { if ((_hasBits0 & 1) != 0) { return allowAlias_; } else { return AllowAliasDefaultValue; } } - set { - _hasBits0 |= 1; - allowAlias_ = value; - } - } - /// Gets whether the "allow_alias" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasAllowAlias { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "allow_alias" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearAllowAlias() { - _hasBits0 &= ~1; - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 3; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this enum deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating enums. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 2) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 2; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~2; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (AllowAlias != other.AllowAlias) return false; - if (Deprecated != other.Deprecated) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasAllowAlias) hash ^= AllowAlias.GetHashCode(); - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasAllowAlias) { - output.WriteRawTag(16); - output.WriteBool(AllowAlias); - } - if (HasDeprecated) { - output.WriteRawTag(24); - output.WriteBool(Deprecated); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasAllowAlias) { - output.WriteRawTag(16); - output.WriteBool(AllowAlias); - } - if (HasDeprecated) { - output.WriteRawTag(24); - output.WriteBool(Deprecated); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasAllowAlias) { - size += 1 + 1; - } - if (HasDeprecated) { - size += 1 + 1; - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumOptions other) { - if (other == null) { - return; - } - if (other.HasAllowAlias) { - AllowAlias = other.AllowAlias; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 16: { - AllowAlias = input.ReadBool(); - break; - } - case 24: { - Deprecated = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 16: { - AllowAlias = input.ReadBool(); - break; - } - case 24: { - Deprecated = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - } - - public sealed partial class EnumValueOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValueOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValueOptions(EnumValueOptions other) : this() { - _hasBits0 = other._hasBits0; - deprecated_ = other.deprecated_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValueOptions Clone() { - return new EnumValueOptions(this); - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 1; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this enum value deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum value, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating enum values. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 1) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 1; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~1; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumValueOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumValueOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Deprecated != other.Deprecated) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasDeprecated) { - output.WriteRawTag(8); - output.WriteBool(Deprecated); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasDeprecated) { - output.WriteRawTag(8); - output.WriteBool(Deprecated); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasDeprecated) { - size += 1 + 1; - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumValueOptions other) { - if (other == null) { - return; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 8: { - Deprecated = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 8: { - Deprecated = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - } - - public sealed partial class ServiceOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServiceOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServiceOptions(ServiceOptions other) : this() { - _hasBits0 = other._hasBits0; - deprecated_ = other.deprecated_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ServiceOptions Clone() { - return new ServiceOptions(this); - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 33; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this service deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the service, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating services. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 1) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 1; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~1; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ServiceOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ServiceOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Deprecated != other.Deprecated) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasDeprecated) { - output.WriteRawTag(136, 2); - output.WriteBool(Deprecated); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasDeprecated) { - output.WriteRawTag(136, 2); - output.WriteBool(Deprecated); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasDeprecated) { - size += 2 + 1; - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ServiceOptions other) { - if (other == null) { - return; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 264: { - Deprecated = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 264: { - Deprecated = input.ReadBool(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - } - - public sealed partial class MethodOptions : pb::IExtendableMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodOptions()); - private pb::UnknownFieldSet _unknownFields; - internal pb::ExtensionSet _extensions; - private pb::ExtensionSet _Extensions { get { return _extensions; } } - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodOptions() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodOptions(MethodOptions other) : this() { - _hasBits0 = other._hasBits0; - deprecated_ = other.deprecated_; - idempotencyLevel_ = other.idempotencyLevel_; - uninterpretedOption_ = other.uninterpretedOption_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - _extensions = pb::ExtensionSet.Clone(other._extensions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodOptions Clone() { - return new MethodOptions(this); - } - - /// Field number for the "deprecated" field. - public const int DeprecatedFieldNumber = 33; - private readonly static bool DeprecatedDefaultValue = false; - - private bool deprecated_; - /// - /// Is this method deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the method, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating methods. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Deprecated { - get { if ((_hasBits0 & 1) != 0) { return deprecated_; } else { return DeprecatedDefaultValue; } } - set { - _hasBits0 |= 1; - deprecated_ = value; - } - } - /// Gets whether the "deprecated" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDeprecated { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "deprecated" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDeprecated() { - _hasBits0 &= ~1; - } - - /// Field number for the "idempotency_level" field. - public const int IdempotencyLevelFieldNumber = 34; - private readonly static global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel IdempotencyLevelDefaultValue = global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel.IdempotencyUnknown; - - private global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel idempotencyLevel_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel IdempotencyLevel { - get { if ((_hasBits0 & 2) != 0) { return idempotencyLevel_; } else { return IdempotencyLevelDefaultValue; } } - set { - _hasBits0 |= 2; - idempotencyLevel_ = value; - } - } - /// Gets whether the "idempotency_level" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIdempotencyLevel { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "idempotency_level" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIdempotencyLevel() { - _hasBits0 &= ~2; - } - - /// Field number for the "uninterpreted_option" field. - public const int UninterpretedOptionFieldNumber = 999; - private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec - = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); - private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); - /// - /// The parser stores options it doesn't recognize here. See above. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UninterpretedOption { - get { return uninterpretedOption_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MethodOptions); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MethodOptions other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Deprecated != other.Deprecated) return false; - if (IdempotencyLevel != other.IdempotencyLevel) return false; - if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; - if (!Equals(_extensions, other._extensions)) { - return false; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasDeprecated) hash ^= Deprecated.GetHashCode(); - if (HasIdempotencyLevel) hash ^= IdempotencyLevel.GetHashCode(); - hash ^= uninterpretedOption_.GetHashCode(); - if (_extensions != null) { - hash ^= _extensions.GetHashCode(); - } - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasDeprecated) { - output.WriteRawTag(136, 2); - output.WriteBool(Deprecated); - } - if (HasIdempotencyLevel) { - output.WriteRawTag(144, 2); - output.WriteEnum((int) IdempotencyLevel); - } - uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasDeprecated) { - output.WriteRawTag(136, 2); - output.WriteBool(Deprecated); - } - if (HasIdempotencyLevel) { - output.WriteRawTag(144, 2); - output.WriteEnum((int) IdempotencyLevel); - } - uninterpretedOption_.WriteTo(ref output, _repeated_uninterpretedOption_codec); - if (_extensions != null) { - _extensions.WriteTo(ref output); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasDeprecated) { - size += 2 + 1; - } - if (HasIdempotencyLevel) { - size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) IdempotencyLevel); - } - size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); - if (_extensions != null) { - size += _extensions.CalculateSize(); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MethodOptions other) { - if (other == null) { - return; - } - if (other.HasDeprecated) { - Deprecated = other.Deprecated; - } - if (other.HasIdempotencyLevel) { - IdempotencyLevel = other.IdempotencyLevel; - } - uninterpretedOption_.Add(other.uninterpretedOption_); - pb::ExtensionSet.MergeFrom(ref _extensions, other._extensions); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - } - break; - case 264: { - Deprecated = input.ReadBool(); - break; - } - case 272: { - IdempotencyLevel = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - if (!pb::ExtensionSet.TryMergeFieldFrom(ref _extensions, ref input)) { - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - } - break; - case 264: { - Deprecated = input.ReadBool(); - break; - } - case 272: { - IdempotencyLevel = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum(); - break; - } - case 7994: { - uninterpretedOption_.AddEntriesFrom(ref input, _repeated_uninterpretedOption_codec); - break; - } - } - } - } - #endif - - public TValue GetExtension(pb::Extension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.Get(ref _extensions, extension); - } - public pbc::RepeatedField GetOrInitializeExtension(pb::RepeatedExtension extension) { - return pb::ExtensionSet.GetOrInitialize(ref _extensions, extension); - } - public void SetExtension(pb::Extension extension, TValue value) { - pb::ExtensionSet.Set(ref _extensions, extension, value); - } - public bool HasExtension(pb::Extension extension) { - return pb::ExtensionSet.Has(ref _extensions, extension); - } - public void ClearExtension(pb::Extension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - public void ClearExtension(pb::RepeatedExtension extension) { - pb::ExtensionSet.Clear(ref _extensions, extension); - } - - #region Nested types - /// Container for nested types declared in the MethodOptions message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - /// or neither? HTTP based RPC implementation may choose GET verb for safe - /// methods, and PUT verb for idempotent methods instead of the default POST. - /// - public enum IdempotencyLevel { - [pbr::OriginalName("IDEMPOTENCY_UNKNOWN")] IdempotencyUnknown = 0, - /// - /// implies idempotent - /// - [pbr::OriginalName("NO_SIDE_EFFECTS")] NoSideEffects = 1, - /// - /// idempotent, but may have side effects - /// - [pbr::OriginalName("IDEMPOTENT")] Idempotent = 2, - } - - } - #endregion - - } - - /// - /// A message representing a option the parser does not recognize. This only - /// appears in options protos created by the compiler::Parser class. - /// DescriptorPool resolves these when building Descriptor objects. Therefore, - /// options protos in descriptor objects (e.g. returned by Descriptor::options(), - /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions - /// in them. - /// - public sealed partial class UninterpretedOption : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UninterpretedOption()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UninterpretedOption() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UninterpretedOption(UninterpretedOption other) : this() { - _hasBits0 = other._hasBits0; - name_ = other.name_.Clone(); - identifierValue_ = other.identifierValue_; - positiveIntValue_ = other.positiveIntValue_; - negativeIntValue_ = other.negativeIntValue_; - doubleValue_ = other.doubleValue_; - stringValue_ = other.stringValue_; - aggregateValue_ = other.aggregateValue_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UninterpretedOption Clone() { - return new UninterpretedOption(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_name_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser); - private readonly pbc::RepeatedField name_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Name { - get { return name_; } - } - - /// Field number for the "identifier_value" field. - public const int IdentifierValueFieldNumber = 3; - private readonly static string IdentifierValueDefaultValue = ""; - - private string identifierValue_; - /// - /// The value of the uninterpreted option, in whatever type the tokenizer - /// identified it as during parsing. Exactly one of these should be set. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string IdentifierValue { - get { return identifierValue_ ?? IdentifierValueDefaultValue; } - set { - identifierValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "identifier_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIdentifierValue { - get { return identifierValue_ != null; } - } - /// Clears the value of the "identifier_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIdentifierValue() { - identifierValue_ = null; - } - - /// Field number for the "positive_int_value" field. - public const int PositiveIntValueFieldNumber = 4; - private readonly static ulong PositiveIntValueDefaultValue = 0UL; - - private ulong positiveIntValue_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ulong PositiveIntValue { - get { if ((_hasBits0 & 1) != 0) { return positiveIntValue_; } else { return PositiveIntValueDefaultValue; } } - set { - _hasBits0 |= 1; - positiveIntValue_ = value; - } - } - /// Gets whether the "positive_int_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasPositiveIntValue { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "positive_int_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearPositiveIntValue() { - _hasBits0 &= ~1; - } - - /// Field number for the "negative_int_value" field. - public const int NegativeIntValueFieldNumber = 5; - private readonly static long NegativeIntValueDefaultValue = 0L; - - private long negativeIntValue_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long NegativeIntValue { - get { if ((_hasBits0 & 2) != 0) { return negativeIntValue_; } else { return NegativeIntValueDefaultValue; } } - set { - _hasBits0 |= 2; - negativeIntValue_ = value; - } - } - /// Gets whether the "negative_int_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNegativeIntValue { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "negative_int_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNegativeIntValue() { - _hasBits0 &= ~2; - } - - /// Field number for the "double_value" field. - public const int DoubleValueFieldNumber = 6; - private readonly static double DoubleValueDefaultValue = 0D; - - private double doubleValue_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double DoubleValue { - get { if ((_hasBits0 & 4) != 0) { return doubleValue_; } else { return DoubleValueDefaultValue; } } - set { - _hasBits0 |= 4; - doubleValue_ = value; - } - } - /// Gets whether the "double_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasDoubleValue { - get { return (_hasBits0 & 4) != 0; } - } - /// Clears the value of the "double_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearDoubleValue() { - _hasBits0 &= ~4; - } - - /// Field number for the "string_value" field. - public const int StringValueFieldNumber = 7; - private readonly static pb::ByteString StringValueDefaultValue = pb::ByteString.Empty; - - private pb::ByteString stringValue_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString StringValue { - get { return stringValue_ ?? StringValueDefaultValue; } - set { - stringValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "string_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasStringValue { - get { return stringValue_ != null; } - } - /// Clears the value of the "string_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearStringValue() { - stringValue_ = null; - } - - /// Field number for the "aggregate_value" field. - public const int AggregateValueFieldNumber = 8; - private readonly static string AggregateValueDefaultValue = ""; - - private string aggregateValue_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string AggregateValue { - get { return aggregateValue_ ?? AggregateValueDefaultValue; } - set { - aggregateValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "aggregate_value" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasAggregateValue { - get { return aggregateValue_ != null; } - } - /// Clears the value of the "aggregate_value" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearAggregateValue() { - aggregateValue_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UninterpretedOption); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UninterpretedOption other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!name_.Equals(other.name_)) return false; - if (IdentifierValue != other.IdentifierValue) return false; - if (PositiveIntValue != other.PositiveIntValue) return false; - if (NegativeIntValue != other.NegativeIntValue) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DoubleValue, other.DoubleValue)) return false; - if (StringValue != other.StringValue) return false; - if (AggregateValue != other.AggregateValue) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= name_.GetHashCode(); - if (HasIdentifierValue) hash ^= IdentifierValue.GetHashCode(); - if (HasPositiveIntValue) hash ^= PositiveIntValue.GetHashCode(); - if (HasNegativeIntValue) hash ^= NegativeIntValue.GetHashCode(); - if (HasDoubleValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DoubleValue); - if (HasStringValue) hash ^= StringValue.GetHashCode(); - if (HasAggregateValue) hash ^= AggregateValue.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - name_.WriteTo(output, _repeated_name_codec); - if (HasIdentifierValue) { - output.WriteRawTag(26); - output.WriteString(IdentifierValue); - } - if (HasPositiveIntValue) { - output.WriteRawTag(32); - output.WriteUInt64(PositiveIntValue); - } - if (HasNegativeIntValue) { - output.WriteRawTag(40); - output.WriteInt64(NegativeIntValue); - } - if (HasDoubleValue) { - output.WriteRawTag(49); - output.WriteDouble(DoubleValue); - } - if (HasStringValue) { - output.WriteRawTag(58); - output.WriteBytes(StringValue); - } - if (HasAggregateValue) { - output.WriteRawTag(66); - output.WriteString(AggregateValue); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - name_.WriteTo(ref output, _repeated_name_codec); - if (HasIdentifierValue) { - output.WriteRawTag(26); - output.WriteString(IdentifierValue); - } - if (HasPositiveIntValue) { - output.WriteRawTag(32); - output.WriteUInt64(PositiveIntValue); - } - if (HasNegativeIntValue) { - output.WriteRawTag(40); - output.WriteInt64(NegativeIntValue); - } - if (HasDoubleValue) { - output.WriteRawTag(49); - output.WriteDouble(DoubleValue); - } - if (HasStringValue) { - output.WriteRawTag(58); - output.WriteBytes(StringValue); - } - if (HasAggregateValue) { - output.WriteRawTag(66); - output.WriteString(AggregateValue); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += name_.CalculateSize(_repeated_name_codec); - if (HasIdentifierValue) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(IdentifierValue); - } - if (HasPositiveIntValue) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(PositiveIntValue); - } - if (HasNegativeIntValue) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(NegativeIntValue); - } - if (HasDoubleValue) { - size += 1 + 8; - } - if (HasStringValue) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(StringValue); - } - if (HasAggregateValue) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregateValue); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UninterpretedOption other) { - if (other == null) { - return; - } - name_.Add(other.name_); - if (other.HasIdentifierValue) { - IdentifierValue = other.IdentifierValue; - } - if (other.HasPositiveIntValue) { - PositiveIntValue = other.PositiveIntValue; - } - if (other.HasNegativeIntValue) { - NegativeIntValue = other.NegativeIntValue; - } - if (other.HasDoubleValue) { - DoubleValue = other.DoubleValue; - } - if (other.HasStringValue) { - StringValue = other.StringValue; - } - if (other.HasAggregateValue) { - AggregateValue = other.AggregateValue; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 18: { - name_.AddEntriesFrom(input, _repeated_name_codec); - break; - } - case 26: { - IdentifierValue = input.ReadString(); - break; - } - case 32: { - PositiveIntValue = input.ReadUInt64(); - break; - } - case 40: { - NegativeIntValue = input.ReadInt64(); - break; - } - case 49: { - DoubleValue = input.ReadDouble(); - break; - } - case 58: { - StringValue = input.ReadBytes(); - break; - } - case 66: { - AggregateValue = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 18: { - name_.AddEntriesFrom(ref input, _repeated_name_codec); - break; - } - case 26: { - IdentifierValue = input.ReadString(); - break; - } - case 32: { - PositiveIntValue = input.ReadUInt64(); - break; - } - case 40: { - NegativeIntValue = input.ReadInt64(); - break; - } - case 49: { - DoubleValue = input.ReadDouble(); - break; - } - case 58: { - StringValue = input.ReadBytes(); - break; - } - case 66: { - AggregateValue = input.ReadString(); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the UninterpretedOption message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// The name of the uninterpreted option. Each string represents a segment in - /// a dot-separated name. is_extension is true iff a segment represents an - /// extension (denoted with parentheses in options specs in .proto files). - /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - /// "foo.(bar.baz).qux". - /// - public sealed partial class NamePart : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamePart()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.UninterpretedOption.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NamePart() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NamePart(NamePart other) : this() { - _hasBits0 = other._hasBits0; - namePart_ = other.namePart_; - isExtension_ = other.isExtension_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NamePart Clone() { - return new NamePart(this); - } - - /// Field number for the "name_part" field. - public const int NamePart_FieldNumber = 1; - private readonly static string NamePart_DefaultValue = ""; - - private string namePart_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string NamePart_ { - get { return namePart_ ?? NamePart_DefaultValue; } - set { - namePart_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "name_part" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasNamePart_ { - get { return namePart_ != null; } - } - /// Clears the value of the "name_part" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearNamePart_() { - namePart_ = null; - } - - /// Field number for the "is_extension" field. - public const int IsExtensionFieldNumber = 2; - private readonly static bool IsExtensionDefaultValue = false; - - private bool isExtension_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsExtension { - get { if ((_hasBits0 & 1) != 0) { return isExtension_; } else { return IsExtensionDefaultValue; } } - set { - _hasBits0 |= 1; - isExtension_ = value; - } - } - /// Gets whether the "is_extension" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasIsExtension { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "is_extension" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearIsExtension() { - _hasBits0 &= ~1; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NamePart); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NamePart other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (NamePart_ != other.NamePart_) return false; - if (IsExtension != other.IsExtension) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (HasNamePart_) hash ^= NamePart_.GetHashCode(); - if (HasIsExtension) hash ^= IsExtension.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (HasNamePart_) { - output.WriteRawTag(10); - output.WriteString(NamePart_); - } - if (HasIsExtension) { - output.WriteRawTag(16); - output.WriteBool(IsExtension); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (HasNamePart_) { - output.WriteRawTag(10); - output.WriteString(NamePart_); - } - if (HasIsExtension) { - output.WriteRawTag(16); - output.WriteBool(IsExtension); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (HasNamePart_) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(NamePart_); - } - if (HasIsExtension) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NamePart other) { - if (other == null) { - return; - } - if (other.HasNamePart_) { - NamePart_ = other.NamePart_; - } - if (other.HasIsExtension) { - IsExtension = other.IsExtension; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - NamePart_ = input.ReadString(); - break; - } - case 16: { - IsExtension = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - NamePart_ = input.ReadString(); - break; - } - case 16: { - IsExtension = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Encapsulates information about the original source file from which a - /// FileDescriptorProto was generated. - /// - public sealed partial class SourceCodeInfo : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceCodeInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceCodeInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceCodeInfo(SourceCodeInfo other) : this() { - location_ = other.location_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceCodeInfo Clone() { - return new SourceCodeInfo(this); - } - - /// Field number for the "location" field. - public const int LocationFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_location_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser); - private readonly pbc::RepeatedField location_ = new pbc::RepeatedField(); - /// - /// A Location identifies a piece of source code in a .proto file which - /// corresponds to a particular definition. This information is intended - /// to be useful to IDEs, code indexers, documentation generators, and similar - /// tools. - /// - /// For example, say we have a file like: - /// message Foo { - /// optional string foo = 1; - /// } - /// Let's look at just the field definition: - /// optional string foo = 1; - /// ^ ^^ ^^ ^ ^^^ - /// a bc de f ghi - /// We have the following locations: - /// span path represents - /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. - /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - /// - /// Notes: - /// - A location may refer to a repeated field itself (i.e. not to any - /// particular index within it). This is used whenever a set of elements are - /// logically enclosed in a single code segment. For example, an entire - /// extend block (possibly containing multiple extension definitions) will - /// have an outer location whose path refers to the "extensions" repeated - /// field without an index. - /// - Multiple locations may have the same path. This happens when a single - /// logical declaration is spread out across multiple places. The most - /// obvious example is the "extend" block again -- there may be multiple - /// extend blocks in the same scope, each of which will have the same path. - /// - A location's span is not always a subset of its parent's span. For - /// example, the "extendee" of an extension declaration appears at the - /// beginning of the "extend" block and is shared by all extensions within - /// the block. - /// - Just because a location's span is a subset of some other location's span - /// does not mean that it is a descendant. For example, a "group" defines - /// both a type and a field in a single declaration. Thus, the locations - /// corresponding to the type and field and their components will overlap. - /// - Code which tries to interpret locations should probably be designed to - /// ignore those that it doesn't understand, as more types of locations could - /// be recorded in the future. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Location { - get { return location_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SourceCodeInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SourceCodeInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!location_.Equals(other.location_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= location_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - location_.WriteTo(output, _repeated_location_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - location_.WriteTo(ref output, _repeated_location_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += location_.CalculateSize(_repeated_location_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SourceCodeInfo other) { - if (other == null) { - return; - } - location_.Add(other.location_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - location_.AddEntriesFrom(input, _repeated_location_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - location_.AddEntriesFrom(ref input, _repeated_location_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the SourceCodeInfo message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class Location : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Location()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.SourceCodeInfo.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Location() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Location(Location other) : this() { - path_ = other.path_.Clone(); - span_ = other.span_.Clone(); - leadingComments_ = other.leadingComments_; - trailingComments_ = other.trailingComments_; - leadingDetachedComments_ = other.leadingDetachedComments_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Location Clone() { - return new Location(this); - } - - /// Field number for the "path" field. - public const int PathFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_path_codec - = pb::FieldCodec.ForInt32(10); - private readonly pbc::RepeatedField path_ = new pbc::RepeatedField(); - /// - /// Identifies which part of the FileDescriptorProto was defined at this - /// location. - /// - /// Each element is a field number or an index. They form a path from - /// the root FileDescriptorProto to the place where the definition. For - /// example, this path: - /// [ 4, 3, 2, 7, 1 ] - /// refers to: - /// file.message_type(3) // 4, 3 - /// .field(7) // 2, 7 - /// .name() // 1 - /// This is because FileDescriptorProto.message_type has field number 4: - /// repeated DescriptorProto message_type = 4; - /// and DescriptorProto.field has field number 2: - /// repeated FieldDescriptorProto field = 2; - /// and FieldDescriptorProto.name has field number 1: - /// optional string name = 1; - /// - /// Thus, the above path gives the location of a field name. If we removed - /// the last element: - /// [ 4, 3, 2, 7 ] - /// this path refers to the whole field declaration (from the beginning - /// of the label to the terminating semicolon). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Path { - get { return path_; } - } - - /// Field number for the "span" field. - public const int SpanFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_span_codec - = pb::FieldCodec.ForInt32(18); - private readonly pbc::RepeatedField span_ = new pbc::RepeatedField(); - /// - /// Always has exactly three or four elements: start line, start column, - /// end line (optional, otherwise assumed same as start line), end column. - /// These are packed into a single field for efficiency. Note that line - /// and column numbers are zero-based -- typically you will want to add - /// 1 to each before displaying to a user. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Span { - get { return span_; } - } - - /// Field number for the "leading_comments" field. - public const int LeadingCommentsFieldNumber = 3; - private readonly static string LeadingCommentsDefaultValue = ""; - - private string leadingComments_; - /// - /// If this SourceCodeInfo represents a complete declaration, these are any - /// comments appearing before and after the declaration which appear to be - /// attached to the declaration. - /// - /// A series of line comments appearing on consecutive lines, with no other - /// tokens appearing on those lines, will be treated as a single comment. - /// - /// leading_detached_comments will keep paragraphs of comments that appear - /// before (but not connected to) the current element. Each paragraph, - /// separated by empty lines, will be one comment element in the repeated - /// field. - /// - /// Only the comment content is provided; comment markers (e.g. //) are - /// stripped out. For block comments, leading whitespace and an asterisk - /// will be stripped from the beginning of each line other than the first. - /// Newlines are included in the output. - /// - /// Examples: - /// - /// optional int32 foo = 1; // Comment attached to foo. - /// // Comment attached to bar. - /// optional int32 bar = 2; - /// - /// optional string baz = 3; - /// // Comment attached to baz. - /// // Another line attached to baz. - /// - /// // Comment attached to qux. - /// // - /// // Another line attached to qux. - /// optional double qux = 4; - /// - /// // Detached comment for corge. This is not leading or trailing comments - /// // to qux or corge because there are blank lines separating it from - /// // both. - /// - /// // Detached comment for corge paragraph 2. - /// - /// optional string corge = 5; - /// /* Block comment attached - /// * to corge. Leading asterisks - /// * will be removed. */ - /// /* Block comment attached to - /// * grault. */ - /// optional int32 grault = 6; - /// - /// // ignored detached comments. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string LeadingComments { - get { return leadingComments_ ?? LeadingCommentsDefaultValue; } - set { - leadingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "leading_comments" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasLeadingComments { - get { return leadingComments_ != null; } - } - /// Clears the value of the "leading_comments" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearLeadingComments() { - leadingComments_ = null; - } - - /// Field number for the "trailing_comments" field. - public const int TrailingCommentsFieldNumber = 4; - private readonly static string TrailingCommentsDefaultValue = ""; - - private string trailingComments_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TrailingComments { - get { return trailingComments_ ?? TrailingCommentsDefaultValue; } - set { - trailingComments_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "trailing_comments" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasTrailingComments { - get { return trailingComments_ != null; } - } - /// Clears the value of the "trailing_comments" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearTrailingComments() { - trailingComments_ = null; - } - - /// Field number for the "leading_detached_comments" field. - public const int LeadingDetachedCommentsFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_leadingDetachedComments_codec - = pb::FieldCodec.ForString(50); - private readonly pbc::RepeatedField leadingDetachedComments_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField LeadingDetachedComments { - get { return leadingDetachedComments_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Location); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Location other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!path_.Equals(other.path_)) return false; - if(!span_.Equals(other.span_)) return false; - if (LeadingComments != other.LeadingComments) return false; - if (TrailingComments != other.TrailingComments) return false; - if(!leadingDetachedComments_.Equals(other.leadingDetachedComments_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= path_.GetHashCode(); - hash ^= span_.GetHashCode(); - if (HasLeadingComments) hash ^= LeadingComments.GetHashCode(); - if (HasTrailingComments) hash ^= TrailingComments.GetHashCode(); - hash ^= leadingDetachedComments_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - path_.WriteTo(output, _repeated_path_codec); - span_.WriteTo(output, _repeated_span_codec); - if (HasLeadingComments) { - output.WriteRawTag(26); - output.WriteString(LeadingComments); - } - if (HasTrailingComments) { - output.WriteRawTag(34); - output.WriteString(TrailingComments); - } - leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - path_.WriteTo(ref output, _repeated_path_codec); - span_.WriteTo(ref output, _repeated_span_codec); - if (HasLeadingComments) { - output.WriteRawTag(26); - output.WriteString(LeadingComments); - } - if (HasTrailingComments) { - output.WriteRawTag(34); - output.WriteString(TrailingComments); - } - leadingDetachedComments_.WriteTo(ref output, _repeated_leadingDetachedComments_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += path_.CalculateSize(_repeated_path_codec); - size += span_.CalculateSize(_repeated_span_codec); - if (HasLeadingComments) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(LeadingComments); - } - if (HasTrailingComments) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TrailingComments); - } - size += leadingDetachedComments_.CalculateSize(_repeated_leadingDetachedComments_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Location other) { - if (other == null) { - return; - } - path_.Add(other.path_); - span_.Add(other.span_); - if (other.HasLeadingComments) { - LeadingComments = other.LeadingComments; - } - if (other.HasTrailingComments) { - TrailingComments = other.TrailingComments; - } - leadingDetachedComments_.Add(other.leadingDetachedComments_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: - case 8: { - path_.AddEntriesFrom(input, _repeated_path_codec); - break; - } - case 18: - case 16: { - span_.AddEntriesFrom(input, _repeated_span_codec); - break; - } - case 26: { - LeadingComments = input.ReadString(); - break; - } - case 34: { - TrailingComments = input.ReadString(); - break; - } - case 50: { - leadingDetachedComments_.AddEntriesFrom(input, _repeated_leadingDetachedComments_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: - case 8: { - path_.AddEntriesFrom(ref input, _repeated_path_codec); - break; - } - case 18: - case 16: { - span_.AddEntriesFrom(ref input, _repeated_span_codec); - break; - } - case 26: { - LeadingComments = input.ReadString(); - break; - } - case 34: { - TrailingComments = input.ReadString(); - break; - } - case 50: { - leadingDetachedComments_.AddEntriesFrom(ref input, _repeated_leadingDetachedComments_codec); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Describes the relationship between generated code and its original source - /// file. A GeneratedCodeInfo message is associated with only one generated - /// source file, but may contain references to different source .proto files. - /// - public sealed partial class GeneratedCodeInfo : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GeneratedCodeInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GeneratedCodeInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GeneratedCodeInfo(GeneratedCodeInfo other) : this() { - annotation_ = other.annotation_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GeneratedCodeInfo Clone() { - return new GeneratedCodeInfo(this); - } - - /// Field number for the "annotation" field. - public const int AnnotationFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_annotation_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser); - private readonly pbc::RepeatedField annotation_ = new pbc::RepeatedField(); - /// - /// An Annotation connects some span of text in generated code to an element - /// of its generating .proto file. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Annotation { - get { return annotation_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GeneratedCodeInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GeneratedCodeInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!annotation_.Equals(other.annotation_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= annotation_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - annotation_.WriteTo(output, _repeated_annotation_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - annotation_.WriteTo(ref output, _repeated_annotation_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += annotation_.CalculateSize(_repeated_annotation_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GeneratedCodeInfo other) { - if (other == null) { - return; - } - annotation_.Add(other.annotation_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - annotation_.AddEntriesFrom(input, _repeated_annotation_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - annotation_.AddEntriesFrom(ref input, _repeated_annotation_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the GeneratedCodeInfo message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class Annotation : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Annotation()); - private pb::UnknownFieldSet _unknownFields; - private int _hasBits0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.GeneratedCodeInfo.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Annotation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Annotation(Annotation other) : this() { - _hasBits0 = other._hasBits0; - path_ = other.path_.Clone(); - sourceFile_ = other.sourceFile_; - begin_ = other.begin_; - end_ = other.end_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Annotation Clone() { - return new Annotation(this); - } - - /// Field number for the "path" field. - public const int PathFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_path_codec - = pb::FieldCodec.ForInt32(10); - private readonly pbc::RepeatedField path_ = new pbc::RepeatedField(); - /// - /// Identifies the element in the original source .proto file. This field - /// is formatted the same as SourceCodeInfo.Location.path. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Path { - get { return path_; } - } - - /// Field number for the "source_file" field. - public const int SourceFileFieldNumber = 2; - private readonly static string SourceFileDefaultValue = ""; - - private string sourceFile_; - /// - /// Identifies the filesystem path to the original source .proto. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SourceFile { - get { return sourceFile_ ?? SourceFileDefaultValue; } - set { - sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - /// Gets whether the "source_file" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasSourceFile { - get { return sourceFile_ != null; } - } - /// Clears the value of the "source_file" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearSourceFile() { - sourceFile_ = null; - } - - /// Field number for the "begin" field. - public const int BeginFieldNumber = 3; - private readonly static int BeginDefaultValue = 0; - - private int begin_; - /// - /// Identifies the starting offset in bytes in the generated code - /// that relates to the identified object. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Begin { - get { if ((_hasBits0 & 1) != 0) { return begin_; } else { return BeginDefaultValue; } } - set { - _hasBits0 |= 1; - begin_ = value; - } - } - /// Gets whether the "begin" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasBegin { - get { return (_hasBits0 & 1) != 0; } - } - /// Clears the value of the "begin" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearBegin() { - _hasBits0 &= ~1; - } - - /// Field number for the "end" field. - public const int EndFieldNumber = 4; - private readonly static int EndDefaultValue = 0; - - private int end_; - /// - /// Identifies the ending offset in bytes in the generated code that - /// relates to the identified offset. The end offset should be one past - /// the last relevant byte (so the length of the text = end - begin). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int End { - get { if ((_hasBits0 & 2) != 0) { return end_; } else { return EndDefaultValue; } } - set { - _hasBits0 |= 2; - end_ = value; - } - } - /// Gets whether the "end" field is set - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool HasEnd { - get { return (_hasBits0 & 2) != 0; } - } - /// Clears the value of the "end" field - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearEnd() { - _hasBits0 &= ~2; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Annotation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Annotation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!path_.Equals(other.path_)) return false; - if (SourceFile != other.SourceFile) return false; - if (Begin != other.Begin) return false; - if (End != other.End) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= path_.GetHashCode(); - if (HasSourceFile) hash ^= SourceFile.GetHashCode(); - if (HasBegin) hash ^= Begin.GetHashCode(); - if (HasEnd) hash ^= End.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - path_.WriteTo(output, _repeated_path_codec); - if (HasSourceFile) { - output.WriteRawTag(18); - output.WriteString(SourceFile); - } - if (HasBegin) { - output.WriteRawTag(24); - output.WriteInt32(Begin); - } - if (HasEnd) { - output.WriteRawTag(32); - output.WriteInt32(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - path_.WriteTo(ref output, _repeated_path_codec); - if (HasSourceFile) { - output.WriteRawTag(18); - output.WriteString(SourceFile); - } - if (HasBegin) { - output.WriteRawTag(24); - output.WriteInt32(Begin); - } - if (HasEnd) { - output.WriteRawTag(32); - output.WriteInt32(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += path_.CalculateSize(_repeated_path_codec); - if (HasSourceFile) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile); - } - if (HasBegin) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Begin); - } - if (HasEnd) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(End); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Annotation other) { - if (other == null) { - return; - } - path_.Add(other.path_); - if (other.HasSourceFile) { - SourceFile = other.SourceFile; - } - if (other.HasBegin) { - Begin = other.Begin; - } - if (other.HasEnd) { - End = other.End; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: - case 8: { - path_.AddEntriesFrom(input, _repeated_path_codec); - break; - } - case 18: { - SourceFile = input.ReadString(); - break; - } - case 24: { - Begin = input.ReadInt32(); - break; - } - case 32: { - End = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: - case 8: { - path_.AddEntriesFrom(ref input, _repeated_path_codec); - break; - } - case 18: { - SourceFile = input.ReadString(); - break; - } - case 24: { - Begin = input.ReadInt32(); - break; - } - case 32: { - End = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs deleted file mode 100644 index 2b33cd4..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ /dev/null @@ -1,366 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/any.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/any.proto - public static partial class AnyReflection { - - #region Descriptor - /// File descriptor for google/protobuf/any.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static AnyReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", - "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQm8KE2Nv", - "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaJWdpdGh1Yi5jb20vZ29s", - "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmiAgNHUEKqAh5Hb29nbGUuUHJvdG9i", - "dWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Any), global::Google.Protobuf.WellKnownTypes.Any.Parser, new[]{ "TypeUrl", "Value" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// `Any` contains an arbitrary serialized protocol buffer message along with a - /// URL that describes the type of the serialized message. - /// - /// Protobuf library provides support to pack/unpack Any values in the form - /// of utility functions or additional generated methods of the Any type. - /// - /// Example 1: Pack and unpack a message in C++. - /// - /// Foo foo = ...; - /// Any any; - /// any.PackFrom(foo); - /// ... - /// if (any.UnpackTo(&foo)) { - /// ... - /// } - /// - /// Example 2: Pack and unpack a message in Java. - /// - /// Foo foo = ...; - /// Any any = Any.pack(foo); - /// ... - /// if (any.is(Foo.class)) { - /// foo = any.unpack(Foo.class); - /// } - /// - /// Example 3: Pack and unpack a message in Python. - /// - /// foo = Foo(...) - /// any = Any() - /// any.Pack(foo) - /// ... - /// if any.Is(Foo.DESCRIPTOR): - /// any.Unpack(foo) - /// ... - /// - /// Example 4: Pack and unpack a message in Go - /// - /// foo := &pb.Foo{...} - /// any, err := ptypes.MarshalAny(foo) - /// ... - /// foo := &pb.Foo{} - /// if err := ptypes.UnmarshalAny(any, foo); err != nil { - /// ... - /// } - /// - /// The pack methods provided by protobuf library will by default use - /// 'type.googleapis.com/full.type.name' as the type URL and the unpack - /// methods only use the fully qualified type name after the last '/' - /// in the type URL, for example "foo.bar.com/x/y.z" will yield type - /// name "y.z". - /// - /// JSON - /// ==== - /// The JSON representation of an `Any` value uses the regular - /// representation of the deserialized, embedded message, with an - /// additional field `@type` which contains the type URL. Example: - /// - /// package google.profile; - /// message Person { - /// string first_name = 1; - /// string last_name = 2; - /// } - /// - /// { - /// "@type": "type.googleapis.com/google.profile.Person", - /// "firstName": <string>, - /// "lastName": <string> - /// } - /// - /// If the embedded message type is well-known and has a custom JSON - /// representation, that representation will be embedded adding a field - /// `value` which holds the custom JSON in addition to the `@type` - /// field. Example (for message [google.protobuf.Duration][]): - /// - /// { - /// "@type": "type.googleapis.com/google.protobuf.Duration", - /// "value": "1.212s" - /// } - /// - public sealed partial class Any : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Any()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Any() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Any(Any other) : this() { - typeUrl_ = other.typeUrl_; - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Any Clone() { - return new Any(this); - } - - /// Field number for the "type_url" field. - public const int TypeUrlFieldNumber = 1; - private string typeUrl_ = ""; - /// - /// A URL/resource name that uniquely identifies the type of the serialized - /// protocol buffer message. This string must contain at least - /// one "/" character. The last segment of the URL's path must represent - /// the fully qualified name of the type (as in - /// `path/google.protobuf.Duration`). The name should be in a canonical form - /// (e.g., leading "." is not accepted). - /// - /// In practice, teams usually precompile into the binary all types that they - /// expect it to use in the context of Any. However, for URLs which use the - /// scheme `http`, `https`, or no scheme, one can optionally set up a type - /// server that maps type URLs to message definitions as follows: - /// - /// * If no scheme is provided, `https` is assumed. - /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] - /// value in binary format, or produce an error. - /// * Applications are allowed to cache lookup results based on the - /// URL, or have them precompiled into a binary to avoid any - /// lookup. Therefore, binary compatibility needs to be preserved - /// on changes to types. (Use versioned type names to manage - /// breaking changes.) - /// - /// Note: this functionality is not currently available in the official - /// protobuf release, and it is not used for type URLs beginning with - /// type.googleapis.com. - /// - /// Schemes other than `http`, `https` (or the empty scheme) might be - /// used with implementation specific semantics. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TypeUrl { - get { return typeUrl_; } - set { - typeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 2; - private pb::ByteString value_ = pb::ByteString.Empty; - /// - /// Must be a valid serialized protocol buffer of the above specified type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Any); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Any other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TypeUrl != other.TypeUrl) return false; - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); - if (Value.Length != 0) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (TypeUrl.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TypeUrl); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (TypeUrl.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TypeUrl); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeUrl); - } - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Any other) { - if (other == null) { - return; - } - if (other.TypeUrl.Length != 0) { - TypeUrl = other.TypeUrl; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - TypeUrl = input.ReadString(); - break; - } - case 18: { - Value = input.ReadBytes(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - TypeUrl = input.ReadString(); - break; - } - case 18: { - Value = input.ReadBytes(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs deleted file mode 100644 index 6bc0821..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ /dev/null @@ -1,1172 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/api.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/api.proto - public static partial class ApiReflection { - - #region Descriptor - /// File descriptor for google/protobuf/api.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ApiReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chlnb29nbGUvcHJvdG9idWYvYXBpLnByb3RvEg9nb29nbGUucHJvdG9idWYa", - "JGdvb2dsZS9wcm90b2J1Zi9zb3VyY2VfY29udGV4dC5wcm90bxoaZ29vZ2xl", - "L3Byb3RvYnVmL3R5cGUucHJvdG8igQIKA0FwaRIMCgRuYW1lGAEgASgJEigK", - "B21ldGhvZHMYAiADKAsyFy5nb29nbGUucHJvdG9idWYuTWV0aG9kEigKB29w", - "dGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9uEg8KB3ZlcnNp", - "b24YBCABKAkSNgoOc291cmNlX2NvbnRleHQYBSABKAsyHi5nb29nbGUucHJv", - "dG9idWYuU291cmNlQ29udGV4dBImCgZtaXhpbnMYBiADKAsyFi5nb29nbGUu", - "cHJvdG9idWYuTWl4aW4SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3Rv", - "YnVmLlN5bnRheCLVAQoGTWV0aG9kEgwKBG5hbWUYASABKAkSGAoQcmVxdWVz", - "dF90eXBlX3VybBgCIAEoCRIZChFyZXF1ZXN0X3N0cmVhbWluZxgDIAEoCBIZ", - "ChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25zZV9zdHJlYW1p", - "bmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5P", - "cHRpb24SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRh", - "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCdQoTY29t", - "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAVorZ29vZ2xlLmdvbGFuZy5v", - "cmcvZ2VucHJvdG8vcHJvdG9idWYvYXBpO2FwaaICA0dQQqoCHkdvb2dsZS5Q", - "cm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Api), global::Google.Protobuf.WellKnownTypes.Api.Parser, new[]{ "Name", "Methods", "Options", "Version", "SourceContext", "Mixins", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Method), global::Google.Protobuf.WellKnownTypes.Method.Parser, new[]{ "Name", "RequestTypeUrl", "RequestStreaming", "ResponseTypeUrl", "ResponseStreaming", "Options", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Mixin), global::Google.Protobuf.WellKnownTypes.Mixin.Parser, new[]{ "Name", "Root" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// Api is a light-weight descriptor for an API Interface. - /// - /// Interfaces are also described as "protocol buffer services" in some contexts, - /// such as by the "service" keyword in a .proto file, but they are different - /// from API Services, which represent a concrete implementation of an interface - /// as opposed to simply a description of methods and bindings. They are also - /// sometimes simply referred to as "APIs" in other contexts, such as the name of - /// this message itself. See https://cloud.google.com/apis/design/glossary for - /// detailed terminology. - /// - public sealed partial class Api : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Api()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Api() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Api(Api other) : this() { - name_ = other.name_; - methods_ = other.methods_.Clone(); - options_ = other.options_.Clone(); - version_ = other.version_; - sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null; - mixins_ = other.mixins_.Clone(); - syntax_ = other.syntax_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Api Clone() { - return new Api(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The fully qualified name of this interface, including package name - /// followed by the interface's simple name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "methods" field. - public const int MethodsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_methods_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Method.Parser); - private readonly pbc::RepeatedField methods_ = new pbc::RepeatedField(); - /// - /// The methods of this interface, in unspecified order. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Methods { - get { return methods_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - /// - /// Any metadata attached to the interface. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - /// Field number for the "version" field. - public const int VersionFieldNumber = 4; - private string version_ = ""; - /// - /// A version string for this interface. If specified, must have the form - /// `major-version.minor-version`, as in `1.10`. If the minor version is - /// omitted, it defaults to zero. If the entire version field is empty, the - /// major version is derived from the package name, as outlined below. If the - /// field is not empty, the version in the package name will be verified to be - /// consistent with what is provided here. - /// - /// The versioning schema uses [semantic - /// versioning](http://semver.org) where the major version number - /// indicates a breaking change and the minor version an additive, - /// non-breaking change. Both version numbers are signals to users - /// what to expect from different versions, and should be carefully - /// chosen based on the product plan. - /// - /// The major version is also reflected in the package name of the - /// interface, which must end in `v<major-version>`, as in - /// `google.feature.v1`. For major versions 0 and 1, the suffix can - /// be omitted. Zero major versions must only be used for - /// experimental, non-GA interfaces. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Version { - get { return version_; } - set { - version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "source_context" field. - public const int SourceContextFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; - /// - /// Source context for the protocol buffer service represented by this - /// message. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { - get { return sourceContext_; } - set { - sourceContext_ = value; - } - } - - /// Field number for the "mixins" field. - public const int MixinsFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_mixins_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Mixin.Parser); - private readonly pbc::RepeatedField mixins_ = new pbc::RepeatedField(); - /// - /// Included interfaces. See [Mixin][]. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Mixins { - get { return mixins_; } - } - - /// Field number for the "syntax" field. - public const int SyntaxFieldNumber = 7; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2; - /// - /// The source syntax of the service. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Api); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Api other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!methods_.Equals(other.methods_)) return false; - if(!options_.Equals(other.options_)) return false; - if (Version != other.Version) return false; - if (!object.Equals(SourceContext, other.SourceContext)) return false; - if(!mixins_.Equals(other.mixins_)) return false; - if (Syntax != other.Syntax) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= methods_.GetHashCode(); - hash ^= options_.GetHashCode(); - if (Version.Length != 0) hash ^= Version.GetHashCode(); - if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); - hash ^= mixins_.GetHashCode(); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) hash ^= Syntax.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - methods_.WriteTo(output, _repeated_methods_codec); - options_.WriteTo(output, _repeated_options_codec); - if (Version.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Version); - } - if (sourceContext_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SourceContext); - } - mixins_.WriteTo(output, _repeated_mixins_codec); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(56); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - methods_.WriteTo(ref output, _repeated_methods_codec); - options_.WriteTo(ref output, _repeated_options_codec); - if (Version.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Version); - } - if (sourceContext_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SourceContext); - } - mixins_.WriteTo(ref output, _repeated_mixins_codec); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(56); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += methods_.CalculateSize(_repeated_methods_codec); - size += options_.CalculateSize(_repeated_options_codec); - if (Version.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); - } - if (sourceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); - } - size += mixins_.CalculateSize(_repeated_mixins_codec); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Api other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - methods_.Add(other.methods_); - options_.Add(other.options_); - if (other.Version.Length != 0) { - Version = other.Version; - } - if (other.sourceContext_ != null) { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - SourceContext.MergeFrom(other.SourceContext); - } - mixins_.Add(other.mixins_); - if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - Syntax = other.Syntax; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - methods_.AddEntriesFrom(input, _repeated_methods_codec); - break; - } - case 26: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 34: { - Version = input.ReadString(); - break; - } - case 42: { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(SourceContext); - break; - } - case 50: { - mixins_.AddEntriesFrom(input, _repeated_mixins_codec); - break; - } - case 56: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - methods_.AddEntriesFrom(ref input, _repeated_methods_codec); - break; - } - case 26: { - options_.AddEntriesFrom(ref input, _repeated_options_codec); - break; - } - case 34: { - Version = input.ReadString(); - break; - } - case 42: { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(SourceContext); - break; - } - case 50: { - mixins_.AddEntriesFrom(ref input, _repeated_mixins_codec); - break; - } - case 56: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - /// - /// Method represents a method of an API interface. - /// - public sealed partial class Method : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Method()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Method() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Method(Method other) : this() { - name_ = other.name_; - requestTypeUrl_ = other.requestTypeUrl_; - requestStreaming_ = other.requestStreaming_; - responseTypeUrl_ = other.responseTypeUrl_; - responseStreaming_ = other.responseStreaming_; - options_ = other.options_.Clone(); - syntax_ = other.syntax_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Method Clone() { - return new Method(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The simple name of this method. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "request_type_url" field. - public const int RequestTypeUrlFieldNumber = 2; - private string requestTypeUrl_ = ""; - /// - /// A URL of the input message type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RequestTypeUrl { - get { return requestTypeUrl_; } - set { - requestTypeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "request_streaming" field. - public const int RequestStreamingFieldNumber = 3; - private bool requestStreaming_; - /// - /// If true, the request is streamed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool RequestStreaming { - get { return requestStreaming_; } - set { - requestStreaming_ = value; - } - } - - /// Field number for the "response_type_url" field. - public const int ResponseTypeUrlFieldNumber = 4; - private string responseTypeUrl_ = ""; - /// - /// The URL of the output message type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ResponseTypeUrl { - get { return responseTypeUrl_; } - set { - responseTypeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "response_streaming" field. - public const int ResponseStreamingFieldNumber = 5; - private bool responseStreaming_; - /// - /// If true, the response is streamed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool ResponseStreaming { - get { return responseStreaming_; } - set { - responseStreaming_ = value; - } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - /// - /// Any metadata attached to the method. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - /// Field number for the "syntax" field. - public const int SyntaxFieldNumber = 7; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2; - /// - /// The source syntax of this method. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Method); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Method other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (RequestTypeUrl != other.RequestTypeUrl) return false; - if (RequestStreaming != other.RequestStreaming) return false; - if (ResponseTypeUrl != other.ResponseTypeUrl) return false; - if (ResponseStreaming != other.ResponseStreaming) return false; - if(!options_.Equals(other.options_)) return false; - if (Syntax != other.Syntax) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (RequestTypeUrl.Length != 0) hash ^= RequestTypeUrl.GetHashCode(); - if (RequestStreaming != false) hash ^= RequestStreaming.GetHashCode(); - if (ResponseTypeUrl.Length != 0) hash ^= ResponseTypeUrl.GetHashCode(); - if (ResponseStreaming != false) hash ^= ResponseStreaming.GetHashCode(); - hash ^= options_.GetHashCode(); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) hash ^= Syntax.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (RequestTypeUrl.Length != 0) { - output.WriteRawTag(18); - output.WriteString(RequestTypeUrl); - } - if (RequestStreaming != false) { - output.WriteRawTag(24); - output.WriteBool(RequestStreaming); - } - if (ResponseTypeUrl.Length != 0) { - output.WriteRawTag(34); - output.WriteString(ResponseTypeUrl); - } - if (ResponseStreaming != false) { - output.WriteRawTag(40); - output.WriteBool(ResponseStreaming); - } - options_.WriteTo(output, _repeated_options_codec); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(56); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (RequestTypeUrl.Length != 0) { - output.WriteRawTag(18); - output.WriteString(RequestTypeUrl); - } - if (RequestStreaming != false) { - output.WriteRawTag(24); - output.WriteBool(RequestStreaming); - } - if (ResponseTypeUrl.Length != 0) { - output.WriteRawTag(34); - output.WriteString(ResponseTypeUrl); - } - if (ResponseStreaming != false) { - output.WriteRawTag(40); - output.WriteBool(ResponseStreaming); - } - options_.WriteTo(ref output, _repeated_options_codec); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(56); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (RequestTypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestTypeUrl); - } - if (RequestStreaming != false) { - size += 1 + 1; - } - if (ResponseTypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ResponseTypeUrl); - } - if (ResponseStreaming != false) { - size += 1 + 1; - } - size += options_.CalculateSize(_repeated_options_codec); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Method other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.RequestTypeUrl.Length != 0) { - RequestTypeUrl = other.RequestTypeUrl; - } - if (other.RequestStreaming != false) { - RequestStreaming = other.RequestStreaming; - } - if (other.ResponseTypeUrl.Length != 0) { - ResponseTypeUrl = other.ResponseTypeUrl; - } - if (other.ResponseStreaming != false) { - ResponseStreaming = other.ResponseStreaming; - } - options_.Add(other.options_); - if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - Syntax = other.Syntax; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - RequestTypeUrl = input.ReadString(); - break; - } - case 24: { - RequestStreaming = input.ReadBool(); - break; - } - case 34: { - ResponseTypeUrl = input.ReadString(); - break; - } - case 40: { - ResponseStreaming = input.ReadBool(); - break; - } - case 50: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 56: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - RequestTypeUrl = input.ReadString(); - break; - } - case 24: { - RequestStreaming = input.ReadBool(); - break; - } - case 34: { - ResponseTypeUrl = input.ReadString(); - break; - } - case 40: { - ResponseStreaming = input.ReadBool(); - break; - } - case 50: { - options_.AddEntriesFrom(ref input, _repeated_options_codec); - break; - } - case 56: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - /// - /// Declares an API Interface to be included in this interface. The including - /// interface must redeclare all the methods from the included interface, but - /// documentation and options are inherited as follows: - /// - /// - If after comment and whitespace stripping, the documentation - /// string of the redeclared method is empty, it will be inherited - /// from the original method. - /// - /// - Each annotation belonging to the service config (http, - /// visibility) which is not set in the redeclared method will be - /// inherited. - /// - /// - If an http annotation is inherited, the path pattern will be - /// modified as follows. Any version prefix will be replaced by the - /// version of the including interface plus the [root][] path if - /// specified. - /// - /// Example of a simple mixin: - /// - /// package google.acl.v1; - /// service AccessControl { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v1/{resource=**}:getAcl"; - /// } - /// } - /// - /// package google.storage.v2; - /// service Storage { - /// rpc GetAcl(GetAclRequest) returns (Acl); - /// - /// // Get a data record. - /// rpc GetData(GetDataRequest) returns (Data) { - /// option (google.api.http).get = "/v2/{resource=**}"; - /// } - /// } - /// - /// Example of a mixin configuration: - /// - /// apis: - /// - name: google.storage.v2.Storage - /// mixins: - /// - name: google.acl.v1.AccessControl - /// - /// The mixin construct implies that all methods in `AccessControl` are - /// also declared with same name and request/response types in - /// `Storage`. A documentation generator or annotation processor will - /// see the effective `Storage.GetAcl` method after inherting - /// documentation and annotations as follows: - /// - /// service Storage { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v2/{resource=**}:getAcl"; - /// } - /// ... - /// } - /// - /// Note how the version in the path pattern changed from `v1` to `v2`. - /// - /// If the `root` field in the mixin is specified, it should be a - /// relative path under which inherited HTTP paths are placed. Example: - /// - /// apis: - /// - name: google.storage.v2.Storage - /// mixins: - /// - name: google.acl.v1.AccessControl - /// root: acls - /// - /// This implies the following inherited HTTP annotation: - /// - /// service Storage { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; - /// } - /// ... - /// } - /// - public sealed partial class Mixin : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Mixin()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Mixin() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Mixin(Mixin other) : this() { - name_ = other.name_; - root_ = other.root_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Mixin Clone() { - return new Mixin(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The fully qualified name of the interface which is included. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "root" field. - public const int RootFieldNumber = 2; - private string root_ = ""; - /// - /// If non-empty specifies a path under which inherited HTTP paths - /// are rooted. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Root { - get { return root_; } - set { - root_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Mixin); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Mixin other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Root != other.Root) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Root.Length != 0) hash ^= Root.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Root.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Root); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Root.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Root); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Root.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Root); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Mixin other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Root.Length != 0) { - Root = other.Root; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Root = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - Root = input.ReadString(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs deleted file mode 100644 index 2d479ba..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ /dev/null @@ -1,328 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/duration.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/duration.proto - public static partial class DurationReflection { - - #region Descriptor - /// File descriptor for google/protobuf/duration.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static DurationReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", - "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", - "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", - "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9u+AEB", - "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", - "bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// A Duration represents a signed, fixed-length span of time represented - /// as a count of seconds and fractions of seconds at nanosecond - /// resolution. It is independent of any calendar and concepts like "day" - /// or "month". It is related to Timestamp in that the difference between - /// two Timestamp values is a Duration and it can be added or subtracted - /// from a Timestamp. Range is approximately +-10,000 years. - /// - /// # Examples - /// - /// Example 1: Compute Duration from two Timestamps in pseudo code. - /// - /// Timestamp start = ...; - /// Timestamp end = ...; - /// Duration duration = ...; - /// - /// duration.seconds = end.seconds - start.seconds; - /// duration.nanos = end.nanos - start.nanos; - /// - /// if (duration.seconds < 0 && duration.nanos > 0) { - /// duration.seconds += 1; - /// duration.nanos -= 1000000000; - /// } else if (duration.seconds > 0 && duration.nanos < 0) { - /// duration.seconds -= 1; - /// duration.nanos += 1000000000; - /// } - /// - /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - /// - /// Timestamp start = ...; - /// Duration duration = ...; - /// Timestamp end = ...; - /// - /// end.seconds = start.seconds + duration.seconds; - /// end.nanos = start.nanos + duration.nanos; - /// - /// if (end.nanos < 0) { - /// end.seconds -= 1; - /// end.nanos += 1000000000; - /// } else if (end.nanos >= 1000000000) { - /// end.seconds += 1; - /// end.nanos -= 1000000000; - /// } - /// - /// Example 3: Compute Duration from datetime.timedelta in Python. - /// - /// td = datetime.timedelta(days=3, minutes=10) - /// duration = Duration() - /// duration.FromTimedelta(td) - /// - /// # JSON Mapping - /// - /// In JSON format, the Duration type is encoded as a string rather than an - /// object, where the string ends in the suffix "s" (indicating seconds) and - /// is preceded by the number of seconds, with nanoseconds expressed as - /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be - /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should - /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 - /// microsecond should be expressed in JSON format as "3.000001s". - /// - public sealed partial class Duration : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Duration()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Duration() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Duration(Duration other) : this() { - seconds_ = other.seconds_; - nanos_ = other.nanos_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Duration Clone() { - return new Duration(this); - } - - /// Field number for the "seconds" field. - public const int SecondsFieldNumber = 1; - private long seconds_; - /// - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. Note: these bounds are computed from: - /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Seconds { - get { return seconds_; } - set { - seconds_ = value; - } - } - - /// Field number for the "nanos" field. - public const int NanosFieldNumber = 2; - private int nanos_; - /// - /// Signed fractions of a second at nanosecond resolution of the span - /// of time. Durations less than one second are represented with a 0 - /// `seconds` field and a positive or negative `nanos` field. For durations - /// of one second or more, a non-zero value for the `nanos` field must be - /// of the same sign as the `seconds` field. Must be from -999,999,999 - /// to +999,999,999 inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Nanos { - get { return nanos_; } - set { - nanos_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Duration); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Duration other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Seconds != other.Seconds) return false; - if (Nanos != other.Nanos) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Seconds != 0L) hash ^= Seconds.GetHashCode(); - if (Nanos != 0) hash ^= Nanos.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Seconds != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Seconds); - } - if (Nanos != 0) { - output.WriteRawTag(16); - output.WriteInt32(Nanos); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Seconds != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Seconds); - } - if (Nanos != 0) { - output.WriteRawTag(16); - output.WriteInt32(Nanos); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Seconds != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); - } - if (Nanos != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Duration other) { - if (other == null) { - return; - } - if (other.Seconds != 0L) { - Seconds = other.Seconds; - } - if (other.Nanos != 0) { - Nanos = other.Nanos; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Seconds = input.ReadInt64(); - break; - } - case 16: { - Nanos = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Seconds = input.ReadInt64(); - break; - } - case 16: { - Nanos = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs deleted file mode 100644 index ce820cb..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ /dev/null @@ -1,193 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/empty.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/empty.proto - public static partial class EmptyReflection { - - #region Descriptor - /// File descriptor for google/protobuf/empty.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static EmptyReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", - "ZiIHCgVFbXB0eUJ2ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", - "UAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0efgB", - "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv", - "dG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Empty), global::Google.Protobuf.WellKnownTypes.Empty.Parser, null, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// A generic empty message that you can re-use to avoid defining duplicated - /// empty messages in your APIs. A typical example is to use it as the request - /// or the response type of an API method. For instance: - /// - /// service Foo { - /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - /// } - /// - /// The JSON representation for `Empty` is empty JSON object `{}`. - /// - public sealed partial class Empty : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Empty()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty(Empty other) : this() { - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Empty Clone() { - return new Empty(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Empty); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Empty other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Empty other) { - if (other == null) { - return; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs deleted file mode 100644 index ee53861..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ /dev/null @@ -1,411 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/field_mask.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/field_mask.proto - public static partial class FieldMaskReflection { - - #region Descriptor - /// File descriptor for google/protobuf/field_mask.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static FieldMaskReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy", - "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUKMAQoTY29tLmdv", - "b2dsZS5wcm90b2J1ZkIORmllbGRNYXNrUHJvdG9QAVo5Z29vZ2xlLmdvbGFu", - "Zy5vcmcvZ2VucHJvdG8vcHJvdG9idWYvZmllbGRfbWFzaztmaWVsZF9tYXNr", - "+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZw", - "cm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.FieldMask), global::Google.Protobuf.WellKnownTypes.FieldMask.Parser, new[]{ "Paths" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// `FieldMask` represents a set of symbolic field paths, for example: - /// - /// paths: "f.a" - /// paths: "f.b.d" - /// - /// Here `f` represents a field in some root message, `a` and `b` - /// fields in the message found in `f`, and `d` a field found in the - /// message in `f.b`. - /// - /// Field masks are used to specify a subset of fields that should be - /// returned by a get operation or modified by an update operation. - /// Field masks also have a custom JSON encoding (see below). - /// - /// # Field Masks in Projections - /// - /// When used in the context of a projection, a response message or - /// sub-message is filtered by the API to only contain those fields as - /// specified in the mask. For example, if the mask in the previous - /// example is applied to a response message as follows: - /// - /// f { - /// a : 22 - /// b { - /// d : 1 - /// x : 2 - /// } - /// y : 13 - /// } - /// z: 8 - /// - /// The result will not contain specific values for fields x,y and z - /// (their value will be set to the default, and omitted in proto text - /// output): - /// - /// f { - /// a : 22 - /// b { - /// d : 1 - /// } - /// } - /// - /// A repeated field is not allowed except at the last position of a - /// paths string. - /// - /// If a FieldMask object is not present in a get operation, the - /// operation applies to all fields (as if a FieldMask of all fields - /// had been specified). - /// - /// Note that a field mask does not necessarily apply to the - /// top-level response message. In case of a REST get operation, the - /// field mask applies directly to the response, but in case of a REST - /// list operation, the mask instead applies to each individual message - /// in the returned resource list. In case of a REST custom method, - /// other definitions may be used. Where the mask applies will be - /// clearly documented together with its declaration in the API. In - /// any case, the effect on the returned resource/resources is required - /// behavior for APIs. - /// - /// # Field Masks in Update Operations - /// - /// A field mask in update operations specifies which fields of the - /// targeted resource are going to be updated. The API is required - /// to only change the values of the fields as specified in the mask - /// and leave the others untouched. If a resource is passed in to - /// describe the updated values, the API ignores the values of all - /// fields not covered by the mask. - /// - /// If a repeated field is specified for an update operation, new values will - /// be appended to the existing repeated field in the target resource. Note that - /// a repeated field is only allowed in the last position of a `paths` string. - /// - /// If a sub-message is specified in the last position of the field mask for an - /// update operation, then new value will be merged into the existing sub-message - /// in the target resource. - /// - /// For example, given the target message: - /// - /// f { - /// b { - /// d: 1 - /// x: 2 - /// } - /// c: [1] - /// } - /// - /// And an update message: - /// - /// f { - /// b { - /// d: 10 - /// } - /// c: [2] - /// } - /// - /// then if the field mask is: - /// - /// paths: ["f.b", "f.c"] - /// - /// then the result will be: - /// - /// f { - /// b { - /// d: 10 - /// x: 2 - /// } - /// c: [1, 2] - /// } - /// - /// An implementation may provide options to override this default behavior for - /// repeated and message fields. - /// - /// In order to reset a field's value to the default, the field must - /// be in the mask and set to the default value in the provided resource. - /// Hence, in order to reset all fields of a resource, provide a default - /// instance of the resource and set all fields in the mask, or do - /// not provide a mask as described below. - /// - /// If a field mask is not present on update, the operation applies to - /// all fields (as if a field mask of all fields has been specified). - /// Note that in the presence of schema evolution, this may mean that - /// fields the client does not know and has therefore not filled into - /// the request will be reset to their default. If this is unwanted - /// behavior, a specific service may require a client to always specify - /// a field mask, producing an error if not. - /// - /// As with get operations, the location of the resource which - /// describes the updated values in the request message depends on the - /// operation kind. In any case, the effect of the field mask is - /// required to be honored by the API. - /// - /// ## Considerations for HTTP REST - /// - /// The HTTP kind of an update operation which uses a field mask must - /// be set to PATCH instead of PUT in order to satisfy HTTP semantics - /// (PUT must only be used for full updates). - /// - /// # JSON Encoding of Field Masks - /// - /// In JSON, a field mask is encoded as a single string where paths are - /// separated by a comma. Fields name in each path are converted - /// to/from lower-camel naming conventions. - /// - /// As an example, consider the following message declarations: - /// - /// message Profile { - /// User user = 1; - /// Photo photo = 2; - /// } - /// message User { - /// string display_name = 1; - /// string address = 2; - /// } - /// - /// In proto a field mask for `Profile` may look as such: - /// - /// mask { - /// paths: "user.display_name" - /// paths: "photo" - /// } - /// - /// In JSON, the same mask is represented as below: - /// - /// { - /// mask: "user.displayName,photo" - /// } - /// - /// # Field Masks and Oneof Fields - /// - /// Field masks treat fields in oneofs just as regular fields. Consider the - /// following message: - /// - /// message SampleMessage { - /// oneof test_oneof { - /// string name = 4; - /// SubMessage sub_message = 9; - /// } - /// } - /// - /// The field mask can be: - /// - /// mask { - /// paths: "name" - /// } - /// - /// Or: - /// - /// mask { - /// paths: "sub_message" - /// } - /// - /// Note that oneof type names ("test_oneof" in this case) cannot be used in - /// paths. - /// - /// ## Field Mask Verification - /// - /// The implementation of any API method which has a FieldMask type field in the - /// request should verify the included field paths, and return an - /// `INVALID_ARGUMENT` error if any path is unmappable. - /// - public sealed partial class FieldMask : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldMask()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldMask() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldMask(FieldMask other) : this() { - paths_ = other.paths_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public FieldMask Clone() { - return new FieldMask(this); - } - - /// Field number for the "paths" field. - public const int PathsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_paths_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField paths_ = new pbc::RepeatedField(); - /// - /// The set of field mask paths. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Paths { - get { return paths_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as FieldMask); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(FieldMask other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!paths_.Equals(other.paths_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= paths_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - paths_.WriteTo(output, _repeated_paths_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - paths_.WriteTo(ref output, _repeated_paths_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += paths_.CalculateSize(_repeated_paths_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(FieldMask other) { - if (other == null) { - return; - } - paths_.Add(other.paths_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - paths_.AddEntriesFrom(input, _repeated_paths_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - paths_.AddEntriesFrom(ref input, _repeated_paths_codec); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs deleted file mode 100644 index 38240bb..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ /dev/null @@ -1,227 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/source_context.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/source_context.proto - public static partial class SourceContextReflection { - - #region Descriptor - /// File descriptor for google/protobuf/source_context.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static SourceContextReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds", - "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo", - "CUKVAQoTY29tLmdvb2dsZS5wcm90b2J1ZkISU291cmNlQ29udGV4dFByb3Rv", - "UAFaQWdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL3Byb3RvYnVmL3NvdXJj", - "ZV9jb250ZXh0O3NvdXJjZV9jb250ZXh0ogIDR1BCqgIeR29vZ2xlLlByb3Rv", - "YnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.SourceContext), global::Google.Protobuf.WellKnownTypes.SourceContext.Parser, new[]{ "FileName" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// `SourceContext` represents information about the source of a - /// protobuf element, like the file in which it is defined. - /// - public sealed partial class SourceContext : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceContext()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceContext() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceContext(SourceContext other) : this() { - fileName_ = other.fileName_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SourceContext Clone() { - return new SourceContext(this); - } - - /// Field number for the "file_name" field. - public const int FileNameFieldNumber = 1; - private string fileName_ = ""; - /// - /// The path-qualified name of the .proto file that contained the associated - /// protobuf element. For example: `"google/protobuf/source_context.proto"`. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string FileName { - get { return fileName_; } - set { - fileName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SourceContext); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SourceContext other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (FileName != other.FileName) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (FileName.Length != 0) hash ^= FileName.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (FileName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(FileName); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (FileName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(FileName); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (FileName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SourceContext other) { - if (other == null) { - return; - } - if (other.FileName.Length != 0) { - FileName = other.FileName; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - FileName = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - FileName = input.ReadString(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs deleted file mode 100644 index 42d37ca..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ /dev/null @@ -1,866 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/struct.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/struct.proto - public static partial class StructReflection { - - #region Descriptor - /// File descriptor for google/protobuf/struct.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static StructReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chxnb29nbGUvcHJvdG9idWYvc3RydWN0LnByb3RvEg9nb29nbGUucHJvdG9i", - "dWYihAEKBlN0cnVjdBIzCgZmaWVsZHMYASADKAsyIy5nb29nbGUucHJvdG9i", - "dWYuU3RydWN0LkZpZWxkc0VudHJ5GkUKC0ZpZWxkc0VudHJ5EgsKA2tleRgB", - "IAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZToC", - "OAEi6gEKBVZhbHVlEjAKCm51bGxfdmFsdWUYASABKA4yGi5nb29nbGUucHJv", - "dG9idWYuTnVsbFZhbHVlSAASFgoMbnVtYmVyX3ZhbHVlGAIgASgBSAASFgoM", - "c3RyaW5nX3ZhbHVlGAMgASgJSAASFAoKYm9vbF92YWx1ZRgEIAEoCEgAEi8K", - "DHN0cnVjdF92YWx1ZRgFIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3RI", - "ABIwCgpsaXN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RW", - "YWx1ZUgAQgYKBGtpbmQiMwoJTGlzdFZhbHVlEiYKBnZhbHVlcxgBIAMoCzIW", - "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", - "QUxVRRAAQoEBChNjb20uZ29vZ2xlLnByb3RvYnVmQgtTdHJ1Y3RQcm90b1AB", - "WjFnaXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvc3RydWN0O3N0", - "cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5", - "cGVzYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.NullValue), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Struct), global::Google.Protobuf.WellKnownTypes.Struct.Parser, new[]{ "Fields" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Value), global::Google.Protobuf.WellKnownTypes.Value.Parser, new[]{ "NullValue", "NumberValue", "StringValue", "BoolValue", "StructValue", "ListValue" }, new[]{ "Kind" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.ListValue), global::Google.Protobuf.WellKnownTypes.ListValue.Parser, new[]{ "Values" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - /// - /// `NullValue` is a singleton enumeration to represent the null value for the - /// `Value` type union. - /// - /// The JSON representation for `NullValue` is JSON `null`. - /// - public enum NullValue { - /// - /// Null value. - /// - [pbr::OriginalName("NULL_VALUE")] NullValue = 0, - } - - #endregion - - #region Messages - /// - /// `Struct` represents a structured data value, consisting of fields - /// which map to dynamically typed values. In some languages, `Struct` - /// might be supported by a native representation. For example, in - /// scripting languages like JS a struct is represented as an - /// object. The details of that representation are described together - /// with the proto support for the language. - /// - /// The JSON representation for `Struct` is JSON object. - /// - public sealed partial class Struct : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Struct()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Struct() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Struct(Struct other) : this() { - fields_ = other.fields_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Struct Clone() { - return new Struct(this); - } - - /// Field number for the "fields" field. - public const int FieldsFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_fields_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); - private readonly pbc::MapField fields_ = new pbc::MapField(); - /// - /// Unordered map of dynamically typed values. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Fields { - get { return fields_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Struct); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Struct other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Fields.Equals(other.Fields)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Fields.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - fields_.WriteTo(output, _map_fields_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - fields_.WriteTo(ref output, _map_fields_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += fields_.CalculateSize(_map_fields_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Struct other) { - if (other == null) { - return; - } - fields_.Add(other.fields_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - fields_.AddEntriesFrom(input, _map_fields_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - fields_.AddEntriesFrom(ref input, _map_fields_codec); - break; - } - } - } - } - #endif - - } - - /// - /// `Value` represents a dynamically typed value which can be either - /// null, a number, a string, a boolean, a recursive struct value, or a - /// list of values. A producer of value is expected to set one of that - /// variants, absence of any variant indicates an error. - /// - /// The JSON representation for `Value` is JSON value. - /// - public sealed partial class Value : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Value() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Value(Value other) : this() { - switch (other.KindCase) { - case KindOneofCase.NullValue: - NullValue = other.NullValue; - break; - case KindOneofCase.NumberValue: - NumberValue = other.NumberValue; - break; - case KindOneofCase.StringValue: - StringValue = other.StringValue; - break; - case KindOneofCase.BoolValue: - BoolValue = other.BoolValue; - break; - case KindOneofCase.StructValue: - StructValue = other.StructValue.Clone(); - break; - case KindOneofCase.ListValue: - ListValue = other.ListValue.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Value Clone() { - return new Value(this); - } - - /// Field number for the "null_value" field. - public const int NullValueFieldNumber = 1; - /// - /// Represents a null value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.NullValue NullValue { - get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : global::Google.Protobuf.WellKnownTypes.NullValue.NullValue; } - set { - kind_ = value; - kindCase_ = KindOneofCase.NullValue; - } - } - - /// Field number for the "number_value" field. - public const int NumberValueFieldNumber = 2; - /// - /// Represents a double value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double NumberValue { - get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; } - set { - kind_ = value; - kindCase_ = KindOneofCase.NumberValue; - } - } - - /// Field number for the "string_value" field. - public const int StringValueFieldNumber = 3; - /// - /// Represents a string value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string StringValue { - get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } - set { - kind_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - kindCase_ = KindOneofCase.StringValue; - } - } - - /// Field number for the "bool_value" field. - public const int BoolValueFieldNumber = 4; - /// - /// Represents a boolean value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool BoolValue { - get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } - set { - kind_ = value; - kindCase_ = KindOneofCase.BoolValue; - } - } - - /// Field number for the "struct_value" field. - public const int StructValueFieldNumber = 5; - /// - /// Represents a structured value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Struct StructValue { - get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; } - set { - kind_ = value; - kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.StructValue; - } - } - - /// Field number for the "list_value" field. - public const int ListValueFieldNumber = 6; - /// - /// Represents a repeated `Value`. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.ListValue ListValue { - get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; } - set { - kind_ = value; - kindCase_ = value == null ? KindOneofCase.None : KindOneofCase.ListValue; - } - } - - private object kind_; - /// Enum of possible cases for the "kind" oneof. - public enum KindOneofCase { - None = 0, - NullValue = 1, - NumberValue = 2, - StringValue = 3, - BoolValue = 4, - StructValue = 5, - ListValue = 6, - } - private KindOneofCase kindCase_ = KindOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public KindOneofCase KindCase { - get { return kindCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearKind() { - kindCase_ = KindOneofCase.None; - kind_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Value); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Value other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (NullValue != other.NullValue) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(NumberValue, other.NumberValue)) return false; - if (StringValue != other.StringValue) return false; - if (BoolValue != other.BoolValue) return false; - if (!object.Equals(StructValue, other.StructValue)) return false; - if (!object.Equals(ListValue, other.ListValue)) return false; - if (KindCase != other.KindCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode(); - if (kindCase_ == KindOneofCase.NumberValue) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(NumberValue); - if (kindCase_ == KindOneofCase.StringValue) hash ^= StringValue.GetHashCode(); - if (kindCase_ == KindOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); - if (kindCase_ == KindOneofCase.StructValue) hash ^= StructValue.GetHashCode(); - if (kindCase_ == KindOneofCase.ListValue) hash ^= ListValue.GetHashCode(); - hash ^= (int) kindCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (kindCase_ == KindOneofCase.NullValue) { - output.WriteRawTag(8); - output.WriteEnum((int) NullValue); - } - if (kindCase_ == KindOneofCase.NumberValue) { - output.WriteRawTag(17); - output.WriteDouble(NumberValue); - } - if (kindCase_ == KindOneofCase.StringValue) { - output.WriteRawTag(26); - output.WriteString(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - output.WriteRawTag(32); - output.WriteBool(BoolValue); - } - if (kindCase_ == KindOneofCase.StructValue) { - output.WriteRawTag(42); - output.WriteMessage(StructValue); - } - if (kindCase_ == KindOneofCase.ListValue) { - output.WriteRawTag(50); - output.WriteMessage(ListValue); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (kindCase_ == KindOneofCase.NullValue) { - output.WriteRawTag(8); - output.WriteEnum((int) NullValue); - } - if (kindCase_ == KindOneofCase.NumberValue) { - output.WriteRawTag(17); - output.WriteDouble(NumberValue); - } - if (kindCase_ == KindOneofCase.StringValue) { - output.WriteRawTag(26); - output.WriteString(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - output.WriteRawTag(32); - output.WriteBool(BoolValue); - } - if (kindCase_ == KindOneofCase.StructValue) { - output.WriteRawTag(42); - output.WriteMessage(StructValue); - } - if (kindCase_ == KindOneofCase.ListValue) { - output.WriteRawTag(50); - output.WriteMessage(ListValue); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (kindCase_ == KindOneofCase.NullValue) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NullValue); - } - if (kindCase_ == KindOneofCase.NumberValue) { - size += 1 + 8; - } - if (kindCase_ == KindOneofCase.StringValue) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue); - } - if (kindCase_ == KindOneofCase.BoolValue) { - size += 1 + 1; - } - if (kindCase_ == KindOneofCase.StructValue) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(StructValue); - } - if (kindCase_ == KindOneofCase.ListValue) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ListValue); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Value other) { - if (other == null) { - return; - } - switch (other.KindCase) { - case KindOneofCase.NullValue: - NullValue = other.NullValue; - break; - case KindOneofCase.NumberValue: - NumberValue = other.NumberValue; - break; - case KindOneofCase.StringValue: - StringValue = other.StringValue; - break; - case KindOneofCase.BoolValue: - BoolValue = other.BoolValue; - break; - case KindOneofCase.StructValue: - if (StructValue == null) { - StructValue = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - StructValue.MergeFrom(other.StructValue); - break; - case KindOneofCase.ListValue: - if (ListValue == null) { - ListValue = new global::Google.Protobuf.WellKnownTypes.ListValue(); - } - ListValue.MergeFrom(other.ListValue); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - kind_ = input.ReadEnum(); - kindCase_ = KindOneofCase.NullValue; - break; - } - case 17: { - NumberValue = input.ReadDouble(); - break; - } - case 26: { - StringValue = input.ReadString(); - break; - } - case 32: { - BoolValue = input.ReadBool(); - break; - } - case 42: { - global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); - if (kindCase_ == KindOneofCase.StructValue) { - subBuilder.MergeFrom(StructValue); - } - input.ReadMessage(subBuilder); - StructValue = subBuilder; - break; - } - case 50: { - global::Google.Protobuf.WellKnownTypes.ListValue subBuilder = new global::Google.Protobuf.WellKnownTypes.ListValue(); - if (kindCase_ == KindOneofCase.ListValue) { - subBuilder.MergeFrom(ListValue); - } - input.ReadMessage(subBuilder); - ListValue = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - kind_ = input.ReadEnum(); - kindCase_ = KindOneofCase.NullValue; - break; - } - case 17: { - NumberValue = input.ReadDouble(); - break; - } - case 26: { - StringValue = input.ReadString(); - break; - } - case 32: { - BoolValue = input.ReadBool(); - break; - } - case 42: { - global::Google.Protobuf.WellKnownTypes.Struct subBuilder = new global::Google.Protobuf.WellKnownTypes.Struct(); - if (kindCase_ == KindOneofCase.StructValue) { - subBuilder.MergeFrom(StructValue); - } - input.ReadMessage(subBuilder); - StructValue = subBuilder; - break; - } - case 50: { - global::Google.Protobuf.WellKnownTypes.ListValue subBuilder = new global::Google.Protobuf.WellKnownTypes.ListValue(); - if (kindCase_ == KindOneofCase.ListValue) { - subBuilder.MergeFrom(ListValue); - } - input.ReadMessage(subBuilder); - ListValue = subBuilder; - break; - } - } - } - } - #endif - - } - - /// - /// `ListValue` is a wrapper around a repeated field of values. - /// - /// The JSON representation for `ListValue` is JSON array. - /// - public sealed partial class ListValue : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ListValue()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ListValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ListValue(ListValue other) : this() { - values_ = other.values_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ListValue Clone() { - return new ListValue(this); - } - - /// Field number for the "values" field. - public const int ValuesFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_values_codec - = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser); - private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); - /// - /// Repeated field of dynamically typed values. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Values { - get { return values_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ListValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ListValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!values_.Equals(other.values_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= values_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - values_.WriteTo(output, _repeated_values_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - values_.WriteTo(ref output, _repeated_values_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += values_.CalculateSize(_repeated_values_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ListValue other) { - if (other == null) { - return; - } - values_.Add(other.values_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - values_.AddEntriesFrom(input, _repeated_values_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - values_.AddEntriesFrom(ref input, _repeated_values_codec); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs deleted file mode 100644 index b2f5d35..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ /dev/null @@ -1,349 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/timestamp.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/timestamp.proto - public static partial class TimestampReflection { - - #region Descriptor - /// File descriptor for google/protobuf/timestamp.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static TimestampReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", - "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", - "AiABKAVCfgoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q", - "AVorZ2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL3RpbWVzdGFt", - "cPgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Timestamp), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - /// - /// A Timestamp represents a point in time independent of any time zone or local - /// calendar, encoded as a count of seconds and fractions of seconds at - /// nanosecond resolution. The count is relative to an epoch at UTC midnight on - /// January 1, 1970, in the proleptic Gregorian calendar which extends the - /// Gregorian calendar backwards to year one. - /// - /// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - /// second table is needed for interpretation, using a [24-hour linear - /// smear](https://developers.google.com/time/smear). - /// - /// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - /// restricting to that range, we ensure that we can convert to and from [RFC - /// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - /// - /// # Examples - /// - /// Example 1: Compute Timestamp from POSIX `time()`. - /// - /// Timestamp timestamp; - /// timestamp.set_seconds(time(NULL)); - /// timestamp.set_nanos(0); - /// - /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. - /// - /// struct timeval tv; - /// gettimeofday(&tv, NULL); - /// - /// Timestamp timestamp; - /// timestamp.set_seconds(tv.tv_sec); - /// timestamp.set_nanos(tv.tv_usec * 1000); - /// - /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - /// - /// FILETIME ft; - /// GetSystemTimeAsFileTime(&ft); - /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - /// - /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - /// Timestamp timestamp; - /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - /// - /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - /// - /// long millis = System.currentTimeMillis(); - /// - /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - /// .setNanos((int) ((millis % 1000) * 1000000)).build(); - /// - /// Example 5: Compute Timestamp from current time in Python. - /// - /// timestamp = Timestamp() - /// timestamp.GetCurrentTime() - /// - /// # JSON Mapping - /// - /// In JSON format, the Timestamp type is encoded as a string in the - /// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - /// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - /// where {year} is always expressed using four digits while {month}, {day}, - /// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - /// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - /// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - /// is required. A proto3 JSON serializer should always use UTC (as indicated by - /// "Z") when printing the Timestamp type and a proto3 JSON parser should be - /// able to accept both UTC and other timezones (as indicated by an offset). - /// - /// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - /// 01:30 UTC on January 15, 2017. - /// - /// In JavaScript, one can convert a Date object to this format using the - /// standard - /// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - /// method. In Python, a standard `datetime.datetime` object can be converted - /// to this format using - /// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - /// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - /// the Joda Time's [`ISODateTimeFormat.dateTime()`]( - /// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D - /// ) to obtain a formatter capable of generating timestamps in this format. - /// - public sealed partial class Timestamp : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Timestamp()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Timestamp() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Timestamp(Timestamp other) : this() { - seconds_ = other.seconds_; - nanos_ = other.nanos_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Timestamp Clone() { - return new Timestamp(this); - } - - /// Field number for the "seconds" field. - public const int SecondsFieldNumber = 1; - private long seconds_; - /// - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Seconds { - get { return seconds_; } - set { - seconds_ = value; - } - } - - /// Field number for the "nanos" field. - public const int NanosFieldNumber = 2; - private int nanos_; - /// - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Nanos { - get { return nanos_; } - set { - nanos_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Timestamp); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Timestamp other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Seconds != other.Seconds) return false; - if (Nanos != other.Nanos) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Seconds != 0L) hash ^= Seconds.GetHashCode(); - if (Nanos != 0) hash ^= Nanos.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Seconds != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Seconds); - } - if (Nanos != 0) { - output.WriteRawTag(16); - output.WriteInt32(Nanos); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Seconds != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Seconds); - } - if (Nanos != 0) { - output.WriteRawTag(16); - output.WriteInt32(Nanos); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Seconds != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); - } - if (Nanos != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Timestamp other) { - if (other == null) { - return; - } - if (other.Seconds != 0L) { - Seconds = other.Seconds; - } - if (other.Nanos != 0) { - Nanos = other.Nanos; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Seconds = input.ReadInt64(); - break; - } - case 16: { - Nanos = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Seconds = input.ReadInt64(); - break; - } - case 16: { - Nanos = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs deleted file mode 100644 index c62095a..0000000 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ /dev/null @@ -1,1877 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/protobuf/type.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Google.Protobuf.WellKnownTypes { - - /// Holder for reflection information generated from google/protobuf/type.proto - public static partial class TypeReflection { - - #region Descriptor - /// File descriptor for google/protobuf/type.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static TypeReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Chpnb29nbGUvcHJvdG9idWYvdHlwZS5wcm90bxIPZ29vZ2xlLnByb3RvYnVm", - "Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvGiRnb29nbGUvcHJvdG9idWYv", - "c291cmNlX2NvbnRleHQucHJvdG8i1wEKBFR5cGUSDAoEbmFtZRgBIAEoCRIm", - "CgZmaWVsZHMYAiADKAsyFi5nb29nbGUucHJvdG9idWYuRmllbGQSDgoGb25l", - "b2ZzGAMgAygJEigKB29wdGlvbnMYBCADKAsyFy5nb29nbGUucHJvdG9idWYu", - "T3B0aW9uEjYKDnNvdXJjZV9jb250ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3Rv", - "YnVmLlNvdXJjZUNvbnRleHQSJwoGc3ludGF4GAYgASgOMhcuZ29vZ2xlLnBy", - "b3RvYnVmLlN5bnRheCLVBQoFRmllbGQSKQoEa2luZBgBIAEoDjIbLmdvb2ds", - "ZS5wcm90b2J1Zi5GaWVsZC5LaW5kEjcKC2NhcmRpbmFsaXR5GAIgASgOMiIu", - "Z29vZ2xlLnByb3RvYnVmLkZpZWxkLkNhcmRpbmFsaXR5Eg4KBm51bWJlchgD", - "IAEoBRIMCgRuYW1lGAQgASgJEhAKCHR5cGVfdXJsGAYgASgJEhMKC29uZW9m", - "X2luZGV4GAcgASgFEg4KBnBhY2tlZBgIIAEoCBIoCgdvcHRpb25zGAkgAygL", - "MhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhIRCglqc29uX25hbWUYCiABKAkS", - "FQoNZGVmYXVsdF92YWx1ZRgLIAEoCSLIAgoES2luZBIQCgxUWVBFX1VOS05P", - "V04QABIPCgtUWVBFX0RPVUJMRRABEg4KClRZUEVfRkxPQVQQAhIOCgpUWVBF", - "X0lOVDY0EAMSDwoLVFlQRV9VSU5UNjQQBBIOCgpUWVBFX0lOVDMyEAUSEAoM", - "VFlQRV9GSVhFRDY0EAYSEAoMVFlQRV9GSVhFRDMyEAcSDQoJVFlQRV9CT09M", - "EAgSDwoLVFlQRV9TVFJJTkcQCRIOCgpUWVBFX0dST1VQEAoSEAoMVFlQRV9N", - "RVNTQUdFEAsSDgoKVFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJ", - "VFlQRV9FTlVNEA4SEQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVE", - "NjQQEBIPCgtUWVBFX1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIidAoLQ2Fy", - "ZGluYWxpdHkSFwoTQ0FSRElOQUxJVFlfVU5LTk9XThAAEhgKFENBUkRJTkFM", - "SVRZX09QVElPTkFMEAESGAoUQ0FSRElOQUxJVFlfUkVRVUlSRUQQAhIYChRD", - "QVJESU5BTElUWV9SRVBFQVRFRBADIs4BCgRFbnVtEgwKBG5hbWUYASABKAkS", - "LQoJZW51bXZhbHVlGAIgAygLMhouZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1", - "ZRIoCgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVmLk9wdGlvbhI2", - "Cg5zb3VyY2VfY29udGV4dBgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5Tb3Vy", - "Y2VDb250ZXh0EicKBnN5bnRheBgFIAEoDjIXLmdvb2dsZS5wcm90b2J1Zi5T", - "eW50YXgiUwoJRW51bVZhbHVlEgwKBG5hbWUYASABKAkSDgoGbnVtYmVyGAIg", - "ASgFEigKB29wdGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9u", - "IjsKBk9wdGlvbhIMCgRuYW1lGAEgASgJEiMKBXZhbHVlGAIgASgLMhQuZ29v", - "Z2xlLnByb3RvYnVmLkFueSouCgZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAA", - "EhEKDVNZTlRBWF9QUk9UTzMQAUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQglU", - "eXBlUHJvdG9QAVovZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vcHJvdG9i", - "dWYvcHR5cGU7cHR5cGX4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2Vs", - "bEtub3duVHlwZXNiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Type), global::Google.Protobuf.WellKnownTypes.Type.Parser, new[]{ "Name", "Fields", "Oneofs", "Options", "SourceContext", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Field), global::Google.Protobuf.WellKnownTypes.Field.Parser, new[]{ "Kind", "Cardinality", "Number", "Name", "TypeUrl", "OneofIndex", "Packed", "Options", "JsonName", "DefaultValue" }, null, new[]{ typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Kind), typeof(global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Enum), global::Google.Protobuf.WellKnownTypes.Enum.Parser, new[]{ "Name", "Enumvalue", "Options", "SourceContext", "Syntax" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.EnumValue), global::Google.Protobuf.WellKnownTypes.EnumValue.Parser, new[]{ "Name", "Number", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Option), global::Google.Protobuf.WellKnownTypes.Option.Parser, new[]{ "Name", "Value" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - /// - /// The syntax in which a protocol buffer element is defined. - /// - public enum Syntax { - /// - /// Syntax `proto2`. - /// - [pbr::OriginalName("SYNTAX_PROTO2")] Proto2 = 0, - /// - /// Syntax `proto3`. - /// - [pbr::OriginalName("SYNTAX_PROTO3")] Proto3 = 1, - } - - #endregion - - #region Messages - /// - /// A protocol buffer message type. - /// - public sealed partial class Type : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Type()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Type() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Type(Type other) : this() { - name_ = other.name_; - fields_ = other.fields_.Clone(); - oneofs_ = other.oneofs_.Clone(); - options_ = other.options_.Clone(); - sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null; - syntax_ = other.syntax_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Type Clone() { - return new Type(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The fully qualified message name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "fields" field. - public const int FieldsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_fields_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser); - private readonly pbc::RepeatedField fields_ = new pbc::RepeatedField(); - /// - /// The list of fields. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Fields { - get { return fields_; } - } - - /// Field number for the "oneofs" field. - public const int OneofsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_oneofs_codec - = pb::FieldCodec.ForString(26); - private readonly pbc::RepeatedField oneofs_ = new pbc::RepeatedField(); - /// - /// The list of types appearing in `oneof` definitions in this type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Oneofs { - get { return oneofs_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - /// - /// The protocol buffer options. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - /// Field number for the "source_context" field. - public const int SourceContextFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; - /// - /// The source context. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { - get { return sourceContext_; } - set { - sourceContext_ = value; - } - } - - /// Field number for the "syntax" field. - public const int SyntaxFieldNumber = 6; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2; - /// - /// The source syntax. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Type); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Type other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!fields_.Equals(other.fields_)) return false; - if(!oneofs_.Equals(other.oneofs_)) return false; - if(!options_.Equals(other.options_)) return false; - if (!object.Equals(SourceContext, other.SourceContext)) return false; - if (Syntax != other.Syntax) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= fields_.GetHashCode(); - hash ^= oneofs_.GetHashCode(); - hash ^= options_.GetHashCode(); - if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) hash ^= Syntax.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - fields_.WriteTo(output, _repeated_fields_codec); - oneofs_.WriteTo(output, _repeated_oneofs_codec); - options_.WriteTo(output, _repeated_options_codec); - if (sourceContext_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SourceContext); - } - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(48); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - fields_.WriteTo(ref output, _repeated_fields_codec); - oneofs_.WriteTo(ref output, _repeated_oneofs_codec); - options_.WriteTo(ref output, _repeated_options_codec); - if (sourceContext_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SourceContext); - } - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(48); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += fields_.CalculateSize(_repeated_fields_codec); - size += oneofs_.CalculateSize(_repeated_oneofs_codec); - size += options_.CalculateSize(_repeated_options_codec); - if (sourceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); - } - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Type other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - fields_.Add(other.fields_); - oneofs_.Add(other.oneofs_); - options_.Add(other.options_); - if (other.sourceContext_ != null) { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - SourceContext.MergeFrom(other.SourceContext); - } - if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - Syntax = other.Syntax; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - fields_.AddEntriesFrom(input, _repeated_fields_codec); - break; - } - case 26: { - oneofs_.AddEntriesFrom(input, _repeated_oneofs_codec); - break; - } - case 34: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 42: { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(SourceContext); - break; - } - case 48: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - fields_.AddEntriesFrom(ref input, _repeated_fields_codec); - break; - } - case 26: { - oneofs_.AddEntriesFrom(ref input, _repeated_oneofs_codec); - break; - } - case 34: { - options_.AddEntriesFrom(ref input, _repeated_options_codec); - break; - } - case 42: { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(SourceContext); - break; - } - case 48: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - /// - /// A single field of a message type. - /// - public sealed partial class Field : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Field()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Field() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Field(Field other) : this() { - kind_ = other.kind_; - cardinality_ = other.cardinality_; - number_ = other.number_; - name_ = other.name_; - typeUrl_ = other.typeUrl_; - oneofIndex_ = other.oneofIndex_; - packed_ = other.packed_; - options_ = other.options_.Clone(); - jsonName_ = other.jsonName_; - defaultValue_ = other.defaultValue_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Field Clone() { - return new Field(this); - } - - /// Field number for the "kind" field. - public const int KindFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown; - /// - /// The field type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind { - get { return kind_; } - set { - kind_ = value; - } - } - - /// Field number for the "cardinality" field. - public const int CardinalityFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown; - /// - /// The field cardinality. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality { - get { return cardinality_; } - set { - cardinality_ = value; - } - } - - /// Field number for the "number" field. - public const int NumberFieldNumber = 3; - private int number_; - /// - /// The field number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Number { - get { return number_; } - set { - number_ = value; - } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 4; - private string name_ = ""; - /// - /// The field name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type_url" field. - public const int TypeUrlFieldNumber = 6; - private string typeUrl_ = ""; - /// - /// The field type URL, without the scheme, for message or enumeration - /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TypeUrl { - get { return typeUrl_; } - set { - typeUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "oneof_index" field. - public const int OneofIndexFieldNumber = 7; - private int oneofIndex_; - /// - /// The index of the field type in `Type.oneofs`, for message or enumeration - /// types. The first type has index 1; zero means the type is not in the list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int OneofIndex { - get { return oneofIndex_; } - set { - oneofIndex_ = value; - } - } - - /// Field number for the "packed" field. - public const int PackedFieldNumber = 8; - private bool packed_; - /// - /// Whether to use alternative packed wire representation. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Packed { - get { return packed_; } - set { - packed_ = value; - } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 9; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - /// - /// The protocol buffer options. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - /// Field number for the "json_name" field. - public const int JsonNameFieldNumber = 10; - private string jsonName_ = ""; - /// - /// The field JSON name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string JsonName { - get { return jsonName_; } - set { - jsonName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "default_value" field. - public const int DefaultValueFieldNumber = 11; - private string defaultValue_ = ""; - /// - /// The string value of the default value of this field. Proto2 syntax only. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DefaultValue { - get { return defaultValue_; } - set { - defaultValue_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Field); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Field other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Kind != other.Kind) return false; - if (Cardinality != other.Cardinality) return false; - if (Number != other.Number) return false; - if (Name != other.Name) return false; - if (TypeUrl != other.TypeUrl) return false; - if (OneofIndex != other.OneofIndex) return false; - if (Packed != other.Packed) return false; - if(!options_.Equals(other.options_)) return false; - if (JsonName != other.JsonName) return false; - if (DefaultValue != other.DefaultValue) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown) hash ^= Kind.GetHashCode(); - if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown) hash ^= Cardinality.GetHashCode(); - if (Number != 0) hash ^= Number.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); - if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); - if (Packed != false) hash ^= Packed.GetHashCode(); - hash ^= options_.GetHashCode(); - if (JsonName.Length != 0) hash ^= JsonName.GetHashCode(); - if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown) { - output.WriteRawTag(8); - output.WriteEnum((int) Kind); - } - if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown) { - output.WriteRawTag(16); - output.WriteEnum((int) Cardinality); - } - if (Number != 0) { - output.WriteRawTag(24); - output.WriteInt32(Number); - } - if (Name.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Name); - } - if (TypeUrl.Length != 0) { - output.WriteRawTag(50); - output.WriteString(TypeUrl); - } - if (OneofIndex != 0) { - output.WriteRawTag(56); - output.WriteInt32(OneofIndex); - } - if (Packed != false) { - output.WriteRawTag(64); - output.WriteBool(Packed); - } - options_.WriteTo(output, _repeated_options_codec); - if (JsonName.Length != 0) { - output.WriteRawTag(82); - output.WriteString(JsonName); - } - if (DefaultValue.Length != 0) { - output.WriteRawTag(90); - output.WriteString(DefaultValue); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown) { - output.WriteRawTag(8); - output.WriteEnum((int) Kind); - } - if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown) { - output.WriteRawTag(16); - output.WriteEnum((int) Cardinality); - } - if (Number != 0) { - output.WriteRawTag(24); - output.WriteInt32(Number); - } - if (Name.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Name); - } - if (TypeUrl.Length != 0) { - output.WriteRawTag(50); - output.WriteString(TypeUrl); - } - if (OneofIndex != 0) { - output.WriteRawTag(56); - output.WriteInt32(OneofIndex); - } - if (Packed != false) { - output.WriteRawTag(64); - output.WriteBool(Packed); - } - options_.WriteTo(ref output, _repeated_options_codec); - if (JsonName.Length != 0) { - output.WriteRawTag(82); - output.WriteString(JsonName); - } - if (DefaultValue.Length != 0) { - output.WriteRawTag(90); - output.WriteString(DefaultValue); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Kind); - } - if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Cardinality); - } - if (Number != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); - } - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (TypeUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeUrl); - } - if (OneofIndex != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofIndex); - } - if (Packed != false) { - size += 1 + 1; - } - size += options_.CalculateSize(_repeated_options_codec); - if (JsonName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonName); - } - if (DefaultValue.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DefaultValue); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Field other) { - if (other == null) { - return; - } - if (other.Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TypeUnknown) { - Kind = other.Kind; - } - if (other.Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.Unknown) { - Cardinality = other.Cardinality; - } - if (other.Number != 0) { - Number = other.Number; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.TypeUrl.Length != 0) { - TypeUrl = other.TypeUrl; - } - if (other.OneofIndex != 0) { - OneofIndex = other.OneofIndex; - } - if (other.Packed != false) { - Packed = other.Packed; - } - options_.Add(other.options_); - if (other.JsonName.Length != 0) { - JsonName = other.JsonName; - } - if (other.DefaultValue.Length != 0) { - DefaultValue = other.DefaultValue; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Kind = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum(); - break; - } - case 16: { - Cardinality = (global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) input.ReadEnum(); - break; - } - case 24: { - Number = input.ReadInt32(); - break; - } - case 34: { - Name = input.ReadString(); - break; - } - case 50: { - TypeUrl = input.ReadString(); - break; - } - case 56: { - OneofIndex = input.ReadInt32(); - break; - } - case 64: { - Packed = input.ReadBool(); - break; - } - case 74: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 82: { - JsonName = input.ReadString(); - break; - } - case 90: { - DefaultValue = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Kind = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum(); - break; - } - case 16: { - Cardinality = (global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality) input.ReadEnum(); - break; - } - case 24: { - Number = input.ReadInt32(); - break; - } - case 34: { - Name = input.ReadString(); - break; - } - case 50: { - TypeUrl = input.ReadString(); - break; - } - case 56: { - OneofIndex = input.ReadInt32(); - break; - } - case 64: { - Packed = input.ReadBool(); - break; - } - case 74: { - options_.AddEntriesFrom(ref input, _repeated_options_codec); - break; - } - case 82: { - JsonName = input.ReadString(); - break; - } - case 90: { - DefaultValue = input.ReadString(); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the Field message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Basic field types. - /// - public enum Kind { - /// - /// Field type unknown. - /// - [pbr::OriginalName("TYPE_UNKNOWN")] TypeUnknown = 0, - /// - /// Field type double. - /// - [pbr::OriginalName("TYPE_DOUBLE")] TypeDouble = 1, - /// - /// Field type float. - /// - [pbr::OriginalName("TYPE_FLOAT")] TypeFloat = 2, - /// - /// Field type int64. - /// - [pbr::OriginalName("TYPE_INT64")] TypeInt64 = 3, - /// - /// Field type uint64. - /// - [pbr::OriginalName("TYPE_UINT64")] TypeUint64 = 4, - /// - /// Field type int32. - /// - [pbr::OriginalName("TYPE_INT32")] TypeInt32 = 5, - /// - /// Field type fixed64. - /// - [pbr::OriginalName("TYPE_FIXED64")] TypeFixed64 = 6, - /// - /// Field type fixed32. - /// - [pbr::OriginalName("TYPE_FIXED32")] TypeFixed32 = 7, - /// - /// Field type bool. - /// - [pbr::OriginalName("TYPE_BOOL")] TypeBool = 8, - /// - /// Field type string. - /// - [pbr::OriginalName("TYPE_STRING")] TypeString = 9, - /// - /// Field type group. Proto2 syntax only, and deprecated. - /// - [pbr::OriginalName("TYPE_GROUP")] TypeGroup = 10, - /// - /// Field type message. - /// - [pbr::OriginalName("TYPE_MESSAGE")] TypeMessage = 11, - /// - /// Field type bytes. - /// - [pbr::OriginalName("TYPE_BYTES")] TypeBytes = 12, - /// - /// Field type uint32. - /// - [pbr::OriginalName("TYPE_UINT32")] TypeUint32 = 13, - /// - /// Field type enum. - /// - [pbr::OriginalName("TYPE_ENUM")] TypeEnum = 14, - /// - /// Field type sfixed32. - /// - [pbr::OriginalName("TYPE_SFIXED32")] TypeSfixed32 = 15, - /// - /// Field type sfixed64. - /// - [pbr::OriginalName("TYPE_SFIXED64")] TypeSfixed64 = 16, - /// - /// Field type sint32. - /// - [pbr::OriginalName("TYPE_SINT32")] TypeSint32 = 17, - /// - /// Field type sint64. - /// - [pbr::OriginalName("TYPE_SINT64")] TypeSint64 = 18, - } - - /// - /// Whether a field is optional, required, or repeated. - /// - public enum Cardinality { - /// - /// For fields with unknown cardinality. - /// - [pbr::OriginalName("CARDINALITY_UNKNOWN")] Unknown = 0, - /// - /// For optional fields. - /// - [pbr::OriginalName("CARDINALITY_OPTIONAL")] Optional = 1, - /// - /// For required fields. Proto2 syntax only. - /// - [pbr::OriginalName("CARDINALITY_REQUIRED")] Required = 2, - /// - /// For repeated fields. - /// - [pbr::OriginalName("CARDINALITY_REPEATED")] Repeated = 3, - } - - } - #endregion - - } - - /// - /// Enum type definition. - /// - public sealed partial class Enum : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Enum()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Enum() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Enum(Enum other) : this() { - name_ = other.name_; - enumvalue_ = other.enumvalue_.Clone(); - options_ = other.options_.Clone(); - sourceContext_ = other.sourceContext_ != null ? other.sourceContext_.Clone() : null; - syntax_ = other.syntax_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Enum Clone() { - return new Enum(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// Enum type name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "enumvalue" field. - public const int EnumvalueFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_enumvalue_codec - = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser); - private readonly pbc::RepeatedField enumvalue_ = new pbc::RepeatedField(); - /// - /// Enum value definitions. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Enumvalue { - get { return enumvalue_; } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - /// - /// Protocol buffer options. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - /// Field number for the "source_context" field. - public const int SourceContextFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; - /// - /// The source context. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { - get { return sourceContext_; } - set { - sourceContext_ = value; - } - } - - /// Field number for the "syntax" field. - public const int SyntaxFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = global::Google.Protobuf.WellKnownTypes.Syntax.Proto2; - /// - /// The source syntax. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { - get { return syntax_; } - set { - syntax_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Enum); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Enum other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if(!enumvalue_.Equals(other.enumvalue_)) return false; - if(!options_.Equals(other.options_)) return false; - if (!object.Equals(SourceContext, other.SourceContext)) return false; - if (Syntax != other.Syntax) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= enumvalue_.GetHashCode(); - hash ^= options_.GetHashCode(); - if (sourceContext_ != null) hash ^= SourceContext.GetHashCode(); - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) hash ^= Syntax.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - enumvalue_.WriteTo(output, _repeated_enumvalue_codec); - options_.WriteTo(output, _repeated_options_codec); - if (sourceContext_ != null) { - output.WriteRawTag(34); - output.WriteMessage(SourceContext); - } - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(40); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - enumvalue_.WriteTo(ref output, _repeated_enumvalue_codec); - options_.WriteTo(ref output, _repeated_options_codec); - if (sourceContext_ != null) { - output.WriteRawTag(34); - output.WriteMessage(SourceContext); - } - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - output.WriteRawTag(40); - output.WriteEnum((int) Syntax); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += enumvalue_.CalculateSize(_repeated_enumvalue_codec); - size += options_.CalculateSize(_repeated_options_codec); - if (sourceContext_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceContext); - } - if (Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Syntax); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Enum other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - enumvalue_.Add(other.enumvalue_); - options_.Add(other.options_); - if (other.sourceContext_ != null) { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - SourceContext.MergeFrom(other.SourceContext); - } - if (other.Syntax != global::Google.Protobuf.WellKnownTypes.Syntax.Proto2) { - Syntax = other.Syntax; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - enumvalue_.AddEntriesFrom(input, _repeated_enumvalue_codec); - break; - } - case 26: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - case 34: { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(SourceContext); - break; - } - case 40: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - enumvalue_.AddEntriesFrom(ref input, _repeated_enumvalue_codec); - break; - } - case 26: { - options_.AddEntriesFrom(ref input, _repeated_options_codec); - break; - } - case 34: { - if (sourceContext_ == null) { - SourceContext = new global::Google.Protobuf.WellKnownTypes.SourceContext(); - } - input.ReadMessage(SourceContext); - break; - } - case 40: { - Syntax = (global::Google.Protobuf.WellKnownTypes.Syntax) input.ReadEnum(); - break; - } - } - } - } - #endif - - } - - /// - /// Enum value definition. - /// - public sealed partial class EnumValue : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValue()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValue() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValue(EnumValue other) : this() { - name_ = other.name_; - number_ = other.number_; - options_ = other.options_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public EnumValue Clone() { - return new EnumValue(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// Enum value name. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "number" field. - public const int NumberFieldNumber = 2; - private int number_; - /// - /// Enum value number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Number { - get { return number_; } - set { - number_ = value; - } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - /// - /// Protocol buffer options. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as EnumValue); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(EnumValue other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Number != other.Number) return false; - if(!options_.Equals(other.options_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Number != 0) hash ^= Number.GetHashCode(); - hash ^= options_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Number != 0) { - output.WriteRawTag(16); - output.WriteInt32(Number); - } - options_.WriteTo(output, _repeated_options_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Number != 0) { - output.WriteRawTag(16); - output.WriteInt32(Number); - } - options_.WriteTo(ref output, _repeated_options_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Number != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Number); - } - size += options_.CalculateSize(_repeated_options_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(EnumValue other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Number != 0) { - Number = other.Number; - } - options_.Add(other.options_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Number = input.ReadInt32(); - break; - } - case 26: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Number = input.ReadInt32(); - break; - } - case 26: { - options_.AddEntriesFrom(ref input, _repeated_options_codec); - break; - } - } - } - } - #endif - - } - - /// - /// A protocol buffer option, which can be attached to a message, field, - /// enumeration, etc. - /// - public sealed partial class Option : pb::IMessage