From abe77ae13efb7112385fbe683bf6c44900ddd8a6 Mon Sep 17 00:00:00 2001 From: johnnyshields Date: Sat, 14 May 2022 11:41:32 +0900 Subject: [PATCH 01/27] Backport: Ruby: support x64-mingw-ucrt platform, which is the new platform which Windows Ruby Installer uses as of Ruby 3.1 --- ruby/Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruby/Rakefile b/ruby/Rakefile index 8b5b68d85..d8ac763e0 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -103,7 +103,7 @@ else ext.lib_dir = "lib/google" ext.cross_compile = true ext.cross_platform = [ - 'x86-mingw32', 'x64-mingw32', + 'x86-mingw32', 'x64-mingw32', 'x64-mingw-ucrt', 'x86_64-linux', 'x86-linux', 'x86_64-darwin', 'arm64-darwin', ] @@ -126,7 +126,7 @@ else task 'gem:windows' do sh "rm Gemfile.lock" require 'rake_compiler_dock' - ['x86-mingw32', 'x64-mingw32', 'x86_64-linux', 'x86-linux'].each do |plat| + ['x86-mingw32', 'x64-mingw32', 'x64-mingw-ucrt', 'x86_64-linux', 'x86-linux'].each do |plat| RakeCompilerDock.sh <<-"EOT", platform: plat bundle && \ IN_DOCKER=true rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem RUBY_CC_VERSION=3.1.0:3.0.0:2.7.0:2.6.0:2.5.0 From d3edfa29b743ef7303e0ddd7b4bc03bf2ff6a7fe Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Mon, 16 May 2022 16:44:24 +0000 Subject: [PATCH 02/27] Use osx-aarch_64 artifact --- protoc-artifacts/pom.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 7f285cae4..45c2123f1 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -71,11 +71,7 @@ exe - - ${basedir}/target/osx/x86_64/protoc.exe + ${basedir}/target/osx/aarch_64/protoc.exe osx-aarch_64 exe From 8353e1975683e4cbf451f6283ee1b2b43e5002b4 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 16 May 2022 17:10:27 +0000 Subject: [PATCH 03/27] Updated to the newest upb, which brings many fixes for Windows builds. --- protobuf_deps.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 0f3c76aac..966d506fd 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -114,6 +114,6 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "c3cfd09b0184bcbdade71a3d788df02c83e897f2", - sha256 = "4a9f79385fc0c1e3e7ba5c34220db53f956c8c42d636bafc6a563da2facf8c3f", + commit = "a60e9a379e976c1b8828145b8475618601cb9cee", + sha256 = "f5e021b986c62848c59f07fd68988e1bc50e782694710906374e4bd905db5c9f", ) From 0f3ee3b625b9b87e562f4544deb3290383fbe188 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Mon, 16 May 2022 22:48:41 +0000 Subject: [PATCH 04/27] Fix protoc_release target --- BUILD.bazel | 2 ++ pkg/BUILD.bazel | 33 ++++++++++++--------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 044e01e4f..476371733 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -186,6 +186,8 @@ exports_files( srcs = [ "src/google/protobuf/any.proto", "src/google/protobuf/api.proto", + "src/google/protobuf/compiler/plugin.proto", + "src/google/protobuf/descriptor.proto", "src/google/protobuf/duration.proto", "src/google/protobuf/empty.proto", "src/google/protobuf/field_mask.proto", diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index 0de27d3a2..ecce255a2 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -17,25 +17,17 @@ package_naming( pkg_files( name = "wkt_protos_files", srcs = [ - "//:any_proto", - "//:api_proto", - "//:duration_proto", - "//:empty_proto", - "//:field_mask_proto", - "//:source_context_proto", - "//:struct_proto", - "//:timestamp_proto", - "//:type_proto", - "//:wrappers_proto", - ], - prefix = "include/google/protobuf", - visibility = ["//visibility:private"], -) - -pkg_files( - name = "descriptor_protos_files", - srcs = [ - "//:descriptor_proto", + "//:src/google/protobuf/any.proto", + "//:src/google/protobuf/api.proto", + "//:src/google/protobuf/descriptor.proto", + "//:src/google/protobuf/duration.proto", + "//:src/google/protobuf/empty.proto", + "//:src/google/protobuf/field_mask.proto", + "//:src/google/protobuf/source_context.proto", + "//:src/google/protobuf/struct.proto", + "//:src/google/protobuf/timestamp.proto", + "//:src/google/protobuf/type.proto", + "//:src/google/protobuf/wrappers.proto", ], prefix = "include/google/protobuf", visibility = ["//visibility:private"], @@ -43,7 +35,7 @@ pkg_files( pkg_files( name = "compiler_plugin_protos_files", - srcs = ["//:compiler_plugin_proto"], + srcs = ["//:src/google/protobuf/compiler/plugin.proto"], prefix = "include/google/protobuf/compiler", visibility = ["//visibility:private"], ) @@ -84,7 +76,6 @@ pkg_zip( name = "protoc_release", srcs = [ ":compiler_plugin_protos_files", - ":descriptor_protos_files", ":protoc_files", ":protoc_readme", ":wkt_protos_files", From 364852e829c5508294fa4c1cc8fc9f7ec9aebc60 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 17 May 2022 22:51:01 +0000 Subject: [PATCH 05/27] Throw a more helpful error if generated code is out of date, and fixed two reference leaks. --- protobuf_deps.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 966d506fd..362ae6577 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -114,6 +114,6 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "a60e9a379e976c1b8828145b8475618601cb9cee", - sha256 = "f5e021b986c62848c59f07fd68988e1bc50e782694710906374e4bd905db5c9f", + commit = "12efc9b096f35b62055a217f45e6b0fe5fb1a099", + sha256 = "de0ab4ee1e2d8f01b494de39cd70b611e190b63943f1d5c448d4ecb9560dc16f", ) From 65a2a52df3af2f276e9a5fe9bc8d2d539aef199b Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 18 May 2022 21:39:30 +0000 Subject: [PATCH 06/27] Fixed PHP SEGV by not writing to shared memory for zend_class_entry. --- php/ext/google/protobuf/message.c | 5 ++--- php/ext/google/protobuf/protobuf.c | 16 +++++++++++++++- php/ext/google/protobuf/protobuf.h | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 27199640c..55f4f4de3 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -603,10 +603,9 @@ PHP_METHOD(Message, __construct) { // will trigger an infinite construction loop and blow the stack. We // temporarily clear create_object to break this loop (see check in // NameMap_GetMessage()). - PBPHP_ASSERT(ce->create_object == Message_create); - ce->create_object = NULL; + NameMap_EnterConstructor(ce); desc = Descriptor_GetFromClassEntry(ce); - ce->create_object = Message_create; + NameMap_ExitConstructor(ce); if (!desc) { zend_throw_exception_ex( diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index 68c0ef00b..c786b6eca 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -56,6 +56,9 @@ ZEND_BEGIN_MODULE_GLOBALS(protobuf) // Set by the user to make the descriptor pool persist between requests. zend_bool keep_descriptor_pool_after_request; + // Set by the user to make the descriptor pool persist between requests. + zend_class_entry* constructing_class; + // A upb_DefPool that we are saving for the next request so that we don't have // to rebuild it from scratch. When keep_descriptor_pool_after_request==true, // we steal the upb_DefPool from the global DescriptorPool object just before @@ -173,6 +176,7 @@ static PHP_RINIT_FUNCTION(protobuf) { zend_hash_init(&PROTOBUF_G(object_cache), 64, NULL, NULL, 0); zend_hash_init(&PROTOBUF_G(descriptors), 64, NULL, ZVAL_PTR_DTOR, 0); + PROTOBUF_G(constructing_class) = NULL; return SUCCESS; } @@ -253,7 +257,7 @@ const upb_MessageDef *NameMap_GetMessage(zend_class_entry *ce) { const upb_MessageDef *ret = zend_hash_find_ptr(&PROTOBUF_G(name_msg_cache), ce->name); - if (!ret && ce->create_object) { + if (!ret && ce->create_object && ce != PROTOBUF_G(constructing_class)) { #if PHP_VERSION_ID < 80000 zval tmp; zval zv; @@ -279,6 +283,16 @@ const upb_EnumDef *NameMap_GetEnum(zend_class_entry *ce) { return ret; } +void NameMap_EnterConstructor(zend_class_entry* ce) { + assert(!PROTOBUF_G(constructing_class)); + PROTOBUF_G(constructing_class) = ce; +} + +void NameMap_ExitConstructor(zend_class_entry* ce) { + assert(PROTOBUF_G(constructing_class) == ce); + PROTOBUF_G(constructing_class) = NULL; +} + // ----------------------------------------------------------------------------- // Module init. // ----------------------------------------------------------------------------- diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 119e40d9d..292a0eeca 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -155,6 +155,8 @@ void NameMap_AddMessage(const upb_MessageDef *m); void NameMap_AddEnum(const upb_EnumDef *m); const upb_MessageDef *NameMap_GetMessage(zend_class_entry *ce); const upb_EnumDef *NameMap_GetEnum(zend_class_entry *ce); +void NameMap_EnterConstructor(zend_class_entry* ce); +void NameMap_ExitConstructor(zend_class_entry* ce); // Add this descriptor object to the global list of descriptors that will be // kept alive for the duration of the request but destroyed when the request From 8a46882bf059feeb669a36efb5f8b91e784aa02e Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 19 May 2022 04:13:16 +0000 Subject: [PATCH 07/27] Brought the comment up to date. --- php/ext/google/protobuf/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 55f4f4de3..83c51a494 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -601,7 +601,7 @@ PHP_METHOD(Message, __construct) { // // However, if the user created their own class derived from Message, this // will trigger an infinite construction loop and blow the stack. We - // temporarily clear create_object to break this loop (see check in + // store this `ce` in a global variable to break the cycle (see the check in // NameMap_GetMessage()). NameMap_EnterConstructor(ce); desc = Descriptor_GetFromClassEntry(ce); From a04d00312f150fc019edd32b9ce6ac8f2112e962 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 18 May 2022 21:39:30 +0000 Subject: [PATCH 08/27] Fixed PHP SEGV by not writing to shared memory for zend_class_entry. --- php/ext/google/protobuf/message.c | 5 ++--- php/ext/google/protobuf/protobuf.c | 16 +++++++++++++++- php/ext/google/protobuf/protobuf.h | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c index 27199640c..55f4f4de3 100644 --- a/php/ext/google/protobuf/message.c +++ b/php/ext/google/protobuf/message.c @@ -603,10 +603,9 @@ PHP_METHOD(Message, __construct) { // will trigger an infinite construction loop and blow the stack. We // temporarily clear create_object to break this loop (see check in // NameMap_GetMessage()). - PBPHP_ASSERT(ce->create_object == Message_create); - ce->create_object = NULL; + NameMap_EnterConstructor(ce); desc = Descriptor_GetFromClassEntry(ce); - ce->create_object = Message_create; + NameMap_ExitConstructor(ce); if (!desc) { zend_throw_exception_ex( diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index 68c0ef00b..c786b6eca 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -56,6 +56,9 @@ ZEND_BEGIN_MODULE_GLOBALS(protobuf) // Set by the user to make the descriptor pool persist between requests. zend_bool keep_descriptor_pool_after_request; + // Set by the user to make the descriptor pool persist between requests. + zend_class_entry* constructing_class; + // A upb_DefPool that we are saving for the next request so that we don't have // to rebuild it from scratch. When keep_descriptor_pool_after_request==true, // we steal the upb_DefPool from the global DescriptorPool object just before @@ -173,6 +176,7 @@ static PHP_RINIT_FUNCTION(protobuf) { zend_hash_init(&PROTOBUF_G(object_cache), 64, NULL, NULL, 0); zend_hash_init(&PROTOBUF_G(descriptors), 64, NULL, ZVAL_PTR_DTOR, 0); + PROTOBUF_G(constructing_class) = NULL; return SUCCESS; } @@ -253,7 +257,7 @@ const upb_MessageDef *NameMap_GetMessage(zend_class_entry *ce) { const upb_MessageDef *ret = zend_hash_find_ptr(&PROTOBUF_G(name_msg_cache), ce->name); - if (!ret && ce->create_object) { + if (!ret && ce->create_object && ce != PROTOBUF_G(constructing_class)) { #if PHP_VERSION_ID < 80000 zval tmp; zval zv; @@ -279,6 +283,16 @@ const upb_EnumDef *NameMap_GetEnum(zend_class_entry *ce) { return ret; } +void NameMap_EnterConstructor(zend_class_entry* ce) { + assert(!PROTOBUF_G(constructing_class)); + PROTOBUF_G(constructing_class) = ce; +} + +void NameMap_ExitConstructor(zend_class_entry* ce) { + assert(PROTOBUF_G(constructing_class) == ce); + PROTOBUF_G(constructing_class) = NULL; +} + // ----------------------------------------------------------------------------- // Module init. // ----------------------------------------------------------------------------- diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 119e40d9d..292a0eeca 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -155,6 +155,8 @@ void NameMap_AddMessage(const upb_MessageDef *m); void NameMap_AddEnum(const upb_EnumDef *m); const upb_MessageDef *NameMap_GetMessage(zend_class_entry *ce); const upb_EnumDef *NameMap_GetEnum(zend_class_entry *ce); +void NameMap_EnterConstructor(zend_class_entry* ce); +void NameMap_ExitConstructor(zend_class_entry* ce); // Add this descriptor object to the global list of descriptors that will be // kept alive for the duration of the request but destroyed when the request From 9806b0f57bef209b9d0afd996915b1468fb396e0 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Tue, 17 May 2022 08:54:35 +0800 Subject: [PATCH 09/27] Suppress CS8981 in generated source --- src/google/protobuf/compiler/csharp/csharp_reflection_class.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc index 644fbf16f..d9ab4b49b 100644 --- a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc @@ -128,7 +128,7 @@ void ReflectionClassGenerator::WriteIntroduction(io::Printer* printer) { "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" "// source: $file_name$\n" "// \n" - "#pragma warning disable 1591, 0612, 3021\n" + "#pragma warning disable 1591, 0612, 3021, 8981\n" "#region Designer generated code\n" "\n" "using pb = global::Google.Protobuf;\n" From 70afbd3c8d8142c7fead0117450c5392bf1b7114 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 May 2022 15:50:11 +0200 Subject: [PATCH 10/27] regenerate C# protos --- csharp/src/AddressBook/Addressbook.cs | 2 +- .../src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs | 2 +- csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs | 2 +- .../src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs | 2 +- csharp/src/Google.Protobuf.Conformance/Conformance.cs | 2 +- csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs | 2 +- csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs | 2 +- .../UnittestCustomOptionsProto3.cs | 2 +- csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs | 2 +- .../UnittestImportPublicProto3.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs | 2 +- .../src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs | 2 +- csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs | 2 +- csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs | 2 +- .../Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs | 2 +- .../UnittestSelfreferentialOptions.cs | 2 +- .../Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs | 2 +- csharp/src/Google.Protobuf/Reflection/Descriptor.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Any.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Api.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Type.cs | 2 +- csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index 484a2296a..1ff0f3b6c 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: addressbook.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs b/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs index 412440417..fe21d0c40 100644 --- a/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs +++ b/csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: datasets/google_message1/proto3/benchmark_message1_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs b/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs index faa37b050..a05802da5 100644 --- a/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs +++ b/csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: benchmarks.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs b/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs index df427e802..e2eb2e8b9 100644 --- a/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs +++ b/csharp/src/Google.Protobuf.Benchmarks/WrapperBenchmarkMessages.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: wrapper_benchmark_messages.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs index 0a3d5c604..79977a0ca 100644 --- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs +++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: conformance.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs index 4791b7325..57e59a9ac 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: map_unittest_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs index 94f089c3f..35f2b8a15 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/test_messages_proto2.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs index 5a2aa3bd5..520216fdf 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/test_messages_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs index 706b7c473..c1f43ce0f 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/Unittest.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs index 305dfe188..ea7a936af 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_custom_options_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs index 4f40564eb..de5f0c24d 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_import.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs index a3ce7a225..d661c2d47 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_import_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs index b1e0f30ad..f8a0e55fb 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_import_public.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs index dde8b9bda..f664c7ba9 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_import_public_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs index 56fde4f00..e7e2b4275 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_issue6936_a.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs index 1ac4a6729..21232fbd6 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_issue6936_b.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs index d7789b87a..cb53b7a19 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_issue6936_c.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs index 344010551..3fe2dd68a 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_issues.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs index 1af0d9e3f..ddb73d779 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_proto3.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs index a41b890fc..4502ffaa1 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/unittest_proto3_optional.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs index 7a8f72d4b..e1118c96c 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: unittest_selfreferential_options.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs index 58e866e76..3ec8d3556 100644 --- a/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs +++ b/csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/unittest_well_known_types.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 5967a4fef..1cb43c0ea 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/descriptor.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs index 13066da3f..d0ce71b1d 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/any.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs index 58a658e07..c524031e3 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/api.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs index b46f4d293..576ef2e60 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/duration.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs index 08f4a849d..43d2b7490 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/empty.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs index e90c3d571..19e0e6e41 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/field_mask.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs index 58c23cea1..6edd4f139 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/source_context.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs index 123d80ac9..8c1eec53b 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/struct.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs index e981dc2a0..e6d57afd5 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/timestamp.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs index 120f31a90..3088e385d 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/type.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs index 29c04b36b..307a446f0 100644 --- a/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs +++ b/csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/wrappers.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; From 1fa42c4be4b6d937c5903c6864e3f6d4a09614b9 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 19 May 2022 13:35:48 -0700 Subject: [PATCH 11/27] Updating version.json and repo version numbers to: 21.0-rc2 --- Protobuf-C++.podspec | 4 ++-- Protobuf.podspec | 4 ++-- configure.ac | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/README.md | 6 +++--- java/bom/pom.xml | 2 +- java/core/pom.xml | 2 +- java/kotlin-lite/pom.xml | 2 +- java/kotlin/pom.xml | 2 +- java/lite.md | 2 +- java/lite/pom.xml | 2 +- java/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/package.xml | 21 ++++++++++++++++--- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 6 +++--- protoc-artifacts/pom.xml | 2 +- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- ruby/pom.xml | 4 ++-- src/google/protobuf/port_def.inc | 2 +- src/google/protobuf/stubs/common.h | 2 +- version.json | 20 +++++++++--------- 24 files changed, 57 insertions(+), 42 deletions(-) diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 9d8815a8c..1297ad3e8 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '3.21.0-rc1' + s.version = '3.21.0-rc2' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.cocoapods_version = '>= 1.0' s.source = { :git => 'https://github.com/google/protobuf.git', - :tag => "v#{s.version}" } + :tag => "v21.0-rc2" } s.source_files = 'src/google/protobuf/*.{h,cc,inc}', 'src/google/protobuf/stubs/*.{h,cc}', diff --git a/Protobuf.podspec b/Protobuf.podspec index 37d7fc9a9..643635d8b 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.21.0-rc1' + s.version = '3.21.0-rc2' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.cocoapods_version = '>= 1.0' s.source = { :git => 'https://github.com/protocolbuffers/protobuf.git', - :tag => "v#{s.version}" } + :tag => "v21.0-rc2" } s.source_files = 'objectivec/*.{h,m}', 'objectivec/google/protobuf/Any.pbobjc.h', diff --git a/configure.ac b/configure.ac index 7cf520012..61246b27b 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.21.0-rc-1],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.21.0-rc-2],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 25c0609b4..92a860ee8 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.21.0-rc1 + 3.21.0-rc2 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/main/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 40986da94..d63455132 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -4,7 +4,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.21.0-rc1 + 3.21.0-rc2 7.2 Google Inc. diff --git a/java/README.md b/java/README.md index 41cbc869e..1fbc624c5 100644 --- a/java/README.md +++ b/java/README.md @@ -23,7 +23,7 @@ If you are using Maven, use the following: com.google.protobuf protobuf-java - 3.21.0-rc-1 + 3.21.0-rc-2 ``` @@ -37,7 +37,7 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.21.0-rc-1 + 3.21.0-rc-2 ``` @@ -45,7 +45,7 @@ protobuf-java-util package: If you are using Gradle, add the following to your `build.gradle` file's dependencies: ``` - implementation 'com.google.protobuf:protobuf-java:3.21.0-rc-1' + implementation 'com.google.protobuf:protobuf-java:3.21.0-rc-2' ``` Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using. diff --git a/java/bom/pom.xml b/java/bom/pom.xml index ce950a209..a770cbb9f 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.21.0-rc-1 + 3.21.0-rc-2 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 8a33a507a..bffa2958b 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.21.0-rc-1 + 3.21.0-rc-2 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index a4737d829..fd3734d36 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.21.0-rc-1 + 3.21.0-rc-2 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index a3f66409b..c9eeb6d79 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.21.0-rc-1 + 3.21.0-rc-2 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index fd6c163c1..633478b4a 100644 --- a/java/lite.md +++ b/java/lite.md @@ -29,7 +29,7 @@ protobuf Java Lite runtime. If you are using Maven, include the following: com.google.protobuf protobuf-javalite - 3.21.0-rc-1 + 3.21.0-rc-2 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index d62c1b375..c10edfd44 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.21.0-rc-1 + 3.21.0-rc-2 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index a1d6ab06d..467c06d0b 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.21.0-rc-1 + 3.21.0-rc-2 pom Protocol Buffers [Parent] diff --git a/java/util/pom.xml b/java/util/pom.xml index f20e1e5c5..a12fd2226 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.21.0-rc-1 + 3.21.0-rc-2 protobuf-java-util diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index d1d5d87d2..deda5c5b4 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,10 +10,10 @@ protobuf-opensource@google.com yes - 2022-05-10 - + 2022-05-19 + - 3.21.0RC1 + 3.21.0RC2 3.21.0 @@ -1298,5 +1298,20 @@ G A release. + + + 3.21.0RC2 + 3.21.0 + + + beta + beta + + 2022-05-19 + + BSD-3-Clause + + + diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 292a0eeca..f95179b05 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -127,7 +127,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -#define PHP_PROTOBUF_VERSION "3.21.0RC1" +#define PHP_PROTOBUF_VERSION "3.21.0RC2" // ptr -> PHP object cache. This is a weak map that caches lazily-created // wrapper objects around upb types: diff --git a/protobuf_version.bzl b/protobuf_version.bzl index 94e224745..5725bdd6c 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,3 +1,3 @@ -PROTOC_VERSION = '21.0-rc-1' -PROTOBUF_JAVA_VERSION = '3.21.0-rc-1' -PROTOBUF_PYTHON_VERSION = '4.21.0-rc-1' +PROTOC_VERSION = '21.0-rc-2' +PROTOBUF_JAVA_VERSION = '3.21.0-rc-2' +PROTOBUF_PYTHON_VERSION = '4.21.0-rc-2' diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 45c2123f1..80451f971 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 21.0-rc-1 + 3.21.0-rc-2 pom Protobuf Compiler diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 49039d5e1..bd2faa4e5 100644 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,4 +30,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '4.21.0rc1' +__version__ = '4.21.0rc2' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index ff55b6427..f86cda765 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.21.0.rc.1" + s.version = "3.21.0.rc.2" git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag s.licenses = ["BSD-3-Clause"] s.summary = "Protocol Buffers" diff --git a/ruby/pom.xml b/ruby/pom.xml index 0d53cd1f3..0514dbe6e 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.21.0-rc-1 + 3.21.0-rc-2 Protocol Buffer JRuby native extension Protocol Buffers are a way of encoding structured data in an efficient yet @@ -76,7 +76,7 @@ com.google.protobuf protobuf-java-util - 3.21.0-rc-1 + 3.21.0-rc-2 org.jruby diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 033563090..78b97e6cc 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -193,7 +193,7 @@ #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined #endif -#define PROTOBUF_VERSION_SUFFIX "-rc1" +#define PROTOBUF_VERSION_SUFFIX "-rc2" #if defined(PROTOBUF_NAMESPACE) || defined(PROTOBUF_NAMESPACE_ID) #error PROTOBUF_NAMESPACE or PROTOBUF_NAMESPACE_ID was previously defined diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 8b581ba63..36a4b08e4 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -85,7 +85,7 @@ namespace internal { #define GOOGLE_PROTOBUF_VERSION 3021000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. -#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc1" +#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc2" // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code diff --git a/version.json b/version.json index 21379503c..a007aba97 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "21.x": { - "protoc_version": "21.0-dev", + "protoc_version": "21.0-rc2", "lts": false, - "date": "2022-05-13", + "date": "2022-05-19", "languages": { - "cpp": "3.21.0-dev", - "csharp": "3.21.0-dev", - "java": "3.21.0-dev", - "javascript": "3.21.0-dev", - "objectivec": "3.21.0-dev", - "php": "3.21.0-dev", - "python": "4.21.0-dev", - "ruby": "3.21.0-dev" + "cpp": "3.21.0-rc2", + "csharp": "3.21.0-rc2", + "java": "3.21.0-rc2", + "javascript": "3.21.0-rc2", + "objectivec": "3.21.0-rc2", + "php": "3.21.0-rc2", + "python": "4.21.0-rc2", + "ruby": "3.21.0-rc2" } } } \ No newline at end of file From 71271ad1f8d95d33f7fa7c70df0cf42e28117320 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 19 May 2022 20:42:46 +0000 Subject: [PATCH 12/27] Edit changelog --- CHANGES.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 3c6bc3510..889fa0c65 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,23 @@ +2022-05-19 version 21.0-rc2(C++/Java/Python/PHP/Objective-C/C#/Ruby) + + Python + * Fix windows builds + * Throw more helpful error if generated code is out of date + * Fixed two reference leaks + + Ruby + * Support x64-mingw-ucrt platform + + PHP + * Fix SEGV by not writing to shared memory for zend_class_entry + + C# + * Suppress warning CS8981 + + Other + * Fix Maven release to release actual osx_aarch64 binary + * Fix protoc zips to have the proto files for well known types + 2022-05-10 version 21.0-rc1 (C++/Java/Python/PHP/Objective-C/C#/Ruby) C++ From cd5cc376247720125b6e5bc672347af663dbe2e4 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Thu, 19 May 2022 14:22:56 -0700 Subject: [PATCH 13/27] Fix some style/lint issues. (#10003) - Starlark: ensure docstrings are present. - python/setup.py: https://refex.readthedocs.io/en/latest/guide/fixers/superfluous_parens.html --- build_defs/cpp_opts.bzl | 2 +- conformance/defs.bzl | 20 ++++++++++++++++++-- python/setup.py | 4 ++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl index f868c4ae5..94966e3af 100644 --- a/build_defs/cpp_opts.bzl +++ b/build_defs/cpp_opts.bzl @@ -1,4 +1,4 @@ -# C++ compile/link options for Protobuf. +"""C++ compile/link options for Protobuf libraries.""" COPTS = select({ "//build_defs:config_msvc": [ diff --git a/conformance/defs.bzl b/conformance/defs.bzl index 905953a11..cd36ab43a 100644 --- a/conformance/defs.bzl +++ b/conformance/defs.bzl @@ -1,6 +1,22 @@ -# PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE. +"""Starlark definitions for Protobuf conformance tests. -def conformance_test(name, testee, failure_list = None, text_format_failure_list = None): +PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE. +""" + +def conformance_test( + name, + testee, + failure_list = None, + text_format_failure_list = None): + """Conformance test runner. + + Args: + name: the name for the test. + testee: a conformance test client binary. + failure_list: a text file with known failures, one per line. + text_format_failure_list: a text file with known failures (one per line) + for the text format conformance suite. + """ args = ["--testee %s" % _strip_bazel(testee)] failure_lists = [] if failure_list: diff --git a/python/setup.py b/python/setup.py index 380c7d809..302c82bf6 100755 --- a/python/setup.py +++ b/python/setup.py @@ -209,7 +209,7 @@ class TestConformanceCmd(_build_py): # Python 2.6 dodges these extra failures. os.environ['CONFORMANCE_PYTHON_EXTRA_FAILURES'] = ( '--failure_list failure_list_python-post26.txt') - cmd = 'cd ../conformance && make %s' % (TestConformanceCmd.target) + cmd = 'cd ../conformance && make %s' % (TestConformanceCmd.target,) subprocess.check_call(cmd, shell=True) @@ -227,7 +227,7 @@ def _GetFlagValues(flag_long, flag_short): flag_res = [re.compile(r'--?%s(=(.*))?' % (flag_long[:-1] if expect_value else flag_long))] if flag_short: - flag_res.append(re.compile(r'-%s(.*)?' % (flag_short))) + flag_res.append(re.compile(r'-%s(.*)?' % (flag_short,))) flag_match = None for arg in sys.argv: From d0a4dc76618bf832690ad13e0a3437155699ab02 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Thu, 19 May 2022 14:46:31 -0700 Subject: [PATCH 14/27] Update CHANGES.txt. --- CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 3c6bc3510..ffb9c08a2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,7 @@ Java * Update protobuf_version.bzl to separate protoc and per-language java … (#9900) * 6x speedup in ArrayEncoder.writeUInt32NotTag + * Java generated code is no longer compatible with runtimes 2.6.1 and earlier Python * Increment python major version to 4 in version.json for python upb (#9926) @@ -26,6 +27,7 @@ * Due to the breaking changes for Python, the major version number for Python has been incremented. * The binary wheel for macOS now supports Apple silicon. + * In TextFormat, transform UnicodeDecodeError into ParseError. PHP From 7f2368933ab3d96140f125e8141c25157caef88e Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Thu, 19 May 2022 16:02:36 -0700 Subject: [PATCH 15/27] Re-generate csharp and php golden proto files after changes to descriptor.proto. --- csharp/src/Google.Protobuf.Test/testprotos.pb | Bin 344236 -> 344150 bytes .../Google.Protobuf/Reflection/Descriptor.cs | 7 ++--- .../Google/Protobuf/Internal/FieldOptions.php | 24 ++++++------------ 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb index 83958c6097de21507388e922bdd6647de49fbd80..4bc182570b31f0469177a01e4fbfdf9456916cee 100644 GIT binary patch delta 4144 zcmYjUTWnO<6`gbE?0YBI_IT!cc=>@Z#x}1|3~5rKHi{_egG4Efsx}2u%0TQgii2C* z2_gL$zzI&kacTj&KUR^5a9XKS9a&8@#MnF=%mK%ryGqSPGKoppf zYd5&hDFL=8i$UiOv1Mm5;FhW;yqds*?bjg=H* zP^FFtD>3W?Oo#g@W-(l})UD@zPk3@JsM{r$|8P!LRE8-}@Q!kb9ST;umaOvZM>2Mp zgj<3ARmglK6B#9@%0l4<7W49V7K{u8A!EVF0K}FBBLfgJ7L1H4$aoyec&UnIJT@|b zun#bl0f?p^vkY!3>Dfmqc3L-;MCMUS)VO;v;UqV8Eco_yq%DXbDjg$jazJc3 zMyWbA06;W#jFvaL(`>S&h1G%J$G;G_cML=n0u%!gh2SL8Cc_p`43IV%AWSeo+GKz@ z_5p&)8ZpEq4q-6(-EOgB{UGT>NUB39htR7a+a_rN4F&(&EnfciP}GryNe_`W406!X z5NX2zqN5?whDoCNQ$aB+Uindy2YrgPUx2U;FdQ@>N}VD-=xWanDE6@)bTu*qN-TBf zcudti>EWPykC@*zY??w4m4?lj0I_G-j0q4;4Vy6mVobwkOn?~EFpr5vSF@fo6#Vl0 z;)N{$xGZO)G6LGq80}b9xmr6Q%A7IUtI^R}*8b|YvqpBck_{Nj288UhMs~`x&rz(P zWv9S>juMOAFXLz{#j-~WC-;gQV%Ml?2vJlSHM#+@Y1HTjL_?$05PtIjp?j44jmm$3 z&^=1)+LZ1T>mJj(0ib&LZq z+pKpW;bM@@iPolzBx_1}0(lo{@e=o2IuH0#@W-6koWDdeS<2&UcZt#-I$-U>v#*eK zm0H!Y0pn;82>;Ci;%Kf=MfgzxMDZ(BzuqKc2v?|WlYtn*RkB+Q#1O7hy17zWAkBrR zv;_cAXDX`0*M7=a0IR4oWv)FS>P#66q;W3Slm&wAuM666%~&9#KtQhIm2br^)5v*u22UbBkn?nx4XF z8-dCwfNpM4Rd^061FhepOhc4`=5LX|qQr@W+ay<(5_seYXwE#U@@M%r>tI(fDbM{j zdCQ{!NN>}MCj9Gw0&epTSq*CNKp+GR&kzu^y+ai>W))m_C=>o`#VVNYP+h${%vSX* ze#zVoI=jU0^LHZ-?&vO6gp>7DKX=J%(v*Bf?@~*v?gnEolC?%J@<{`lZY(erBPKrS zB6;CU$x|m?q*be#DUWVIe2=Wvnu=d}fQBj#s(VzCGOM7vN9mOYs=ckNbW_-RpDeQo zr3?)dzvk{oP4NuwQy%l?*Cl2Gs{7Hjk^F!xBOVD14HduJ9z;#?yX^s`&C&3??E#x1 zJU5)oELq{*^DJ17p<#N8pJ=mDSNueqC2xgpil1n+)ZF6!L%`iNc+*hqf5BgVBfd;M z;xGHrG|sbztua#gxLdrN*gaxvZbVUe#MYhw1oeoWsaMp1pdPUsef5o~;rsE4Z9TH% z;c}d_Ke2I3K5%eNu+Bxs3-A3_oQUVgZS7(gmc6MKH;iJ5G zR^+i9-Y2GH^G=p`!PjZBybCt)WO*0-)|o8tLL|_|BzJMHQg?yCoGsVXo~rb>b>LS@ zuE+mL*PGq@+P8KUUOXaFb{@-77i|1FTYo9IEw=ugooOyfXSdJUFh75NI0N{hE!UP3 z*#8JboO}ZwmUG6z`Owa^s4aQLp-5J*DUpI>-j!U5; zoVVLHx<$5L#TsluO@wlTcpaO~@)2Jq^0%+p6)3nk(s4Jl2VDN_% z;?Va7%bD0rgXMDAOoL9%(h?J!XVAfS{f3zg0w;rx0rAgoo-C(g51lNhVh^2kY8IEM W;=Hr};D-W#7XIRegCEML$NmptS13dP delta 4186 zcmYjTZEO_B8NS(@**(Vg`EKv{GB#ctn{SG35+bUi3N=ZUR0O4shyn<5;7jb*eAISB zoT|DM8mLVz%PL|~RMip@Q5>~uD@&ZH(jT={Ii>-MB@h&~KT@?dE^&N-`(YsN^UluP zo@7gY-kEux_j%{p_1<`U;V*u;@Ym-*<`cb9>1X;`-N>bnCu-#F%a(Lpu_|(QUwb^z{Q%m!D&%e2owfOO!ER}nyt-Z@T znCbC4vYA$|`>=PQGt88y`yc}L-@mMKlDbXqrKJJ-_xD-y1F~FnS)+? zm-Jq1Ka}a{=<$wZI=iy1-uI3i#`XgTvRz$YlG1x=$J0Aj@88(c+`Oe}b93{iHDC6; zXAWidcVs<9m&tXv;{bj-GH>;OEZfma2P>qY?zw8e2nE5iO0&ucCej8fuZx!$7^Bst zYYlV=Hms4qVrnp8p5)e3RsN-&?3cUorxD>0nG8iZL?(HnR?~2ZO!E2$10gcW8#fyW zkxAb4q?`;yKsD`8yv(NdO@{)4s-b{@z%)-(X$k>>Xhr&Mk2H9Jea!E4|L_!NYGLVBhZUIg*vKocdY-ra4|#9vodj zOr;P^3YJTYSGe|L9yu=95?Kb~3T%DMV`=5D!UE4c`TNE;{EcYL8<&7^Id5D7;^4e- z2?&?-#$^Ru9`nCwWiM~9Ad|<0HVK4dfPqOsw02CuB()ZI?RP}vtYE6MICj1xVk!A5 z9LA}$UVrx1ze)3tiY*U;rWKie}0Rn3& zglh#URB;RFwD9*m%bwo`fT^Dj+p{qB(?Vwps~|cpbhZG|-f5w;6^9dFP5p&9P2D$B z2f{JHVCsNS^v%>OUHe@Td0$Vx56S1Rv-fpAqN`K|VzfWQYLwn*NJqPGNjAIWds&u+8bBc>}< zAvI#m1LDw#F%O8YMnp~UngoRT5#cqfL;}M6h*;O8%qPhF1#KPx<}ZXYWd4FNk5#o- zn+Jr<1!F#ejxLh8 z>?YegW*R~jDr3esAP$Wg-+*Xn%=iX`?=j;W5WdIA_Y9>f$s?})iLn0U-+G;W{4a#FoiFT9|tFdx9qf6Qn-r3UW77g%&mF<*)$|lb+bEQW1$1*qR0Q{+cA$qlB3%>iK=XHm zS6Af3hAF{U6gSYwQP7+@sM0%nihNKih?M3&CEVp<0i;u+u3r5+bg9j|!m3e&2Ld5r zaEE}H?OjopGOOUaE7HM#VXT7bu2@zre@0PtE&A@6@fRItKhMpC9MsW_C<`X*s(xmK zTdyhU>6{UbD|I&*dqG%h^dj9fpy|c}Qz2xcn=S}9_^xu*O&7$f)x?xTHz2+ztks%| zJ_`X2RTNbBL|MYDg6f_~t}sxYUAam(g`@X{WftL-pkbnKzx!cRG=uvhhk4WIC}skx z`{A^)`GK&Ed2AqPsOT&2LD&?1zVKVW%Wfqe(@XtW5)vtj#&CXnC;L%s@35`8 zQHAobtup}#>R~%wt*8M(J#5!{>K&1y=i@`$dTd97)9K938b&!Rt*GAT?^^^+r)w1-wK??do+hA!E9LJdN5lYvqKc z9QLUR$Qi%f6X8(4F6sV_R7pmV@VsC@H+-rCreDG+x>T1$ex) z3;OUGFYSWG(8V})alTx4fx=w=uWz$ec5bdzjuJj+>sJElQ^x1)bVJc2#d^+0%IP&j zJAfbBd~I<91s#RZ0!95{DQ6U%5AAfLI&x5PD3aA{ilpFpWb>9HDPJ`!RcK?+HgI3`HdD zgj2RqWd;z`C!9r|fgnENtY}aPOH;y5I+pJQ2?NINla5Tw0fq?ylSZHahh8@LdY_{$ zs4^_{IXYmffRlZW4wx!Hsn5{?Qw3aYpQ8g76mXM$4z6~G76V7W|GPf+;?w=5Vw9tP zM_(+Rq#X4-=~^`}Re)H(Q@=tU)l6U>^uKwE^*l3J%0v+vENz=2GU%k16qzUzgAQKH xx6K4lIO8XN!v6BanNliB#+gzoO2!!{wWvrHrIRP?`Wb#L{6_P2{rt(1{{t9ZF8=@k diff --git a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index 1cb43c0ea..7e7a1a528 100644 --- a/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -7098,11 +7098,8 @@ namespace Google.Protobuf.Reflection { /// check its required fields, regardless of whether or not the message has /// been parsed. /// - /// As of 2021, lazy does no correctness checks on the byte stream during - /// parsing. This may lead to crashes if and when an invalid byte stream is - /// finally parsed upon access. - /// - /// TODO(b/211906113): Enable validation on lazy fields. + /// As of May 2022, lazy verifies the contents of the byte stream during + /// parsing. An invalid byte stream will cause the overall parsing to fail. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index 665cb065a..ea32e7f2a 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -74,10 +74,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. - * As of 2021, lazy does no correctness checks on the byte stream during - * parsing. This may lead to crashes if and when an invalid byte stream is - * finally parsed upon access. - * TODO(b/211906113): Enable validation on lazy fields. + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. * * Generated from protobuf field optional bool lazy = 5 [default = false]; */ @@ -165,10 +163,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. - * As of 2021, lazy does no correctness checks on the byte stream during - * parsing. This may lead to crashes if and when an invalid byte stream is - * finally parsed upon access. - * TODO(b/211906113): Enable validation on lazy fields. + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. * @type bool $unverified_lazy * unverified_lazy does no correctness checks on the byte stream. This should * only be used where lazy with verification is prohibitive for performance @@ -354,10 +350,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. - * As of 2021, lazy does no correctness checks on the byte stream during - * parsing. This may lead to crashes if and when an invalid byte stream is - * finally parsed upon access. - * TODO(b/211906113): Enable validation on lazy fields. + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. * * Generated from protobuf field optional bool lazy = 5 [default = false]; * @return bool @@ -402,10 +396,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message * implementation must either *always* check its required fields, or *never* * check its required fields, regardless of whether or not the message has * been parsed. - * As of 2021, lazy does no correctness checks on the byte stream during - * parsing. This may lead to crashes if and when an invalid byte stream is - * finally parsed upon access. - * TODO(b/211906113): Enable validation on lazy fields. + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. * * Generated from protobuf field optional bool lazy = 5 [default = false]; * @param bool $var From 053f698e9099554f2c42d2a40b4b07e993bb00c3 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Thu, 19 May 2022 16:57:17 -0700 Subject: [PATCH 16/27] Adjust constexpr qualifiers so they work in gcc < 4.9. --- src/google/protobuf/util/time_util.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/google/protobuf/util/time_util.cc b/src/google/protobuf/util/time_util.cc index 4c69b50be..ee6406d7a 100644 --- a/src/google/protobuf/util/time_util.cc +++ b/src/google/protobuf/util/time_util.cc @@ -165,14 +165,14 @@ int64_t RoundTowardZero(int64_t value, int64_t divider) { // Actually define these static const integers. Required by C++ standard (but // some compilers don't like it). #ifndef _MSC_VER -const int64_t TimeUtil::kTimestampMinSeconds; -const int64_t TimeUtil::kTimestampMaxSeconds; -const int32_t TimeUtil::kTimestampMinNanoseconds; -const int32_t TimeUtil::kTimestampMaxNanoseconds; -const int64_t TimeUtil::kDurationMaxSeconds; -const int64_t TimeUtil::kDurationMinSeconds; -const int32_t TimeUtil::kDurationMaxNanoseconds; -const int32_t TimeUtil::kDurationMinNanoseconds; +constexpr int64_t TimeUtil::kTimestampMinSeconds; +constexpr int64_t TimeUtil::kTimestampMaxSeconds; +constexpr int32_t TimeUtil::kTimestampMinNanoseconds; +constexpr int32_t TimeUtil::kTimestampMaxNanoseconds; +constexpr int64_t TimeUtil::kDurationMaxSeconds; +constexpr int64_t TimeUtil::kDurationMinSeconds; +constexpr int32_t TimeUtil::kDurationMaxNanoseconds; +constexpr int32_t TimeUtil::kDurationMinNanoseconds; #endif // !_MSC_VER std::string TimeUtil::ToString(const Timestamp& timestamp) { From 42ff77e55fc12831f8188d86244b53d11a26bd49 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Thu, 19 May 2022 17:26:06 -0700 Subject: [PATCH 17/27] Restore erroneous changes to Makefile.am. --- src/Makefile.am | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 9033a4679..e4a0a2b60 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -540,8 +540,18 @@ protoc_inputs = \ EXTRA_DIST = \ $(protoc_inputs) \ + BUILD.bazel \ README.md \ + google/protobuf/BUILD.bazel \ + google/protobuf/compiler/BUILD.bazel \ + google/protobuf/compiler/cpp/BUILD.bazel \ + google/protobuf/compiler/csharp/BUILD.bazel \ + google/protobuf/compiler/java/BUILD.bazel \ + google/protobuf/compiler/objectivec/BUILD.bazel \ google/protobuf/compiler/package_info.h \ + google/protobuf/compiler/php/BUILD.bazel \ + google/protobuf/compiler/python/BUILD.bazel \ + google/protobuf/compiler/ruby/BUILD.bazel \ google/protobuf/compiler/ruby/ruby_generated_code.proto \ google/protobuf/compiler/ruby/ruby_generated_code_pb.rb \ google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \ @@ -554,10 +564,12 @@ EXTRA_DIST = \ google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \ google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \ google/protobuf/compiler/zip_output_unittest.sh \ + google/protobuf/io/BUILD.bazel \ google/protobuf/io/gzip_stream.h \ google/protobuf/io/gzip_stream_unittest.sh \ google/protobuf/io/package_info.h \ google/protobuf/package_info.h \ + google/protobuf/stubs/BUILD.bazel \ google/protobuf/test_messages_proto2.proto \ google/protobuf/test_messages_proto3.proto \ google/protobuf/testdata/bad_utf8_string \ @@ -573,6 +585,9 @@ EXTRA_DIST = \ google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \ google/protobuf/testdata/text_format_unittest_extensions_data.txt \ google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \ + google/protobuf/testing/BUILD.bazel \ + google/protobuf/util/BUILD.bazel \ + google/protobuf/util/internal/BUILD.bazel \ google/protobuf/util/package_info.h \ libprotobuf-lite.map \ libprotobuf.map \ From ecaeadecedc85bbaae2b7e051cc4ff40306d72ee Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 20 May 2022 00:38:39 +0000 Subject: [PATCH 18/27] Update version.json to: 21.0-dev --- version.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/version.json b/version.json index a007aba97..7c47bbc5b 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "21.x": { - "protoc_version": "21.0-rc2", + "protoc_version": "21.0-dev", "lts": false, - "date": "2022-05-19", + "date": "2022-05-20", "languages": { - "cpp": "3.21.0-rc2", - "csharp": "3.21.0-rc2", - "java": "3.21.0-rc2", - "javascript": "3.21.0-rc2", - "objectivec": "3.21.0-rc2", - "php": "3.21.0-rc2", - "python": "4.21.0-rc2", - "ruby": "3.21.0-rc2" + "cpp": "3.21.0-dev", + "csharp": "3.21.0-dev", + "java": "3.21.0-dev", + "javascript": "3.21.0-dev", + "objectivec": "3.21.0-dev", + "php": "3.21.0-dev", + "python": "4.21.0-dev", + "ruby": "3.21.0-dev" } } } \ No newline at end of file From 30f6c7851b49cf6155ea1cea490a6e6510de11be Mon Sep 17 00:00:00 2001 From: Chan Wen Xu Date: Fri, 20 May 2022 20:51:18 +0800 Subject: [PATCH 19/27] Add protoc-gen-xo to global extension registry (#9997) --- docs/options.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/options.md b/docs/options.md index bda41c211..8c22af12b 100644 --- a/docs/options.md +++ b/docs/options.md @@ -324,3 +324,7 @@ with info about your project (name and website) so we can add an entry for you. 1. Protonium * Website: https://github.com/zyp/protonium * Extension: 1146 + +1. Protoc-gen-xo + * Website: https://github.com/xo/ecosystem + * Extension: 1147 From 1407efb39f6664e9caf1b7170ab240183d55a204 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 20 May 2022 17:45:47 +0000 Subject: [PATCH 20/27] Fix merge conflict --- BUILD.bazel | 211 ---------------------------------------------------- 1 file changed, 211 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index e634a09b3..98584b604 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -12,217 +12,6 @@ licenses(["notice"]) exports_files(["LICENSE"]) -################################################################################ -# Protobuf Runtime Library -################################################################################ - -cc_library( - name = "protobuf_lite", - srcs = [ - # AUTOGEN(protobuf_lite_srcs) - "src/google/protobuf/any_lite.cc", - "src/google/protobuf/arena.cc", - "src/google/protobuf/arenastring.cc", - "src/google/protobuf/arenaz_sampler.cc", - "src/google/protobuf/extension_set.cc", - "src/google/protobuf/generated_enum_util.cc", - "src/google/protobuf/generated_message_tctable_lite.cc", - "src/google/protobuf/generated_message_util.cc", - "src/google/protobuf/implicit_weak_message.cc", - "src/google/protobuf/inlined_string_field.cc", - "src/google/protobuf/io/coded_stream.cc", - "src/google/protobuf/io/io_win32.cc", - "src/google/protobuf/io/strtod.cc", - "src/google/protobuf/io/zero_copy_stream.cc", - "src/google/protobuf/io/zero_copy_stream_impl.cc", - "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", - "src/google/protobuf/map.cc", - "src/google/protobuf/message_lite.cc", - "src/google/protobuf/parse_context.cc", - "src/google/protobuf/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", - "src/google/protobuf/stubs/status.cc", - "src/google/protobuf/stubs/statusor.cc", - "src/google/protobuf/stubs/stringpiece.cc", - "src/google/protobuf/stubs/stringprintf.cc", - "src/google/protobuf/stubs/structurally_valid.cc", - "src/google/protobuf/stubs/strutil.cc", - "src/google/protobuf/stubs/time.cc", - "src/google/protobuf/wire_format_lite.cc", - ], - hdrs = glob([ - "src/google/protobuf/**/*.h", - "src/google/protobuf/**/*.inc", - ]), - copts = COPTS, - includes = ["src/"], - linkopts = LINK_OPTS, - visibility = ["//visibility:public"], -) - -cc_library( - name = "protobuf", - srcs = [ - # AUTOGEN(protobuf_srcs) - "src/google/protobuf/any.cc", - "src/google/protobuf/any.pb.cc", - "src/google/protobuf/api.pb.cc", - "src/google/protobuf/compiler/importer.cc", - "src/google/protobuf/compiler/parser.cc", - "src/google/protobuf/descriptor.cc", - "src/google/protobuf/descriptor.pb.cc", - "src/google/protobuf/descriptor_database.cc", - "src/google/protobuf/duration.pb.cc", - "src/google/protobuf/dynamic_message.cc", - "src/google/protobuf/empty.pb.cc", - "src/google/protobuf/extension_set_heavy.cc", - "src/google/protobuf/field_mask.pb.cc", - "src/google/protobuf/generated_message_bases.cc", - "src/google/protobuf/generated_message_reflection.cc", - "src/google/protobuf/generated_message_tctable_full.cc", - "src/google/protobuf/io/gzip_stream.cc", - "src/google/protobuf/io/printer.cc", - "src/google/protobuf/io/tokenizer.cc", - "src/google/protobuf/map_field.cc", - "src/google/protobuf/message.cc", - "src/google/protobuf/reflection_ops.cc", - "src/google/protobuf/service.cc", - "src/google/protobuf/source_context.pb.cc", - "src/google/protobuf/struct.pb.cc", - "src/google/protobuf/stubs/substitute.cc", - "src/google/protobuf/text_format.cc", - "src/google/protobuf/timestamp.pb.cc", - "src/google/protobuf/type.pb.cc", - "src/google/protobuf/unknown_field_set.cc", - "src/google/protobuf/util/delimited_message_util.cc", - "src/google/protobuf/util/field_comparator.cc", - "src/google/protobuf/util/field_mask_util.cc", - "src/google/protobuf/util/internal/datapiece.cc", - "src/google/protobuf/util/internal/default_value_objectwriter.cc", - "src/google/protobuf/util/internal/error_listener.cc", - "src/google/protobuf/util/internal/field_mask_utility.cc", - "src/google/protobuf/util/internal/json_escaping.cc", - "src/google/protobuf/util/internal/json_objectwriter.cc", - "src/google/protobuf/util/internal/json_stream_parser.cc", - "src/google/protobuf/util/internal/object_writer.cc", - "src/google/protobuf/util/internal/proto_writer.cc", - "src/google/protobuf/util/internal/protostream_objectsource.cc", - "src/google/protobuf/util/internal/protostream_objectwriter.cc", - "src/google/protobuf/util/internal/type_info.cc", - "src/google/protobuf/util/internal/utility.cc", - "src/google/protobuf/util/json_util.cc", - "src/google/protobuf/util/message_differencer.cc", - "src/google/protobuf/util/time_util.cc", - "src/google/protobuf/util/type_resolver_util.cc", - "src/google/protobuf/wire_format.cc", - "src/google/protobuf/wrappers.pb.cc", - ], - hdrs = glob([ - "src/**/*.h", - "src/**/*.inc", - ]), - copts = COPTS, - includes = ["src/"], - linkopts = LINK_OPTS, - visibility = ["//visibility:public"], - deps = [":protobuf_lite"] + select({ - "//build_defs:config_msvc": [], - "//conditions:default": ["@zlib//:zlib"], - }), -) - -# This provides just the header files for use in projects that need to build -# shared libraries for dynamic loading. This target is available until Bazel -# adds native support for such use cases. -# TODO(keveman): Remove this target once the support gets added to Bazel. -cc_library( - name = "protobuf_headers", - hdrs = glob([ - "src/**/*.h", - "src/**/*.inc", - ]), - includes = ["src/"], - visibility = ["//visibility:public"], -) - -filegroup( - name = "well_known_type_protos", - srcs = [ - "src/google/protobuf/any.proto", - "src/google/protobuf/api.proto", - "src/google/protobuf/duration.proto", - "src/google/protobuf/empty.proto", - "src/google/protobuf/field_mask.proto", - "src/google/protobuf/source_context.proto", - "src/google/protobuf/struct.proto", - "src/google/protobuf/timestamp.proto", - "src/google/protobuf/type.proto", - "src/google/protobuf/wrappers.proto", - ], - visibility = ["//visibility:public"], -) - -filegroup( - name = "built_in_runtime_protos", - srcs = [ - "src/google/protobuf/compiler/plugin.proto", - "src/google/protobuf/descriptor.proto", - ], - visibility = ["//:__subpackages__"], -) - -exports_files( - srcs = [ - "src/google/protobuf/any.proto", - "src/google/protobuf/api.proto", - "src/google/protobuf/compiler/plugin.proto", - "src/google/protobuf/descriptor.proto", - "src/google/protobuf/duration.proto", - "src/google/protobuf/empty.proto", - "src/google/protobuf/field_mask.proto", - "src/google/protobuf/source_context.proto", - "src/google/protobuf/struct.proto", - "src/google/protobuf/timestamp.proto", - "src/google/protobuf/type.proto", - "src/google/protobuf/wrappers.proto", - ], - visibility = ["//pkg:__pkg__"], -) - -alias( - name = "lite_well_known_protos", - actual = ":well_known_type_protos", - visibility = ["//visibility:public"], -) - -adapt_proto_library( - name = "cc_wkt_protos_genproto", - visibility = ["//visibility:public"], - deps = [ - "//:any_proto", - "//:api_proto", - "//:compiler_plugin_proto", - "//:descriptor_proto", - "//:duration_proto", - "//:empty_proto", - "//:field_mask_proto", - "//:source_context_proto", - "//:struct_proto", - "//:timestamp_proto", - "//:type_proto", - "//:wrappers_proto", - ], -) - -cc_library( - name = "cc_wkt_protos", - deprecation = "Only for backward compatibility. Do not use.", - visibility = ["//visibility:public"], -) - ################################################################################ # Well Known Types Proto Library Rules # From cdfd60f63d641036f0223db93465b2a79fe56db5 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 20 May 2022 18:03:26 +0000 Subject: [PATCH 21/27] Fix podspec errors --- Protobuf-C++.podspec | 4 ++-- Protobuf.podspec | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 1297ad3e8..9d8815a8c 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '3.21.0-rc2' + s.version = '3.21.0-rc1' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.cocoapods_version = '>= 1.0' s.source = { :git => 'https://github.com/google/protobuf.git', - :tag => "v21.0-rc2" } + :tag => "v#{s.version}" } s.source_files = 'src/google/protobuf/*.{h,cc,inc}', 'src/google/protobuf/stubs/*.{h,cc}', diff --git a/Protobuf.podspec b/Protobuf.podspec index 643635d8b..37d7fc9a9 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.21.0-rc2' + s.version = '3.21.0-rc1' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.cocoapods_version = '>= 1.0' s.source = { :git => 'https://github.com/protocolbuffers/protobuf.git', - :tag => "v21.0-rc2" } + :tag => "v#{s.version}" } s.source_files = 'objectivec/*.{h,m}', 'objectivec/google/protobuf/Any.pbobjc.h', From bb27447f42f30457423ab1adaf328ac71d219f7c Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Fri, 20 May 2022 13:04:18 -0700 Subject: [PATCH 22/27] [Bazel] Use pyenv to select Python 3.9.5 on our linux/bazel builds. (#10009) We still need to use python2 when running autotools. --- kokoro/common/pyenv.sh | 16 ++++++++++++ kokoro/linux/bazel/build.sh | 7 ++++- kokoro/linux/bazel_distcheck/build.sh | 37 ++++++--------------------- 3 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 kokoro/common/pyenv.sh diff --git a/kokoro/common/pyenv.sh b/kokoro/common/pyenv.sh new file mode 100644 index 000000000..f89dc26a5 --- /dev/null +++ b/kokoro/common/pyenv.sh @@ -0,0 +1,16 @@ +# Shared logic to choose a Python version with pyenv. +# +# This file should be `source`d. + +# Requested version of Python can be overridden by env variable. +: ${PYTHON_VERSION:=3.9.5} + +if pyenv --version >/dev/null ; then + eval "$(pyenv init -)" + if ! pyenv global ${PYTHON_VERSION}; then + echo "Python ${PYTHON_VERSION} is not available. Versions available:" >&2 + pyenv versions >&2 + exit 1 + fi +fi +echo "Using $(python --version || python3 --version)" diff --git a/kokoro/linux/bazel/build.sh b/kokoro/linux/bazel/build.sh index fd0f51f82..7d053c109 100755 --- a/kokoro/linux/bazel/build.sh +++ b/kokoro/linux/bazel/build.sh @@ -9,6 +9,7 @@ bazel version # Change to repo root cd $(dirname $0)/../../.. +source kokoro/common/pyenv.sh git submodule update --init --recursive @@ -24,7 +25,11 @@ bazel test \ @com_google_protobuf_examples//... # Verify that we can build successfully from generated tar files. -./autogen.sh && ./configure && make -j$(nproc) dist +( + pyenv versions + pyenv shell 2.7.9 # python2 required for old googletest autotools support + ./autogen.sh && ./configure && make -j$(nproc) dist +) DIST=`ls *.tar.gz` tar -xf $DIST cd ${DIST//.tar.gz} diff --git a/kokoro/linux/bazel_distcheck/build.sh b/kokoro/linux/bazel_distcheck/build.sh index b122761bd..517b6fdb0 100755 --- a/kokoro/linux/bazel_distcheck/build.sh +++ b/kokoro/linux/bazel_distcheck/build.sh @@ -23,14 +23,17 @@ TEST_TARGETS=( @com_google_protobuf_examples//... ) -CONTAINER_NAME=gcr.io/protobuf-build/bazel/linux -CONTAINER_VERSION=5.1.1-e41ccfa1648716433276ebe077c665796550fcbb - use_bazel.sh 5.0.0 || true bazel version # Change to repo root cd $(dirname $0)/../../.. +source kokoro/common/pyenv.sh + +# Build distribution archive +date +bazel build //pkg:dist_all_tar +bazel shutdown # Construct temp directory for running the dist build. # If you want to run locally and keep the build dir, create a directory @@ -43,43 +46,19 @@ if [[ -z ${DIST_WORK_ROOT:-} ]]; then trap dist_cleanup EXIT fi -# Let Bazel share the distdir. -TMP_DISTDIR=${DIST_WORK_ROOT}/bazel-distdir -mkdir -p ${TMP_DISTDIR} - -# Build distribution archive -date -bazel fetch --distdir=${TMP_DISTDIR} //pkg:dist_all_tar -bazel build --distdir=${TMP_DISTDIR} //pkg:dist_all_tar -DIST_ARCHIVE=$(readlink $(bazel info bazel-bin)/pkg/dist_all_tar.tar.gz) -bazel shutdown - -# The `pkg_tar` rule emits a symlink based on the rule name. The actual -# file is named with the current version. -date -echo "Resolved archive path: ${DIST_ARCHIVE}" - # Extract the dist archive. date DIST_WORKSPACE=${DIST_WORK_ROOT}/protobuf mkdir -p ${DIST_WORKSPACE} -tar -C ${DIST_WORKSPACE} --strip-components=1 -axf ${DIST_ARCHIVE} +tar -C ${DIST_WORKSPACE} --strip-components=1 -axf bazel-bin/pkg/dist_all_tar.tar.gz # Perform build steps in the extracted dist sources. cd ${DIST_WORKSPACE} FAILED=false -until docker pull gcr.io/protobuf-build/bazel/linux:${CONTAINER_VERSION}; do - sleep 10 -done - date -docker run --rm \ - -v ${DIST_WORKSPACE}:/workspace \ - -v ${TMP_DISTDIR}:${TMP_DISTDIR} \ - ${CONTAINER_NAME}:${CONTAINER_VERSION} \ - test --distdir=${TMP_DISTDIR} --test_output=errors -k \ +bazel test --test_output=errors -k \ "${BUILD_ONLY_TARGETS[@]}" "${TEST_TARGETS[@]}" || FAILED=true if ${FAILED}; then From 38f0bd4d152f2965ff7a6e21a7e5e029c1bde435 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 20 May 2022 21:28:55 +0000 Subject: [PATCH 23/27] Fix bazel builds --- pkg/BUILD.bazel | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index 93d816ea9..f30c8367c 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -17,17 +17,8 @@ package_naming( pkg_files( name = "wkt_protos_files", srcs = [ - "//:src/google/protobuf/any.proto", - "//:src/google/protobuf/api.proto", - "//:src/google/protobuf/descriptor.proto", - "//:src/google/protobuf/duration.proto", - "//:src/google/protobuf/empty.proto", - "//:src/google/protobuf/field_mask.proto", - "//:src/google/protobuf/source_context.proto", - "//:src/google/protobuf/struct.proto", - "//:src/google/protobuf/timestamp.proto", - "//:src/google/protobuf/type.proto", - "//:src/google/protobuf/wrappers.proto", + "//:well_known_type_protos", + "//src/google/protobuf:descriptor_proto_srcs", ], prefix = "include/google/protobuf", visibility = ["//visibility:private"], @@ -35,7 +26,9 @@ pkg_files( pkg_files( name = "compiler_plugin_protos_files", - srcs = ["//:src/google/protobuf/compiler/plugin.proto"], + srcs = [ + "//src/google/protobuf/compiler:compiler_plugin_protos_files", + ], prefix = "include/google/protobuf/compiler", visibility = ["//visibility:private"], ) @@ -76,11 +69,9 @@ pkg_zip( name = "protoc_release", srcs = [ ":compiler_plugin_protos_files", - ":descriptor_protos_files", ":protoc_files", ":protoc_readme", ":wkt_protos_files", - "//src/google/protobuf/compiler:compiler_plugin_protos_files", ], package_file_name = "protoc-{version}-{platform}.zip", package_variables = ":protobuf_pkg_naming", From e5e8378a62ddf3b01267e87009b0c242f145ca57 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Fri, 20 May 2022 19:33:42 -0700 Subject: [PATCH 24/27] [Bazel] Make the protobuf workspace (nearly) wildcard-buildable. (#10010) - Add back benchmarks/datasets/BUILD.bazel to dist archive - Change dist/build_systems.bzl to be compatible with Bazel 4.0.0. After this, most builds can use //..., with one exception: non-Mac environments must also exclude objectivec: `bazel build -- //... -//objectivec/...` --- benchmarks/BUILD.bazel | 2 +- pkg/build_systems.bzl | 163 +++++++++++++++++++++-------------------- 2 files changed, 84 insertions(+), 81 deletions(-) diff --git a/benchmarks/BUILD.bazel b/benchmarks/BUILD.bazel index 36f6283f6..cd80ca69e 100644 --- a/benchmarks/BUILD.bazel +++ b/benchmarks/BUILD.bazel @@ -87,7 +87,7 @@ pkg_filegroup( srcs = [ ":dist_files", "//benchmarks/cpp:dist_files", - # "//benchmarks/datasets:dist_files", # not in autotools dist + "//benchmarks/datasets:dist_files", # not in autotools dist "//benchmarks/datasets/google_message1/proto2:dist_files", "//benchmarks/datasets/google_message1/proto3:dist_files", "//benchmarks/datasets/google_message2:dist_files", diff --git a/pkg/build_systems.bzl b/pkg/build_systems.bzl index 753d285f1..2d8cdd70b 100644 --- a/pkg/build_systems.bzl +++ b/pkg/build_systems.bzl @@ -178,7 +178,7 @@ Output is CcFileList and/or ProtoFileList. Example: # fragment generator function. ################################################################################ -def _create_file_list_impl(fragment_generator): +def _create_file_list_impl(ctx, fragment_generator): # `fragment_generator` is a function like: # def fn(originating_rule: Label, # varname: str, @@ -191,92 +191,89 @@ def _create_file_list_impl(fragment_generator): # When dealing with `File` objects, the `short_path` is used to strip # the output prefix for generated files. - def _impl(ctx): - out = ctx.outputs.out + out = ctx.outputs.out - fragments = [] - for srcrule, libname in ctx.attr.src_libs.items(): - if CcFileList in srcrule: - cc_file_list = srcrule[CcFileList] - fragments.extend([ - fragment_generator( - srcrule.label, - libname + "_srcs", - ctx.attr.source_prefix, - [f.short_path for f in cc_file_list.srcs], - ), - fragment_generator( - srcrule.label, - libname + "_hdrs", - ctx.attr.source_prefix, - [f.short_path for f in (cc_file_list.hdrs + - cc_file_list.textual_hdrs)], - ), - ]) + fragments = [] + for srcrule, libname in ctx.attr.src_libs.items(): + if CcFileList in srcrule: + cc_file_list = srcrule[CcFileList] + fragments.extend([ + fragment_generator( + srcrule.label, + libname + "_srcs", + ctx.attr.source_prefix, + [f.short_path for f in cc_file_list.srcs], + ), + fragment_generator( + srcrule.label, + libname + "_hdrs", + ctx.attr.source_prefix, + [f.short_path for f in (cc_file_list.hdrs + + cc_file_list.textual_hdrs)], + ), + ]) - if ProtoFileList in srcrule: - proto_file_list = srcrule[ProtoFileList] - fragments.extend([ - fragment_generator( - srcrule.label, - libname + "_proto_srcs", - ctx.attr.source_prefix, - [f.short_path for f in proto_file_list.proto_srcs], - ), - fragment_generator( - srcrule.label, - libname + "_srcs", - ctx.attr.source_prefix, - proto_file_list.srcs, - ), - fragment_generator( - srcrule.label, - libname + "_hdrs", - ctx.attr.source_prefix, - proto_file_list.hdrs, - ), - ]) + if ProtoFileList in srcrule: + proto_file_list = srcrule[ProtoFileList] + fragments.extend([ + fragment_generator( + srcrule.label, + libname + "_proto_srcs", + ctx.attr.source_prefix, + [f.short_path for f in proto_file_list.proto_srcs], + ), + fragment_generator( + srcrule.label, + libname + "_srcs", + ctx.attr.source_prefix, + proto_file_list.srcs, + ), + fragment_generator( + srcrule.label, + libname + "_hdrs", + ctx.attr.source_prefix, + proto_file_list.hdrs, + ), + ]) - files = {} + files = {} - if PackageFilegroupInfo in srcrule: - for pkg_files_info, origin in srcrule[PackageFilegroupInfo].pkg_files: - # keys are the destination path: - files.update(pkg_files_info.dest_src_map) + if PackageFilegroupInfo in srcrule: + for pkg_files_info, origin in srcrule[PackageFilegroupInfo].pkg_files: + # keys are the destination path: + files.update(pkg_files_info.dest_src_map) - if PackageFilesInfo in srcrule: - # keys are the destination: - files.update(srcrule[PackageFilesInfo].dest_src_map) + if PackageFilesInfo in srcrule: + # keys are the destination: + files.update(srcrule[PackageFilesInfo].dest_src_map) - if files == {} and DefaultInfo in srcrule and CcInfo not in srcrule: - # This could be an individual file or filegroup. - # We explicitly ignore rules with CcInfo, since their - # output artifacts are libraries or binaries. - files.update( - { - f.short_path: 1 - for f in srcrule[DefaultInfo].files.to_list() - }, - ) + if files == {} and DefaultInfo in srcrule and CcInfo not in srcrule: + # This could be an individual file or filegroup. + # We explicitly ignore rules with CcInfo, since their + # output artifacts are libraries or binaries. + files.update( + { + f.short_path: 1 + for f in srcrule[DefaultInfo].files.to_list() + }, + ) - if files: - fragments.append( - fragment_generator( - srcrule.label, - libname + "_files", - ctx.attr.source_prefix, - sorted(files.keys()), - ), - ) + if files: + fragments.append( + fragment_generator( + srcrule.label, + libname + "_files", + ctx.attr.source_prefix, + sorted(files.keys()), + ), + ) - ctx.actions.write( - output = out, - content = (ctx.attr._header % ctx.label) + "\n".join(fragments), - ) + ctx.actions.write( + output = out, + content = (ctx.attr._header % ctx.label) + "\n".join(fragments), + ) - return [DefaultInfo(files = depset([out]))] - - return _impl + return [DefaultInfo(files = depset([out]))] # Common rule attrs for rules that use `_create_file_list_impl`: # (note that `_header` is also required) @@ -343,6 +340,9 @@ def _cmake_var_fragment(owner, varname, prefix, entries): entries = "\n".join([" %s%s" % (prefix, f) for f in entries]), ) +def _cmake_file_list_impl(ctx): + _create_file_list_impl(ctx, _cmake_var_fragment) + gen_cmake_file_lists = rule( doc = """ Generates a CMake-syntax file with lists of files. @@ -361,7 +361,7 @@ For proto_library, the following are generated: {libname}_hdrs: contains syntesized paths for generated C++ headers. """, - implementation = _create_file_list_impl(_cmake_var_fragment), + implementation = _cmake_file_list_impl, attrs = dict( _source_list_common_attrs, _header = attr.string( @@ -416,6 +416,9 @@ def _automake_var_fragment(owner, varname, prefix, entries): ) return fragment.rstrip("\\ ") + "\n" +def _automake_file_list_impl(ctx): + _create_file_list_impl(ctx, _automake_var_fragment) + gen_automake_file_lists = rule( doc = """ Generates an Automake-syntax file with lists of files. @@ -434,7 +437,7 @@ For proto_library, the following are generated: {libname}_hdrs: contains syntesized paths for generated C++ headers. """, - implementation = _create_file_list_impl(_automake_var_fragment), + implementation = _automake_file_list_impl, attrs = dict( _source_list_common_attrs.items(), _header = attr.string( From bbcc459aa0c2d5796725f5cb66718acda1ee38f8 Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Fri, 20 May 2022 19:44:51 -0700 Subject: [PATCH 25/27] [Kokoro/Bazel] Send Bazel build results to BES. (#10008) This change adds bazel_wrapper.sh, which uses values set by Kokoro to log remotely. --- kokoro/common/bazel_wrapper.sh | 71 +++++++++++++++++++++++++ kokoro/linux/bazel/build.sh | 28 ++++++---- kokoro/linux/bazel/common.cfg | 9 ++++ kokoro/linux/bazel_distcheck/build.sh | 60 +++++++++------------ kokoro/linux/bazel_distcheck/common.cfg | 9 ++++ 5 files changed, 133 insertions(+), 44 deletions(-) create mode 100755 kokoro/common/bazel_wrapper.sh create mode 100644 kokoro/linux/bazel/common.cfg create mode 100644 kokoro/linux/bazel_distcheck/common.cfg diff --git a/kokoro/common/bazel_wrapper.sh b/kokoro/common/bazel_wrapper.sh new file mode 100755 index 000000000..bd3539607 --- /dev/null +++ b/kokoro/common/bazel_wrapper.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# Wrapper for invoking bazel on Kokoro. +# +# This script adds extra flags to a bazel invocation when it is run from Kokoro. +# When the special environment variables are not present (e.g., if you run +# Kokoro build scripts locally), this script is equivalent to the "bazel" +# command. +# +# Example of running directly: +# path/to/bazel_wrapper.sh build //... +# +# Example of `source`ing: +# source path/to/bazel_wrapper.sh +# bazel_wrapper build //... + +function bazel_wrapper::gen_invocation_id() { + # Create a new invocation ID and store in the artifacts dir. + local _invocation_id=$(uuidgen | tr A-Z a-z) + + # Put the new invocation ID at the start of the output IDs file. Some + # Google-internal tools only look at the first entry, so this ensures the most + # recent entry is first. + local _ids_file=${KOKORO_ARTIFACTS_DIR}/bazel_invocation_ids + local _temp_ids=$(mktemp) + echo ${_invocation_id} > ${_temp_ids} + [[ -e ${_ids_file} ]] && cat ${_ids_file} >> ${_temp_ids} + mv -f ${_temp_ids} ${_ids_file} + + echo -n ${_invocation_id} +} + +# Prints flags to use on Kokoro. +function bazel_wrapper::kokoro_flags() { + [[ -n ${KOKORO_BES_PROJECT_ID:-} ]] || return + + local -a _flags + _flags+=( + --bes_backend=${KOKORO_BES_BACKEND_ADDRESS:-buildeventservice.googleapis.com} + --bes_results_url=https://source.cloud.google.com/results/invocations/ + --invocation_id=$(bazel_wrapper::gen_invocation_id) + --project_id=${KOKORO_BES_PROJECT_ID} # --bes_instance_name in Bazel 5+ + --remote_cache=https://storage.googleapis.com/protobuf-bazel-cache + ) + if [[ -n ${KOKORO_BAZEL_AUTH_CREDENTIAL:-} ]]; then + _flags+=( --google_credentials=${KOKORO_BAZEL_AUTH_CREDENTIAL} ) + else + _flags+=( --google_default_credentials=true ) + fi + + echo "${_flags[@]}" +} + +# Runs bazel with Kokoro flags, if appropriate. +function bazel_wrapper() { + local -a _flags + + # We might need to add flags. They need to come after any startup flags and + # the command, but before any terminating "--", so copy them into the _flags + # variable. + until (( ${#@} == 0 )) || [[ $1 == "--" ]]; do + _flags+=( "${1}" ); shift + done + + # Set the `BAZEL` env variable to override the actual bazel binary to use: + ${BAZEL:=bazel} "${_flags[@]}" $(bazel_wrapper::kokoro_flags) "${@}" +} + +# If this script was called directly, run bazel. Otherwise (i.e., this script +# was `source`d), the sourcing script will call bazel_wrapper themselves. +(( ${#BASH_SOURCE[@]} == 1 )) && bazel_wrapper "${@}" diff --git a/kokoro/linux/bazel/build.sh b/kokoro/linux/bazel/build.sh index 7d053c109..bc8fdcb05 100755 --- a/kokoro/linux/bazel/build.sh +++ b/kokoro/linux/bazel/build.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Build file to set up and run tests -set -ex +set -eu # Install Bazel 4.0.0. use_bazel.sh 4.0.0 @@ -9,28 +9,36 @@ bazel version # Change to repo root cd $(dirname $0)/../../.. -source kokoro/common/pyenv.sh -git submodule update --init --recursive +# Get kokoro scripts from repo root by default. +: ${SCRIPT_ROOT:=$(pwd)} +source ${SCRIPT_ROOT}/kokoro/common/pyenv.sh # Disabled for now, re-enable if appropriate. # //:build_files_updated_unittest \ -bazel test \ - -k --copt=-Werror --host_copt=-Werror --test_output=errors \ - //build_defs:all \ - //java:tests \ - //src/... \ - //:protobuf_python \ +bazel_args=( + test + --keep_going + --copt=-Werror + --host_copt=-Werror + --test_output=errors + -- + //... + -//objectivec/... # only works on macOS @com_google_protobuf_examples//... +) + +${SCRIPT_ROOT}/kokoro/common/bazel_wrapper.sh "${bazel_args[@]}" # Verify that we can build successfully from generated tar files. ( pyenv versions pyenv shell 2.7.9 # python2 required for old googletest autotools support + git submodule update --init --recursive ./autogen.sh && ./configure && make -j$(nproc) dist ) DIST=`ls *.tar.gz` tar -xf $DIST cd ${DIST//.tar.gz} -bazel build //:protobuf //:protobuf_java +${SCRIPT_ROOT}/kokoro/common/bazel_wrapper.sh build //:protobuf //:protobuf_java diff --git a/kokoro/linux/bazel/common.cfg b/kokoro/linux/bazel/common.cfg new file mode 100644 index 000000000..6b1848816 --- /dev/null +++ b/kokoro/linux/bazel/common.cfg @@ -0,0 +1,9 @@ +# Common config shared by presubmit and continuous. + +bazel_setting: { + project_id: "protobuf-build" + bes_backend_address: "buildeventservice.googleapis.com" + foundry_backend_address: "remotebuildexecution.googleapis.com" + upsalite_frontend_address: "https://source.cloud.google.com" + local_execution: true +} diff --git a/kokoro/linux/bazel_distcheck/build.sh b/kokoro/linux/bazel_distcheck/build.sh index 517b6fdb0..7c8c53990 100755 --- a/kokoro/linux/bazel_distcheck/build.sh +++ b/kokoro/linux/bazel_distcheck/build.sh @@ -5,64 +5,56 @@ # Note that the builds use WORKSPACE to fetch external sources, not # git submodules. -set -eux - -BUILD_ONLY_TARGETS=( - //pkg:all - //:protoc - //:protobuf - //:protobuf_python -) - -TEST_TARGETS=( - //build_defs:all - //conformance:all - //java:tests - //python:all - //src/... - @com_google_protobuf_examples//... -) +set -eu use_bazel.sh 5.0.0 || true bazel version # Change to repo root cd $(dirname $0)/../../.. -source kokoro/common/pyenv.sh + +# Get kokoro scripts from repo root by default. +: ${SCRIPT_ROOT:=$(pwd)} +source ${SCRIPT_ROOT}/kokoro/common/pyenv.sh # Build distribution archive -date -bazel build //pkg:dist_all_tar +echo "============================================================" +echo -e "[[ $(date) ]] Building distribution archive...\n" +${SCRIPT_ROOT}/kokoro/common/bazel_wrapper.sh build //pkg:dist_all_tar +DIST_ARCHIVE=$(readlink $(bazel info bazel-bin)/pkg/dist_all_tar.tar.gz) bazel shutdown +# Extract the dist archive. +echo "============================================================" +echo -e "[[ $(date) ]] Extracting distribution archive...\n" + # Construct temp directory for running the dist build. # If you want to run locally and keep the build dir, create a directory # and pass it in the DIST_WORK_ROOT env var. if [[ -z ${DIST_WORK_ROOT:-} ]]; then : ${DIST_WORK_ROOT:=$(mktemp -d)} function dist_cleanup() { - rm -rf ${DIST_WORK_ROOT} + (( $BASH_SUBSHELL == 0 )) && rm -rf ${DIST_WORK_ROOT} } trap dist_cleanup EXIT fi -# Extract the dist archive. -date DIST_WORKSPACE=${DIST_WORK_ROOT}/protobuf mkdir -p ${DIST_WORKSPACE} tar -C ${DIST_WORKSPACE} --strip-components=1 -axf bazel-bin/pkg/dist_all_tar.tar.gz -# Perform build steps in the extracted dist sources. +echo "============================================================" +echo -e "[[ $(date) ]] Building extracted archive...\n" cd ${DIST_WORKSPACE} -FAILED=false -date -bazel test --test_output=errors -k \ - "${BUILD_ONLY_TARGETS[@]}" "${TEST_TARGETS[@]}" || FAILED=true - -if ${FAILED}; then - echo FAILED - exit 1 -fi -echo PASS +bazel_args=( + test + --keep_going + --test_output=errors + -- + //... + -//objectivec/... # only works on macOS + @com_google_protobuf_examples//... +) +${SCRIPT_ROOT}/kokoro/common/bazel_wrapper.sh "${bazel_args[@]}" diff --git a/kokoro/linux/bazel_distcheck/common.cfg b/kokoro/linux/bazel_distcheck/common.cfg new file mode 100644 index 000000000..6b1848816 --- /dev/null +++ b/kokoro/linux/bazel_distcheck/common.cfg @@ -0,0 +1,9 @@ +# Common config shared by presubmit and continuous. + +bazel_setting: { + project_id: "protobuf-build" + bes_backend_address: "buildeventservice.googleapis.com" + foundry_backend_address: "remotebuildexecution.googleapis.com" + upsalite_frontend_address: "https://source.cloud.google.com" + local_execution: true +} From 586b72c1acd6f3b69679eceb8c69f251a5003d8d Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Tue, 24 May 2022 12:31:56 -0700 Subject: [PATCH 26/27] [Bazel/C++] Augment `cc_dist_library` to generate lists of source files (#10026) This change largely moves internal logic that creates the the `CcFileList` provider from `build_systems.bzl` to `cc_dist_library.bzl`. There are also some associated changes to the particular `cc_dist_library` targets, since the output didn't really make sense after previous BUILD.bazel refactoring. There is also a target now for `libprotoc`. --- pkg/BUILD.bazel | 28 +- pkg/build_systems.bzl | 78 +---- pkg/cc_dist_library.bzl | 304 ++++++++++++++---- src/google/protobuf/BUILD.bazel | 2 + src/google/protobuf/compiler/cpp/BUILD.bazel | 5 +- .../protobuf/compiler/csharp/BUILD.bazel | 7 +- src/google/protobuf/compiler/java/BUILD.bazel | 7 +- .../protobuf/compiler/objectivec/BUILD.bazel | 5 +- src/google/protobuf/compiler/php/BUILD.bazel | 5 +- .../protobuf/compiler/python/BUILD.bazel | 5 +- src/google/protobuf/compiler/ruby/BUILD.bazel | 5 +- 11 files changed, 304 insertions(+), 147 deletions(-) diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index f30c8367c..a2663dc2b 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -305,9 +305,9 @@ gen_file_lists( out_stem = "src_file_lists", src_libs = { # source rule: name in generated file - "//:protobuf": "libprotobuf", - "//src/google/protobuf/compiler:protoc_lib": "libprotoc", - "//:protobuf_lite": "libprotobuf_lite", + ":protobuf": "libprotobuf", + ":protoc": "libprotoc", + ":protobuf_lite": "libprotobuf_lite", }, ) @@ -343,8 +343,8 @@ cc_dist_library( }), tags = ["manual"], deps = [ - "//:protobuf_lite", "//src/google/protobuf:arena", + "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/io", "//src/google/protobuf/io:io_win32", "//src/google/protobuf/stubs:lite", @@ -362,8 +362,6 @@ cc_dist_library( }), tags = ["manual"], deps = [ - "//:protobuf", - "//:protobuf_lite", "//src/google/protobuf:arena", "//src/google/protobuf/compiler:importer", "//src/google/protobuf/io", @@ -371,6 +369,8 @@ cc_dist_library( "//src/google/protobuf/io:io_win32", "//src/google/protobuf/io:printer", "//src/google/protobuf/io:tokenizer", + "//src/google/protobuf:protobuf", + "//src/google/protobuf:protobuf_lite", "//src/google/protobuf/stubs", "//src/google/protobuf/stubs:lite", "//src/google/protobuf/util:delimited_message_util", @@ -382,6 +382,22 @@ cc_dist_library( ], ) +cc_dist_library( + name = "protoc", + tags = ["manual"], + deps = [ + "//src/google/protobuf/compiler:code_generator", + "//src/google/protobuf/compiler:command_line_interface", + "//src/google/protobuf/compiler/cpp", + "//src/google/protobuf/compiler/csharp", + "//src/google/protobuf/compiler/java", + "//src/google/protobuf/compiler/objectivec", + "//src/google/protobuf/compiler/php", + "//src/google/protobuf/compiler/python", + "//src/google/protobuf/compiler/ruby", + ], +) + ################################################################################ # Distribution sources ################################################################################ diff --git a/pkg/build_systems.bzl b/pkg/build_systems.bzl index 2d8cdd70b..40bdaad65 100644 --- a/pkg/build_systems.bzl +++ b/pkg/build_systems.bzl @@ -1,6 +1,7 @@ # Starlark utilities for working with other build systems load("@rules_pkg//:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo") +load(":cc_dist_library.bzl", "CcFileList") ################################################################################ # Macro to create CMake and Automake source lists. @@ -31,21 +32,6 @@ def gen_file_lists(name, out_stem, **kwargs): # Aspect that extracts srcs, hdrs, etc. ################################################################################ -CcFileList = provider( - doc = "List of files to be built into a library.", - fields = { - # As a rule of thumb, `hdrs` and `textual_hdrs` are the files that - # would be installed along with a prebuilt library. - "hdrs": "public header files, including those used by generated code", - "textual_hdrs": "files which are included but are not self-contained", - - # The `internal_hdrs` are header files which appear in `srcs`. - # These are only used when compiling the library. - "internal_hdrs": "internal header files (only used to build .cc files)", - "srcs": "source files", - }, -) - ProtoFileList = provider( doc = "List of proto files and generated code to be built into a library.", fields = { @@ -65,56 +51,11 @@ def _flatten_target_files(targets): files.append(tfile) return files -def _combine_cc_file_lists(file_lists): - hdrs = {} - textual_hdrs = {} - internal_hdrs = {} - srcs = {} - for file_list in file_lists: - hdrs.update({f: 1 for f in file_list.hdrs}) - textual_hdrs.update({f: 1 for f in file_list.textual_hdrs}) - internal_hdrs.update({f: 1 for f in file_list.internal_hdrs}) - srcs.update({f: 1 for f in file_list.srcs}) - return CcFileList( - hdrs = sorted(hdrs.keys()), - textual_hdrs = sorted(textual_hdrs.keys()), - internal_hdrs = sorted(internal_hdrs.keys()), - srcs = sorted(srcs.keys()), - ) - def _file_list_aspect_impl(target, ctx): # We're going to reach directly into the attrs on the traversed rule. rule_attr = ctx.rule.attr providers = [] - # Extract sources from a `cc_library` (or similar): - if CcInfo in target: - # CcInfo is a proxy for what we expect this rule to look like. - # However, some deps may expose `CcInfo` without having `srcs`, - # `hdrs`, etc., so we use `getattr` to handle that gracefully. - - internal_hdrs = [] - srcs = [] - - # Filter `srcs` so it only contains source files. Headers will go - # into `internal_headers`. - for src in _flatten_target_files(getattr(rule_attr, "srcs", [])): - if src.extension.lower() in ["c", "cc", "cpp", "cxx"]: - srcs.append(src) - else: - internal_hdrs.append(src) - - providers.append(CcFileList( - hdrs = _flatten_target_files(getattr(rule_attr, "hdrs", [])), - textual_hdrs = _flatten_target_files(getattr( - rule_attr, - "textual_hdrs", - [], - )), - internal_hdrs = internal_hdrs, - srcs = srcs, - )) - # Extract sources from a `proto_library`: if ProtoInfo in target: proto_srcs = [] @@ -197,19 +138,28 @@ def _create_file_list_impl(ctx, fragment_generator): for srcrule, libname in ctx.attr.src_libs.items(): if CcFileList in srcrule: cc_file_list = srcrule[CcFileList] + + # Turn depsets of files into sorted lists. + srcs = sorted(cc_file_list.srcs.to_list()) + hdrs = sorted( + depset(transitive = [ + cc_file_list.textual_hdrs, + cc_file_list.hdrs, + ]).to_list(), + ) + fragments.extend([ fragment_generator( srcrule.label, libname + "_srcs", ctx.attr.source_prefix, - [f.short_path for f in cc_file_list.srcs], + [f.short_path for f in srcs], ), fragment_generator( srcrule.label, libname + "_hdrs", ctx.attr.source_prefix, - [f.short_path for f in (cc_file_list.hdrs + - cc_file_list.textual_hdrs)], + [f.short_path for f in hdrs], ), ]) @@ -247,7 +197,7 @@ def _create_file_list_impl(ctx, fragment_generator): # keys are the destination: files.update(srcrule[PackageFilesInfo].dest_src_map) - if files == {} and DefaultInfo in srcrule and CcInfo not in srcrule: + if files == {} and DefaultInfo in srcrule and CcFileList not in srcrule: # This could be an individual file or filegroup. # We explicitly ignore rules with CcInfo, since their # output artifacts are libraries or binaries. diff --git a/pkg/cc_dist_library.bzl b/pkg/cc_dist_library.bzl index d48e8bed8..383979e6c 100644 --- a/pkg/cc_dist_library.bzl +++ b/pkg/cc_dist_library.bzl @@ -3,12 +3,32 @@ load("@rules_cc//cc:action_names.bzl", cc_action_names = "ACTION_NAMES") load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain") +################################################################################ +# Archive/linking support +################################################################################ + +def _collect_linker_input_objects(dep_label, cc_info, objs, pic_objs): + """Accumulate .o and .pic.o files into `objs` and `pic_objs`.""" + link_ctx = cc_info.linking_context + if link_ctx == None: + return + + linker_inputs = link_ctx.linker_inputs.to_list() + for link_input in linker_inputs: + if link_input.owner != dep_label: + # This is a transitive dep: skip it. + continue + + for lib in link_input.libraries: + objs.extend(lib.objects or []) + pic_objs.extend(lib.pic_objects or []) + # Creates an action to build the `output_file` static library (archive) # using `object_files`. def _create_archive_action( ctx, feature_configuration, - cc_toolchain, + cc_toolchain_info, output_file, object_files): # Based on Bazel's src/main/starlark/builtins_bzl/common/cc/cc_import.bzl: @@ -16,7 +36,7 @@ def _create_archive_action( # Build the command line and add args for all of the input files: archiver_variables = cc_common.create_link_variables( feature_configuration = feature_configuration, - cc_toolchain = cc_toolchain, + cc_toolchain = cc_toolchain_info, output_file = output_file.path, is_using_linker = False, ) @@ -48,7 +68,7 @@ def _create_archive_action( inputs = depset( direct = object_files, transitive = [ - cc_toolchain.all_files, + cc_toolchain_info.all_files, ], ), use_default_shell_env = False, @@ -56,72 +76,15 @@ def _create_archive_action( mnemonic = "CppArchiveDist", ) -# Implementation for cc_dist_library rule. -def _cc_dist_library_impl(ctx): - cc_toolchain_info = find_cc_toolchain(ctx) - if cc_toolchain_info.ar_executable == None: - return [] - - feature_configuration = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain_info, - ) - - # Collect the set of object files from the immediate deps. - - objs = [] - pic_objs = [] - for dep in ctx.attr.deps: - if CcInfo not in dep: - continue - - link_ctx = dep[CcInfo].linking_context - if link_ctx == None: - continue - - linker_inputs = link_ctx.linker_inputs.to_list() - for link_input in linker_inputs: - if link_input.owner != dep.label: - # This is a transitive dep: skip it. - continue - - for lib in link_input.libraries: - objs.extend(lib.objects or []) - pic_objs.extend(lib.pic_objects or []) - - # For static libraries, build separately with and without pic. - - stemname = "lib" + ctx.label.name - outputs = [] - - if len(objs) > 0: - archive_out = ctx.actions.declare_file(stemname + ".a") - _create_archive_action( - ctx, - feature_configuration, - cc_toolchain_info, - archive_out, - objs, - ) - outputs.append(archive_out) - - if len(pic_objs) > 0: - pic_archive_out = ctx.actions.declare_file(stemname + ".pic.a") - _create_archive_action( - ctx, - feature_configuration, - cc_toolchain_info, - pic_archive_out, - pic_objs, - ) - outputs.append(pic_archive_out) - - # For dynamic libraries, use the `cc_common.link` command to ensure - # everything gets built correctly according to toolchain definitions. - +def _create_dso_link_action( + ctx, + feature_configuration, + cc_toolchain_info, + object_files, + pic_object_files): compilation_outputs = cc_common.create_compilation_outputs( - objects = depset(objs), - pic_objects = depset(pic_objs), + objects = depset(object_files), + pic_objects = depset(pic_object_files), ) link_output = cc_common.link( actions = ctx.actions, @@ -134,6 +97,8 @@ def _cc_dist_library_impl(ctx): ) library_to_link = link_output.library_to_link + outputs = [] + # Note: library_to_link.dynamic_library and interface_library are often # symlinks in the solib directory. For DefaultInfo, prefer reporting # the resolved artifact paths. @@ -147,6 +112,207 @@ def _cc_dist_library_impl(ctx): elif library_to_link.interface_library != None: outputs.append(library_to_link.interface_library) + return outputs + +################################################################################ +# Source file/header support +################################################################################ + +CcFileList = provider( + doc = "List of files to be built into a library.", + fields = { + # As a rule of thumb, `hdrs` and `textual_hdrs` are the files that + # would be installed along with a prebuilt library. + "hdrs": "public header files, including those used by generated code", + "textual_hdrs": "files which are included but are not self-contained", + + # The `internal_hdrs` are header files which appear in `srcs`. + # These are only used when compiling the library. + "internal_hdrs": "internal header files (only used to build .cc files)", + "srcs": "source files", + }, +) + +def _flatten_target_files(targets): + return depset(transitive = [target.files for target in targets]) + + files = [] + for target in targets: + files.extend(target.files.to_list()) + return files + +def _cc_file_list_aspect_impl(target, ctx): + # Extract sources from a `cc_library` (or similar): + if CcInfo not in target: + return [] + + # We're going to reach directly into the attrs on the traversed rule. + rule_attr = ctx.rule.attr + + # CcInfo is a proxy for what we expect this rule to look like. + # However, some deps may expose `CcInfo` without having `srcs`, + # `hdrs`, etc., so we use `getattr` to handle that gracefully. + + internal_hdrs = [] + srcs = [] + + # Filter `srcs` so it only contains source files. Headers will go + # into `internal_headers`. + for src in _flatten_target_files(getattr(rule_attr, "srcs", [])).to_list(): + if src.extension.lower() in ["c", "cc", "cpp", "cxx"]: + srcs.append(src) + else: + internal_hdrs.append(src) + + return [CcFileList( + hdrs = _flatten_target_files(getattr(rule_attr, "hdrs", depset())), + textual_hdrs = _flatten_target_files(getattr( + rule_attr, + "textual_hdrs", + depset(), + )), + internal_hdrs = depset(internal_hdrs), + srcs = depset(srcs), + )] + +cc_file_list_aspect = aspect( + doc = """ +Aspect to provide the list of sources and headers from a rule. + +Output is CcFileList. Example: + + cc_library( + name = "foo", + srcs = [ + "foo.cc", + "foo_internal.h", + ], + hdrs = ["foo.h"], + textual_hdrs = ["foo_inl.inc"], + ) + # produces: + # CcFileList( + # hdrs = depset([File("foo.h")]), + # textual_hdrs = depset([File("foo_inl.inc")]), + # internal_hdrs = depset([File("foo_internal.h")]), + # srcs = depset([File("foo.cc")]), + # ) +""", + implementation = _cc_file_list_aspect_impl, +) + +################################################################################ +# Rule impl +################################################################################ + +def _collect_inputs(deps): + """Collects files from a list of immediate deps. + + This rule collects source files and linker inputs for C++ deps. Only + these immediate deps are considered, not transitive deps. + + The return value is a struct with object files (linker inputs), + partitioned by PIC and non-pic, and the rules' source and header files: + + struct( + objects = ..., # non-PIC object files + pic_objects = ..., # PIC objects + cc_file_list = ..., # a CcFileList + ) + + Args: + deps: Iterable of immediate deps. These will be treated as the "inputs," + but not the transitive deps. + + Returns: + A struct with linker inputs, source files, and header files. + """ + + objs = [] + pic_objs = [] + + # The returned CcFileList will contain depsets of the deps' file lists. + # These lists hold `depset()`s from each of `deps`. + srcs = [] + hdrs = [] + internal_hdrs = [] + textual_hdrs = [] + + for dep in deps: + if CcInfo in dep: + _collect_linker_input_objects( + dep.label, + dep[CcInfo], + objs, + pic_objs, + ) + + if CcFileList in dep: + cfl = dep[CcFileList] + srcs.append(cfl.srcs) + hdrs.append(cfl.hdrs) + internal_hdrs.append(cfl.internal_hdrs) + textual_hdrs.append(cfl.textual_hdrs) + + return struct( + objects = objs, + pic_objects = pic_objs, + cc_file_list = CcFileList( + srcs = depset(transitive = srcs), + hdrs = depset(transitive = hdrs), + internal_hdrs = depset(transitive = internal_hdrs), + textual_hdrs = depset(transitive = textual_hdrs), + ), + ) + +# Implementation for cc_dist_library rule. +def _cc_dist_library_impl(ctx): + cc_toolchain_info = find_cc_toolchain(ctx) + + feature_configuration = cc_common.configure_features( + ctx = ctx, + cc_toolchain = cc_toolchain_info, + ) + + inputs = _collect_inputs(ctx.attr.deps) + + # For static libraries, build separately with and without pic. + + stemname = "lib" + ctx.label.name + outputs = [] + + if len(inputs.objects) > 0: + archive_out = ctx.actions.declare_file(stemname + ".a") + _create_archive_action( + ctx, + feature_configuration, + cc_toolchain_info, + archive_out, + inputs.objects, + ) + outputs.append(archive_out) + + if len(inputs.pic_objects) > 0: + pic_archive_out = ctx.actions.declare_file(stemname + ".pic.a") + _create_archive_action( + ctx, + feature_configuration, + cc_toolchain_info, + pic_archive_out, + inputs.pic_objects, + ) + outputs.append(pic_archive_out) + + # For dynamic libraries, use the `cc_common.link` command to ensure + # everything gets built correctly according to toolchain definitions. + outputs.extend(_create_dso_link_action( + ctx, + feature_configuration, + cc_toolchain_info, + inputs.objects, + inputs.pic_objects, + )) + # We could expose the libraries for use from cc rules: # # linking_context = cc_common.create_linking_context( @@ -169,6 +335,7 @@ def _cc_dist_library_impl(ctx): return [ DefaultInfo(files = depset(outputs)), + inputs.cc_file_list, ] cc_dist_library = rule( @@ -214,6 +381,7 @@ Example: "Only these targets' compilation outputs will be " + "included (i.e., the transitive dependencies are not " + "included in the output)."), + aspects = [cc_file_list_aspect], ), "linkopts": attr.string_list( doc = ("Add these flags to the C++ linker command when creating " + diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index ac5da9049..a8736c337 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -160,6 +160,7 @@ cc_library( linkopts = LINK_OPTS, visibility = [ "//:__pkg__", + "//pkg:__pkg__", "//src/google/protobuf:__subpackages__", ], # In Bazel 6.0+, these will be `interface_deps`: @@ -209,6 +210,7 @@ cc_library( linkopts = LINK_OPTS, visibility = [ "//:__pkg__", + "//pkg:__pkg__", "//src/google/protobuf:__subpackages__", ], deps = [ diff --git a/src/google/protobuf/compiler/cpp/BUILD.bazel b/src/google/protobuf/compiler/cpp/BUILD.bazel index 37e31e803..b14259495 100644 --- a/src/google/protobuf/compiler/cpp/BUILD.bazel +++ b/src/google/protobuf/compiler/cpp/BUILD.bazel @@ -48,7 +48,10 @@ cc_library( ], copts = COPTS, include_prefix = "google/protobuf/compiler/cpp", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", diff --git a/src/google/protobuf/compiler/csharp/BUILD.bazel b/src/google/protobuf/compiler/csharp/BUILD.bazel index 1271b94ff..819c9dec2 100644 --- a/src/google/protobuf/compiler/csharp/BUILD.bazel +++ b/src/google/protobuf/compiler/csharp/BUILD.bazel @@ -51,7 +51,10 @@ cc_library( "//conditions:default": ["-Wno-overloaded-virtual"], }), include_prefix = "google/protobuf/compiler/csharp", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", @@ -62,11 +65,11 @@ cc_test( name = "bootstrap_unittest", srcs = ["csharp_bootstrap_unittest.cc"], data = [ - "//src/google/protobuf:descriptor_proto_srcs", "//:well_known_type_protos", "//conformance:all_files", "//conformance:conformance_proto", "//csharp:wkt_cs_srcs", + "//src/google/protobuf:descriptor_proto_srcs", "//src/google/protobuf:testdata", ], deps = [ diff --git a/src/google/protobuf/compiler/java/BUILD.bazel b/src/google/protobuf/compiler/java/BUILD.bazel index f035f32de..66a809ec2 100644 --- a/src/google/protobuf/compiler/java/BUILD.bazel +++ b/src/google/protobuf/compiler/java/BUILD.bazel @@ -74,7 +74,10 @@ cc_library( ], copts = COPTS, include_prefix = "google/protobuf/compiler/java", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", @@ -85,9 +88,9 @@ cc_test( name = "doc_comment_unittest", srcs = ["doc_comment_unittest.cc"], data = [ - "//src/google/protobuf:descriptor_proto_srcs", "//:well_known_type_protos", "//conformance:conformance_proto", + "//src/google/protobuf:descriptor_proto_srcs", ], deps = [ ":java", diff --git a/src/google/protobuf/compiler/objectivec/BUILD.bazel b/src/google/protobuf/compiler/objectivec/BUILD.bazel index 071539075..634dda248 100644 --- a/src/google/protobuf/compiler/objectivec/BUILD.bazel +++ b/src/google/protobuf/compiler/objectivec/BUILD.bazel @@ -39,7 +39,10 @@ cc_library( ], copts = COPTS, include_prefix = "google/protobuf/compiler/objectivec", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", diff --git a/src/google/protobuf/compiler/php/BUILD.bazel b/src/google/protobuf/compiler/php/BUILD.bazel index 969d2df84..82ba185fd 100644 --- a/src/google/protobuf/compiler/php/BUILD.bazel +++ b/src/google/protobuf/compiler/php/BUILD.bazel @@ -12,7 +12,10 @@ cc_library( hdrs = ["php_generator.h"], copts = COPTS, include_prefix = "google/protobuf/compiler/php", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", diff --git a/src/google/protobuf/compiler/python/BUILD.bazel b/src/google/protobuf/compiler/python/BUILD.bazel index 3fe6807d1..1924a9ac5 100644 --- a/src/google/protobuf/compiler/python/BUILD.bazel +++ b/src/google/protobuf/compiler/python/BUILD.bazel @@ -20,7 +20,10 @@ cc_library( ], copts = COPTS, include_prefix = "google/protobuf/compiler/python", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", diff --git a/src/google/protobuf/compiler/ruby/BUILD.bazel b/src/google/protobuf/compiler/ruby/BUILD.bazel index 3a3469eb0..455865322 100644 --- a/src/google/protobuf/compiler/ruby/BUILD.bazel +++ b/src/google/protobuf/compiler/ruby/BUILD.bazel @@ -12,7 +12,10 @@ cc_library( hdrs = ["ruby_generator.h"], copts = COPTS, include_prefix = "google/protobuf/compiler/ruby", - visibility = ["//src/google/protobuf/compiler:__pkg__"], + visibility = [ + "//pkg:__pkg__", + "//src/google/protobuf/compiler:__pkg__", + ], deps = [ "//:protobuf", "//src/google/protobuf/compiler:code_generator", From 5e7b709564403f1fe22476f7efa1eeff61e995cb Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 24 May 2022 15:52:18 -0700 Subject: [PATCH 27/27] Revert "Various fixups to warnings flags (#9344)" (#10037) This reverts commit 448d421250569811a3e656cd4c87fe42e857ed6f. Unfortunately we have to revert this because we're finding that it introduces too much new build log spam for existing proto files that are out of compliance with the warnings. We might be able to roll it forward again if we can figure out a way to do so without so many new log messages. --- .../command_line_interface_unittest.cc | 25 +++++-------------- src/google/protobuf/compiler/importer.cc | 6 ----- src/google/protobuf/compiler/parser.cc | 12 ++++----- .../protobuf/compiler/parser_unittest.cc | 3 ++- 4 files changed, 13 insertions(+), 33 deletions(-) diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 99fa0ace3..7bde1b403 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -1217,8 +1217,7 @@ TEST_F(CommandLineInterfaceTest, InsertWithAnnotationFixup) { "--plug_out=insert_endlines=test_generator,test_plugin:$tmpdir " "--proto_path=$tmpdir foo.proto"); - ExpectWarningSubstring( - "foo.proto:2:36: warning: Message name should be in UpperCamelCase."); + ExpectNoErrors(); CheckGeneratedAnnotations("test_generator", "foo.proto"); CheckGeneratedAnnotations("test_plugin", "foo.proto"); } @@ -2372,21 +2371,6 @@ TEST_F(CommandLineInterfaceTest, Warnings) { ExpectErrorSubstring("foo.proto:2:1: warning: Import bar.proto is unused."); } -TEST_F(CommandLineInterfaceTest, ParserWarnings) { - // Test that parser warnings are propagated. See #9343. - - CreateTempFile("foo.proto", - "syntax = \"proto2\";\n" - "message bad_to_the_bone {};\n"); - - Run("protocol_compiler --test_out=$tmpdir " - "--proto_path=$tmpdir foo.proto"); - ExpectCapturedStderrSubstringWithZeroReturnCode( - "foo.proto:2:25: warning: Message name should be in UpperCamelCase. " - "Found: bad_to_the_bone. " - "See https://developers.google.com/protocol-buffers/docs/style"); -} - // ------------------------------------------------------------------- // Flag parsing tests @@ -2707,6 +2691,7 @@ TEST_P(EncodeDecodeTest, Encode) { EXPECT_TRUE(Run(args + " --encode=protobuf_unittest.TestAllTypes")); ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( "third_party/protobuf/testdata/golden_message_oneof_implemented")); + ExpectStderrMatchesText(""); } TEST_P(EncodeDecodeTest, Decode) { @@ -2718,6 +2703,7 @@ TEST_P(EncodeDecodeTest, Decode) { ExpectStdoutMatchesTextFile(TestUtil::GetTestDataPath( "third_party/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt")); + ExpectStderrMatchesText(""); } TEST_P(EncodeDecodeTest, Partial) { @@ -2726,7 +2712,7 @@ TEST_P(EncodeDecodeTest, Partial) { Run(TestUtil::MaybeTranslatePath("net/proto2/internal/unittest.proto") + " --encode=protobuf_unittest.TestRequired")); ExpectStdoutMatchesText(""); - ExpectStderrContainsText( + ExpectStderrMatchesText( "warning: Input message is missing required fields: a, b, c\n"); } @@ -2750,7 +2736,7 @@ TEST_P(EncodeDecodeTest, UnknownType) { Run(TestUtil::MaybeTranslatePath("net/proto2/internal/unittest.proto") + " --encode=NoSuchType")); ExpectStdoutMatchesText(""); - ExpectStderrContainsText("Type not defined: NoSuchType\n"); + ExpectStderrMatchesText("Type not defined: NoSuchType\n"); } TEST_P(EncodeDecodeTest, ProtoParseError) { @@ -2775,6 +2761,7 @@ TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) { args + " --encode=protobuf_unittest.TestAllTypes --deterministic_output")); ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( "third_party/protobuf/testdata/golden_message_oneof_implemented")); + ExpectStderrMatchesText(""); } TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) { diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc index 595bcd127..f1e26f8bd 100644 --- a/src/google/protobuf/compiler/importer.cc +++ b/src/google/protobuf/compiler/importer.cc @@ -105,12 +105,6 @@ class SourceTreeDescriptorDatabase::SingleFileErrorCollector had_errors_ = true; } - void AddWarning(int line, int column, const std::string& message) override { - if (multi_file_error_collector_ != NULL) { - multi_file_error_collector_->AddWarning(filename_, line, column, message); - } - } - private: std::string filename_; MultiFileErrorCollector* multi_file_error_collector_; diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index 472394dbb..5bd37d147 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -643,11 +643,10 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { // Store the syntax into the file. if (file != nullptr) file->set_syntax(syntax_identifier_); } else if (!stop_after_syntax_identifier_) { - AddWarning( - "No syntax specified. Please use 'syntax = \"proto2\";' or " - "'syntax = \"proto3\";' to specify a syntax version. " - "(Defaulted to proto2 syntax.)" - ); + GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " << file->name() + << ". Please use 'syntax = \"proto2\";' " + << "or 'syntax = \"proto3\";' to specify a syntax " + << "version. (Defaulted to proto2 syntax.)"; syntax_identifier_ = "proto2"; } @@ -1020,8 +1019,7 @@ bool Parser::ParseMessageFieldNoLabel( location.RecordLegacyLocation(field, DescriptorPool::ErrorCollector::NAME); DO(ConsumeIdentifier(field->mutable_name(), "Expected field name.")); - if (field->type() != FieldDescriptorProto::TYPE_GROUP && - !IsLowerUnderscore(field->name())) { + if (!IsLowerUnderscore(field->name())) { AddWarning( "Field name should be lowercase. Found: " + field->name() + ". See: https://developers.google.com/protocol-buffers/docs/style"); diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc index 83f591dc3..2d681d957 100644 --- a/src/google/protobuf/compiler/parser_unittest.cc +++ b/src/google/protobuf/compiler/parser_unittest.cc @@ -221,8 +221,9 @@ TEST_F(ParserTest, StopAfterSyntaxIdentifierWithErrors) { TEST_F(ParserTest, WarnIfSyntaxIdentifierOmmitted) { SetupParser("message A {}"); FileDescriptorProto file; + CaptureTestStderr(); EXPECT_TRUE(parser_->Parse(input_.get(), &file)); - EXPECT_TRUE(error_collector_.warning_.find("No syntax specified") != + EXPECT_TRUE(GetCapturedTestStderr().find("No syntax specified") != std::string::npos); }