diff --git a/.github/mergeable.yml b/.github/mergeable.yml
index ade6c679a47c8..17688527de561 100644
--- a/.github/mergeable.yml
+++ b/.github/mergeable.yml
@@ -9,10 +9,10 @@ mergeable:
- and:
- must_include:
regex: 'release notes: yes'
- message: 'Please include release notes: yes'
+ message: 'Include release notes: yes'
- must_include:
regex: '^(autotools|bazel|c#|c\+\+|cleanup|cmake|conformance tests|integration|go|java|javascript|objective-c|php|protoc|python|ruby|kotlin)'
- message: 'Please include at least a language label (e.g., c++, java, python). Or apply one of the following labels: autotools, bazel, cmake, cleanup, conformance tests, integration, protoc.'
+ message: 'at least a language label (e.g., c++, java, python). Or apply one of the following labels: autotools, bazel, cmake, cleanup, conformance tests, integration, protoc.'
- must_include:
regex: 'release notes: no'
- message: 'Please include release notes: no'
+ message: 'Include release notes: no'
diff --git a/BUILD b/BUILD
index 9fbf69dfca963..df62e9e22bca1 100644
--- a/BUILD
+++ b/BUILD
@@ -2,11 +2,13 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
+load("@rules_pkg//:pkg.bzl", "pkg_zip")
+load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("@rules_python//python:defs.bzl", "py_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
-
+load(":protobuf_release.bzl", "package_naming")
licenses(["notice"])
exports_files(["LICENSE"])
@@ -26,7 +28,6 @@ ZLIB_DEPS = ["@zlib//:zlib"]
################################################################################
MSVC_COPTS = [
- "/DHAVE_PTHREAD",
"/wd4018", # -Wno-sign-compare
"/wd4065", # switch statement contains 'default' but no 'case' labels
"/wd4146", # unary minus operator applied to unsigned type, result still unsigned
@@ -46,7 +47,6 @@ MSVC_COPTS = [
COPTS = select({
":msvc": MSVC_COPTS,
"//conditions:default": [
- "-DHAVE_PTHREAD",
"-DHAVE_ZLIB",
"-Wmissing-field-initializers",
"-Woverloaded-virtual",
@@ -65,6 +65,13 @@ create_compiler_config_setting(
],
)
+# 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 = "android",
values = {
@@ -76,6 +83,17 @@ config_setting(
],
)
+config_setting(
+ name = "android-stlport",
+ values = {
+ "crosstool_top": "@androidndk//:toolchain-stlport",
+ },
+ visibility = [
+ # Public, but Protobuf only visibility.
+ "//:__subpackages__",
+ ],
+)
+
config_setting(
name = "android-libcpp",
values = {
@@ -98,11 +116,24 @@ config_setting(
],
)
+config_setting(
+ name = "android-default",
+ values = {
+ "crosstool_top": "@androidndk//:default_crosstool",
+ },
+ visibility = [
+ # Public, but Protobuf only visibility.
+ "//:__subpackages__",
+ ],
+)
+
# Android and MSVC builds do not need to link in a separate pthread library.
LINK_OPTS = select({
":android": [],
+ ":android-stlport": [],
":android-libcpp": [],
":android-gnu-libstdcpp": [],
+ ":android-default": [],
":msvc": [
# Suppress linker warnings about files with no symbols defined.
"-ignore:4221",
@@ -147,6 +178,7 @@ cc_library(
"src/google/protobuf/message_lite.cc",
"src/google/protobuf/parse_context.cc",
"src/google/protobuf/repeated_field.cc",
+ "src/google/protobuf/repeated_ptr_field.cc",
"src/google/protobuf/stubs/bytestream.cc",
"src/google/protobuf/stubs/common.cc",
"src/google/protobuf/stubs/int128.cc",
@@ -488,6 +520,70 @@ cc_binary(
deps = [":protoc_lib"],
)
+
+################################################################################
+# Generates protoc release artifacts.
+################################################################################
+
+genrule(
+ name = "protoc_readme",
+ visibility = ["//visibility:private"],
+ cmd = """
+echo "Protocol Buffers - Google's data interchange format
+Copyright 2008 Google Inc.
+https://developers.google.com/protocol-buffers/
+This package contains a precompiled binary version of the protocol buffer
+compiler (protoc). This binary is intended for users who want to use Protocol
+Buffers in languages other than C++ but do not want to compile protoc
+themselves. To install, simply place this binary somewhere in your PATH.
+If you intend to use the included well known types then don't forget to
+copy the contents of the 'include' directory somewhere as well, for example
+into '/usr/local/include/'.
+Please refer to our official github site for more installation instructions:
+ https://github.com/protocolbuffers/protobuf" > $@
+ """,
+ outs = ["readme.txt"],
+)
+
+# plugin.proto is excluded from this list because it belongs in a nested folder (protobuf/compiler/plugin.proto)
+pkg_files(
+ name = "wkt_protos_files",
+ srcs = [value[0] for value in WELL_KNOWN_PROTO_MAP.values() if not value[0].endswith("plugin.proto")],
+ visibility = ["//visibility:private"],
+ prefix = "include/google/protobuf",
+)
+
+pkg_files(
+ name = "compiler_plugin_protos_files",
+ srcs = ["src/google/protobuf/compiler/plugin.proto"],
+ visibility = ["//visibility:private"],
+ prefix = "include/google/protobuf/compiler",
+)
+
+pkg_files(
+ name = "protoc_files",
+ srcs = [":protoc"],
+ attributes = pkg_attributes(mode = "0555"),
+ visibility = ["//visibility:private"],
+ prefix = "bin/",
+)
+
+package_naming(
+ name = "protoc_pkg_naming",
+)
+
+pkg_zip(
+ name = "protoc_release",
+ package_file_name = "protoc-{version}-{platform}.zip",
+ package_variables = ":protoc_pkg_naming",
+ srcs = [
+ ":protoc_files",
+ ":wkt_protos_files",
+ ":compiler_plugin_protos_files",
+ "readme.txt",
+ ],
+)
+
################################################################################
# Tests
################################################################################
@@ -560,6 +656,8 @@ RELATIVE_TEST_PROTOS = [
TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS]
GENERIC_RELATIVE_TEST_PROTOS = [
+ "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",
@@ -953,7 +1051,6 @@ py_proto_library(
protoc = ":protoc",
py_libs = [
":python_srcs",
- "@six//:six",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
@@ -1087,7 +1184,7 @@ proto_library(
name = "generated_protos_proto",
srcs = [
"src/google/protobuf/unittest_import_public.proto",
- "unittest_gen.proto",
+ "unittest_gen_import.proto",
],
)
@@ -1095,7 +1192,7 @@ py_proto_library(
name = "generated_protos_py",
srcs = [
"src/google/protobuf/unittest_import_public.proto",
- "unittest_gen.proto",
+ "unittest_gen_import.proto",
],
default_runtime = "",
protoc = ":protoc",
@@ -1225,6 +1322,19 @@ cc_binary(
# ],
# )
+
+java_proto_library(
+ name = "java_test_protos",
+ deps = [":generic_test_protos"],
+ visibility = ["//java:__subpackages__"],
+)
+
+java_lite_proto_library(
+ name = "java_lite_test_protos",
+ deps = [":generic_test_protos"],
+ visibility = ["//java:__subpackages__"],
+)
+
java_proto_library(
name = "test_messages_proto2_java_proto",
visibility = [
@@ -1318,3 +1428,146 @@ filegroup(
srcs = glob(["**/*.bzl"]),
visibility = ["//visibility:public"],
)
+
+# Kotlin proto rules
+
+genrule(
+ name = "gen_kotlin_unittest_lite",
+ srcs = [
+ "src/google/protobuf/unittest_lite.proto",
+ "src/google/protobuf/unittest_import_lite.proto",
+ "src/google/protobuf/unittest_import_public_lite.proto",
+ "src/google/protobuf/map_lite_unittest.proto",
+ ],
+ outs = [
+ "TestAllTypesLiteKt.kt",
+ "ForeignMessageLiteKt.kt",
+ "TestAllExtensionsLiteKt.kt",
+ "TestEmptyMessageLiteKt.kt",
+ "TestEmptyMessageWithExtensionsLiteKt.kt",
+ "TestMapLiteKt.kt",
+ "OptionalGroup_extension_liteKt.kt",
+ "RepeatedGroup_extension_liteKt.kt",
+ ],
+ visibility = ["//java:__subpackages__"],
+ cmd = "$(location //:protoc) " +
+ "--kotlin_out=lite:$(@D) -Isrc/ " +
+ "$(locations src/google/protobuf/unittest_lite.proto) && " +
+ "$(location //:protoc) " +
+ "--kotlin_out=lite:$(@D) -Isrc/ " +
+ "$(locations src/google/protobuf/map_lite_unittest.proto) && " +
+ "cp $(@D)/com/google/protobuf/TestAllTypesLiteKt.kt " +
+ "$(location TestAllTypesLiteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/ForeignMessageLiteKt.kt " +
+ "$(location ForeignMessageLiteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/TestAllExtensionsLiteKt.kt " +
+ "$(location TestAllExtensionsLiteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/TestAllTypesLiteKt.kt " +
+ "$(location TestAllTypesLiteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/TestEmptyMessageLiteKt.kt " +
+ "$(location TestEmptyMessageLiteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/TestEmptyMessageWithExtensionsLiteKt.kt " +
+ "$(location TestEmptyMessageWithExtensionsLiteKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestMapLiteKt.kt " +
+ "$(location TestMapLiteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/OptionalGroup_extension_liteKt.kt " +
+ "$(location OptionalGroup_extension_liteKt.kt) && " +
+ "cp $(@D)/com/google/protobuf/RepeatedGroup_extension_liteKt.kt " +
+ "$(location RepeatedGroup_extension_liteKt.kt)",
+ tools = [":protoc"],
+)
+
+genrule(
+ name = "gen_kotlin_unittest",
+ srcs = [
+ "src/google/protobuf/unittest.proto",
+ "src/google/protobuf/unittest_import.proto",
+ "src/google/protobuf/unittest_import_public.proto",
+ "src/google/protobuf/map_proto2_unittest.proto",
+ ],
+ outs = [
+ "TestAllTypesKt.kt",
+ "ForeignMessageKt.kt",
+ "TestAllExtensionsKt.kt",
+ "TestEmptyMessageKt.kt",
+ "TestEmptyMessageWithExtensionsKt.kt",
+ "TestIntIntMapKt.kt",
+ "TestEnumMapKt.kt",
+ "TestMapsKt.kt",
+ "OptionalGroup_extensionKt.kt",
+ "RepeatedGroup_extensionKt.kt",
+ ],
+ visibility = ["//java:__subpackages__"],
+ cmd = "$(location //:protoc) " +
+ "--kotlin_out=shared,immutable:$(@D) -Isrc/ " +
+ "$(location src/google/protobuf/unittest.proto) && " +
+ "$(location //:protoc) " +
+ "--kotlin_out=shared,immutable:$(@D) -Isrc/ " +
+ "$(location src/google/protobuf/map_proto2_unittest.proto) && " +
+ "cp $(@D)/protobuf_unittest/TestAllTypesKt.kt " +
+ "$(location TestAllTypesKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/ForeignMessageKt.kt " +
+ "$(location ForeignMessageKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestAllExtensionsKt.kt " +
+ "$(location TestAllExtensionsKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestEmptyMessageKt.kt " +
+ "$(location TestEmptyMessageKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestEmptyMessageWithExtensionsKt.kt " +
+ "$(location TestEmptyMessageWithExtensionsKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestIntIntMapKt.kt " +
+ "$(location TestIntIntMapKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestEnumMapKt.kt " +
+ "$(location TestEnumMapKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/TestMapsKt.kt " +
+ "$(location TestMapsKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/OptionalGroup_extensionKt.kt " +
+ "$(location OptionalGroup_extensionKt.kt) && " +
+ "cp $(@D)/protobuf_unittest/RepeatedGroup_extensionKt.kt " +
+ "$(location RepeatedGroup_extensionKt.kt)",
+ tools = ["//:protoc"],
+)
+
+genrule(
+ name = "gen_kotlin_proto3_unittest_lite",
+ srcs = [
+ "src/google/protobuf/unittest_proto3_lite.proto",
+ "src/google/protobuf/unittest_import.proto",
+ "src/google/protobuf/unittest_import_public.proto",
+ ],
+ outs = [
+ "TestAllTypesProto3LiteKt.kt",
+ "TestEmptyMessageProto3LiteKt.kt",
+ ],
+ visibility = ["//java:__subpackages__"],
+ cmd = "$(location //:protoc) " +
+ "--kotlin_out=lite:$(@D) -Isrc/ " +
+ "$(location src/google/protobuf/unittest_proto3_lite.proto) && " +
+ "cp $(@D)/proto3_lite_unittest/TestAllTypesKt.kt " +
+ "$(location TestAllTypesProto3LiteKt.kt) && " +
+ "cp $(@D)/proto3_lite_unittest/TestEmptyMessageKt.kt " +
+ "$(location TestEmptyMessageProto3LiteKt.kt)",
+ tools = ["//:protoc"],
+)
+
+genrule(
+ name = "gen_kotlin_proto3_unittest",
+ srcs = [
+ "src/google/protobuf/unittest_proto3.proto",
+ "src/google/protobuf/unittest_import.proto",
+ "src/google/protobuf/unittest_import_public.proto",
+ ],
+ outs = [
+ "TestAllTypesProto3Kt.kt",
+ "TestEmptyMessageProto3Kt.kt",
+ ],
+ visibility = ["//java:__subpackages__"],
+ cmd = "$(location //:protoc) " +
+ "--kotlin_out=shared,immutable:$(@D) -Isrc/ " +
+ "$(location src/google/protobuf/unittest_proto3.proto) && " +
+ "cp $(@D)/proto3_unittest/TestAllTypesKt.kt " +
+ "$(location TestAllTypesProto3Kt.kt) && " +
+ "cp $(@D)/proto3_unittest/TestEmptyMessageKt.kt " +
+ "$(location TestEmptyMessageProto3Kt.kt)",
+ tools = ["//:protoc"],
+)
+
diff --git a/CHANGES.txt b/CHANGES.txt
index 7682fbdd19707..ea9e6afaefbdc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,110 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
- Protocol Compiler
+
+ Ruby
+ * JSON will now output shorter strings for double and float fields when possible
+ without losing precision.
+ * Encoding and decoding of binary format will now work properly on big-endian
+ systems.
+ * UTF-8 verification was fixed to properly reject surrogate code points.
+ * Unknown enums for proto2 protos now properly implement proto2's behavior of
+ putting such values in unknown fields.
+
+2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Python
+ * Make libprotobuf symbols local on OSX to fix issue #9395 (#9435)
+
+ Ruby
+ * Fixed a data loss bug that could occur when the number of `optional`
+ fields in a message is an exact multiple of 32. (#9440).
+
+ PHP
+ * Fixed a data loss bug that could occur when the number of `optional`
+ fields in a message is an exact multiple of 32. (#9440).
+
+2022-01-10 version 3.19.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Python
+ * Fix missing Windows wheel for Python 3.10 on PyPI
+
+2022-01-05 version 3.19.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Java
+ * Improve performance characteristics of UnknownFieldSet parsing (#9371)
+ * This release addresses a Security Advisory for Java users
+ (https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-wrvw-hg22-4m67)
+
+2022-01-05 version 3.18.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Java
+ * Improve performance characteristics of UnknownFieldSet parsing (#9371)
+ * This release addresses a Security Advisory for Java users
+ (https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-wrvw-hg22-4m67)
+
+2022-01-05 version 3.16.1 (Java)
+
+ Java
+ * Improve performance characteristics of UnknownFieldSet parsing (#9371)
+ * This release addresses a Security Advisory for Java users
+ (https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-wrvw-hg22-4m67)
+
+2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Bazel
+ * Ensure that release archives contain everything needed for Bazel (#9131)
+ * Align dependency handling with Bazel best practices (#9165)
+
+ JavaScript
+ * Fix `ReferenceError: window is not defined` when getting the global object (#9156)
+
+ Ruby
+ * Fix memory leak in MessageClass.encode (#9150)
+
+2021-10-15 version 3.19.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ C++
* Make proto2::Message::DiscardUnknownFields() non-virtual
+ * Separate RepeatedPtrField into its own header file
+ * For default floating point values of 0, consider all bits significant
+ * cmake: support `MSVC_RUNTIME_LIBRARY` property (#8851)
+ * Fix shadowing warnings (#8926)
+ * Fix for issue #8484, constant initialization doesn't compile in msvc clang-cl environment (#8993)
+ * Fix build on AIX and SunOS (#8373) (#9065)
+ * Add Android stlport and default toolchains to BUILD. (#8290)
+
+ Java
+ * For default floating point values of 0, consider all bits significant
+ * Annotate `//java/com/google/protobuf/util/...` with nullness annotations
+ * Use ArrayList copy constructor (#7853)
+
+ Kotlin
+ * Switch Kotlin proto DSLs to be implemented with inline value classes
+ * Fix inlining and deprecation for repeated string fields in kotlin (#9120)
+
+ Python
+ * Proto2 DecodeError now includes message name in error message
+ * Make MessageToDict convert map keys to strings (#8122)
+ * Add python-requires in setup.py (#8989)
+ * Add python 3.10 (#9034)
+
+ JavaScript
+ * Skip exports if not available by CommonJS (#8856)
+ * JS: Comply with CSP no-unsafe-eval. (#8864)
+
+ PHP
+ * Added "object" as a reserved name for PHP (#8962)
+
+ Ruby
+ * Override Map.clone to use Map's dup method (#7938)
+ * Ruby: build extensions for arm64-darwin (#8232)
+ * Add class method Timestamp.from_time to ruby well known types (#8562)
+ * Adopt pure ruby DSL implementation for JRuby (#9047)
+ * Add size to Map class (#8068)
+ * Fix for descriptor_pb.rb: google/protobuf should be required first (#9121)
+
+ C#
+ * Correctly set ExtensionRegistry when parsing with MessageParser, but using an already existing CodedInputStream (#7246)
+ * [C#] Make FieldDescriptor propertyName public (#7642)
2021-10-04 version 3.18.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index db1ff31cac6c4..8ef5dd29c85c6 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
@@ -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
diff --git a/Makefile.am b/Makefile.am
index 6fb1c84fc54e8..858eedfa7495f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1011,6 +1011,7 @@ python_EXTRA_DIST= \
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/builder.py \
python/google/protobuf/internal/containers.py \
python/google/protobuf/internal/decoder.py \
python/google/protobuf/internal/descriptor_database_test.py \
@@ -1426,7 +1427,6 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
examples/pubspec.yaml \
protobuf.bzl \
protobuf_deps.bzl \
- third_party/six.BUILD \
third_party/zlib.BUILD \
util/python/BUILD \
internal.bzl
diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec
index f285e58af8e3d..9b8fae51a732b 100644
--- a/Protobuf-C++.podspec
+++ b/Protobuf-C++.podspec
@@ -35,9 +35,6 @@ Pod::Spec.new do |s|
# Do not let src/google/protobuf/stubs/time.h override system API
'USE_HEADERMAP' => 'NO',
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
-
- # Configure tool is not being used for Xcode. When building, assume pthread is supported.
- 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "HAVE_PTHREAD=1"',
}
end
diff --git a/Protobuf.podspec b/Protobuf.podspec
index 4a5f7dd9c17fd..67c31141ce028 100644
--- a/Protobuf.podspec
+++ b/Protobuf.podspec
@@ -5,10 +5,10 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
- s.version = '3.18.1'
+ s.version = '3.19.4'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
- s.license = '3-Clause BSD License'
+ s.license = 'BSD-3-Clause'
s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
s.cocoapods_version = '>= 1.0'
diff --git a/WORKSPACE b/WORKSPACE
index 2174cabf8c8fa..36df3f33714cf 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -27,7 +27,7 @@ http_archive(
)
# Load common dependencies.
-load("//:protobuf_deps.bzl", "protobuf_deps")
+load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps")
protobuf_deps()
bind(
@@ -36,68 +36,33 @@ bind(
)
load("@rules_jvm_external//:defs.bzl", "maven_install")
+
maven_install(
- artifacts = [
- "com.google.code.gson:gson:2.8.6",
- "com.google.errorprone:error_prone_annotations:2.3.2",
- "com.google.j2objc:j2obj_annotations:1.3",
- "com.google.guava:guava:30.1.1-jre",
- "com.google.truth:truth:1.1.2",
- "junit:junit:4.12",
- "org.easymock:easymock:3.2",
- ],
+ 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",
],
- # For updating instructions, see:
- # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson
- maven_install_json = "//:maven_install.json",
)
load("@maven//:defs.bzl", "pinned_maven_install")
-pinned_maven_install()
-bind(
- name = "guava",
- actual = "@maven//:com_google_guava_guava",
-)
-
-bind(
- name = "gson",
- actual = "@maven//:com_google_code_gson_gson",
-)
-
-bind(
- name = "error_prone_annotations",
- actual = "@maven//:com_google_errorprone_error_prone_annotations",
-)
-
-bind(
- name = "j2objc_annotations",
- actual = "@maven//:com_google_j2objc_j2objc_annotations",
-)
+pinned_maven_install()
-bind(
- name = "junit",
- actual = "@maven//:junit_junit",
-)
+# For `cc_proto_blacklist_test` and `build_test`.
+load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
-bind(
- name = "easymock",
- actual = "@maven//:org_easymock_easymock",
-)
+bazel_skylib_workspace()
-bind(
- name = "easymock_classextension",
- actual = "@maven//:org_easymock_easymockclassextension",
-)
+load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
+rules_pkg_dependencies()
-bind(
- name = "truth",
- actual = "@maven//:com_google_truth_truth",
-)
+# For `kt_jvm_library`
+load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
+kotlin_repositories()
-# For `cc_proto_blacklist_test` and `build_test`.
-load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
-bazel_skylib_workspace()
+load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
+kt_register_toolchains()
diff --git a/appveyor.bat b/appveyor.bat
index 7a35ceb4d678e..005fb11f891c5 100644
--- a/appveyor.bat
+++ b/appveyor.bat
@@ -38,7 +38,7 @@ 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 netcoreapp3.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
goto :EOF
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 9c25c7803d254..f708afd9cb166 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -4,8 +4,8 @@
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)
+numbers of officially supported languages, see [Protobuf Performance](
+https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md).
## Prerequisite
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index caa92150c7d7b..51e8478f6e211 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -127,9 +127,6 @@ if (protobuf_DISABLE_RTTI)
endif()
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)
@@ -209,6 +206,8 @@ if (MSVC)
# Build with multiple processes
add_definitions(/MP)
endif()
+ # Set source file and execution character sets to UTF-8
+ add_definitions(/utf-8)
# MSVC warning suppressions
add_definitions(
/wd4018 # 'expression' : signed/unsigned mismatch
diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
index 8e26aedd18355..2f53be0dad3f0 100644
--- a/cmake/extract_includes.bat.in
+++ b/cmake/extract_includes.bat.in
@@ -41,6 +41,8 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_gene
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\python\python_pyi_generator.h" include\google\protobuf\compiler\python\python_pyi_generator.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_helpers.h" include\google\protobuf\compiler\python\python_helpers.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
@@ -48,6 +50,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\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\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.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_access_listener.h" include\google\protobuf\field_access_listener.h
@@ -92,6 +95,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" inclu
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\repeated_ptr_field.h" include\google\protobuf\repeated_ptr_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
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index f36a7acf6c04e..0ee65e20f8437 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -2,9 +2,9 @@ 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/arenastring.cc
+ ${protobuf_source_dir}/src/google/protobuf/arenaz_sampler.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_tctable_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
@@ -38,15 +38,13 @@ set(libprotobuf_lite_includes
${protobuf_source_dir}/src/google/protobuf/arena.h
${protobuf_source_dir}/src/google/protobuf/arena_impl.h
${protobuf_source_dir}/src/google/protobuf/arenastring.h
+ ${protobuf_source_dir}/src/google/protobuf/arenaz_sampler.h
${protobuf_source_dir}/src/google/protobuf/explicitly_constructed.h
${protobuf_source_dir}/src/google/protobuf/extension_set.h
${protobuf_source_dir}/src/google/protobuf/extension_set_inl.h
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.h
- ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.h
- ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.h
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_decl.h
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h
- ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.inc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
${protobuf_source_dir}/src/google/protobuf/has_bits.h
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index e4b810c66a4f9..1f5ae5ab04550 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -14,7 +14,6 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.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/generated_message_tctable_full.cc
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/printer.cc
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index 505e469d07f0a..ed20f31c75aa1 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -91,6 +91,8 @@ set(libprotoc_files
${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/python/python_helpers.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_pyi_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
@@ -117,6 +119,7 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h
${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_pyi_generator.h
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h
)
diff --git a/cmake/protobuf-module.cmake.in b/cmake/protobuf-module.cmake.in
index 810256e54cfb4..09b9d29c22123 100644
--- a/cmake/protobuf-module.cmake.in
+++ b/cmake/protobuf-module.cmake.in
@@ -110,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.
#
@@ -139,10 +129,6 @@ _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)
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 9ede4f328caeb..aa069febd2359 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -131,6 +131,7 @@ 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/arenaz_sampler_test.cc
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.h
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -155,6 +156,7 @@ set(tests_files
${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/generated_message_tctable_lite_test.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
diff --git a/conformance/ConformanceJava.java b/conformance/ConformanceJava.java
index 100bec4b54f09..f724548d7cb6c 100644
--- a/conformance/ConformanceJava.java
+++ b/conformance/ConformanceJava.java
@@ -361,7 +361,7 @@ private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest re
case TEXT_FORMAT:
return Conformance.ConformanceResponse.newBuilder()
- .setTextPayload(TextFormat.printToString(testMessage))
+ .setTextPayload(TextFormat.printer().printToString(testMessage))
.build();
default:
diff --git a/conformance/conformance_python.py b/conformance/conformance_python.py
index 37ee36e24c51f..f81275244067f 100755
--- a/conformance/conformance_python.py
+++ b/conformance/conformance_python.py
@@ -39,8 +39,8 @@
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 google3.third_party.protobuf import test_messages_proto3_pb2
+from google3.third_party.protobuf import test_messages_proto2_pb2
from google.protobuf import text_format
import conformance_pb2
diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc
index 1572ac03b5f49..19222c7a7ceac 100644
--- a/conformance/conformance_test_runner.cc
+++ b/conformance/conformance_test_runner.cc
@@ -162,7 +162,7 @@ void ForkPipeRunner::RunTest(
// We failed to read from the child, assume a crash and try to reap.
GOOGLE_LOG(INFO) << "Trying to reap child, pid=" << child_pid_;
- int status;
+ int status = 0;
waitpid(child_pid_, &status, WEXITED);
string error_msg;
diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec
index 8e5786fdbdd46..098d79d09cb7e 100644
--- a/csharp/Google.Protobuf.Tools.nuspec
+++ b/csharp/Google.Protobuf.Tools.nuspec
@@ -5,7 +5,7 @@
Google Protocol Buffers toolsTools for Protocol Buffers - Google's data interchange format.See project site for more info.
- 3.18.1
+ 3.19.4Google Inc.protobuf-packageshttps://github.com/protocolbuffers/protobuf/blob/master/LICENSE
diff --git a/csharp/NuGet.Config b/csharp/NuGet.Config
new file mode 100644
index 0000000000000..b04b00689fcb4
--- /dev/null
+++ b/csharp/NuGet.Config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/csharp/build_packages.bat b/csharp/build_packages.bat
index d7205659f103a..9e68229037f5a 100644
--- a/csharp/build_packages.bat
+++ b/csharp/build_packages.bat
@@ -1,7 +1,7 @@
@rem Builds Google.Protobuf NuGet packages
dotnet restore src/Google.Protobuf.sln
-dotnet pack -c Release src/Google.Protobuf.sln || goto :error
+dotnet pack -c Release src/Google.Protobuf.sln -p:ContinuousIntegrationBuild=true || goto :error
goto :EOF
diff --git a/csharp/buildall.sh b/csharp/buildall.sh
index 43b5ac3ffb29a..ab1a6c425aaab 100755
--- a/csharp/buildall.sh
+++ b/csharp/buildall.sh
@@ -10,8 +10,8 @@ dotnet restore $SRC/Google.Protobuf.sln
dotnet build -c $CONFIG $SRC/Google.Protobuf.sln
echo Running tests.
-# Only test netcoreapp2.1, which uses the .NET Core runtime.
+# Only test netcoreapp3.1, which uses the .NET Core runtime.
# If we want to test the .NET 4.5 version separately, we could
# run Mono explicitly. However, we don't have any differences between
# the .NET 4.5 and netstandard2.1 assemblies.
-dotnet test -c $CONFIG -f netcoreapp2.1 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+dotnet test -c $CONFIG -f netcoreapp3.1 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index cbb6fee5f7d41..0ecdf37abb953 100644
--- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -2,7 +2,7 @@
Exe
- net451;netcoreapp2.1
+ net451;netcoreapp3.1../../keys/Google.Protobuf.snktrueFalse
diff --git a/csharp/compatibility_tests/v3.0.0/test.sh b/csharp/compatibility_tests/v3.0.0/test.sh
index f893d64aba830..459c0798794ca 100755
--- a/csharp/compatibility_tests/v3.0.0/test.sh
+++ b/csharp/compatibility_tests/v3.0.0/test.sh
@@ -22,7 +22,7 @@ function run_test() {
dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj
dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
- dotnet run -c Release -f netcoreapp2.1 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+ dotnet run -c Release -f netcoreapp3.1 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
}
set -ex
diff --git a/csharp/install_dotnet_sdk.ps1 b/csharp/install_dotnet_sdk.ps1
index c78655cc027ea..f9dc0d9d7ac38 100755
--- a/csharp/install_dotnet_sdk.ps1
+++ b/csharp/install_dotnet_sdk.ps1
@@ -16,5 +16,5 @@ Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
# The SDK versions to install should be kept in sync with versions
# installed by kokoro/linux/dockerfile/test/csharp/Dockerfile
-&$InstallScriptPath -Version 2.1.802
-&$InstallScriptPath -Version 5.0.102
+&$InstallScriptPath -Version 3.1.415
+&$InstallScriptPath -Version 6.0.100
diff --git a/csharp/src/AddressBook/AddressBook.csproj b/csharp/src/AddressBook/AddressBook.csproj
index f3268c0acf3e3..9a527874ce81a 100644
--- a/csharp/src/AddressBook/AddressBook.csproj
+++ b/csharp/src/AddressBook/AddressBook.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.1ExeGoogle.Protobuf.Examples.AddressBook.ProgramFalse
diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs
index 2e88db9a18abd..484a2296a72b5 100644
--- a/csharp/src/AddressBook/Addressbook.cs
+++ b/csharp/src/AddressBook/Addressbook.cs
@@ -32,9 +32,10 @@ static AddressbookReflection() {
"Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy",
"c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N",
"RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy",
- "EC50dXRvcmlhbC5QZXJzb25CZgobY29tLmV4YW1wbGUudHV0b3JpYWwucHJv",
- "dG9zQhFBZGRyZXNzQm9va1Byb3Rvc1ABWgsuLi90dXRvcmlhbKoCJEdvb2ds",
- "ZS5Qcm90b2J1Zi5FeGFtcGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
+ "EC50dXRvcmlhbC5QZXJzb25ClQEKG2NvbS5leGFtcGxlLnR1dG9yaWFsLnBy",
+ "b3Rvc0IRQWRkcmVzc0Jvb2tQcm90b3NQAVo6Z2l0aHViLmNvbS9wcm90b2Nv",
+ "bGJ1ZmZlcnMvcHJvdG9idWYvZXhhbXBsZXMvZ28vdHV0b3JpYWxwYqoCJEdv",
+ "b2dsZS5Qcm90b2J1Zi5FeGFtcGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
diff --git a/csharp/src/Google.Protobuf.Benchmarks/Program.cs b/csharp/src/Google.Protobuf.Benchmarks/Program.cs
index 1f77a26135eba..037752f6b78ec 100644
--- a/csharp/src/Google.Protobuf.Benchmarks/Program.cs
+++ b/csharp/src/Google.Protobuf.Benchmarks/Program.cs
@@ -36,7 +36,7 @@ namespace Google.Protobuf.Benchmarks
{
class Program
{
- // typical usage: dotnet run -c Release -f netcoreapp2.1
+ // typical usage: dotnet run -c Release -f netcoreapp3.1
// (this can profile both .net core and .net framework; for some reason
// if you start from "-f net461", it goes horribly wrong)
public static void Main(string[] args)
diff --git a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
index ec8fb9138947c..6277e6898a584 100644
--- a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
+++ b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.1ExeFalse
diff --git a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
index fee35be9910d3..b2c4272628a8e 100644
--- a/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
+++ b/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.1ExeFalse
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj b/csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj
index 9f2ba6b0deeb9..5030043d760b4 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/Google.Protobuf.Test.TestProtos.csproj
@@ -1,4 +1,4 @@
-
+
-
+
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
index d2db53d06ae61..94f089c3f2184 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
@@ -25,7 +25,7 @@ static TestMessagesProto2Reflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Cipnb29nbGUvcHJvdG9idWYvdGVzdF9tZXNzYWdlc19wcm90bzIucHJvdG8S",
- "HXByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yIqQ+ChJUZXN0QWxsVHlw",
+ "HXByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yIsQ+ChJUZXN0QWxsVHlw",
"ZXNQcm90bzISFgoOb3B0aW9uYWxfaW50MzIYASABKAUSFgoOb3B0aW9uYWxf",
"aW50NjQYAiABKAMSFwoPb3B0aW9uYWxfdWludDMyGAMgASgNEhcKD29wdGlv",
"bmFsX3VpbnQ2NBgEIAEoBBIXCg9vcHRpb25hbF9zaW50MzIYBSABKBESFwoP",
@@ -148,79 +148,81 @@ static TestMessagesProto2Reflection() {
"NTY3ODkxMjM0NTY3ODkSHQoNZGVmYXVsdF9mbG9hdBj7ASABKAI6BTllKzA5",
"Eh4KDmRlZmF1bHRfZG91YmxlGPwBIAEoAToFN2UrMjISGwo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gFIhYKFE51",
- "bGxIeXBvdGhlc2lzUHJvdG8yIi8KDkVudW1Pbmx5UHJvdG8yIh0KBEJvb2wS",
- "CgoGa0ZhbHNlEAASCQoFa1RydWUQASpGChFGb3JlaWduRW51bVByb3RvMhIP",
- "CgtGT1JFSUdOX0ZPTxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9C",
- "QVoQAjpKCg9leHRlbnNpb25faW50MzISMS5wcm90b2J1Zl90ZXN0X21lc3Nh",
- "Z2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIYeCABKAVCLwooY29tLmdv",
- "b2dsZS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMkgB+AEB"));
+ "b3RvMhh4IAEoBUIvCihjb20uZ29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2Fn",
+ "ZXMucHJvdG8ySAH4AQE="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto2.ForeignEnumProto2), }, new pb::Extension[] { TestMessagesProto2Extensions.ExtensionInt32 }, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedNestedEnum", "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedNestedEnum", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "Data", "DefaultInt32", "DefaultInt64", "DefaultUint32", "DefaultUint64", "DefaultSint32", "DefaultSint64", "DefaultFixed32", "DefaultFixed64", "DefaultSfixed32", "DefaultSfixed64", "DefaultFloat", "DefaultDouble", "DefaultBool", "DefaultString", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedNestedEnum", "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedNestedEnum", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "Data", "DefaultInt32", "DefaultInt64", "DefaultUint32", "DefaultUint64", "DefaultSint32", "DefaultSint64", "DefaultFixed32", "DefaultFixed64", "DefaultSfixed32", "DefaultSfixed64", "DefaultFloat", "DefaultDouble", "DefaultBool", "DefaultString", "DefaultBytes", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null, null),
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.Data), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.Data.Parser, new[]{ "GroupInt32", "GroupUint32" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrect), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrect.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Parser, new[]{ "Str" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension }, null),
@@ -228,7 +230,8 @@ static TestMessagesProto2Reflection() {
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.ForeignMessageProto2), global::ProtobufTestMessages.Proto2.ForeignMessageProto2.Parser, new[]{ "C" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.UnknownToTestAllTypes), global::ProtobufTestMessages.Proto2.UnknownToTestAllTypes.Parser, new[]{ "OptionalInt32", "OptionalString", "NestedMessage", "OptionalGroup", "OptionalBool", "RepeatedInt32" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.UnknownToTestAllTypes.Types.OptionalGroup), global::ProtobufTestMessages.Proto2.UnknownToTestAllTypes.Types.OptionalGroup.Parser, new[]{ "A" }, null, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.NullHypothesisProto2), global::ProtobufTestMessages.Proto2.NullHypothesisProto2.Parser, null, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.EnumOnlyProto2), global::ProtobufTestMessages.Proto2.EnumOnlyProto2.Parser, null, null, new[]{ typeof(global::ProtobufTestMessages.Proto2.EnumOnlyProto2.Types.Bool) }, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.EnumOnlyProto2), global::ProtobufTestMessages.Proto2.EnumOnlyProto2.Parser, null, null, new[]{ typeof(global::ProtobufTestMessages.Proto2.EnumOnlyProto2.Types.Bool) }, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.OneStringProto2), global::ProtobufTestMessages.Proto2.OneStringProto2.Parser, new[]{ "Data" }, null, null, null, null)
}));
}
#endregion
@@ -404,6 +407,7 @@ public TestAllTypesProto2(TestAllTypesProto2 other) : this() {
defaultDouble_ = other.defaultDouble_;
defaultBool_ = other.defaultBool_;
defaultString_ = other.defaultString_;
+ defaultBytes_ = other.defaultBytes_;
fieldname1_ = other.fieldname1_;
fieldName2_ = other.fieldName2_;
FieldName3_ = other.FieldName3_;
@@ -2394,6 +2398,32 @@ public void ClearDefaultString() {
defaultString_ = null;
}
+ /// Field number for the "default_bytes" field.
+ public const int DefaultBytesFieldNumber = 255;
+ private readonly static pb::ByteString DefaultBytesDefaultValue = pb::ByteString.FromBase64("am9zaHVh");
+
+ private pb::ByteString defaultBytes_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public pb::ByteString DefaultBytes {
+ get { return defaultBytes_ ?? DefaultBytesDefaultValue; }
+ set {
+ defaultBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+ /// Gets whether the "default_bytes" field is set
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public bool HasDefaultBytes {
+ get { return defaultBytes_ != null; }
+ }
+ /// Clears the value of the "default_bytes" field
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void ClearDefaultBytes() {
+ defaultBytes_ = null;
+ }
+
/// Field number for the "fieldname1" field.
public const int Fieldname1FieldNumber = 401;
private readonly static int Fieldname1DefaultValue = 0;
@@ -3041,6 +3071,7 @@ public bool Equals(TestAllTypesProto2 other) {
if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DefaultDouble, other.DefaultDouble)) return false;
if (DefaultBool != other.DefaultBool) return false;
if (DefaultString != other.DefaultString) return false;
+ if (DefaultBytes != other.DefaultBytes) return false;
if (Fieldname1 != other.Fieldname1) return false;
if (FieldName2 != other.FieldName2) return false;
if (FieldName3 != other.FieldName3) return false;
@@ -3184,6 +3215,7 @@ public override int GetHashCode() {
if (HasDefaultDouble) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DefaultDouble);
if (HasDefaultBool) hash ^= DefaultBool.GetHashCode();
if (HasDefaultString) hash ^= DefaultString.GetHashCode();
+ if (HasDefaultBytes) hash ^= DefaultBytes.GetHashCode();
if (HasFieldname1) hash ^= Fieldname1.GetHashCode();
if (HasFieldName2) hash ^= FieldName2.GetHashCode();
if (HasFieldName3) hash ^= FieldName3.GetHashCode();
@@ -3477,6 +3509,10 @@ public void WriteTo(pb::CodedOutputStream output) {
output.WriteRawTag(242, 15);
output.WriteString(DefaultString);
}
+ if (HasDefaultBytes) {
+ output.WriteRawTag(250, 15);
+ output.WriteBytes(DefaultBytes);
+ }
if (HasFieldname1) {
output.WriteRawTag(136, 25);
output.WriteInt32(Fieldname1);
@@ -3815,6 +3851,10 @@ public void WriteTo(pb::CodedOutputStream output) {
output.WriteRawTag(242, 15);
output.WriteString(DefaultString);
}
+ if (HasDefaultBytes) {
+ output.WriteRawTag(250, 15);
+ output.WriteBytes(DefaultBytes);
+ }
if (HasFieldname1) {
output.WriteRawTag(136, 25);
output.WriteInt32(Fieldname1);
@@ -4106,6 +4146,9 @@ public int CalculateSize() {
if (HasDefaultString) {
size += 2 + pb::CodedOutputStream.ComputeStringSize(DefaultString);
}
+ if (HasDefaultBytes) {
+ size += 2 + pb::CodedOutputStream.ComputeBytesSize(DefaultBytes);
+ }
if (HasFieldname1) {
size += 2 + pb::CodedOutputStream.ComputeInt32Size(Fieldname1);
}
@@ -4366,6 +4409,9 @@ public void MergeFrom(TestAllTypesProto2 other) {
if (other.HasDefaultString) {
DefaultString = other.DefaultString;
}
+ if (other.HasDefaultBytes) {
+ DefaultBytes = other.DefaultBytes;
+ }
if (other.HasFieldname1) {
Fieldname1 = other.Fieldname1;
}
@@ -4988,6 +5034,10 @@ public void MergeFrom(pb::CodedInputStream input) {
DefaultString = input.ReadString();
break;
}
+ case 2042: {
+ DefaultBytes = input.ReadBytes();
+ break;
+ }
case 3208: {
Fieldname1 = input.ReadInt32();
break;
@@ -5594,6 +5644,10 @@ public void MergeFrom(pb::CodedInputStream input) {
DefaultString = input.ReadString();
break;
}
+ case 2042: {
+ DefaultBytes = input.ReadBytes();
+ break;
+ }
case 3208: {
Fieldname1 = input.ReadInt32();
break;
@@ -8043,6 +8097,209 @@ public enum Bool {
}
+ public sealed partial class OneStringProto2 : pb::IMessage
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ , pb::IBufferMessage
+ #endif
+ {
+ private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneStringProto2());
+ private pb::UnknownFieldSet _unknownFields;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public static pb::MessageParser Parser { get { return _parser; } }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public static pbr::MessageDescriptor Descriptor {
+ get { return global::ProtobufTestMessages.Proto2.TestMessagesProto2Reflection.Descriptor.MessageTypes[5]; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ pbr::MessageDescriptor pb::IMessage.Descriptor {
+ get { return Descriptor; }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public OneStringProto2() {
+ OnConstruction();
+ }
+
+ partial void OnConstruction();
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public OneStringProto2(OneStringProto2 other) : this() {
+ data_ = other.data_;
+ _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public OneStringProto2 Clone() {
+ return new OneStringProto2(this);
+ }
+
+ /// Field number for the "data" field.
+ public const int DataFieldNumber = 1;
+ private readonly static string DataDefaultValue = "";
+
+ private string data_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public string Data {
+ get { return data_ ?? DataDefaultValue; }
+ set {
+ data_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+ }
+ }
+ /// Gets whether the "data" field is set
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public bool HasData {
+ get { return data_ != null; }
+ }
+ /// Clears the value of the "data" field
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void ClearData() {
+ data_ = null;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public override bool Equals(object other) {
+ return Equals(other as OneStringProto2);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public bool Equals(OneStringProto2 other) {
+ if (ReferenceEquals(other, null)) {
+ return false;
+ }
+ if (ReferenceEquals(other, this)) {
+ return true;
+ }
+ if (Data != other.Data) return false;
+ return Equals(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public override int GetHashCode() {
+ int hash = 1;
+ if (HasData) hash ^= Data.GetHashCode();
+ if (_unknownFields != null) {
+ hash ^= _unknownFields.GetHashCode();
+ }
+ return hash;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public override string ToString() {
+ return pb::JsonFormatter.ToDiagnosticString(this);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void WriteTo(pb::CodedOutputStream output) {
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ output.WriteRawMessage(this);
+ #else
+ if (HasData) {
+ output.WriteRawTag(10);
+ output.WriteString(Data);
+ }
+ if (_unknownFields != null) {
+ _unknownFields.WriteTo(output);
+ }
+ #endif
+ }
+
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
+ if (HasData) {
+ output.WriteRawTag(10);
+ output.WriteString(Data);
+ }
+ if (_unknownFields != null) {
+ _unknownFields.WriteTo(ref output);
+ }
+ }
+ #endif
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public int CalculateSize() {
+ int size = 0;
+ if (HasData) {
+ size += 1 + pb::CodedOutputStream.ComputeStringSize(Data);
+ }
+ if (_unknownFields != null) {
+ size += _unknownFields.CalculateSize();
+ }
+ return size;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public void MergeFrom(OneStringProto2 other) {
+ if (other == null) {
+ return;
+ }
+ if (other.HasData) {
+ Data = other.Data;
+ }
+ _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ 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: {
+ Data = input.ReadString();
+ break;
+ }
+ }
+ }
+ #endif
+ }
+
+ #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ 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: {
+ Data = input.ReadString();
+ break;
+ }
+ }
+ }
+ }
+ #endif
+
+ }
+
#endregion
}
diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index 61453e5ab2e6d..ff8f5cc6b1181 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
@@ -840,7 +840,7 @@ public void NaNValuesComparedBitwise()
var list2 = new RepeatedField { SampleNaNs.Regular, SampleNaNs.PayloadFlipped };
var list3 = new RepeatedField { SampleNaNs.Regular, SampleNaNs.SignallingFlipped };
- // All SampleNaNs have the same hashcode under certain targets (e.g. netcoreapp2.1)
+ // All SampleNaNs have the same hashcode under certain targets (e.g. netcoreapp3.1)
EqualityTester.AssertInequality(list1, list2, checkHashcode: false);
EqualityTester.AssertEquality(list1, list3);
Assert.True(list1.Contains(SampleNaNs.SignallingFlipped));
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
index 1abed60563c86..894d914124939 100644
--- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
+++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
@@ -380,5 +380,18 @@ public void RoundTrip_NestedExtensionGroup()
TestGroupExtension.Parser.WithExtensionRegistry(new ExtensionRegistry() { TestNestedExtension.Extensions.OptionalGroupExtension }),
message);
}
+
+ [Test]
+ public void RoundTrip_ParseUsingCodedInput()
+ {
+ var message = new TestAllExtensions();
+ message.SetExtension(UnittestExtensions.OptionalBoolExtension, true);
+ byte[] bytes = message.ToByteArray();
+ using (CodedInputStream input = new CodedInputStream(bytes))
+ {
+ var parsed = TestAllExtensions.Parser.WithExtensionRegistry(new ExtensionRegistry() { UnittestExtensions.OptionalBoolExtension }).ParseFrom(input);
+ Assert.AreEqual(message, parsed);
+ }
+ }
}
}
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index cdfa98e09874c..deb17e9f52e47 100644
--- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -1,7 +1,7 @@
- net451;netcoreapp2.1;net50
+ net451;netcoreapp3.1;net60../../keys/Google.Protobuf.snktrueFalse
@@ -21,7 +21,7 @@
-
+
diff --git a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
index 69c9eb6e998b5..eb8996e620f65 100644
--- a/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonParserTest.cs
@@ -35,6 +35,7 @@
using Google.Protobuf.WellKnownTypes;
using NUnit.Framework;
using ProtobufTestMessages.Proto2;
+using ProtobufTestMessages.Proto3;
using System;
using UnitTest.Issues.TestProtos;
@@ -551,13 +552,9 @@ public void NumberToDouble_Valid(string jsonValue, double expectedParsedValue)
}
[Test]
- // Skip these test cases in .NET 5 because floating point parsing supports bigger values.
- // These big values won't throw an error in the test.
-#if !NET5_0
[TestCase("1.7977e308")]
[TestCase("-1.7977e308")]
[TestCase("1e309")]
-#endif
[TestCase("1,0")]
[TestCase("1.0.0")]
[TestCase("+1")]
@@ -922,10 +919,10 @@ public void Bytes_InvalidBase64(string badBase64)
}
[Test]
- [TestCase("\"FOREIGN_BAR\"", ForeignEnum.ForeignBar)]
- [TestCase("5", ForeignEnum.ForeignBar)]
- [TestCase("100", (ForeignEnum)100)]
- public void EnumValid(string value, ForeignEnum expectedValue)
+ [TestCase("\"FOREIGN_BAR\"", TestProtos.ForeignEnum.ForeignBar)]
+ [TestCase("5", TestProtos.ForeignEnum.ForeignBar)]
+ [TestCase("100", (TestProtos.ForeignEnum)100)]
+ public void EnumValid(string value, TestProtos.ForeignEnum expectedValue)
{
string json = "{ \"singleForeignEnum\": " + value + " }";
var parsed = TestAllTypes.Parser.ParseJson(json);
@@ -1025,5 +1022,128 @@ internal static string WrapInQuotes(string text)
{
return '"' + text + '"';
}
+
+ [Test]
+ public void ParseAllNullValues()
+ {
+ string json = @"{
+ ""optionalInt32"": null,
+ ""optionalInt64"": null,
+ ""optionalUint32"": null,
+ ""optionalUint64"": null,
+ ""optionalSint32"": null,
+ ""optionalSint64"": null,
+ ""optionalFixed32"": null,
+ ""optionalFixed64"": null,
+ ""optionalSfixed32"": null,
+ ""optionalSfixed64"": null,
+ ""optionalFloat"": null,
+ ""optionalDouble"": null,
+ ""optionalBool"": null,
+ ""optionalString"": null,
+ ""optionalBytes"": null,
+ ""optionalNestedEnum"": null,
+ ""optionalNestedMessage"": null,
+ ""repeatedInt32"": null,
+ ""repeatedInt64"": null,
+ ""repeatedUint32"": null,
+ ""repeatedUint64"": null,
+ ""repeatedSint32"": null,
+ ""repeatedSint64"": null,
+ ""repeatedFixed32"": null,
+ ""repeatedFixed64"": null,
+ ""repeatedSfixed32"": null,
+ ""repeatedSfixed64"": null,
+ ""repeatedFloat"": null,
+ ""repeatedDouble"": null,
+ ""repeatedBool"": null,
+ ""repeatedString"": null,
+ ""repeatedBytes"": null,
+ ""repeatedNestedEnum"": null,
+ ""repeatedNestedMessage"": null,
+ ""mapInt32Int32"": null,
+ ""mapBoolBool"": null,
+ ""mapStringNestedMessage"": null
+}";
+
+ TestAllTypesProto3 message = new TestAllTypesProto3();
+
+ message.OptionalInt32 = 1;
+ message.OptionalInt64 = 1;
+ message.OptionalUint32 = 1;
+ message.OptionalUint64 = 1;
+ message.OptionalSint32 = 1;
+ message.OptionalSint64 = 1;
+ message.OptionalFixed32 = 1;
+ message.OptionalFixed64 = 1;
+ message.OptionalSfixed32 = 1;
+ message.OptionalSfixed64 = 1;
+ message.OptionalFloat = 1;
+ message.OptionalDouble = 1;
+ message.OptionalBool = true;
+ message.OptionalString = "1";
+ message.OptionalBytes = ByteString.CopyFrom(new byte[] { 1 });
+ message.OptionalNestedEnum = TestAllTypesProto3.Types.NestedEnum.Bar;
+ message.OptionalNestedMessage = new TestAllTypesProto3.Types.NestedMessage();
+ message.RepeatedInt32.Add(1);
+ message.RepeatedInt64.Add(1);
+ message.RepeatedUint32.Add(1);
+ message.RepeatedUint64.Add(1);
+ message.RepeatedSint32.Add(1);
+ message.RepeatedSint64.Add(1);
+ message.RepeatedFixed32.Add(1);
+ message.RepeatedFixed64.Add(1);
+ message.RepeatedSfixed32.Add(1);
+ message.RepeatedSfixed64.Add(1);
+ message.RepeatedFloat.Add(1);
+ message.RepeatedDouble.Add(1);
+ message.RepeatedBool.Add(true);
+ message.RepeatedString.Add("1");
+ message.RepeatedBytes.Add(ByteString.CopyFrom(new byte[] { 1 }));
+ message.RepeatedNestedEnum.Add(TestAllTypesProto3.Types.NestedEnum.Bar);
+ message.RepeatedNestedMessage.Add(new TestAllTypesProto3.Types.NestedMessage());
+ message.MapInt32Int32.Add(1, 1);
+ message.MapBoolBool.Add(true, true);
+ message.MapStringNestedMessage.Add(" ", new TestAllTypesProto3.Types.NestedMessage());
+
+ JsonParser.Default.Merge(message, json);
+
+ Assert.AreEqual(0, message.OptionalInt32);
+ Assert.AreEqual(0, message.OptionalInt64);
+ Assert.AreEqual(0, message.OptionalUint32);
+ Assert.AreEqual(0, message.OptionalUint64);
+ Assert.AreEqual(0, message.OptionalSint32);
+ Assert.AreEqual(0, message.OptionalSint64);
+ Assert.AreEqual(0, message.OptionalFixed32);
+ Assert.AreEqual(0, message.OptionalFixed64);
+ Assert.AreEqual(0, message.OptionalSfixed32);
+ Assert.AreEqual(0, message.OptionalSfixed64);
+ Assert.AreEqual(0, message.OptionalFloat);
+ Assert.AreEqual(0, message.OptionalDouble);
+ Assert.AreEqual(false, message.OptionalBool);
+ Assert.AreEqual("", message.OptionalString);
+ Assert.AreEqual(ByteString.Empty, message.OptionalBytes);
+ Assert.AreEqual(TestAllTypesProto3.Types.NestedEnum.Foo, message.OptionalNestedEnum);
+ Assert.AreEqual(null, message.OptionalNestedMessage);
+ Assert.AreEqual(0, message.RepeatedInt32.Count);
+ Assert.AreEqual(0, message.RepeatedInt64.Count);
+ Assert.AreEqual(0, message.RepeatedUint32.Count);
+ Assert.AreEqual(0, message.RepeatedUint64.Count);
+ Assert.AreEqual(0, message.RepeatedSint32.Count);
+ Assert.AreEqual(0, message.RepeatedSint64.Count);
+ Assert.AreEqual(0, message.RepeatedFixed32.Count);
+ Assert.AreEqual(0, message.RepeatedFixed64.Count);
+ Assert.AreEqual(0, message.RepeatedSfixed32.Count);
+ Assert.AreEqual(0, message.RepeatedFloat.Count);
+ Assert.AreEqual(0, message.RepeatedDouble.Count);
+ Assert.AreEqual(0, message.RepeatedBool.Count);
+ Assert.AreEqual(0, message.RepeatedString.Count);
+ Assert.AreEqual(0, message.RepeatedBytes.Count);
+ Assert.AreEqual(0, message.RepeatedNestedEnum.Count);
+ Assert.AreEqual(0, message.RepeatedNestedMessage.Count);
+ Assert.AreEqual(0, message.MapInt32Int32.Count);
+ Assert.AreEqual(0, message.MapBoolBool.Count);
+ Assert.AreEqual(0, message.MapStringNestedMessage.Count);
+ }
}
}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs b/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
index 0cbc0a4ff8ec8..df43effd4ff0f 100644
--- a/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
+++ b/csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
@@ -199,12 +199,8 @@ public void NumberValue(string json, double expectedValue)
[TestCase("1e-")]
[TestCase("--")]
[TestCase("--1")]
- // Skip these test cases in .NET 5 because floating point parsing supports bigger values.
- // These big values won't throw an error in the test.
-#if !NET5_0
[TestCase("-1.7977e308")]
[TestCase("1.7977e308")]
-#endif
public void InvalidNumberValue(string json)
{
AssertThrowsAfter(json);
diff --git a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
index fab983d463517..65c8b8267fbd5 100644
--- a/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
@@ -124,6 +124,7 @@ private void TestFileDescriptor(FileDescriptor file, FileDescriptor importedFile
}
Assert.AreEqual(10, file.SerializedData[0]);
+ TestDescriptorToProto(file.ToProto, file.Proto);
}
[Test]
@@ -231,6 +232,7 @@ public void MessageDescriptor()
{
Assert.AreEqual(i, messageType.EnumTypes[i].Index);
}
+ TestDescriptorToProto(messageType.ToProto, messageType.Proto);
}
[Test]
@@ -294,6 +296,11 @@ public void TestFieldDescriptor(
// For a field in a regular onoef, ContainingOneof and RealContainingOneof should be the same.
Assert.AreEqual("oneof_field", fieldInOneof.ContainingOneof.Name);
Assert.AreSame(fieldInOneof.ContainingOneof, fieldInOneof.RealContainingOneof);
+
+ TestDescriptorToProto(primitiveField.ToProto, primitiveField.Proto);
+ TestDescriptorToProto(enumField.ToProto, enumField.Proto);
+ TestDescriptorToProto(foreignMessageField.ToProto, foreignMessageField.Proto);
+ TestDescriptorToProto(fieldInOneof.ToProto, fieldInOneof.Proto);
}
[Test]
@@ -338,6 +345,8 @@ public void EnumDescriptor()
{
Assert.AreEqual(i, enumType.Values[i].Index);
}
+ TestDescriptorToProto(enumType.ToProto, enumType.Proto);
+ TestDescriptorToProto(nestedType.ToProto, nestedType.Proto);
}
[Test]
@@ -361,6 +370,7 @@ public void OneofDescriptor()
}
CollectionAssert.AreEquivalent(expectedFields, descriptor.Fields);
+ TestDescriptorToProto(descriptor.ToProto, descriptor.Proto);
}
[Test]
@@ -370,6 +380,7 @@ public void MapEntryMessageDescriptor()
Assert.IsNull(descriptor.Parser);
Assert.IsNull(descriptor.ClrType);
Assert.IsNull(descriptor.Fields[1].Accessor);
+ TestDescriptorToProto(descriptor.ToProto, descriptor.Proto);
}
// From TestFieldOrdering:
@@ -391,6 +402,7 @@ public void DescriptorProtoFileDescriptor()
{
var descriptor = Google.Protobuf.Reflection.FileDescriptor.DescriptorProtoFileDescriptor;
Assert.AreEqual("google/protobuf/descriptor.proto", descriptor.Name);
+ TestDescriptorToProto(descriptor.ToProto, descriptor.Proto);
}
[Test]
@@ -453,5 +465,17 @@ public void SyntheticOneofReflection()
}
}
}
+
+ private static void TestDescriptorToProto(Func toProtoFunction, IMessage expectedProto)
+ {
+ var clone1 = toProtoFunction();
+ var clone2 = toProtoFunction();
+ Assert.AreNotSame(clone1, clone2);
+ Assert.AreNotSame(clone1, expectedProto);
+ Assert.AreNotSame(clone2, expectedProto);
+
+ Assert.AreEqual(clone1, clone2);
+ Assert.AreEqual(clone1, expectedProto);
+ }
}
}
diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb
index f1f44f1c54670..2fc4b53029fe3 100644
Binary files a/csharp/src/Google.Protobuf.Test/testprotos.pb and b/csharp/src/Google.Protobuf.Test/testprotos.pb differ
diff --git a/csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMemberTypes.cs b/csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMemberTypes.cs
new file mode 100644
index 0000000000000..a4d739d80298a
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMemberTypes.cs
@@ -0,0 +1,127 @@
+#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 !NET5_0_OR_GREATER
+// Copied with permission from https://github.com/dotnet/runtime/tree/8fbf206d0e518b45ca855832e8bfb391afa85972/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
+namespace System.Diagnostics.CodeAnalysis
+{
+ ///
+ /// Specifies the types of members that are dynamically accessed.
+ ///
+ /// This enumeration has a attribute that allows a
+ /// bitwise combination of its member values.
+ ///
+ [Flags]
+ internal enum DynamicallyAccessedMemberTypes
+ {
+ ///
+ /// Specifies no members.
+ ///
+ None = 0,
+
+ ///
+ /// Specifies the default, parameterless public constructor.
+ ///
+ PublicParameterlessConstructor = 0x0001,
+
+ ///
+ /// Specifies all public constructors.
+ ///
+ PublicConstructors = 0x0002 | PublicParameterlessConstructor,
+
+ ///
+ /// Specifies all non-public constructors.
+ ///
+ NonPublicConstructors = 0x0004,
+
+ ///
+ /// Specifies all public methods.
+ ///
+ PublicMethods = 0x0008,
+
+ ///
+ /// Specifies all non-public methods.
+ ///
+ NonPublicMethods = 0x0010,
+
+ ///
+ /// Specifies all public fields.
+ ///
+ PublicFields = 0x0020,
+
+ ///
+ /// Specifies all non-public fields.
+ ///
+ NonPublicFields = 0x0040,
+
+ ///
+ /// Specifies all public nested types.
+ ///
+ PublicNestedTypes = 0x0080,
+
+ ///
+ /// Specifies all non-public nested types.
+ ///
+ NonPublicNestedTypes = 0x0100,
+
+ ///
+ /// Specifies all public properties.
+ ///
+ PublicProperties = 0x0200,
+
+ ///
+ /// Specifies all non-public properties.
+ ///
+ NonPublicProperties = 0x0400,
+
+ ///
+ /// Specifies all public events.
+ ///
+ PublicEvents = 0x0800,
+
+ ///
+ /// Specifies all non-public events.
+ ///
+ NonPublicEvents = 0x1000,
+
+ ///
+ /// Specifies all interfaces implemented by the type.
+ ///
+ Interfaces = 0x2000,
+
+ ///
+ /// Specifies all members.
+ ///
+ All = ~None
+ }
+}
+#endif
diff --git a/csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMembersAttribute.cs b/csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMembersAttribute.cs
new file mode 100644
index 0000000000000..ae0927623474d
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Compatibility/DynamicallyAccessedMembersAttribute.cs
@@ -0,0 +1,83 @@
+#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 !NET5_0_OR_GREATER
+// Copied with permission from https://github.com/dotnet/runtime/tree/8fbf206d0e518b45ca855832e8bfb391afa85972/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
+namespace System.Diagnostics.CodeAnalysis
+{
+ ///
+ /// Indicates that certain members on a specified are accessed dynamically,
+ /// for example through .
+ ///
+ ///
+ /// This allows tools to understand which members are being accessed during the execution
+ /// of a program.
+ ///
+ /// This attribute is valid on members whose type is or .
+ ///
+ /// When this attribute is applied to a location of type , the assumption is
+ /// that the string represents a fully qualified type name.
+ ///
+ /// When this attribute is applied to a class, interface, or struct, the members specified
+ /// can be accessed dynamically on instances returned from calling
+ /// on instances of that class, interface, or struct.
+ ///
+ /// If the attribute is applied to a method it's treated as a special case and it implies
+ /// the attribute should be applied to the "this" parameter of the method. As such the attribute
+ /// should only be used on instance methods of types assignable to System.Type (or string, but no methods
+ /// will use it there).
+ ///
+ [AttributeUsage(
+ AttributeTargets.Field | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter |
+ AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Method |
+ AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct,
+ Inherited = false)]
+ internal sealed class DynamicallyAccessedMembersAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class
+ /// with the specified member types.
+ ///
+ /// The types of members dynamically accessed.
+ public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
+ {
+ MemberTypes = memberTypes;
+ }
+
+ ///
+ /// Gets the which specifies the type
+ /// of members dynamically accessed.
+ ///
+ public DynamicallyAccessedMemberTypes MemberTypes { get; }
+ }
+}
+#endif
diff --git a/csharp/src/Google.Protobuf/Compatibility/RequiresUnreferencedCodeAttribute.cs b/csharp/src/Google.Protobuf/Compatibility/RequiresUnreferencedCodeAttribute.cs
new file mode 100644
index 0000000000000..1fc8e66d49b16
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Compatibility/RequiresUnreferencedCodeAttribute.cs
@@ -0,0 +1,72 @@
+#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 !NET5_0_OR_GREATER
+// Copied with permission from https://github.com/dotnet/runtime/tree/8fbf206d0e518b45ca855832e8bfb391afa85972/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
+namespace System.Diagnostics.CodeAnalysis
+{
+ ///
+ /// Indicates that the specified method requires dynamic access to code that is not referenced
+ /// statically, for example through .
+ ///
+ ///
+ /// This allows tools to understand which methods are unsafe to call when removing unreferenced
+ /// code from an application.
+ ///
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
+ internal sealed class RequiresUnreferencedCodeAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class
+ /// with the specified message.
+ ///
+ ///
+ /// A message that contains information about the usage of unreferenced code.
+ ///
+ public RequiresUnreferencedCodeAttribute(string message)
+ {
+ Message = message;
+ }
+
+ ///
+ /// Gets a message that contains information about the usage of unreferenced code.
+ ///
+ public string Message { get; }
+
+ ///
+ /// Gets or sets an optional URL that contains more information about the method,
+ /// why it requires unreferenced code, and what options a consumer has to deal with it.
+ ///
+ public string Url { get; set; }
+ }
+}
+#endif
diff --git a/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs b/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
index 2f23713819f6a..b3acda2da7667 100644
--- a/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
+++ b/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs
@@ -31,6 +31,7 @@
#endregion
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
#if !NET35
@@ -59,7 +60,11 @@ internal static bool IsAssignableFrom(this Type target, Type c)
/// including inherited properties or null if there is no such public property.
/// Here, "public property" means a property where either the getter, or the setter, or both, is public.
///
- internal static PropertyInfo GetProperty(this Type target, string name)
+ [UnconditionalSuppressMessage("Trimming", "IL2072",
+ Justification = "The BaseType of the target will have all properties because of the annotation.")]
+ internal static PropertyInfo GetProperty(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)]
+ this Type target, string name)
{
// GetDeclaredProperty only returns properties declared in the given type, so we need to recurse.
while (target != null)
@@ -86,7 +91,11 @@ internal static PropertyInfo GetProperty(this Type target, string name)
/// class Child : Base declares public void Foo(long)).
///
/// One type in the hierarchy declared more than one method with the same name
- internal static MethodInfo GetMethod(this Type target, string name)
+ [UnconditionalSuppressMessage("Trimming", "IL2072",
+ Justification = "The BaseType of the target will have all properties because of the annotation.")]
+ internal static MethodInfo GetMethod(
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
+ this Type target, string name)
{
// GetDeclaredMethod only returns methods declared in the given type, so we need to recurse.
while (target != null)
diff --git a/csharp/src/Google.Protobuf/Compatibility/UnconditionalSuppressMessageAttribute.cs b/csharp/src/Google.Protobuf/Compatibility/UnconditionalSuppressMessageAttribute.cs
new file mode 100644
index 0000000000000..a02a1453ebb3e
--- /dev/null
+++ b/csharp/src/Google.Protobuf/Compatibility/UnconditionalSuppressMessageAttribute.cs
@@ -0,0 +1,117 @@
+#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 !NET5_0_OR_GREATER
+// Copied with permission from https://github.com/dotnet/runtime/tree/8fbf206d0e518b45ca855832e8bfb391afa85972/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
+namespace System.Diagnostics.CodeAnalysis
+{
+ ///
+ /// Suppresses reporting of a specific rule violation, allowing multiple suppressions on a
+ /// single code artifact.
+ ///
+ ///
+ /// is different than
+ /// in that it doesn't have a
+ /// . So it is always preserved in the compiled assembly.
+ ///
+ [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
+ internal sealed class UnconditionalSuppressMessageAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the
+ /// class, specifying the category of the tool and the identifier for an analysis rule.
+ ///
+ /// The category for the attribute.
+ /// The identifier of the analysis rule the attribute applies to.
+ public UnconditionalSuppressMessageAttribute(string category, string checkId)
+ {
+ Category = category;
+ CheckId = checkId;
+ }
+
+ ///
+ /// Gets the category identifying the classification of the attribute.
+ ///
+ ///
+ /// The property describes the tool or tool analysis category
+ /// for which a message suppression attribute applies.
+ ///
+ public string Category { get; }
+
+ ///
+ /// Gets the identifier of the analysis tool rule to be suppressed.
+ ///
+ ///
+ /// Concatenated together, the and
+ /// properties form a unique check identifier.
+ ///
+ public string CheckId { get; }
+
+ ///
+ /// Gets or sets the scope of the code that is relevant for the attribute.
+ ///
+ ///
+ /// The Scope property is an optional argument that specifies the metadata scope for which
+ /// the attribute is relevant.
+ ///
+ public string Scope { get; set; }
+
+ ///
+ /// Gets or sets a fully qualified path that represents the target of the attribute.
+ ///
+ ///
+ /// The property is an optional argument identifying the analysis target
+ /// of the attribute. An example value is "System.IO.Stream.ctor():System.Void".
+ /// Because it is fully qualified, it can be long, particularly for targets such as parameters.
+ /// The analysis tool user interface should be capable of automatically formatting the parameter.
+ ///
+ public string Target { get; set; }
+
+ ///
+ /// Gets or sets an optional argument expanding on exclusion criteria.
+ ///
+ ///
+ /// The property is an optional argument that specifies additional
+ /// exclusion where the literal metadata target is not sufficiently precise. For example,
+ /// the cannot be applied within a method,
+ /// and it may be desirable to suppress a violation against a statement in the method that will
+ /// give a rule violation, but not against all statements in the method.
+ ///
+ public string MessageId { get; set; }
+
+ ///
+ /// Gets or sets the justification for suppressing the code analysis message.
+ ///
+ public string Justification { get; set; }
+ }
+}
+#endif
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
index f6d6069102ef7..8c2a68a1cd856 100644
--- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
@@ -1,10 +1,10 @@
-
+C# runtime library for Protocol Buffers - Google's data interchange format.Copyright 2015, Google Inc.Google Protocol Buffers
- 3.18.1
+ 3.19.47.2Google Inc.
@@ -15,12 +15,14 @@
Protocol;Buffers;Binary;Serialization;Format;Google;proto;proto3C# proto3 supporthttps://github.com/protocolbuffers/protobuf
- https://github.com/protocolbuffers/protobuf/blob/master/LICENSE
+ BSD-3-Clausegithttps://github.com/protocolbuffers/protobuf.git
- True
+ true
+ true$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+ true
@@ -43,7 +45,7 @@
-
+
diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs
index 4bffd58c1f406..17fdc7f738664 100644
--- a/csharp/src/Google.Protobuf/JsonFormatter.cs
+++ b/csharp/src/Google.Protobuf/JsonFormatter.cs
@@ -40,6 +40,7 @@
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
+using System.Diagnostics.CodeAnalysis;
namespace Google.Protobuf
{
@@ -879,6 +880,8 @@ private static class OriginalEnumValueHelper
private static readonly Dictionary> dictionaries
= new Dictionary>();
+ [UnconditionalSuppressMessage("Trimming", "IL2072",
+ Justification = "The field for the value must still be present. It will be returned by reflection, will be in this collection, and its name can be resolved.")]
internal static string GetOriginalName(object value)
{
var enumType = value.GetType();
@@ -898,21 +901,13 @@ internal static string GetOriginalName(object value)
return originalName;
}
-#if NET35
- // TODO: Consider adding functionality to TypeExtensions to avoid this difference.
- private static Dictionary