From 05835e374d5f666561a175b08c8cc2100787164e Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 11 Jul 2023 14:54:12 -0700 Subject: [PATCH 01/27] Updating version.json and repo version numbers to: 24.0-rc1 --- CMakeLists.txt | 2 +- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 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/protoc/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 10 ++++----- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- ruby/pom.xml | 4 ++-- src/google/protobuf/any.pb.h | 4 ++-- src/google/protobuf/api.pb.h | 4 ++-- src/google/protobuf/compiler/plugin.pb.h | 4 ++-- src/google/protobuf/cpp_features.pb.h | 4 ++-- src/google/protobuf/descriptor.pb.h | 4 ++-- src/google/protobuf/duration.pb.h | 4 ++-- src/google/protobuf/empty.pb.h | 4 ++-- src/google/protobuf/field_mask.pb.h | 4 ++-- src/google/protobuf/port_def.inc | 10 ++++----- src/google/protobuf/source_context.pb.h | 4 ++-- src/google/protobuf/struct.pb.h | 4 ++-- src/google/protobuf/stubs/common.h | 10 ++++----- src/google/protobuf/timestamp.pb.h | 4 ++-- src/google/protobuf/type.pb.h | 4 ++-- src/google/protobuf/wrappers.pb.h | 4 ++-- version.json | 22 +++++++++---------- 36 files changed, 74 insertions(+), 74 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bed862400fb4..6d1f762123501 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "4.23.0") +set(protobuf_VERSION_STRING "4.24.0-rc-1") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 22abbb6e9cb4c..719c1815da918 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '4.23.0' + s.version = '4.24.0-rc1' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' diff --git a/Protobuf.podspec b/Protobuf.podspec index acb38911d30d6..cd394a5f4b435 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.23.0' + s.version = '3.24.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' diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 5dc2349bc7074..a32a5062fc94a 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.23.0 + 3.24.0-rc1 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 032ccf784c584..f27aa46d8e85e 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.23.0 + 3.24.0-rc1 10.0 Google Inc. netstandard1.1;netstandard2.0;net45;net50 diff --git a/java/README.md b/java/README.md index 45205730a57bf..1a16f34f2a951 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.23.0 + 3.24.0-rc-1 ``` @@ -37,14 +37,14 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.23.0 + 3.24.0-rc-1 ``` ### Gradle If you are using Gradle, add the following to your `build.gradle` file's -dependencies: `implementation 'com.google.protobuf:protobuf-java:3.23.0'` Again, +dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.0-rc-1'` 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 3606fb4913e13..e93a88b49c245 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.23.0 + 3.24.0-RC1 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 43903ddad2deb..cb5bc5479a5df 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.23.0 + 3.24.0-RC1 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index 4db88860915a0..17405efb92747 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.23.0 + 3.24.0-RC1 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index f24abca75945e..ee58789c6ba5a 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.23.0 + 3.24.0-RC1 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index 22563fe90d0ca..913a48e44440d 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.23.0 + 3.24.0-rc-1 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index ede4b4daa1de9..69097e63be3bd 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.23.0 + 3.24.0-RC1 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index fec490faf2b4d..cd81d8489d029 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.23.0 + 3.24.0-RC1 pom Protocol Buffers [Parent] diff --git a/java/protoc/pom.xml b/java/protoc/pom.xml index 8e6212efc5856..2c01607144654 100644 --- a/java/protoc/pom.xml +++ b/java/protoc/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.23.0 + 3.24.0-RC1 pom Protobuf Compiler diff --git a/java/util/pom.xml b/java/util/pom.xml index e2a9597dc5cf9..37c4116524828 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.23.0 + 3.24.0-RC1 protobuf-java-util diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 0879cf135c68b..66e281be440c8 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.23.0" +#define PHP_PROTOBUF_VERSION "3.24.0RC1" // 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 9ee991feba6d2..9f3483c1a1da5 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,6 +1,6 @@ """ Contains version numbers to be used in other bzl files """ -PROTOC_VERSION = "23.0" -PROTOBUF_JAVA_VERSION = "3.23.0" -PROTOBUF_PYTHON_VERSION = "4.23.0" -PROTOBUF_PHP_VERSION = "3.23.0" -PROTOBUF_RUBY_VERSION = "3.23.0" +PROTOC_VERSION = "24.0-rc-1" +PROTOBUF_JAVA_VERSION = "3.24.0-RC1" +PROTOBUF_PYTHON_VERSION = "4.24.0rc1" +PROTOBUF_PHP_VERSION = "3.24.0RC1" +PROTOBUF_RUBY_VERSION = "3.24.0.rc.1" diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 98a760614c446..566e75f1168d2 100755 --- 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.23.0' +__version__ = '4.24.0rc1' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index fbf0631671863..e20bcaac01d9a 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.23.0" + s.version = "3.24.0.rc.1" 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 52ae7149b8a64..d625a021cd49d 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.23.0 + 3.24.0-RC1 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.23.0 + 3.24.0-RC1 org.jruby diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 7906e5e0fc916..3d8bc85af3f16 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index c3e9082f2028c..9e300c4c0a4ea 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index fd7a9a7100504..7cadfa0c4e820 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/cpp_features.pb.h b/src/google/protobuf/cpp_features.pb.h index d6f4947ee2c2d..948569b19281d 100644 --- a/src/google/protobuf/cpp_features.pb.h +++ b/src/google/protobuf/cpp_features.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index b1d88ae945fab..e66401e2d1db8 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 13bd2f18075a7..dfebb45b8839f 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 1ecba9449ad74..2aab3f1a17d05 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index e614510356cf5..8ef1aca0ab1be 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index ea74d184a0972..c2e595f6014c2 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -255,22 +255,22 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 4023000 +#define PROTOBUF_VERSION 4024000 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined #endif -#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 4023000 +#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 4024000 #ifdef PROTOBUF_MIN_PROTOC_VERSION #error PROTOBUF_MIN_PROTOC_VERSION was previously defined #endif -#define PROTOBUF_MIN_PROTOC_VERSION 4023000 +#define PROTOBUF_MIN_PROTOC_VERSION 4024000 #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined #endif -#define PROTOBUF_VERSION_SUFFIX "" +#define PROTOBUF_VERSION_SUFFIX "-rc1" #ifdef PROTOBUF_ALWAYS_INLINE #error PROTOBUF_ALWAYS_INLINE was previously defined @@ -446,7 +446,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 4023000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 4024000 #ifdef PROTOBUF_RTTI #error PROTOBUF_RTTI was previously defined diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 4e15bf2103a7b..e2a6c13cb00ba 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index cb6ea1e0f36ca..79eebf9753c63 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 61ea63543a685..b653484c0fd49 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -66,23 +66,23 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 4023000 +#define GOOGLE_PROTOBUF_VERSION 4024000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. -#define GOOGLE_PROTOBUF_VERSION_SUFFIX "" +#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc1" // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code // generator. -static const int kMinHeaderVersionForLibrary = 4023000; +static const int kMinHeaderVersionForLibrary = 4024000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 4023000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 4024000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 4023000; +static const int kMinHeaderVersionForProtoc = 4024000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index dc39fcc6c69cf..9dbfe0c4dc44a 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 117eacf711c42..12d8bf4ca6d63 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index d9aa8d36691f5..cdf0ff912e907 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -9,13 +9,13 @@ #include #include "google/protobuf/port_def.inc" -#if PROTOBUF_VERSION < 4023000 +#if PROTOBUF_VERSION < 4024000 #error "This file was generated by a newer version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please update" #error "your headers." #endif // PROTOBUF_VERSION -#if 4023000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4024000 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/version.json b/version.json index 43e9072f7182a..f281874f71084 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { - "main": { - "protoc_version": "24-dev", + "24.x": { + "protoc_version": "24.0-rc1", "lts": false, - "date": "2023-04-25", + "date": "2023-07-11", "languages": { - "cpp": "4.24-dev", - "csharp": "3.24-dev", - "java": "3.24-dev", - "javascript": "3.24-dev", - "objectivec": "3.24-dev", - "php": "3.24-dev", - "python": "4.24-dev", - "ruby": "3.24-dev" + "cpp": "4.24.0-rc1", + "csharp": "3.24.0-rc1", + "java": "3.24.0-rc1", + "javascript": "3.24.0-rc1", + "objectivec": "3.24.0-rc1", + "php": "3.24.0-rc1", + "python": "4.24.0-rc1", + "ruby": "3.24.0-rc1" } } } \ No newline at end of file From b411d7d94a55d339eb2b997b34e8d859d9135355 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 11 Jul 2023 14:54:12 -0700 Subject: [PATCH 02/27] Updating version.json to: 24.0-dev --- version.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/version.json b/version.json index f281874f71084..c473ed391b048 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0-rc1", + "protoc_version": "24.0-dev", "lts": false, "date": "2023-07-11", "languages": { - "cpp": "4.24.0-rc1", - "csharp": "3.24.0-rc1", - "java": "3.24.0-rc1", - "javascript": "3.24.0-rc1", - "objectivec": "3.24.0-rc1", - "php": "3.24.0-rc1", - "python": "4.24.0-rc1", - "ruby": "3.24.0-rc1" + "cpp": "4.24.0-dev", + "csharp": "3.24.0-dev", + "java": "3.24.0-dev", + "javascript": "3.24.0-dev", + "objectivec": "3.24.0-dev", + "php": "3.24.0-dev", + "python": "4.24.0-dev", + "ruby": "3.24.0-dev" } } } \ No newline at end of file From c27bb6206f771d386762564dc925a79d09f7671b Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Wed, 12 Jul 2023 11:14:04 -0700 Subject: [PATCH 03/27] Explicitly delete the destructor for the internal `Rep` structure. MSVC compilers generate warnings that the default destructor is implicitly deleted, which causes errors on /W1. While this is a pedantic warning (error), we can easily make the deletion explicit to avoid these warnings. PiperOrigin-RevId: 547548886 --- src/google/protobuf/repeated_field.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index ae04c20942908..8879be58c548f 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -459,6 +459,9 @@ class RepeatedField final Element unused; }; Element* elements() { return reinterpret_cast(this + 1); } + + // Avoid 'implicitly deleted dtor' warnings on certain compilers. + ~Rep() = delete; }; static PROTOBUF_CONSTEXPR const size_t kRepHeaderSize = sizeof(Rep); From 173adca21659bfd06ae23f07d48129e7633d1f2e Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 22 Jun 2023 09:18:12 -0700 Subject: [PATCH 04/27] Put a 4k limit on preallocation to prevent OOM from malformed inputs. PiperOrigin-RevId: 542579832 --- src/google/protobuf/compiler/java/primitive_field.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/java/primitive_field.cc b/src/google/protobuf/compiler/java/primitive_field.cc index 35f0571647b19..23c09f20df5f1 100644 --- a/src/google/protobuf/compiler/java/primitive_field.cc +++ b/src/google/protobuf/compiler/java/primitive_field.cc @@ -971,10 +971,12 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateBuilderParsingCode( void RepeatedImmutablePrimitiveFieldGenerator:: GenerateBuilderParsingCodeFromPacked(io::Printer* printer) const { if (FixedSize(GetType(descriptor_)) != -1) { + // 4K limit on pre-allocations to prevent OOM from malformed input. printer->Print(variables_, "int length = input.readRawVarint32();\n" "int limit = input.pushLimit(length);\n" - "ensure$capitalized_name$IsMutable(length / $fixed_size$);\n" + "int alloc = length > 4096 ? 4096 : length;\n" + "ensure$capitalized_name$IsMutable(alloc / $fixed_size$);\n" "while (input.getBytesUntilLimit() > 0) {\n" " $repeated_add$(input.read$capitalized_type$());\n" "}\n" From ac3cad94454f547a9c29648c2e8af26a4014abb3 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 13 Jul 2023 12:26:38 -0700 Subject: [PATCH 05/27] Protobuf's Linakge Monitor check to use a local test BOM rather than google-cloud-shared-dependencies PiperOrigin-RevId: 547882989 --- java/BUILD.bazel | 1 + java/linkage_monitor.sh | 19 ++++-- java/test/linkage-monitor-check-bom/pom.xml | 75 +++++++++++++++++++++ 3 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 java/test/linkage-monitor-check-bom/pom.xml diff --git a/java/BUILD.bazel b/java/BUILD.bazel index fa6d8ba74f0d0..1b45507282078 100644 --- a/java/BUILD.bazel +++ b/java/BUILD.bazel @@ -26,6 +26,7 @@ sh_test( ] + glob([ "pom.xml", "*/pom.xml", + "test/linkage-monitor-check-bom/pom.xml", ]), ) diff --git a/java/linkage_monitor.sh b/java/linkage_monitor.sh index 3adae2b58de39..e6a54a8b3e296 100755 --- a/java/linkage_monitor.sh +++ b/java/linkage_monitor.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -e -o pipefail echo "Running Linkage Monitor check" @@ -17,22 +17,27 @@ fi cd java +# Install the test BOM for Linkage Monitor +pushd test/linkage-monitor-check-bom +mvn -e -B install +popd + # Linkage Monitor requires the artifacts to be available in local Maven # repository. -mvn --projects "bom,core,util" -e -B -Dhttps.protocols=TLSv1.2 clean generate-sources install \ +mvn -e -B clean generate-sources install \ + -Dhttps.protocols=TLSv1.2 \ -Dmaven.test.skip=true \ -Dprotobuf.basedir="../.." \ -Dprotoc="${protoc_location}" echo "Installed the artifacts to local Maven repository" -curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/linkage-monitor-latest-all-deps.jar" +curl -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/linkage-monitor-latest-all-deps.jar" echo "Running linkage-monitor-latest-all-deps.jar." -# The generated libraries in google-cloud-shared-dependencies would detect -# incompatible changes via Linkage Monitor -# https://github.com/googleapis/sdk-platform-java/tree/main/java-shared-dependencies -java -Xmx2048m -jar linkage-monitor-latest-all-deps.jar com.google.cloud:google-cloud-shared-dependencies +# The libraries in the BOM would detect incompatible changes via Linkage Monitor +java -Xmx2048m -jar linkage-monitor-latest-all-deps.jar \ + com.google.protobuf.test:linkage-monitor-check-bom echo "Finished running Linkage Monitor check" diff --git a/java/test/linkage-monitor-check-bom/pom.xml b/java/test/linkage-monitor-check-bom/pom.xml new file mode 100644 index 0000000000000..e666cde608473 --- /dev/null +++ b/java/test/linkage-monitor-check-bom/pom.xml @@ -0,0 +1,75 @@ + + + 4.0.0 + com.google.protobuf.test + linkage-monitor-check-bom + pom + 0.0.1-SNAPSHOT + Protobuf linkage monitor validation BOM + + A BOM to use in Linkage Monitor. This lists artifacts that use + Protobuf runtime libraries, such as gRPC and Google Cloud + client libraries. + We do not publish this pom.xml to Maven Central. + + + + 3.23.2 + + + + + com.google.protobuf + protobuf-bom + ${protobuf.version} + pom + import + + + io.grpc + grpc-bom + 1.55.3 + pom + import + + + com.google.api.grpc + grpc-google-common-protos + 2.22.0 + + + com.google.api.grpc + proto-google-common-protos + 2.22.0 + + + com.google.api.grpc + proto-google-iam-v1 + 1.17.0 + + + com.google.api.grpc + proto-google-iam-v2 + 1.17.0 + + + com.google.api.grpc + proto-google-iam-v2beta + 1.17.0 + + + com.google.cloud + google-cloud-bigquery + 2.29.0 + + + com.google.cloud + google-cloud-bigtable + 2.24.1 + + + + From 9f2d7ea773217cac09630eef63d91e22b1b00d60 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 14 Jul 2023 08:06:36 -0700 Subject: [PATCH 06/27] Automated rollback of commit adb2c4b415c35cda3e4394384ec579ea8dd8ec92. PiperOrigin-RevId: 548128917 --- .../generated_message_tctable_lite.cc | 217 ++++++------------ src/google/protobuf/repeated_field.h | 26 --- .../protobuf/repeated_field_unittest.cc | 18 -- 3 files changed, 74 insertions(+), 187 deletions(-) diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc index e67a9d5c2360e..b672830e7d44a 100644 --- a/src/google/protobuf/generated_message_tctable_lite.cc +++ b/src/google/protobuf/generated_message_tctable_lite.cc @@ -393,45 +393,6 @@ inline PROTOBUF_ALWAYS_INLINE void InvertPacked(TcFieldData& data) { data.data ^= Wt ^ WireFormatLite::WIRETYPE_LENGTH_DELIMITED; } -constexpr uint32_t kAccumulatorBytesOnStack = 256; - -// Accumulates fields to buffer repeated fields on parsing path to avoid growing -// repeated field container type too frequently. It flushes to the backing -// repeated fields if it's full or out of the scope. A larger buffer (e.g. 2KiB) -// is actually harmful due to: -// - increased stack overflow risk -// - extra cache misses on accessing local variables -// - less competitive to the cost of growing large buffer -template -class ScopedFieldAccumulator { - public: - constexpr explicit ScopedFieldAccumulator(ContainerType& field) - : field_(field) {} - - ~ScopedFieldAccumulator() { - if (ABSL_PREDICT_TRUE(current_size_ > 0)) { - field_.MergeFromArray(buffer_, current_size_); - } - } - - PROTOBUF_NODISCARD ElementType& Next() { - if (ABSL_PREDICT_FALSE(current_size_ == kSize)) { - field_.MergeFromArray(buffer_, kSize); - current_size_ = 0; - } - return buffer_[current_size_++]; - } - - private: - static constexpr uint32_t kSize = - kAccumulatorBytesOnStack / sizeof(ElementType); - static_assert(kSize > 0, "Size cannot be zero"); - - uint32_t current_size_ = 0; - ElementType buffer_[kSize]; - ContainerType& field_; -}; - } // namespace ////////////////////////////////////////////////////////////////////////////// @@ -659,17 +620,14 @@ PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedFixed( } auto& field = RefAt>(msg, data.offset()); const auto tag = UnalignedLoad(ptr); - { - ScopedFieldAccumulator accumulator(field); - do { - accumulator.Next() = UnalignedLoad(ptr + sizeof(TagType)); - ptr += sizeof(TagType) + sizeof(LayoutType); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; - } while (UnalignedLoad(ptr) == tag); - } + do { + field.Add(UnalignedLoad(ptr + sizeof(TagType))); + ptr += sizeof(TagType) + sizeof(LayoutType); + if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + } while (UnalignedLoad(ptr) == tag); PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); -parse_loop: - PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); } PROTOBUF_NOINLINE const char* TcParser::FastF32R1(PROTOBUF_TC_PARAM_DECL) { @@ -1003,22 +961,19 @@ PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedVarint( } auto& field = RefAt>(msg, data.offset()); const auto expected_tag = UnalignedLoad(ptr); - { - ScopedFieldAccumulator accumulator(field); - do { - ptr += sizeof(TagType); - FieldType tmp; - ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) goto error; - accumulator.Next() = ZigZagDecodeHelper(tmp); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; - } while (UnalignedLoad(ptr) == expected_tag); - } + do { + ptr += sizeof(TagType); + FieldType tmp; + ptr = ParseVarint(ptr, &tmp); + if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + field.Add(ZigZagDecodeHelper(tmp)); + if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + } while (UnalignedLoad(ptr) == expected_tag); PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); -parse_loop: - PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); -error: - PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); } PROTOBUF_NOINLINE const char* TcParser::FastV8R1(PROTOBUF_TC_PARAM_DECL) { @@ -1080,8 +1035,7 @@ const char* TcParser::PackedVarint(PROTOBUF_TC_PARAM_DECL) { // pending hasbits now: SyncHasbits(msg, hasbits, table); auto* field = &RefAt>(msg, data.offset()); - ScopedFieldAccumulator accumulator(*field); - return ctx->ReadPackedVarint(ptr, [&](uint64_t varint) { + return ctx->ReadPackedVarint(ptr, [field](uint64_t varint) { FieldType val; if (zigzag) { if (sizeof(FieldType) == 8) { @@ -1092,7 +1046,7 @@ const char* TcParser::PackedVarint(PROTOBUF_TC_PARAM_DECL) { } else { val = varint; } - accumulator.Next() = val; + field->Add(val); }); } @@ -1227,33 +1181,28 @@ const char* TcParser::RepeatedEnum(PROTOBUF_TC_PARAM_DECL) { auto& field = RefAt>(msg, data.offset()); const auto expected_tag = UnalignedLoad(ptr); const TcParseTableBase::FieldAux aux = *table->field_aux(data.aux_idx()); - { - ScopedFieldAccumulator accumulator(field); - do { - const char* ptr2 = ptr; // save for unknown enum case - ptr += sizeof(TagType); - uint64_t tmp; - ptr = ParseVarint(ptr, &tmp); - if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) goto error; - if (PROTOBUF_PREDICT_FALSE( - !EnumIsValidAux(static_cast(tmp), xform_val, aux))) { - // We can avoid duplicate work in MiniParse by directly calling - // table->fallback. - ptr = ptr2; - goto unknown_enum_fallback; - } - accumulator.Next() = static_cast(tmp); - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; - } while (UnalignedLoad(ptr) == expected_tag); - } + do { + const char* ptr2 = ptr; // save for unknown enum case + ptr += sizeof(TagType); + uint64_t tmp; + ptr = ParseVarint(ptr, &tmp); + if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) { + PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + if (PROTOBUF_PREDICT_FALSE( + !EnumIsValidAux(static_cast(tmp), xform_val, aux))) { + // We can avoid duplicate work in MiniParse by directly calling + // table->fallback. + ptr = ptr2; + PROTOBUF_MUSTTAIL return FastUnknownEnumFallback(PROTOBUF_TC_PARAM_PASS); + } + field.Add(static_cast(tmp)); + if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + } while (UnalignedLoad(ptr) == expected_tag); PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); -parse_loop: - PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); -error: - PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); -unknown_enum_fallback: - PROTOBUF_MUSTTAIL return FastUnknownEnumFallback(PROTOBUF_TC_PARAM_PASS); } const TcParser::UnknownFieldOps& TcParser::GetUnknownFieldOps( @@ -1387,22 +1336,19 @@ const char* TcParser::RepeatedEnumSmallRange(PROTOBUF_TC_PARAM_DECL) { auto& field = RefAt>(msg, data.offset()); auto expected_tag = UnalignedLoad(ptr); const uint8_t max = data.aux_idx(); - { - ScopedFieldAccumulator accumulator(field); - do { - uint8_t v = ptr[sizeof(TagType)]; - if (PROTOBUF_PREDICT_FALSE(min > v || v > max)) goto mini_parse; - accumulator.Next() = static_cast(v); - ptr += sizeof(TagType) + 1; - if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; - } while (UnalignedLoad(ptr) == expected_tag); - } + do { + uint8_t v = ptr[sizeof(TagType)]; + if (PROTOBUF_PREDICT_FALSE(min > v || v > max)) { + PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + field.Add(static_cast(v)); + ptr += sizeof(TagType) + 1; + if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) { + PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); + } + } while (UnalignedLoad(ptr) == expected_tag); PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_NO_DATA_PASS); -parse_loop: - PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); -mini_parse: - PROTOBUF_MUSTTAIL return MiniParse(PROTOBUF_TC_PARAM_NO_DATA_PASS); } PROTOBUF_NOINLINE const char* TcParser::FastEr0R1(PROTOBUF_TC_PARAM_DECL) { @@ -1904,10 +1850,9 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedFixed( constexpr auto size = sizeof(uint64_t); const char* ptr2 = ptr; uint32_t next_tag; - ScopedFieldAccumulator accumulator(field); do { ptr = ptr2; - accumulator.Next() = UnalignedLoad(ptr); + *field.Add() = UnalignedLoad(ptr); ptr += size; if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); @@ -1922,10 +1867,9 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedFixed( constexpr auto size = sizeof(uint32_t); const char* ptr2 = ptr; uint32_t next_tag; - ScopedFieldAccumulator accumulator(field); do { ptr = ptr2; - accumulator.Next() = UnalignedLoad(ptr); + *field.Add() = UnalignedLoad(ptr); ptr += size; if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); @@ -2055,13 +1999,11 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedVarint( auto& field = RefAt>(msg, entry.offset); const char* ptr2 = ptr; uint32_t next_tag; - ScopedFieldAccumulator accumulator(field); do { uint64_t tmp; ptr = ParseVarint(ptr2, &tmp); if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) goto error; - accumulator.Next() = - is_zigzag ? WireFormatLite::ZigZagDecode64(tmp) : tmp; + field.Add(is_zigzag ? WireFormatLite::ZigZagDecode64(tmp) : tmp); if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; @@ -2070,7 +2012,6 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedVarint( auto& field = RefAt>(msg, entry.offset); const char* ptr2 = ptr; uint32_t next_tag; - ScopedFieldAccumulator accumulator(field); do { uint64_t tmp; ptr = ParseVarint(ptr2, &tmp); @@ -2078,12 +2019,13 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedVarint( if (is_validated_enum) { if (!EnumIsValidAux(tmp, xform_val, *table->field_aux(&entry))) { ptr = ptr2; - goto unknown_enum_fallback; + PROTOBUF_MUSTTAIL return MpUnknownEnumFallback( + PROTOBUF_TC_PARAM_PASS); } } else if (is_zigzag) { tmp = WireFormatLite::ZigZagDecode32(tmp); } - accumulator.Next() = tmp; + field.Add(tmp); if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; @@ -2093,12 +2035,11 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedVarint( auto& field = RefAt>(msg, entry.offset); const char* ptr2 = ptr; uint32_t next_tag; - ScopedFieldAccumulator accumulator(field); do { uint64_t tmp; ptr = ParseVarint(ptr2, &tmp); if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) goto error; - accumulator.Next() = static_cast(tmp); + field.Add(static_cast(tmp)); if (PROTOBUF_PREDICT_FALSE(!ctx->DataAvailable(ptr))) goto parse_loop; ptr2 = ReadTag(ptr, &next_tag); if (PROTOBUF_PREDICT_FALSE(ptr2 == nullptr)) goto error; @@ -2110,8 +2051,6 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedVarint( PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_NO_DATA_PASS); error: PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); -unknown_enum_fallback: - PROTOBUF_MUSTTAIL return MpUnknownEnumFallback(PROTOBUF_TC_PARAM_PASS); } PROTOBUF_NOINLINE const char* TcParser::MpPackedVarint(PROTOBUF_TC_PARAM_DECL) { @@ -2133,41 +2072,33 @@ PROTOBUF_NOINLINE const char* TcParser::MpPackedVarint(PROTOBUF_TC_PARAM_DECL) { uint16_t rep = type_card & field_layout::kRepMask; if (rep == field_layout::kRep64Bits) { - auto& field = RefAt>(msg, entry.offset); - ScopedFieldAccumulator accumulator(field); - return ctx->ReadPackedVarint( - ptr, [&accumulator, is_zigzag](uint64_t value) { - accumulator.Next() = - is_zigzag ? WireFormatLite::ZigZagDecode64(value) : value; - }); + auto* field = &RefAt>(msg, entry.offset); + return ctx->ReadPackedVarint(ptr, [field, is_zigzag](uint64_t value) { + field->Add(is_zigzag ? WireFormatLite::ZigZagDecode64(value) : value); + }); } else if (rep == field_layout::kRep32Bits) { - auto& field = RefAt>(msg, entry.offset); + auto* field = &RefAt>(msg, entry.offset); if (is_validated_enum) { const TcParseTableBase::FieldAux aux = *table->field_aux(entry.aux_idx); - ScopedFieldAccumulator accumulator(field); - return ctx->ReadPackedVarint(ptr, [=, &accumulator](int32_t value) { + return ctx->ReadPackedVarint(ptr, [=](int32_t value) { if (!EnumIsValidAux(value, xform_val, aux)) { AddUnknownEnum(msg, table, data.tag(), value); } else { - accumulator.Next() = value; + field->Add(value); } }); } else { - ScopedFieldAccumulator accumulator(field); - return ctx->ReadPackedVarint( - ptr, [&accumulator, is_zigzag](uint64_t value) { - accumulator.Next() = is_zigzag ? WireFormatLite::ZigZagDecode32( - static_cast(value)) - : value; - }); + return ctx->ReadPackedVarint(ptr, [field, is_zigzag](uint64_t value) { + field->Add(is_zigzag ? WireFormatLite::ZigZagDecode32( + static_cast(value)) + : value); + }); } } else { ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); - auto& field = RefAt>(msg, entry.offset); - ScopedFieldAccumulator accumulator(field); - return ctx->ReadPackedVarint(ptr, [&](uint64_t value) { - accumulator.Next() = static_cast(value); - }); + auto* field = &RefAt>(msg, entry.offset); + return ctx->ReadPackedVarint( + ptr, [field](uint64_t value) { field->Add(static_cast(value)); }); } PROTOBUF_MUSTTAIL return Error(PROTOBUF_TC_PARAM_NO_DATA_PASS); diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 8879be58c548f..7c8ddf355f393 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -358,8 +358,6 @@ class RepeatedField final // This is public due to it being called by generated code. inline void InternalSwap(RepeatedField* other); - void MergeFromArray(const Element* array, size_t length); - private: RepeatedField(Arena* arena, const RepeatedField& rhs); template friend class Arena::InternalHelper; @@ -624,30 +622,6 @@ inline int RepeatedField::Capacity() const { return total_size_; } -template -inline void RepeatedField::MergeFromArray(const Element* array, - size_t length) { - // Only supports trivially copyable types. - static_assert(std::is_trivially_copyable::value, - "only trivialy copyable types are supported"); - - ABSL_DCHECK_GT(length, 0u); - if (ABSL_PREDICT_TRUE(current_size_ + static_cast(length) > - total_size_)) { - Grow(current_size_, current_size_ + length); - } - Element* elem = unsafe_elements(); - ABSL_DCHECK_NE(elem, nullptr); - void* p = elem + ExchangeCurrentSize(current_size_ + length); - memcpy(p, array, sizeof(Element) * length); -} - -template <> -inline void RepeatedField::MergeFromArray(const absl::Cord* array, - size_t length) { - ABSL_LOG(FATAL) << "not supported"; -} - template inline void RepeatedField::AddAlreadyReserved(Element value) { ABSL_DCHECK_LT(current_size_, total_size_); diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc index 0443b2d41a6db..cde5cc338806d 100644 --- a/src/google/protobuf/repeated_field_unittest.cc +++ b/src/google/protobuf/repeated_field_unittest.cc @@ -530,24 +530,6 @@ TEST(RepeatedField, MergeFrom) { EXPECT_EQ(5, destination.Get(4)); } -TEST(RepeatedField, MergeFromArray) { - RepeatedField rep; - - for (int i = 0; i < 7; ++i) { - rep.Add(i); - } - int array[] = {7, 8, 9, 10, 11, 12}; - rep.MergeFromArray(array, 6); - for (int i = 13; i < 19; ++i) { - rep.Add(i); - } - - EXPECT_EQ(rep.size(), 19); - for (int i = 0; i < 19; ++i) { - EXPECT_EQ(rep.Get(i), i); - } -} - TEST(RepeatedField, CopyFrom) { RepeatedField source, destination; From 4018fa893eafb5832cb24f2a6fc58984b0550f68 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 12 Jul 2023 15:00:31 -0700 Subject: [PATCH 07/27] Add a `raw_features` field to FeatureSet. This will be used for tracking the unresolved feature sets from the original proto file. Notable use-cases for this include: * Code generators that need to validate their own features * Runtimes that need to be able to accurately round-trip the original protos PiperOrigin-RevId: 547610367 --- php/ext/google/protobuf/php-upb.c | 167 +++++++++++------- php/ext/google/protobuf/php-upb.h | 75 +++++--- ruby/ext/google/protobuf_c/ruby-upb.c | 54 +++++- ruby/ext/google/protobuf_c/ruby-upb.h | 75 +++++--- src/google/protobuf/descriptor.pb.cc | 218 +++++++++++++++--------- src/google/protobuf/descriptor.pb.h | 151 +++++++++++++--- src/google/protobuf/descriptor.proto | 2 + src/google/protobuf/feature_resolver.cc | 10 ++ 8 files changed, 528 insertions(+), 224 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index ca504b2986d4a..8300206a86d08 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -737,7 +737,7 @@ bool _upb_mapsorter_pushexts(_upb_mapsorter* s, * regenerated. */ -static const char descriptor[10909] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', +static const char descriptor[10979] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', 'M', '\n', '\021', 'F', 'i', 'l', 'e', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'S', 'e', 't', '\022', '8', '\n', '\004', 'f', 'i', 'l', 'e', '\030', '\001', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', @@ -1093,7 +1093,7 @@ static const char descriptor[10909] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', 'e', '\032', 'J', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a', 'm', 'e', '_', 'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!', '\n', '\014', 'i', 's', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E', 'x', 't', 'e', 'n', 's', 'i', -'o', 'n', '\"', '\327', '\t', '\n', '\n', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '\022', 'n', '\n', '\016', 'f', 'i', 'e', 'l', +'o', 'n', '\"', '\235', '\n', '\n', '\n', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '\022', 'n', '\n', '\016', 'f', 'i', 'e', 'l', 'd', '_', 'p', 'r', 'e', 's', 'e', 'n', 'c', 'e', '\030', '\001', ' ', '\001', '(', '\016', '2', ')', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '.', 'F', 'i', 'e', 'l', 'd', 'P', 'r', 'e', 's', 'e', 'n', 'c', 'e', 'B', '\034', '\210', '\001', '\001', '\230', '\001', '\004', '\230', '\001', '\001', '\242', '\001', '\020', '\n', '\004', @@ -1122,58 +1122,61 @@ static const char descriptor[10909] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '.', 'J', 's', 'o', 'n', 'F', 'o', 'r', 'm', 'a', 't', 'B', '\034', '\210', '\001', '\001', '\230', '\001', '\003', '\230', '\001', '\006', '\230', '\001', '\001', '\242', '\001', '\r', '\n', '\004', '2', '0', '2', '3', '\022', '\005', 'A', 'L', 'L', 'O', 'W', 'R', '\n', 'j', 's', 'o', 'n', 'F', 'o', 'r', 'm', 'a', 't', -'\"', '\\', '\n', '\r', 'F', 'i', 'e', 'l', 'd', 'P', 'r', 'e', 's', 'e', 'n', 'c', 'e', '\022', '\032', '\n', '\026', 'F', 'I', 'E', 'L', -'D', '_', 'P', 'R', 'E', 'S', 'E', 'N', 'C', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\014', '\n', '\010', 'E', -'X', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\001', '\022', '\014', '\n', '\010', 'I', 'M', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\002', '\022', '\023', -'\n', '\017', 'L', 'E', 'G', 'A', 'C', 'Y', '_', 'R', 'E', 'Q', 'U', 'I', 'R', 'E', 'D', '\020', '\003', '\"', '7', '\n', '\010', 'E', 'n', -'u', 'm', 'T', 'y', 'p', 'e', '\022', '\025', '\n', '\021', 'E', 'N', 'U', 'M', '_', 'T', 'Y', 'P', 'E', '_', 'U', 'N', 'K', 'N', 'O', -'W', 'N', '\020', '\000', '\022', '\010', '\n', '\004', 'O', 'P', 'E', 'N', '\020', '\001', '\022', '\n', '\n', '\006', 'C', 'L', 'O', 'S', 'E', 'D', '\020', -'\002', '\"', 'V', '\n', '\025', 'R', 'e', 'p', 'e', 'a', 't', 'e', 'd', 'F', 'i', 'e', 'l', 'd', 'E', 'n', 'c', 'o', 'd', 'i', 'n', -'g', '\022', '#', '\n', '\037', 'R', 'E', 'P', 'E', 'A', 'T', 'E', 'D', '_', 'F', 'I', 'E', 'L', 'D', '_', 'E', 'N', 'C', 'O', 'D', -'I', 'N', 'G', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\n', '\n', '\006', 'P', 'A', 'C', 'K', 'E', 'D', '\020', '\001', -'\022', '\014', '\n', '\010', 'E', 'X', 'P', 'A', 'N', 'D', 'E', 'D', '\020', '\002', '\"', '_', '\n', '\025', 'S', 't', 'r', 'i', 'n', 'g', 'F', -'i', 'e', 'l', 'd', 'V', 'a', 'l', 'i', 'd', 'a', 't', 'i', 'o', 'n', '\022', '#', '\n', '\037', 'S', 'T', 'R', 'I', 'N', 'G', '_', -'F', 'I', 'E', 'L', 'D', '_', 'V', 'A', 'L', 'I', 'D', 'A', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', -'\000', '\022', '\r', '\n', '\t', 'M', 'A', 'N', 'D', 'A', 'T', 'O', 'R', 'Y', '\020', '\001', '\022', '\010', '\n', '\004', 'H', 'I', 'N', 'T', '\020', -'\002', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\003', '\"', 'S', '\n', '\017', 'M', 'e', 's', 's', 'a', 'g', 'e', 'E', 'n', 'c', -'o', 'd', 'i', 'n', 'g', '\022', '\034', '\n', '\030', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', -'_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'L', 'E', 'N', 'G', 'T', 'H', '_', 'P', 'R', 'E', 'F', -'I', 'X', 'E', 'D', '\020', '\001', '\022', '\r', '\n', '\t', 'D', 'E', 'L', 'I', 'M', 'I', 'T', 'E', 'D', '\020', '\002', '\"', 'H', '\n', '\n', -'J', 's', 'o', 'n', 'F', 'o', 'r', 'm', 'a', 't', '\022', '\027', '\n', '\023', 'J', 'S', 'O', 'N', '_', 'F', 'O', 'R', 'M', 'A', 'T', -'_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\t', '\n', '\005', 'A', 'L', 'L', 'O', 'W', '\020', '\001', '\022', '\026', '\n', '\022', -'L', 'E', 'G', 'A', 'C', 'Y', '_', 'B', 'E', 'S', 'T', '_', 'E', 'F', 'F', 'O', 'R', 'T', '\020', '\002', '*', '\006', '\010', '\350', '\007', -'\020', '\351', '\007', '*', '\006', '\010', '\351', '\007', '\020', '\352', '\007', '*', '\006', '\010', '\213', 'N', '\020', '\220', 'N', '\"', '\247', '\002', '\n', '\016', 'S', -'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', -'\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', -'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', -'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', -'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', -'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', -'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', -'d', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', '+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', -'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(', '\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', -'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', -'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006', ' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', -'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', -'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', -'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', -'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', -'t', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', -'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', -'\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o', 'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', -'\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', -'\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', -'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', -'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', -'d', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', -'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', -'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', -'L', 'I', 'A', 'S', '\020', '\002', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', -'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', -'-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', -'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', -'\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', -'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n', +'\022', 'D', '\n', '\014', 'r', 'a', 'w', '_', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\030', '\347', '\007', ' ', '\001', '(', '\013', '2', '\033', +'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', +'e', 't', 'B', '\003', '\230', '\001', '\000', 'R', '\013', 'r', 'a', 'w', 'F', 'e', 'a', 't', 'u', 'r', 'e', 's', '\"', '\\', '\n', '\r', 'F', +'i', 'e', 'l', 'd', 'P', 'r', 'e', 's', 'e', 'n', 'c', 'e', '\022', '\032', '\n', '\026', 'F', 'I', 'E', 'L', 'D', '_', 'P', 'R', 'E', +'S', 'E', 'N', 'C', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\014', '\n', '\010', 'E', 'X', 'P', 'L', 'I', 'C', +'I', 'T', '\020', '\001', '\022', '\014', '\n', '\010', 'I', 'M', 'P', 'L', 'I', 'C', 'I', 'T', '\020', '\002', '\022', '\023', '\n', '\017', 'L', 'E', 'G', +'A', 'C', 'Y', '_', 'R', 'E', 'Q', 'U', 'I', 'R', 'E', 'D', '\020', '\003', '\"', '7', '\n', '\010', 'E', 'n', 'u', 'm', 'T', 'y', 'p', +'e', '\022', '\025', '\n', '\021', 'E', 'N', 'U', 'M', '_', 'T', 'Y', 'P', 'E', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', +'\010', '\n', '\004', 'O', 'P', 'E', 'N', '\020', '\001', '\022', '\n', '\n', '\006', 'C', 'L', 'O', 'S', 'E', 'D', '\020', '\002', '\"', 'V', '\n', '\025', +'R', 'e', 'p', 'e', 'a', 't', 'e', 'd', 'F', 'i', 'e', 'l', 'd', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g', '\022', '#', '\n', '\037', +'R', 'E', 'P', 'E', 'A', 'T', 'E', 'D', '_', 'F', 'I', 'E', 'L', 'D', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', '_', 'U', +'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\n', '\n', '\006', 'P', 'A', 'C', 'K', 'E', 'D', '\020', '\001', '\022', '\014', '\n', '\010', 'E', +'X', 'P', 'A', 'N', 'D', 'E', 'D', '\020', '\002', '\"', '_', '\n', '\025', 'S', 't', 'r', 'i', 'n', 'g', 'F', 'i', 'e', 'l', 'd', 'V', +'a', 'l', 'i', 'd', 'a', 't', 'i', 'o', 'n', '\022', '#', '\n', '\037', 'S', 'T', 'R', 'I', 'N', 'G', '_', 'F', 'I', 'E', 'L', 'D', +'_', 'V', 'A', 'L', 'I', 'D', 'A', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\r', '\n', '\t', +'M', 'A', 'N', 'D', 'A', 'T', 'O', 'R', 'Y', '\020', '\001', '\022', '\010', '\n', '\004', 'H', 'I', 'N', 'T', '\020', '\002', '\022', '\010', '\n', '\004', +'N', 'O', 'N', 'E', '\020', '\003', '\"', 'S', '\n', '\017', 'M', 'e', 's', 's', 'a', 'g', 'e', 'E', 'n', 'c', 'o', 'd', 'i', 'n', 'g', +'\022', '\034', '\n', '\030', 'M', 'E', 'S', 'S', 'A', 'G', 'E', '_', 'E', 'N', 'C', 'O', 'D', 'I', 'N', 'G', '_', 'U', 'N', 'K', 'N', +'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'L', 'E', 'N', 'G', 'T', 'H', '_', 'P', 'R', 'E', 'F', 'I', 'X', 'E', 'D', '\020', +'\001', '\022', '\r', '\n', '\t', 'D', 'E', 'L', 'I', 'M', 'I', 'T', 'E', 'D', '\020', '\002', '\"', 'H', '\n', '\n', 'J', 's', 'o', 'n', 'F', +'o', 'r', 'm', 'a', 't', '\022', '\027', '\n', '\023', 'J', 'S', 'O', 'N', '_', 'F', 'O', 'R', 'M', 'A', 'T', '_', 'U', 'N', 'K', 'N', +'O', 'W', 'N', '\020', '\000', '\022', '\t', '\n', '\005', 'A', 'L', 'L', 'O', 'W', '\020', '\001', '\022', '\026', '\n', '\022', 'L', 'E', 'G', 'A', 'C', +'Y', '_', 'B', 'E', 'S', 'T', '_', 'E', 'F', 'F', 'O', 'R', 'T', '\020', '\002', '*', '\006', '\010', '\350', '\007', '\020', '\351', '\007', '*', '\006', +'\010', '\351', '\007', '\020', '\352', '\007', '*', '\006', '\010', '\213', 'N', '\020', '\220', 'N', '\"', '\247', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', +'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', +'\013', '2', '(', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', +'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', +'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', +'\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', +' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', +'_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', +'o', 'm', 'm', 'e', 'n', 't', 's', '\022', '+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', +'n', 't', 's', '\030', '\004', ' ', '\001', '(', '\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', +'t', 's', '\022', ':', '\n', '\031', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', +'m', 'm', 'e', 'n', 't', 's', '\030', '\006', ' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', +'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', +'d', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', +' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', +'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', +'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', +'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', +'t', 'h', '\022', '\037', '\n', '\013', 's', 'o', 'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', +'s', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', +'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', +'\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', +'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', +'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', +'\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', +'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', +'\002', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', +'\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', +'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', +'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', +'\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', +'t', 'i', 'o', 'n', }; static _upb_DefPool_Init *deps[1] = { @@ -1184,7 +1187,7 @@ _upb_DefPool_Init google_protobuf_descriptor_proto_upbdefinit = { deps, &google_protobuf_descriptor_proto_upb_file_layout, "google/protobuf/descriptor.proto", - UPB_STRINGVIEW_INIT(descriptor, 10909) + UPB_STRINGVIEW_INIT(descriptor, 10979) }; /* This file was generated by upbc (the upb compiler) from the input * file: @@ -2155,7 +2158,8 @@ const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init = { }) }; -static const upb_MiniTableSub google_protobuf_FeatureSet_submsgs[6] = { +static const upb_MiniTableSub google_protobuf_FeatureSet_submsgs[7] = { + {.submsg = &google_protobuf_FeatureSet_msg_init}, {.subenum = &google_protobuf_FeatureSet_FieldPresence_enum_init}, {.subenum = &google_protobuf_FeatureSet_EnumType_enum_init}, {.subenum = &google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init}, @@ -2164,19 +2168,54 @@ static const upb_MiniTableSub google_protobuf_FeatureSet_submsgs[6] = { {.subenum = &google_protobuf_FeatureSet_JsonFormat_enum_init}, }; -static const upb_MiniTableField google_protobuf_FeatureSet__fields[6] = { - {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, +static const upb_MiniTableField google_protobuf_FeatureSet__fields[7] = { + {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_FeatureSet_msg_init = { &google_protobuf_FeatureSet_submsgs[0], &google_protobuf_FeatureSet__fields[0], - 32, 6, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(32, 40), 7, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(248), 0, + UPB_FASTTABLE_INIT({ + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0020000007003eba, &upb_psm_2bt_max64b}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + }) }; static const upb_MiniTableSub google_protobuf_SourceCodeInfo_submsgs[1] = { diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index c888cf9aa18f5..a434506417f37 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -9164,120 +9164,147 @@ UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_F return ptr; } UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_string_field_validation(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_string_field_validation(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_string_field_validation(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} +UPB_INLINE void google_protobuf_FeatureSet_clear_raw_features(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSet_raw_features(const google_protobuf_FeatureSet* msg) { + const google_protobuf_FeatureSet* default_val = NULL; + const google_protobuf_FeatureSet* ret; + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_raw_features(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_string_field_validation(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); +} +UPB_INLINE void google_protobuf_FeatureSet_set_raw_features(google_protobuf_FeatureSet *msg, google_protobuf_FeatureSet* value) { + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } +UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSet_mutable_raw_features(google_protobuf_FeatureSet* msg, upb_Arena* arena) { + struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSet_raw_features(msg); + if (sub == NULL) { + sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); + if (sub) google_protobuf_FeatureSet_set_raw_features(msg, sub); + } + return sub; +} /* google.protobuf.SourceCodeInfo */ diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index eaf38cd41cad4..5ed3c3d3fe309 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -1697,7 +1697,8 @@ const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msg_init = { }) }; -static const upb_MiniTableSub google_protobuf_FeatureSet_submsgs[6] = { +static const upb_MiniTableSub google_protobuf_FeatureSet_submsgs[7] = { + {.submsg = &google_protobuf_FeatureSet_msg_init}, {.subenum = &google_protobuf_FeatureSet_FieldPresence_enum_init}, {.subenum = &google_protobuf_FeatureSet_EnumType_enum_init}, {.subenum = &google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init}, @@ -1706,19 +1707,54 @@ static const upb_MiniTableSub google_protobuf_FeatureSet_submsgs[6] = { {.subenum = &google_protobuf_FeatureSet_JsonFormat_enum_init}, }; -static const upb_MiniTableField google_protobuf_FeatureSet__fields[6] = { - {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, - {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, +static const upb_MiniTableField google_protobuf_FeatureSet__fields[7] = { + {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_FeatureSet_msg_init = { &google_protobuf_FeatureSet_submsgs[0], &google_protobuf_FeatureSet__fields[0], - 32, 6, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(255), 0, + UPB_SIZE(32, 40), 7, kUpb_ExtMode_Extendable, 6, UPB_FASTTABLE_MASK(248), 0, + UPB_FASTTABLE_INIT({ + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0020000007003eba, &upb_psm_2bt_max64b}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, + }) }; static const upb_MiniTableSub google_protobuf_SourceCodeInfo_submsgs[1] = { diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index f1ff4ae88d01c..949d5489f86bd 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -9139,120 +9139,147 @@ UPB_INLINE char* google_protobuf_FeatureSet_serialize_ex(const google_protobuf_F return ptr; } UPB_INLINE void google_protobuf_FeatureSet_clear_field_presence(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_field_presence(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_field_presence(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_enum_type(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_enum_type(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_enum_type(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_repeated_field_encoding(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_repeated_field_encoding(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_string_field_validation(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_string_field_validation(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_string_field_validation(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_message_encoding(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_message_encoding(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_message_encoding(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_clear_json_format(google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FeatureSet_json_format(const google_protobuf_FeatureSet* msg) { int32_t default_val = 0; int32_t ret; - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf_FeatureSet* msg) { - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} +UPB_INLINE void google_protobuf_FeatureSet_clear_raw_features(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSet_raw_features(const google_protobuf_FeatureSet* msg) { + const google_protobuf_FeatureSet* default_val = NULL; + const google_protobuf_FeatureSet* ret; + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_raw_features(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {1, 4, 1, 0, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {1, 4, 1, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_enum_type(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {2, 8, 2, 1, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {2, 8, 2, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_repeated_field_encoding(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {3, 12, 3, 2, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {3, 12, 3, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_string_field_validation(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {4, 16, 4, 3, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {4, 16, 4, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_message_encoding(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {5, 20, 5, 4, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {5, 20, 5, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_FeatureSet *msg, int32_t value) { - const upb_MiniTableField field = {6, 24, 6, 5, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {6, 24, 6, 6, 14, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); +} +UPB_INLINE void google_protobuf_FeatureSet_set_raw_features(google_protobuf_FeatureSet *msg, google_protobuf_FeatureSet* value) { + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 7, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } +UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSet_mutable_raw_features(google_protobuf_FeatureSet* msg, upb_Arena* arena) { + struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSet_raw_features(msg); + if (sub == NULL) { + sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(&google_protobuf_FeatureSet_msg_init, arena); + if (sub) google_protobuf_FeatureSet_set_raw_features(msg, sub); + } + return sub; +} /* google.protobuf.SourceCodeInfo */ diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index acfe0e4991197..f2221a6ea2064 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -807,6 +807,7 @@ PROTOBUF_CONSTEXPR FeatureSet::FeatureSet(::_pbi::ConstantInitialized) /*decltype(_impl_._extensions_)*/ {}, /*decltype(_impl_._has_bits_)*/ {}, /*decltype(_impl_._cached_size_)*/ {}, + /*decltype(_impl_.raw_features_)*/ nullptr, /*decltype(_impl_.field_presence_)*/ 0, /*decltype(_impl_.enum_type_)*/ 0, /*decltype(_impl_.repeated_field_encoding_)*/ 0, @@ -1438,12 +1439,14 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.string_field_validation_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.message_encoding_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.json_format_), - 0, + PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.raw_features_), 1, 2, 3, 4, 5, + 6, + 0, PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::SourceCodeInfo_Location, _internal_metadata_), ~0u, // no _extensions_ @@ -1527,11 +1530,11 @@ static const ::_pbi::MigrationSchema {431, 443, -1, sizeof(::google::protobuf::MethodOptions)}, {447, 457, -1, sizeof(::google::protobuf::UninterpretedOption_NamePart)}, {459, 474, -1, sizeof(::google::protobuf::UninterpretedOption)}, - {481, 495, -1, sizeof(::google::protobuf::FeatureSet)}, - {501, 514, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, - {519, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, - {528, 541, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, - {546, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, + {481, 496, -1, sizeof(::google::protobuf::FeatureSet)}, + {503, 516, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, + {521, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, + {530, 543, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, + {548, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -1744,7 +1747,7 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR "e\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001(\003\022\024\n\014d" "ouble_value\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014\022" "\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NamePart\022\021\n\t" - "name_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\361\010" + "name_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\252\t" "\n\nFeatureSet\022_\n\016field_presence\030\001 \001(\0162).g" "oogle.protobuf.FeatureSet.FieldPresenceB" "\034\210\001\001\230\001\004\230\001\001\242\001\020\n\0042023\022\010EXPLICIT\022Q\n\tenum_ty" @@ -1760,42 +1763,43 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR "geEncodingB#\210\001\001\230\001\004\230\001\001\242\001\027\n\0042023\022\017LENGTH_P" "REFIXED\022Y\n\013json_format\030\006 \001(\0162&.google.pr" "otobuf.FeatureSet.JsonFormatB\034\210\001\001\230\001\003\230\001\006\230" - "\001\001\242\001\r\n\0042023\022\005ALLOW\"\\\n\rFieldPresence\022\032\n\026F" - "IELD_PRESENCE_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022\014\n" - "\010IMPLICIT\020\002\022\023\n\017LEGACY_REQUIRED\020\003\"7\n\010Enum" - "Type\022\025\n\021ENUM_TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022\n\n" - "\006CLOSED\020\002\"V\n\025RepeatedFieldEncoding\022#\n\037RE" - "PEATED_FIELD_ENCODING_UNKNOWN\020\000\022\n\n\006PACKE" - "D\020\001\022\014\n\010EXPANDED\020\002\"_\n\025StringFieldValidati" - "on\022#\n\037STRING_FIELD_VALIDATION_UNKNOWN\020\000\022" - "\r\n\tMANDATORY\020\001\022\010\n\004HINT\020\002\022\010\n\004NONE\020\003\"S\n\017Me" - "ssageEncoding\022\034\n\030MESSAGE_ENCODING_UNKNOW" - "N\020\000\022\023\n\017LENGTH_PREFIXED\020\001\022\r\n\tDELIMITED\020\002\"" - "H\n\nJsonFormat\022\027\n\023JSON_FORMAT_UNKNOWN\020\000\022\t" - "\n\005ALLOW\020\001\022\026\n\022LEGACY_BEST_EFFORT\020\002*\006\010\350\007\020\351" - "\007*\006\010\351\007\020\352\007*\006\010\213N\020\220N\"\325\001\n\016SourceCodeInfo\022:\n\010" - "location\030\001 \003(\0132(.google.protobuf.SourceC" - "odeInfo.Location\032\206\001\n\010Location\022\020\n\004path\030\001 " - "\003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_com" - "ments\030\003 \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!" - "\n\031leading_detached_comments\030\006 \003(\t\"\234\002\n\021Ge" - "neratedCodeInfo\022A\n\nannotation\030\001 \003(\0132-.go" - "ogle.protobuf.GeneratedCodeInfo.Annotati" - "on\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013s" - "ource_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004" - " \001(\005\022H\n\010semantic\030\005 \001(\01626.google.protobuf" - ".GeneratedCodeInfo.Annotation.Semantic\"(" - "\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002" - "B~\n\023com.google.protobufB\020DescriptorProto" - "sH\001Z-google.golang.org/protobuf/types/de" - "scriptorpb\370\001\001\242\002\003GPB\252\002\032Google.Protobuf.Re" - "flection" + "\001\001\242\001\r\n\0042023\022\005ALLOW\0227\n\014raw_features\030\347\007 \001(" + "\0132\033.google.protobuf.FeatureSetB\003\230\001\000\"\\\n\rF" + "ieldPresence\022\032\n\026FIELD_PRESENCE_UNKNOWN\020\000" + "\022\014\n\010EXPLICIT\020\001\022\014\n\010IMPLICIT\020\002\022\023\n\017LEGACY_R" + "EQUIRED\020\003\"7\n\010EnumType\022\025\n\021ENUM_TYPE_UNKNO" + "WN\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLOSED\020\002\"V\n\025RepeatedFi" + "eldEncoding\022#\n\037REPEATED_FIELD_ENCODING_U" + "NKNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010EXPANDED\020\002\"_\n\025St" + "ringFieldValidation\022#\n\037STRING_FIELD_VALI" + "DATION_UNKNOWN\020\000\022\r\n\tMANDATORY\020\001\022\010\n\004HINT\020" + "\002\022\010\n\004NONE\020\003\"S\n\017MessageEncoding\022\034\n\030MESSAG" + "E_ENCODING_UNKNOWN\020\000\022\023\n\017LENGTH_PREFIXED\020" + "\001\022\r\n\tDELIMITED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_F" + "ORMAT_UNKNOWN\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BES" + "T_EFFORT\020\002*\006\010\350\007\020\351\007*\006\010\351\007\020\352\007*\006\010\213N\020\220N\"\325\001\n\016S" + "ourceCodeInfo\022:\n\010location\030\001 \003(\0132(.google" + ".protobuf.SourceCodeInfo.Location\032\206\001\n\010Lo" + "cation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002" + "\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021trailing" + "_comments\030\004 \001(\t\022!\n\031leading_detached_comm" + "ents\030\006 \003(\t\"\234\002\n\021GeneratedCodeInfo\022A\n\nanno" + "tation\030\001 \003(\0132-.google.protobuf.Generated" + "CodeInfo.Annotation\032\303\001\n\nAnnotation\022\020\n\004pa" + "th\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005beg" + "in\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010semantic\030\005 \001(\0162" + "6.google.protobuf.GeneratedCodeInfo.Anno" + "tation.Semantic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n" + "\003SET\020\001\022\t\n\005ALIAS\020\002B~\n\023com.google.protobuf" + "B\020DescriptorProtosH\001Z-google.golang.org/" + "protobuf/types/descriptorpb\370\001\001\242\002\003GPB\252\002\032G" + "oogle.Protobuf.Reflection" }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = { false, false, - 8888, + 8945, descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto, "google/protobuf/descriptor.proto", &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once, @@ -11668,25 +11672,32 @@ class FeatureSet::_Internal { static constexpr ::int32_t kHasBitsOffset = 8 * PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._has_bits_); static void set_has_field_presence(HasBits* has_bits) { - (*has_bits)[0] |= 1u; + (*has_bits)[0] |= 2u; } static void set_has_enum_type(HasBits* has_bits) { - (*has_bits)[0] |= 2u; + (*has_bits)[0] |= 4u; } static void set_has_repeated_field_encoding(HasBits* has_bits) { - (*has_bits)[0] |= 4u; + (*has_bits)[0] |= 8u; } static void set_has_string_field_validation(HasBits* has_bits) { - (*has_bits)[0] |= 8u; + (*has_bits)[0] |= 16u; } static void set_has_message_encoding(HasBits* has_bits) { - (*has_bits)[0] |= 16u; + (*has_bits)[0] |= 32u; } static void set_has_json_format(HasBits* has_bits) { - (*has_bits)[0] |= 32u; + (*has_bits)[0] |= 64u; + } + static const ::google::protobuf::FeatureSet& raw_features(const FeatureSet* msg); + static void set_has_raw_features(HasBits* has_bits) { + (*has_bits)[0] |= 1u; } }; +const ::google::protobuf::FeatureSet& FeatureSet::_Internal::raw_features(const FeatureSet* msg) { + return *msg->_impl_.raw_features_; +} FeatureSet::FeatureSet(::google::protobuf::Arena* arena) : ::google::protobuf::Message(arena) { SharedCtor(arena); @@ -11699,6 +11710,7 @@ FeatureSet::FeatureSet(const FeatureSet& from) : ::google::protobuf::Message() { /*decltype(_impl_._extensions_)*/ {}, decltype(_impl_._has_bits_){from._impl_._has_bits_}, /*decltype(_impl_._cached_size_)*/ {}, + decltype(_impl_.raw_features_){nullptr}, decltype(_impl_.field_presence_){}, decltype(_impl_.enum_type_){}, decltype(_impl_.repeated_field_encoding_){}, @@ -11710,6 +11722,9 @@ FeatureSet::FeatureSet(const FeatureSet& from) : ::google::protobuf::Message() { from._internal_metadata_); _impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); + if ((from._impl_._has_bits_[0] & 0x00000001u) != 0) { + _this->_impl_.raw_features_ = new ::google::protobuf::FeatureSet(*from._impl_.raw_features_); + } ::memcpy(&_impl_.field_presence_, &from._impl_.field_presence_, static_cast<::size_t>(reinterpret_cast(&_impl_.json_format_) - reinterpret_cast(&_impl_.field_presence_)) + sizeof(_impl_.json_format_)); @@ -11722,6 +11737,7 @@ inline void FeatureSet::SharedCtor(::_pb::Arena* arena) { /*decltype(_impl_._extensions_)*/ {::_pbi::ArenaInitialized(), arena}, decltype(_impl_._has_bits_){}, /*decltype(_impl_._cached_size_)*/ {}, + decltype(_impl_.raw_features_){nullptr}, decltype(_impl_.field_presence_){0}, decltype(_impl_.enum_type_){0}, decltype(_impl_.repeated_field_encoding_){0}, @@ -11738,6 +11754,7 @@ FeatureSet::~FeatureSet() { inline void FeatureSet::SharedDtor() { ABSL_DCHECK(GetArenaForAllocation() == nullptr); _impl_._extensions_.~ExtensionSet(); + if (this != internal_default_instance()) delete _impl_.raw_features_; } void FeatureSet::SetCachedSize(int size) const { _impl_._cached_size_.Set(size); @@ -11751,7 +11768,11 @@ PROTOBUF_NOINLINE void FeatureSet::Clear() { _impl_._extensions_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x00000001u) { + ABSL_DCHECK(_impl_.raw_features_ != nullptr); + _impl_.raw_features_->Clear(); + } + if (cached_has_bits & 0x0000007eu) { ::memset(&_impl_.field_presence_, 0, static_cast<::size_t>( reinterpret_cast(&_impl_.json_format_) - reinterpret_cast(&_impl_.field_presence_)) + sizeof(_impl_.json_format_)); @@ -11767,16 +11788,16 @@ const char* FeatureSet::_InternalParse( } -constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { +constexpr ::_pbi::TcParseTable<3, 7, 7, 0, 7> FeatureSet::_table_ = { { PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._extensions_), - 6, 56, // max_field_number, fast_idx_mask + 999, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), 4294967232, // skipmap offsetof(decltype(_table_), field_entries), - 6, // num_field_entries - 6, // num_aux_entries + 7, // num_field_entries + 7, // num_aux_entries offsetof(decltype(_table_), aux_entries), &_FeatureSet_default_instance_._instance, ::_pbi::TcParser::GenericFallback, // fallback @@ -11784,44 +11805,51 @@ constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { {::_pbi::TcParser::MiniParse, {}}, // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {8, 0, 3, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_)}}, + {8, 1, 3, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_)}}, // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {16, 1, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enum_type_)}}, + {16, 2, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enum_type_)}}, // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {24, 2, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.repeated_field_encoding_)}}, + {24, 3, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.repeated_field_encoding_)}}, // optional .google.protobuf.FeatureSet.StringFieldValidation string_field_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {32, 3, 3, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.string_field_validation_)}}, + {32, 4, 3, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.string_field_validation_)}}, // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {40, 4, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.message_encoding_)}}, + {40, 5, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.message_encoding_)}}, // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, - {48, 5, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_)}}, - {::_pbi::TcParser::MiniParse, {}}, + {48, 6, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_)}}, + // optional .google.protobuf.FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; + {::_pbi::TcParser::FastMtS2, + {16058, 0, 6, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.raw_features_)}}, }}, {{ + 999, 0, 1, + 65534, 6, 65535, 65535 }}, {{ // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_), _Internal::kHasBitsOffset + 0, 0, + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enum_type_), _Internal::kHasBitsOffset + 1, 1, + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enum_type_), _Internal::kHasBitsOffset + 2, 1, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.repeated_field_encoding_), _Internal::kHasBitsOffset + 2, 2, + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.repeated_field_encoding_), _Internal::kHasBitsOffset + 3, 2, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, // optional .google.protobuf.FeatureSet.StringFieldValidation string_field_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.string_field_validation_), _Internal::kHasBitsOffset + 3, 3, + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.string_field_validation_), _Internal::kHasBitsOffset + 4, 3, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.message_encoding_), _Internal::kHasBitsOffset + 4, 4, + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.message_encoding_), _Internal::kHasBitsOffset + 5, 4, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_), _Internal::kHasBitsOffset + 5, 5, + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_), _Internal::kHasBitsOffset + 6, 5, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, + // optional .google.protobuf.FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.raw_features_), _Internal::kHasBitsOffset + 0, 6, + (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, }}, {{ {0, 4}, {0, 3}, @@ -11829,6 +11857,7 @@ constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> FeatureSet::_table_ = { {0, 4}, {0, 3}, {0, 3}, + {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, }}, {{ }}, }; @@ -11842,47 +11871,54 @@ ::uint8_t* FeatureSet::_InternalSerialize( cached_has_bits = _impl_._has_bits_[0]; // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000002u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 1, this->_internal_field_presence(), target); } // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 2, this->_internal_enum_type(), target); } // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 3, this->_internal_repeated_field_encoding(), target); } // optional .google.protobuf.FeatureSet.StringFieldValidation string_field_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 4, this->_internal_string_field_validation(), target); } // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 5, this->_internal_message_encoding(), target); } // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 6, this->_internal_json_format(), target); } + // optional .google.protobuf.FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; + if (cached_has_bits & 0x00000001u) { + target = ::google::protobuf::internal::WireFormatLite:: + InternalWriteMessage(999, _Internal::raw_features(this), + _Internal::raw_features(this).GetCachedSize(), target, stream); + } + // Extension range [1000, 10000) target = _impl_._extensions_._InternalSerialize( internal_default_instance(), 1000, 10000, target, stream); @@ -11906,39 +11942,46 @@ ::size_t FeatureSet::ByteSizeLong() const { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if (cached_has_bits & 0x0000007fu) { + // optional .google.protobuf.FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; if (cached_has_bits & 0x00000001u) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::MessageSize( + *_impl_.raw_features_); + } + + // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { + if (cached_has_bits & 0x00000002u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_field_presence()); } // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000004u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_enum_type()); } // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_repeated_field_encoding()); } // optional .google.protobuf.FeatureSet.StringFieldValidation string_field_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_string_field_validation()); } // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_message_encoding()); } // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_json_format()); } @@ -11963,23 +12006,27 @@ void FeatureSet::MergeImpl(::google::protobuf::Message& to_msg, const ::google:: (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { if (cached_has_bits & 0x00000001u) { - _this->_impl_.field_presence_ = from._impl_.field_presence_; + _this->_internal_mutable_raw_features()->::google::protobuf::FeatureSet::MergeFrom( + from._internal_raw_features()); } if (cached_has_bits & 0x00000002u) { - _this->_impl_.enum_type_ = from._impl_.enum_type_; + _this->_impl_.field_presence_ = from._impl_.field_presence_; } if (cached_has_bits & 0x00000004u) { - _this->_impl_.repeated_field_encoding_ = from._impl_.repeated_field_encoding_; + _this->_impl_.enum_type_ = from._impl_.enum_type_; } if (cached_has_bits & 0x00000008u) { - _this->_impl_.string_field_validation_ = from._impl_.string_field_validation_; + _this->_impl_.repeated_field_encoding_ = from._impl_.repeated_field_encoding_; } if (cached_has_bits & 0x00000010u) { - _this->_impl_.message_encoding_ = from._impl_.message_encoding_; + _this->_impl_.string_field_validation_ = from._impl_.string_field_validation_; } if (cached_has_bits & 0x00000020u) { + _this->_impl_.message_encoding_ = from._impl_.message_encoding_; + } + if (cached_has_bits & 0x00000040u) { _this->_impl_.json_format_ = from._impl_.json_format_; } _this->_impl_._has_bits_[0] |= cached_has_bits; @@ -11999,6 +12046,9 @@ PROTOBUF_NOINLINE bool FeatureSet::IsInitialized() const { if (!_impl_._extensions_.IsInitialized(internal_default_instance())) { return false; } + if ((_impl_._has_bits_[0] & 0x00000001u) != 0) { + if (!_impl_.raw_features_->IsInitialized()) return false; + } return true; } @@ -12010,9 +12060,9 @@ void FeatureSet::InternalSwap(FeatureSet* other) { ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_) + sizeof(FeatureSet::_impl_.json_format_) - - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_)>( - reinterpret_cast(&_impl_.field_presence_), - reinterpret_cast(&other->_impl_.field_presence_)); + - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.raw_features_)>( + reinterpret_cast(&_impl_.raw_features_), + reinterpret_cast(&other->_impl_.raw_features_)); } ::google::protobuf::Metadata FeatureSet::GetMetadata() const { diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index e66401e2d1db8..68073b97a7134 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -8618,6 +8618,7 @@ class PROTOBUF_EXPORT FeatureSet final : // accessors ------------------------------------------------------- enum : int { + kRawFeaturesFieldNumber = 999, kFieldPresenceFieldNumber = 1, kEnumTypeFieldNumber = 2, kRepeatedFieldEncodingFieldNumber = 3, @@ -8625,6 +8626,21 @@ class PROTOBUF_EXPORT FeatureSet final : kMessageEncodingFieldNumber = 5, kJsonFormatFieldNumber = 6, }; + // optional .google.protobuf.FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; + bool has_raw_features() const; + void clear_raw_features() ; + const ::google::protobuf::FeatureSet& raw_features() const; + PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_raw_features(); + ::google::protobuf::FeatureSet* mutable_raw_features(); + void set_allocated_raw_features(::google::protobuf::FeatureSet* value); + void unsafe_arena_set_allocated_raw_features(::google::protobuf::FeatureSet* value); + ::google::protobuf::FeatureSet* unsafe_arena_release_raw_features(); + + private: + const ::google::protobuf::FeatureSet& _internal_raw_features() const; + ::google::protobuf::FeatureSet* _internal_mutable_raw_features(); + + public: // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { bool has_field_presence() const; void clear_field_presence() ; @@ -8847,7 +8863,7 @@ class PROTOBUF_EXPORT FeatureSet final : class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 6, 6, 0, 2> _table_; + static const ::google::protobuf::internal::TcParseTable<3, 7, 7, 0, 7> _table_; template friend class ::google::protobuf::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; @@ -8856,6 +8872,7 @@ class PROTOBUF_EXPORT FeatureSet final : ::google::protobuf::internal::HasBits<1> _has_bits_; mutable ::google::protobuf::internal::CachedSize _cached_size_; + ::google::protobuf::FeatureSet* raw_features_; int field_presence_; int enum_type_; int repeated_field_encoding_; @@ -17188,12 +17205,12 @@ inline void UninterpretedOption::set_allocated_aggregate_value(std::string* valu // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool FeatureSet::has_field_presence() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; return value; } inline void FeatureSet::clear_field_presence() { _impl_.field_presence_ = 0; - _impl_._has_bits_[0] &= ~0x00000001u; + _impl_._has_bits_[0] &= ~0x00000002u; } inline ::google::protobuf::FeatureSet_FieldPresence FeatureSet::field_presence() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.field_presence) @@ -17210,18 +17227,18 @@ inline ::google::protobuf::FeatureSet_FieldPresence FeatureSet::_internal_field_ inline void FeatureSet::_internal_set_field_presence(::google::protobuf::FeatureSet_FieldPresence value) { PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); assert(::google::protobuf::FeatureSet_FieldPresence_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000001u; + _impl_._has_bits_[0] |= 0x00000002u; _impl_.field_presence_ = value; } // optional .google.protobuf.FeatureSet.EnumType enum_type = 2 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool FeatureSet::has_enum_type() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; return value; } inline void FeatureSet::clear_enum_type() { _impl_.enum_type_ = 0; - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000004u; } inline ::google::protobuf::FeatureSet_EnumType FeatureSet::enum_type() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.enum_type) @@ -17238,18 +17255,18 @@ inline ::google::protobuf::FeatureSet_EnumType FeatureSet::_internal_enum_type() inline void FeatureSet::_internal_set_enum_type(::google::protobuf::FeatureSet_EnumType value) { PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); assert(::google::protobuf::FeatureSet_EnumType_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000002u; + _impl_._has_bits_[0] |= 0x00000004u; _impl_.enum_type_ = value; } // optional .google.protobuf.FeatureSet.RepeatedFieldEncoding repeated_field_encoding = 3 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool FeatureSet::has_repeated_field_encoding() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; return value; } inline void FeatureSet::clear_repeated_field_encoding() { _impl_.repeated_field_encoding_ = 0; - _impl_._has_bits_[0] &= ~0x00000004u; + _impl_._has_bits_[0] &= ~0x00000008u; } inline ::google::protobuf::FeatureSet_RepeatedFieldEncoding FeatureSet::repeated_field_encoding() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.repeated_field_encoding) @@ -17266,18 +17283,18 @@ inline ::google::protobuf::FeatureSet_RepeatedFieldEncoding FeatureSet::_interna inline void FeatureSet::_internal_set_repeated_field_encoding(::google::protobuf::FeatureSet_RepeatedFieldEncoding value) { PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); assert(::google::protobuf::FeatureSet_RepeatedFieldEncoding_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000004u; + _impl_._has_bits_[0] |= 0x00000008u; _impl_.repeated_field_encoding_ = value; } // optional .google.protobuf.FeatureSet.StringFieldValidation string_field_validation = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool FeatureSet::has_string_field_validation() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; return value; } inline void FeatureSet::clear_string_field_validation() { _impl_.string_field_validation_ = 0; - _impl_._has_bits_[0] &= ~0x00000008u; + _impl_._has_bits_[0] &= ~0x00000010u; } inline ::google::protobuf::FeatureSet_StringFieldValidation FeatureSet::string_field_validation() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.string_field_validation) @@ -17294,18 +17311,18 @@ inline ::google::protobuf::FeatureSet_StringFieldValidation FeatureSet::_interna inline void FeatureSet::_internal_set_string_field_validation(::google::protobuf::FeatureSet_StringFieldValidation value) { PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); assert(::google::protobuf::FeatureSet_StringFieldValidation_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000008u; + _impl_._has_bits_[0] |= 0x00000010u; _impl_.string_field_validation_ = value; } // optional .google.protobuf.FeatureSet.MessageEncoding message_encoding = 5 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool FeatureSet::has_message_encoding() const { - bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; return value; } inline void FeatureSet::clear_message_encoding() { _impl_.message_encoding_ = 0; - _impl_._has_bits_[0] &= ~0x00000010u; + _impl_._has_bits_[0] &= ~0x00000020u; } inline ::google::protobuf::FeatureSet_MessageEncoding FeatureSet::message_encoding() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.message_encoding) @@ -17322,18 +17339,18 @@ inline ::google::protobuf::FeatureSet_MessageEncoding FeatureSet::_internal_mess inline void FeatureSet::_internal_set_message_encoding(::google::protobuf::FeatureSet_MessageEncoding value) { PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); assert(::google::protobuf::FeatureSet_MessageEncoding_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000010u; + _impl_._has_bits_[0] |= 0x00000020u; _impl_.message_encoding_ = value; } // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { inline bool FeatureSet::has_json_format() const { - bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; return value; } inline void FeatureSet::clear_json_format() { _impl_.json_format_ = 0; - _impl_._has_bits_[0] &= ~0x00000020u; + _impl_._has_bits_[0] &= ~0x00000040u; } inline ::google::protobuf::FeatureSet_JsonFormat FeatureSet::json_format() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.json_format) @@ -17350,10 +17367,106 @@ inline ::google::protobuf::FeatureSet_JsonFormat FeatureSet::_internal_json_form inline void FeatureSet::_internal_set_json_format(::google::protobuf::FeatureSet_JsonFormat value) { PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); assert(::google::protobuf::FeatureSet_JsonFormat_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000020u; + _impl_._has_bits_[0] |= 0x00000040u; _impl_.json_format_ = value; } +// optional .google.protobuf.FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; +inline bool FeatureSet::has_raw_features() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.raw_features_ != nullptr); + return value; +} +inline void FeatureSet::clear_raw_features() { + if (_impl_.raw_features_ != nullptr) _impl_.raw_features_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::google::protobuf::FeatureSet& FeatureSet::_internal_raw_features() const { + PROTOBUF_TSAN_READ(&_impl_._tsan_detect_race); + const ::google::protobuf::FeatureSet* p = _impl_.raw_features_; + return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_FeatureSet_default_instance_); +} +inline const ::google::protobuf::FeatureSet& FeatureSet::raw_features() const { + // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.raw_features) + return _internal_raw_features(); +} +inline void FeatureSet::unsafe_arena_set_allocated_raw_features(::google::protobuf::FeatureSet* value) { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.raw_features_); + } + _impl_.raw_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); + if (value != nullptr) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FeatureSet.raw_features) +} +inline ::google::protobuf::FeatureSet* FeatureSet::release_raw_features() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + + _impl_._has_bits_[0] &= ~0x00000001u; + ::google::protobuf::FeatureSet* released = _impl_.raw_features_; + _impl_.raw_features_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + if (GetArenaForAllocation() == nullptr) { + delete old; + } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + released = ::google::protobuf::internal::DuplicateIfNonNull(released); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return released; +} +inline ::google::protobuf::FeatureSet* FeatureSet::unsafe_arena_release_raw_features() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + // @@protoc_insertion_point(field_release:google.protobuf.FeatureSet.raw_features) + + _impl_._has_bits_[0] &= ~0x00000001u; + ::google::protobuf::FeatureSet* temp = _impl_.raw_features_; + _impl_.raw_features_ = nullptr; + return temp; +} +inline ::google::protobuf::FeatureSet* FeatureSet::_internal_mutable_raw_features() { + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.raw_features_ == nullptr) { + auto* p = CreateMaybeMessage<::google::protobuf::FeatureSet>(GetArenaForAllocation()); + _impl_.raw_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p); + } + return _impl_.raw_features_; +} +inline ::google::protobuf::FeatureSet* FeatureSet::mutable_raw_features() { + ::google::protobuf::FeatureSet* _msg = _internal_mutable_raw_features(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSet.raw_features) + return _msg; +} +inline void FeatureSet::set_allocated_raw_features(::google::protobuf::FeatureSet* value) { + ::google::protobuf::Arena* message_arena = GetArenaForAllocation(); + PROTOBUF_TSAN_WRITE(&_impl_._tsan_detect_race); + if (message_arena == nullptr) { + delete reinterpret_cast<::google::protobuf::FeatureSet*>(_impl_.raw_features_); + } + + if (value != nullptr) { + ::google::protobuf::Arena* submessage_arena = + ::google::protobuf::Arena::InternalGetOwningArena(reinterpret_cast<::google::protobuf::FeatureSet*>(value)); + if (message_arena != submessage_arena) { + value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + + _impl_.raw_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FeatureSet.raw_features) +} + // ------------------------------------------------------------------- // SourceCodeInfo_Location diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index d53acc70f7281..5f148224c98e3 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -974,6 +974,8 @@ message FeatureSet { edition_defaults = { edition: "2023", value: "ALLOW" } ]; + optional FeatureSet raw_features = 999 [targets = TARGET_TYPE_UNKNOWN]; + extensions 1000; // for Protobuf C++ extensions 1001; // for Protobuf Java diff --git a/src/google/protobuf/feature_resolver.cc b/src/google/protobuf/feature_resolver.cc index 9f57d9900e550..feda73ed4447e 100644 --- a/src/google/protobuf/feature_resolver.cc +++ b/src/google/protobuf/feature_resolver.cc @@ -69,6 +69,12 @@ absl::Status Error(Args... args) { return absl::FailedPreconditionError(absl::StrCat(args...)); } +bool IsNonFeatureField(const FieldDescriptor& field) { + return field.containing_type() && + field.containing_type()->full_name() == "google.protobuf.FeatureSet" && + field.name() == "raw_features"; +} + bool EditionsLessThan(absl::string_view a, absl::string_view b) { std::vector as = absl::StrSplit(a, '.'); std::vector bs = absl::StrSplit(b, '.'); @@ -93,6 +99,8 @@ absl::Status ValidateDescriptor(absl::string_view edition, } for (int i = 0; i < descriptor.field_count(); ++i) { const FieldDescriptor& field = *descriptor.field(i); + if (IsNonFeatureField(field)) continue; + if (field.is_required()) { return Error("Feature field ", field.full_name(), " is an unsupported required field."); @@ -122,6 +130,8 @@ absl::Status FillDefaults(absl::string_view edition, Message& msg) { for (int i = 0; i < descriptor.field_count(); ++i) { const FieldDescriptor& field = *descriptor.field(i); + if (IsNonFeatureField(field)) continue; + msg.GetReflection()->ClearField(&msg, &field); ABSL_CHECK(!field.is_repeated()); From b81d2cc8c5c0210414f80c4d4e8883037b613859 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 12 Jul 2023 16:02:16 -0700 Subject: [PATCH 08/27] Expand VisitDescriptor to support mutable access to the proto. PiperOrigin-RevId: 547625871 --- src/google/protobuf/descriptor_visitor.h | 74 +++++++++++++------ .../protobuf/descriptor_visitor_test.cc | 18 +++++ 2 files changed, 70 insertions(+), 22 deletions(-) diff --git a/src/google/protobuf/descriptor_visitor.h b/src/google/protobuf/descriptor_visitor.h index a8b2f04b049ed..267ffab7036aa 100644 --- a/src/google/protobuf/descriptor_visitor.h +++ b/src/google/protobuf/descriptor_visitor.h @@ -46,6 +46,10 @@ template void VisitDescriptors(const FileDescriptor& file, const FileDescriptorProto& proto, Visitor visitor); +template +void VisitDescriptors(const FileDescriptor& file, FileDescriptorProto& proto, + Visitor visitor); + // Visit just the descriptors, without a corresponding proto tree. template void VisitDescriptors(const FileDescriptor& file, Visitor visitor); @@ -54,92 +58,111 @@ template struct VisitImpl { Visitor visitor; template - void Visit(const FieldDescriptor& descriptor, const Proto&... proto) { + void Visit(const FieldDescriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); } template - void Visit(const EnumValueDescriptor& descriptor, const Proto&... proto) { + void Visit(const EnumValueDescriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); } template - void Visit(const EnumDescriptor& descriptor, const Proto&... proto) { + void Visit(const EnumDescriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); for (int i = 0; i < descriptor.value_count(); i++) { - Visit(*descriptor.value(i), proto.value(i)...); + Visit(*descriptor.value(i), value(proto, i)...); } } template - void Visit(const Descriptor::ExtensionRange& descriptor, - const Proto&... proto) { + void Visit(const Descriptor::ExtensionRange& descriptor, Proto&... proto) { visitor(descriptor, proto...); } template - void Visit(const OneofDescriptor& descriptor, const Proto&... proto) { + void Visit(const OneofDescriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); } template - void Visit(const Descriptor& descriptor, const Proto&... proto) { + void Visit(const Descriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); for (int i = 0; i < descriptor.enum_type_count(); i++) { - Visit(*descriptor.enum_type(i), proto.enum_type(i)...); + Visit(*descriptor.enum_type(i), enum_type(proto, i)...); } for (int i = 0; i < descriptor.oneof_decl_count(); i++) { - Visit(*descriptor.oneof_decl(i), proto.oneof_decl(i)...); + Visit(*descriptor.oneof_decl(i), oneof_decl(proto, i)...); } for (int i = 0; i < descriptor.field_count(); i++) { - Visit(*descriptor.field(i), proto.field(i)...); + Visit(*descriptor.field(i), field(proto, i)...); } for (int i = 0; i < descriptor.nested_type_count(); i++) { - Visit(*descriptor.nested_type(i), proto.nested_type(i)...); + Visit(*descriptor.nested_type(i), nested_type(proto, i)...); } for (int i = 0; i < descriptor.extension_count(); i++) { - Visit(*descriptor.extension(i), proto.extension(i)...); + Visit(*descriptor.extension(i), extension(proto, i)...); } for (int i = 0; i < descriptor.extension_range_count(); i++) { - Visit(*descriptor.extension_range(i), proto.extension_range(i)...); + Visit(*descriptor.extension_range(i), extension_range(proto, i)...); } } template - void Visit(const MethodDescriptor& method, const Proto&... proto) { + void Visit(const MethodDescriptor& method, Proto&... proto) { visitor(method, proto...); } template - void Visit(const ServiceDescriptor& descriptor, const Proto&... proto) { + void Visit(const ServiceDescriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); for (int i = 0; i < descriptor.method_count(); i++) { - Visit(*descriptor.method(i), proto.method(i)...); + Visit(*descriptor.method(i), method(proto, i)...); } } template - void Visit(const FileDescriptor& descriptor, const Proto&... proto) { + void Visit(const FileDescriptor& descriptor, Proto&... proto) { visitor(descriptor, proto...); for (int i = 0; i < descriptor.message_type_count(); i++) { - Visit(*descriptor.message_type(i), proto.message_type(i)...); + Visit(*descriptor.message_type(i), message_type(proto, i)...); } for (int i = 0; i < descriptor.enum_type_count(); i++) { - Visit(*descriptor.enum_type(i), proto.enum_type(i)...); + Visit(*descriptor.enum_type(i), enum_type(proto, i)...); } for (int i = 0; i < descriptor.extension_count(); i++) { - Visit(*descriptor.extension(i), proto.extension(i)...); + Visit(*descriptor.extension(i), extension(proto, i)...); } for (int i = 0; i < descriptor.service_count(); i++) { - Visit(*descriptor.service(i), proto.service(i)...); + Visit(*descriptor.service(i), service(proto, i)...); } } + + private: +#define CREATE_NESTED_GETTER(TYPE, NESTED) \ + inline auto& NESTED(TYPE& desc, int i) { return *desc.mutable_##NESTED(i); } \ + inline auto& NESTED(const TYPE& desc, int i) { return desc.NESTED(i); } + + CREATE_NESTED_GETTER(DescriptorProto, enum_type); + CREATE_NESTED_GETTER(DescriptorProto, extension); + CREATE_NESTED_GETTER(DescriptorProto, extension_range); + CREATE_NESTED_GETTER(DescriptorProto, field); + CREATE_NESTED_GETTER(DescriptorProto, nested_type); + CREATE_NESTED_GETTER(DescriptorProto, oneof_decl); + CREATE_NESTED_GETTER(EnumDescriptorProto, value); + CREATE_NESTED_GETTER(FileDescriptorProto, enum_type); + CREATE_NESTED_GETTER(FileDescriptorProto, extension); + CREATE_NESTED_GETTER(FileDescriptorProto, message_type); + CREATE_NESTED_GETTER(FileDescriptorProto, service); + CREATE_NESTED_GETTER(ServiceDescriptorProto, method); + +#undef CREATE_NESTED_GETTER }; // Provide a fallback to ignore all the nodes that are not interesting to the @@ -167,6 +190,13 @@ void VisitDescriptors(const FileDescriptor& file, internal::VisitImpl{VisitorImpl(visitor)}.Visit(file, proto); } +template +void VisitDescriptors(const FileDescriptor& file, FileDescriptorProto& proto, + Visitor visitor) { + using VisitorImpl = internal::VisitorImpl; + internal::VisitImpl{VisitorImpl(visitor)}.Visit(file, proto); +} + template void VisitDescriptors(const FileDescriptor& file, Visitor visitor) { using VisitorImpl = internal::VisitorImpl; diff --git a/src/google/protobuf/descriptor_visitor_test.cc b/src/google/protobuf/descriptor_visitor_test.cc index 020c3754d0632..2e7bb0165e929 100644 --- a/src/google/protobuf/descriptor_visitor_test.cc +++ b/src/google/protobuf/descriptor_visitor_test.cc @@ -78,6 +78,24 @@ TEST(VisitDescriptorsTest, SingleTypeWithProto) { "protobuf_unittest.TestAllTypes.NestedMessage"})); } +TEST(VisitDescriptorsTest, SingleTypeMutableProto) { + const FileDescriptor& file = + *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); + FileDescriptorProto proto; + file.CopyTo(&proto); + std::vector descriptors; + VisitDescriptors(file, proto, + [&](const Descriptor& descriptor, DescriptorProto& proto) { + descriptors.push_back(descriptor.full_name()); + EXPECT_EQ(descriptor.name(), proto.name()); + proto.set_name(""); + }); + EXPECT_THAT(descriptors, + IsSupersetOf({"protobuf_unittest.TestAllTypes", + "protobuf_unittest.TestAllTypes.NestedMessage"})); + EXPECT_EQ(proto.message_type(0).name(), ""); +} + TEST(VisitDescriptorsTest, AllTypesDeduce) { const FileDescriptor& file = *protobuf_unittest::TestAllTypes::GetDescriptor()->file(); From c5a1dbeb1ef46038cd0d749ee103533e7dc4af72 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 13 Jul 2023 10:48:28 -0700 Subject: [PATCH 09/27] Implement helpers for exporting all FeatureSets to generators. There are 4 different feature sets for every descriptor: * Runtime/resolved - Used to make runtime decisions * Source/resolved - Used to make codegen decisions * Runtime/raw - Used to reason about the original proto file during runtime * Source/raw - Used to validate features during codegen All of these will need to be shipped to code generators. While C++ generators can use the C++ runtime to reconstruct these, they won't end up in the FileDescriptorProtos we send to runtimes. Similarly, non-C++ generators wouldn't be able to get them without duplicating our feature resolution logic. This change adds a helper that allows us to bundle all of these into the protos we send to generators. PiperOrigin-RevId: 547849243 --- src/google/protobuf/compiler/BUILD.bazel | 19 ++ src/google/protobuf/compiler/code_generator.h | 12 + .../compiler/code_generator_unittest.cc | 299 ++++++++++++++++++ src/google/protobuf/compiler/retention.cc | 14 +- src/google/protobuf/compiler/retention.h | 2 + .../protobuf/compiler/retention_unittest.cc | 65 +++- src/google/protobuf/descriptor.cc | 35 +- src/google/protobuf/descriptor.h | 13 +- src/google/protobuf/descriptor_unittest.cc | 41 +++ src/google/protobuf/unittest_features.proto | 28 ++ 10 files changed, 512 insertions(+), 16 deletions(-) create mode 100644 src/google/protobuf/compiler/code_generator_unittest.cc diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index 5898938000186..58b8802ff4f14 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -69,6 +69,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ "//src/google/protobuf:protobuf_nowkt", + "//src/google/protobuf/compiler:retention", "//src/google/protobuf/io:io_win32", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/log:absl_check", @@ -248,6 +249,24 @@ cc_binary( ], ) +cc_test( + name = "code_generator_unittest", + srcs = ["code_generator_unittest.cc"], + copts = COPTS, + deps = [ + ":code_generator", + ":importer", + "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_textproto", + "//src/google/protobuf/io", + "//src/google/protobuf/testing", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + cc_test( name = "command_line_interface_unittest", srcs = ["command_line_interface_unittest.cc"], diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h index cff469753bddb..17674c90f244a 100644 --- a/src/google/protobuf/compiler/code_generator.h +++ b/src/google/protobuf/compiler/code_generator.h @@ -43,7 +43,9 @@ #include #include "absl/strings/string_view.h" +#include "google/protobuf/compiler/retention.h" #include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor.pb.h" #include "google/protobuf/port.h" // Must be included last. @@ -143,6 +145,16 @@ class PROTOC_EXPORT CodeGenerator { static const FeatureSet& GetSourceRawFeatures(const DescriptorT& desc) { return ::google::protobuf::internal::InternalFeatureHelper::GetRawFeatures(desc); } + + // Converts a FileDescriptor to a FileDescriptorProto suitable for passing off + // to a runtime. Notably, this strips all source-retention options and + // includes both raw and resolved features. + static FileDescriptorProto GetRuntimeProto(const FileDescriptor& file) { + FileDescriptorProto proto = + ::google::protobuf::internal::InternalFeatureHelper::GetGeneratorProto(file); + StripSourceRetentionOptions(*file.pool(), proto); + return proto; + } #endif // PROTOBUF_FUTURE_EDITIONS }; diff --git a/src/google/protobuf/compiler/code_generator_unittest.cc b/src/google/protobuf/compiler/code_generator_unittest.cc new file mode 100644 index 0000000000000..626342d3fe2b7 --- /dev/null +++ b/src/google/protobuf/compiler/code_generator_unittest.cc @@ -0,0 +1,299 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2023 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "google/protobuf/compiler/code_generator.h" + +#include + +#include "google/protobuf/descriptor.pb.h" +#include +#include +#include "absl/log/absl_log.h" +#include "absl/strings/str_format.h" +#include "absl/strings/str_replace.h" +#include "absl/strings/string_view.h" +#include "google/protobuf/compiler/parser.h" +#include "google/protobuf/io/tokenizer.h" +#include "google/protobuf/io/zero_copy_stream_impl_lite.h" +#include "google/protobuf/test_textproto.h" +#include "google/protobuf/unittest_features.pb.h" + +namespace google { +namespace protobuf { +namespace compiler { +namespace { + +using ::testing::NotNull; + +class TestGenerator : public CodeGenerator { + public: + bool Generate(const FileDescriptor* file, const std::string& parameter, + GeneratorContext* generator_context, + std::string* error) const override { + return true; + } + + // Expose the protected methods for testing. + using CodeGenerator::GetRuntimeProto; + using CodeGenerator::GetSourceFeatures; + using CodeGenerator::GetSourceRawFeatures; +}; + +class SimpleErrorCollector : public io::ErrorCollector { + public: + void RecordError(int line, int column, absl::string_view message) override { + ABSL_LOG(ERROR) << absl::StrFormat("%d:%d:%s", line, column, message); + } +}; + +class CodeGeneratorTest : public ::testing::Test { + protected: + void SetUp() override { + ASSERT_THAT(BuildFile(DescriptorProto::descriptor()->file()), NotNull()); + ASSERT_THAT(BuildFile(pb::TestMessage::descriptor()->file()), NotNull()); + } + + const FileDescriptor* BuildFile(absl::string_view schema) { + io::ArrayInputStream input_stream(schema.data(), + static_cast(schema.size())); + SimpleErrorCollector error_collector; + io::Tokenizer tokenizer(&input_stream, &error_collector); + Parser parser; + parser.RecordErrorsTo(&error_collector); + FileDescriptorProto proto; + ABSL_CHECK(parser.Parse(&tokenizer, &proto)) << schema; + proto.set_name("test.proto"); + return pool_.BuildFile(proto); + } + + const FileDescriptor* BuildFile(const FileDescriptor* file) { + FileDescriptorProto proto; + file->CopyTo(&proto); + return pool_.BuildFile(proto); + } + + DescriptorPool pool_; +}; + +TEST_F(CodeGeneratorTest, GetSourceRawFeaturesRoot) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + + import "google/protobuf/unittest_features.proto"; + + option features.field_presence = EXPLICIT; // 2023 default + option features.enum_type = CLOSED; // override + option features.(pb.test).int_file_feature = 8; + option features.(pb.test).string_source_feature = "file"; + )schema"); + ASSERT_THAT(file, NotNull()); + + EXPECT_THAT(TestGenerator::GetSourceRawFeatures(*file), + google::protobuf::EqualsProto(R"pb( + field_presence: EXPLICIT + enum_type: CLOSED + [pb.test] { int_file_feature: 8 string_source_feature: "file" } + )pb")); +} + +TEST_F(CodeGeneratorTest, GetSourceRawFeaturesInherited) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + + import "google/protobuf/unittest_features.proto"; + + option features.enum_type = OPEN; + option features.(pb.test).int_file_feature = 6; + message EditionsMessage { + option features.(pb.test).int_message_feature = 7; + option features.(pb.test).int_multiple_feature = 8; + + string field = 1 [ + features.field_presence = EXPLICIT, + features.(pb.test).int_multiple_feature = 9, + features.(pb.test).string_source_feature = "field" + ]; + } + )schema"); + ASSERT_THAT(file, NotNull()); + + const FieldDescriptor* field = + file->FindMessageTypeByName("EditionsMessage")->FindFieldByName("field"); + ASSERT_THAT(field, NotNull()); + + EXPECT_THAT( + TestGenerator::GetSourceRawFeatures(*field), google::protobuf::EqualsProto(R"pb( + field_presence: EXPLICIT + [pb.test] { int_multiple_feature: 9 string_source_feature: "field" } + )pb")); +} + +TEST_F(CodeGeneratorTest, GetSourceFeaturesRoot) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + + import "google/protobuf/unittest_features.proto"; + + option features.field_presence = EXPLICIT; // 2023 default + option features.enum_type = CLOSED; // override + option features.(pb.test).int_file_feature = 8; + option features.(pb.test).string_source_feature = "file"; + )schema"); + ASSERT_THAT(file, NotNull()); + + const FeatureSet& features = TestGenerator::GetSourceFeatures(*file); + const pb::TestFeatures& ext = features.GetExtension(pb::test); + + EXPECT_TRUE(features.has_repeated_field_encoding()); + EXPECT_TRUE(features.field_presence()); + EXPECT_EQ(features.field_presence(), FeatureSet::EXPLICIT); + EXPECT_EQ(features.enum_type(), FeatureSet::CLOSED); + + EXPECT_TRUE(ext.has_int_message_feature()); + EXPECT_EQ(ext.int_file_feature(), 8); + EXPECT_EQ(ext.string_source_feature(), "file"); +} + +TEST_F(CodeGeneratorTest, GetSourceFeaturesInherited) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + + import "google/protobuf/unittest_features.proto"; + + option features.enum_type = CLOSED; + option features.(pb.test).int_source_feature = 5; + option features.(pb.test).int_file_feature = 6; + message EditionsMessage { + option features.(pb.test).int_message_feature = 7; + option features.(pb.test).int_multiple_feature = 8; + option features.(pb.test).string_source_feature = "message"; + + string field = 1 [ + features.field_presence = IMPLICIT, + features.(pb.test).int_multiple_feature = 9, + features.(pb.test).string_source_feature = "field" + ]; + } + )schema"); + ASSERT_THAT(file, NotNull()); + + const FieldDescriptor* field = + file->FindMessageTypeByName("EditionsMessage")->FindFieldByName("field"); + ASSERT_THAT(field, NotNull()); + const FeatureSet& features = TestGenerator::GetSourceFeatures(*field); + const pb::TestFeatures& ext = features.GetExtension(pb::test); + + EXPECT_EQ(features.enum_type(), FeatureSet::CLOSED); + EXPECT_EQ(features.field_presence(), FeatureSet::IMPLICIT); + + EXPECT_EQ(ext.int_message_feature(), 7); + EXPECT_EQ(ext.int_file_feature(), 6); + EXPECT_EQ(ext.int_multiple_feature(), 9); + EXPECT_EQ(ext.int_source_feature(), 5); + EXPECT_EQ(ext.string_source_feature(), "field"); +} + +TEST_F(CodeGeneratorTest, GetRuntimeProtoRoot) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + + import "google/protobuf/unittest_features.proto"; + + option features.enum_type = CLOSED; + option features.(pb.test).int_source_feature = 5; + option features.(pb.test).int_file_feature = 6; + )schema"); + ASSERT_THAT(file, NotNull()); + + FileDescriptorProto proto = TestGenerator::GetRuntimeProto(*file); + const FeatureSet& features = proto.options().features(); + const pb::TestFeatures& ext = features.GetExtension(pb::test); + + EXPECT_THAT(features.raw_features(), + EqualsProto(R"pb(enum_type: CLOSED + [pb.test] { int_file_feature: 6 })pb")); + EXPECT_EQ(features.enum_type(), FeatureSet::CLOSED); + EXPECT_TRUE(features.has_field_presence()); + EXPECT_EQ(features.field_presence(), FeatureSet::EXPLICIT); + + EXPECT_FALSE(ext.has_int_source_feature()); + EXPECT_EQ(ext.int_file_feature(), 6); +} + +TEST_F(CodeGeneratorTest, GetRuntimeProtoInherited) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + + import "google/protobuf/unittest_features.proto"; + + option features.enum_type = CLOSED; + option features.(pb.test).int_source_feature = 5; + option features.(pb.test).int_file_feature = 6; + message EditionsMessage { + option features.(pb.test).int_message_feature = 7; + option features.(pb.test).int_multiple_feature = 8; + + string field = 1 [ + features.field_presence = IMPLICIT, + features.(pb.test).int_multiple_feature = 9, + features.(pb.test).string_source_feature = "field" + ]; + } + )schema"); + ASSERT_THAT(file, NotNull()); + + FileDescriptorProto proto = TestGenerator::GetRuntimeProto(*file); + const FieldDescriptorProto& field = proto.message_type(0).field(0); + const FeatureSet& features = field.options().features(); + const pb::TestFeatures& ext = features.GetExtension(pb::test); + + EXPECT_THAT(features.raw_features(), google::protobuf::EqualsProto(R"pb( + field_presence: IMPLICIT + [pb.test] { int_multiple_feature: 9 } + )pb")); + EXPECT_EQ(features.enum_type(), FeatureSet::CLOSED); + EXPECT_EQ(features.field_presence(), FeatureSet::IMPLICIT); + EXPECT_EQ(ext.int_multiple_feature(), 9); + EXPECT_EQ(ext.int_message_feature(), 7); + EXPECT_EQ(ext.int_file_feature(), 6); + EXPECT_FALSE(ext.has_int_source_feature()); + EXPECT_FALSE(ext.has_string_source_feature()); +} + +} // namespace +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/retention.cc b/src/google/protobuf/compiler/retention.cc index 822df6096f3d2..38df6210d116d 100644 --- a/src/google/protobuf/compiler/retention.cc +++ b/src/google/protobuf/compiler/retention.cc @@ -248,16 +248,22 @@ FileDescriptorProto StripSourceRetentionOptions(const FileDescriptor& file, bool include_source_code_info) { FileDescriptorProto file_proto; file.CopyTo(&file_proto); - std::vector> stripped_paths; - ConvertToDynamicMessageAndStripOptions(file_proto, *file.pool(), - &stripped_paths); if (include_source_code_info) { file.CopySourceCodeInfoTo(&file_proto); - StripSourceCodeInfo(stripped_paths, *file_proto.mutable_source_code_info()); } + StripSourceRetentionOptions(*file.pool(), file_proto); return file_proto; } +void StripSourceRetentionOptions(const DescriptorPool& pool, + FileDescriptorProto& file_proto) { + std::vector> stripped_paths; + ConvertToDynamicMessageAndStripOptions(file_proto, pool, &stripped_paths); + if (file_proto.has_source_code_info()) { + StripSourceCodeInfo(stripped_paths, *file_proto.mutable_source_code_info()); + } +} + DescriptorProto StripSourceRetentionOptions(const Descriptor& message) { DescriptorProto message_proto; message.CopyTo(&message_proto); diff --git a/src/google/protobuf/compiler/retention.h b/src/google/protobuf/compiler/retention.h index bf7fe0e1d6180..63353b2c7f210 100644 --- a/src/google/protobuf/compiler/retention.h +++ b/src/google/protobuf/compiler/retention.h @@ -47,6 +47,8 @@ namespace compiler { // corresponding to source-retention options. PROTOC_EXPORT FileDescriptorProto StripSourceRetentionOptions( const FileDescriptor& file, bool include_source_code_info = false); +PROTOC_EXPORT void StripSourceRetentionOptions(const DescriptorPool& pool, + FileDescriptorProto& file_proto); PROTOC_EXPORT DescriptorProto StripSourceRetentionOptions(const Descriptor& message); PROTOC_EXPORT DescriptorProto::ExtensionRange StripSourceRetentionOptions( diff --git a/src/google/protobuf/compiler/retention_unittest.cc b/src/google/protobuf/compiler/retention_unittest.cc index fa14e597aefa6..b0629e01a08b3 100644 --- a/src/google/protobuf/compiler/retention_unittest.cc +++ b/src/google/protobuf/compiler/retention_unittest.cc @@ -115,16 +115,7 @@ class RetentionStripTest : public testing::Test { DynamicMessageFactory factory; std::unique_ptr dynamic_message( factory.GetPrototype(file_options_descriptor)->New()); - ABSL_CHECK(TextFormat::ParseFromString( - R"([google.protobuf.internal.options] { - i2: 456 - c {} - rc {} - } - [google.protobuf.internal.repeated_options] { - i2: 222 - })", - dynamic_message.get())); + ABSL_CHECK(TextFormat::ParseFromString(data, dynamic_message.get())); ProtoType ret; ABSL_CHECK(ret.ParseFromString(dynamic_message->SerializeAsString())); return ret; @@ -179,6 +170,60 @@ TEST_F(RetentionStripTest, StripSourceRetentionFileOptions) { EqualsProto(expected_options)); } +TEST_F(RetentionStripTest, StripSourceRetentionProtoFileOptions) { + const FileDescriptor* file = ParseSchema(R"schema( + option (source_retention_option) = 123; + option (options) = { + i1: 123 + i2: 456 + c { s: "abc" } + rc { s: "abc" } + }; + option (repeated_options) = { + i1: 111 i2: 222 + }; + + message Options { + optional int32 i1 = 1 [retention = RETENTION_SOURCE]; + optional int32 i2 = 2; + message ChildMessage { + optional string s = 1 [retention = RETENTION_SOURCE]; + } + optional ChildMessage c = 3; + repeated ChildMessage rc = 4; + } + + extend google.protobuf.FileOptions { + optional int32 source_retention_option = 50000 [retention = RETENTION_SOURCE]; + optional Options options = 50001; + repeated Options repeated_options = 50002; + } + )schema"); + + FileDescriptorProto proto; + file->CopyTo(&proto); + + ASSERT_THAT(proto.options(), EqualsProto(BuildDynamicProto(R"pb( + [google.protobuf.internal.source_retention_option]: 123 + [google.protobuf.internal.options] { + i1: 123 + i2: 456 + c { s: "abc" } + rc { s: "abc" } + } + [google.protobuf.internal.repeated_options] { i1: 111 i2: 222 })pb"))); + + StripSourceRetentionOptions(*file->pool(), proto); + + EXPECT_THAT(proto.options(), EqualsProto(BuildDynamicProto(R"pb( + [google.protobuf.internal.options] { + i2: 456 + c {} + rc {} + } + [google.protobuf.internal.repeated_options] { i2: 222 })pb"))); +} + TEST_F(RetentionStripTest, StripSourceRetentionMessageOptions) { const FileDescriptor* file = ParseSchema(R"schema( message TestMessage { diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 1f15e59c881e1..4531801c6bb75 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -2759,6 +2759,32 @@ FileDescriptor::FileDescriptor() {} // CopyTo methods ==================================================== +#ifdef PROTOBUF_FUTURE_EDITIONS +namespace internal { +FileDescriptorProto InternalFeatureHelper::GetGeneratorProto( + const FileDescriptor& file) { + FileDescriptorProto file_proto; + file.CopyTo(&file_proto); + + // Insert all the raw features back into the proto. + internal::VisitDescriptors( + file, file_proto, [](const auto& desc, auto& proto) { + const auto& features = GetFeatures(desc); + if (&features != &FeatureSet::default_instance() && + !IsLegacyFeatureSet(features)) { + *proto.mutable_options()->mutable_features() = features; + } + const auto& raw_features = GetRawFeatures(desc); + if (&raw_features != &FeatureSet::default_instance()) { + *proto.mutable_options()->mutable_features()->mutable_raw_features() = + GetRawFeatures(desc); + } + }); + return file_proto; +} +} // namespace internal +#endif // PROTOBUF_FUTURE_EDITIONS + void FileDescriptor::CopyTo(FileDescriptorProto* proto) const { CopyHeadingTo(proto); @@ -5407,7 +5433,14 @@ void DescriptorBuilder::ResolveFeaturesImpl( // internal details. FeatureSet* mutable_features = alloc.AllocateArray(1); descriptor->proto_features_ = mutable_features; - options->mutable_features()->Swap(mutable_features); + if (options->features().has_raw_features()) { + // If the raw features are specified, use those and recalculate the + // resolved features. + options->mutable_features()->mutable_raw_features()->Swap( + mutable_features); + } else { + options->mutable_features()->Swap(mutable_features); + } options->clear_features(); } else if (!force_merge) { // Nothing to merge, and we aren't forcing it. diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index 1bd40c8aff64e..0c0eccbf29e9e 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -262,7 +262,7 @@ class PROTOBUF_EXPORT SymbolBaseN : public SymbolBase {}; // This class is for internal use only and provides access to the FeatureSets // defined on descriptors. These features are not designed to be stable, and // depending directly on them (vs the public descriptor APIs) is not safe. -class InternalFeatureHelper { +class PROTOBUF_EXPORT InternalFeatureHelper { public: template static const FeatureSet& GetFeatures(const DescriptorT& desc) { @@ -271,10 +271,21 @@ class InternalFeatureHelper { private: friend class ::google::protobuf::compiler::CodeGenerator; + + // Provides a restricted view exclusively to code generators. Raw features + // haven't been resolved, and are virtually meaningless to everyone else. Code + // generators will need them to validate their own features, and runtimes may + // need them internally to be able to properly represent the original proto + // files from generated code. template static const FeatureSet& GetRawFeatures(const DescriptorT& desc) { return *desc.proto_features_; } + + // Provides the full descriptor tree including both resolved features (in the + // `features` fields) and unresolved features (in the `raw_features` fields) + // for every descriptor. + static FileDescriptorProto GetGeneratorProto(const FileDescriptor& file); }; #endif // PROTOBUF_FUTURE_EDITIONS diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index bef2eb1846830..cb59fa16459ab 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -9538,6 +9538,47 @@ TEST_F(FeaturesTest, UninterpretedOptionsMergeExtension) { 9); } +TEST_F(FeaturesTest, RawFeatures) { + BuildDescriptorMessagesInTestPool(); + const FileDescriptor* file = BuildFile(R"pb( + name: "foo.proto" + syntax: "editions" + edition: "2023" + options { features { raw_features { field_presence: IMPLICIT } } } + )pb"); + EXPECT_THAT(file->options(), EqualsProto("")); + EXPECT_THAT(GetFeatures(file), EqualsProto(R"pb( + field_presence: IMPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + string_field_validation: MANDATORY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW)pb")); +} + +TEST_F(FeaturesTest, RawFeaturesConflict) { + BuildDescriptorMessagesInTestPool(); + const FileDescriptor* file = BuildFile(R"pb( + name: "foo.proto" + syntax: "editions" + edition: "2023" + options { + features { + enum_type: CLOSED + raw_features { field_presence: IMPLICIT } + } + } + )pb"); + EXPECT_THAT(file->options(), EqualsProto("")); + EXPECT_THAT(GetFeatures(file), EqualsProto(R"pb( + field_presence: IMPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + string_field_validation: MANDATORY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW)pb")); +} + TEST_F(FeaturesTest, InvalidJsonUniquenessDefaultWarning) { BuildFileWithWarnings( R"pb( diff --git a/src/google/protobuf/unittest_features.proto b/src/google/protobuf/unittest_features.proto index 79ac22e9518f3..7ba44b19b2c6b 100644 --- a/src/google/protobuf/unittest_features.proto +++ b/src/google/protobuf/unittest_features.proto @@ -164,4 +164,32 @@ message TestFeatures { edition_defaults = { edition: "2023", value: "ENUM_VALUE1" }, edition_defaults = { edition: "2024", value: "ENUM_VALUE4" } ]; + + optional int32 int_source_feature = 15 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_FILE, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_ENUM_ENTRY, + targets = TARGET_TYPE_SERVICE, + targets = TARGET_TYPE_METHOD, + targets = TARGET_TYPE_ONEOF, + targets = TARGET_TYPE_EXTENSION_RANGE, + edition_defaults = { edition: "2023", value: "1" } + ]; + + optional string string_source_feature = 16 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_FILE, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_ENUM_ENTRY, + targets = TARGET_TYPE_SERVICE, + targets = TARGET_TYPE_METHOD, + targets = TARGET_TYPE_ONEOF, + targets = TARGET_TYPE_EXTENSION_RANGE, + edition_defaults = { edition: "2023", value: "'2023'" } + ]; } From f1de28a435a68e3fe7e9336a6b681b2004ab5efd Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 13 Jul 2023 14:36:03 -0700 Subject: [PATCH 10/27] Send full feature sets to plugins. There are 4 different feature sets for every descriptor: * Runtime/resolved - Used to make runtime decisions * Source/resolved - Used to make codegen decisions * Runtime/unresolved - Used to reason about the original proto file during runtime * Source/unresolved - Used to validate features during codegen Plugins will receive all 4 of these. Unresolved features will show up in the `raw_features` fields nested inside `features`. The runtime features will be in the `proto_file` field of the request, while the source features will be in the unstripped `source_file_descriptors` field. PiperOrigin-RevId: 547925275 --- src/google/protobuf/compiler/BUILD.bazel | 1 + .../compiler/command_line_interface.cc | 41 ++-- .../compiler/command_line_interface.h | 22 ++ .../command_line_interface_unittest.cc | 221 +++++++++++++++--- .../compiler/cpp/bootstrap_unittest.cc | 6 +- .../compiler/cpp/generator_unittest.cc | 10 +- src/google/protobuf/compiler/cpp/unittest.cc | 4 +- src/google/protobuf/compiler/cpp/unittest.inc | 6 +- .../java/message_serialization_unittest.cc | 2 +- .../protobuf/compiler/parser_unittest.cc | 5 +- src/google/protobuf/descriptor.h | 1 + src/google/protobuf/extension_set_unittest.cc | 4 +- .../protobuf/io/zero_copy_stream_unittest.cc | 2 +- src/google/protobuf/json/json_test.cc | 2 +- src/google/protobuf/map_test.inc | 8 +- src/google/protobuf/message_unittest.inc | 4 +- src/google/protobuf/test_util2.h | 24 +- src/google/protobuf/text_format_unittest.cc | 4 +- 18 files changed, 257 insertions(+), 110 deletions(-) diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index 58b8802ff4f14..d5f3a7aecbdb8 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -295,6 +295,7 @@ cc_test( ":mock_code_generator", "//:protobuf", "//src/google/protobuf:cc_test_protos", + "//src/google/protobuf:test_textproto", "//src/google/protobuf:test_util2", "//src/google/protobuf/compiler/cpp:names", "//src/google/protobuf/io", diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 0890e6354fbe9..37bf62bcc180a 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -302,27 +302,13 @@ std::string PluginName(absl::string_view plugin_prefix, } -// Get all transitive dependencies of the given file (including the file -// itself), adding them to the given list of FileDescriptorProtos. The -// protos will be ordered such that every file is listed before any file that -// depends on it, so that you can call DescriptorPool::BuildFile() on them -// in order. Any files in *already_seen will not be added, and each file -// added will be inserted into *already_seen. If include_source_code_info is -// true then include the source code information in the FileDescriptorProtos. -// If include_json_name is true, populate the json_name field of -// FieldDescriptorProto for all fields. -struct TransitiveDependencyOptions { - bool include_json_name = false; - bool include_source_code_info = false; - bool retain_options = false; -}; +} // namespace -void GetTransitiveDependencies( +void CommandLineInterface::GetTransitiveDependencies( const FileDescriptor* file, absl::flat_hash_set* already_seen, RepeatedPtrField* output, - const TransitiveDependencyOptions& options = - TransitiveDependencyOptions()) { + const TransitiveDependencyOptions& options) { if (!already_seen->insert(file).second) { // Already saw this file. Skip. return; @@ -336,22 +322,19 @@ void GetTransitiveDependencies( // Add this file. FileDescriptorProto* new_descriptor = output->Add(); - if (options.retain_options) { - file->CopyTo(new_descriptor); - if (options.include_source_code_info) { - file->CopySourceCodeInfoTo(new_descriptor); - } - } else { - *new_descriptor = - StripSourceRetentionOptions(*file, options.include_source_code_info); + *new_descriptor = + google::protobuf::internal::InternalFeatureHelper::GetGeneratorProto(*file); + if (options.include_source_code_info) { + file->CopySourceCodeInfoTo(new_descriptor); + } + if (!options.retain_options) { + StripSourceRetentionOptions(*file->pool(), *new_descriptor); } if (options.include_json_name) { file->CopyJsonNameTo(new_descriptor); } } -} // namespace - // A MultiFileErrorCollector that prints errors to stderr. class CommandLineInterface::ErrorPrinter : public MultiFileErrorCollector, @@ -2629,9 +2612,11 @@ bool CommandLineInterface::GeneratePluginOutput( if (files_to_generate.contains(file_proto.name())) { const FileDescriptor* file = pool->FindFileByName(file_proto.name()); *request.add_source_file_descriptors() = std::move(file_proto); - file_proto = StripSourceRetentionOptions(*file); + file_proto = + google::protobuf::internal::InternalFeatureHelper::GetGeneratorProto(*file); file->CopySourceCodeInfoTo(&file_proto); file->CopyJsonNameTo(&file_proto); + StripSourceRetentionOptions(*file->pool(), file_proto); } } diff --git a/src/google/protobuf/compiler/command_line_interface.h b/src/google/protobuf/compiler/command_line_interface.h index 51e2312fc9774..c0a606d7c890f 100644 --- a/src/google/protobuf/compiler/command_line_interface.h +++ b/src/google/protobuf/compiler/command_line_interface.h @@ -73,6 +73,12 @@ class CodeGenerator; // code_generator.h class GeneratorContext; // code_generator.h class DiskSourceTree; // importer.h +struct TransitiveDependencyOptions { + bool include_json_name = false; + bool include_source_code_info = false; + bool retain_options = false; +}; + // This class implements the command-line interface to the protocol compiler. // It is designed to make it very easy to create a custom protocol compiler // supporting the languages of your choice. For example, if you wanted to @@ -325,6 +331,22 @@ class PROTOC_EXPORT CommandLineInterface { // listed as free numbers in the output. void PrintFreeFieldNumbers(const Descriptor* descriptor); + // Get all transitive dependencies of the given file (including the file + // itself), adding them to the given list of FileDescriptorProtos. The + // protos will be ordered such that every file is listed before any file that + // depends on it, so that you can call DescriptorPool::BuildFile() on them + // in order. Any files in *already_seen will not be added, and each file + // added will be inserted into *already_seen. If include_source_code_info + // (from TransitiveDependencyOptions) is true then include the source code + // information in the FileDescriptorProtos. If include_json_name is true, + // populate the json_name field of FieldDescriptorProto for all fields. + void GetTransitiveDependencies( + const FileDescriptor* file, + absl::flat_hash_set* already_seen, + RepeatedPtrField* output, + const TransitiveDependencyOptions& options = + TransitiveDependencyOptions()); + // ----------------------------------------------------------------- // The name of the executable as invoked (i.e. argv[0]). diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 07cd76d8e0820..edde502c6a3d2 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -43,6 +43,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "google/protobuf/compiler/command_line_interface_tester.h" +#include "google/protobuf/unittest_features.pb.h" #ifndef _MSC_VER #include @@ -67,6 +68,7 @@ #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/compiler/subprocess.h" #include "google/protobuf/io/io_win32.h" +#include "google/protobuf/test_textproto.h" #include "google/protobuf/test_util2.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_custom_options.pb.h" @@ -439,7 +441,7 @@ TEST_F(CommandLineInterfaceTest, Plugin_OptionRetention) { std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; #else std::string plugin_path = absl::StrCat( - TestUtil::TestSourceDir(), "/third_party/protobuf/compiler/fake_plugin"); + TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin"); #endif // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest @@ -510,7 +512,7 @@ TEST_F(CommandLineInterfaceTest, Plugin_SourceFileDescriptors) { std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; #else std::string plugin_path = absl::StrCat( - TestUtil::TestSourceDir(), "/third_party/protobuf/compiler/fake_plugin"); + TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin"); #endif // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest @@ -1384,13 +1386,13 @@ TEST_F(CommandLineInterfaceTest, FeaturesEditionZero) { } TEST_F(CommandLineInterfaceTest, FeatureExtensions) { - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("features.proto", R"schema( syntax = "proto2"; package pb; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; extend google.protobuf.FeatureSet { optional TestFeatures test = 9999; } @@ -1449,13 +1451,13 @@ TEST_F(CommandLineInterfaceTest, FeatureTargetError) { } TEST_F(CommandLineInterfaceTest, FeatureExtensionError) { - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("features.proto", R"schema( syntax = "proto2"; package pb; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; extend google.protobuf.FeatureSet { optional TestFeatures test = 9999; } @@ -1482,6 +1484,165 @@ TEST_F(CommandLineInterfaceTest, FeatureExtensionError) { "repeated field"); } +TEST_F(CommandLineInterfaceTest, Plugin_LegacyFeatures) { + CreateTempFile("foo.proto", + R"schema( + syntax = "proto2"; + package foo; + message Foo { + optional int32 b = 1; + })schema"); + +#ifdef GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH + std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; +#else + std::string plugin_path = absl::StrCat( + TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin"); +#endif + + // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest + // sent by protoc. + Run(absl::StrCat( + "protocol_compiler --fake_plugin_out=$tmpdir --proto_path=$tmpdir " + "foo.proto --plugin=prefix-gen-fake_plugin=", + plugin_path)); + ExpectNoErrors(); + std::string base64_output = ReadFile("foo.proto.request"); + std::string binary_request; + ASSERT_TRUE(absl::Base64Unescape(base64_output, &binary_request)); + CodeGeneratorRequest request; + ASSERT_TRUE(request.ParseFromString(binary_request)); + + EXPECT_FALSE( + request.proto_file(0).message_type(0).field(0).options().has_features()); + EXPECT_FALSE(request.source_file_descriptors(0) + .message_type(0) + .field(0) + .options() + .has_features()); +} + +TEST_F(CommandLineInterfaceTest, Plugin_RuntimeFeatures) { + CreateTempFile("foo.proto", + R"schema( + edition = "2023"; + package foo; + message Foo { + int32 b = 1 [features.field_presence = IMPLICIT]; + })schema"); + +#ifdef GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH + std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; +#else + std::string plugin_path = absl::StrCat( + TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin"); +#endif + + // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest + // sent by protoc. + Run( + absl::StrCat("protocol_compiler --experimental_editions " + "--fake_plugin_out=$tmpdir --proto_path=$tmpdir " + "foo.proto --plugin=prefix-gen-fake_plugin=", + plugin_path)); + ExpectNoErrors(); + std::string base64_output = ReadFile("foo.proto.request"); + std::string binary_request; + ASSERT_TRUE(absl::Base64Unescape(base64_output, &binary_request)); + CodeGeneratorRequest request; + ASSERT_TRUE(request.ParseFromString(binary_request)); + + EXPECT_THAT( + request.proto_file(0).message_type(0).field(0).options().features(), + EqualsProto(R"pb(field_presence: IMPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + string_field_validation: MANDATORY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + raw_features { field_presence: IMPLICIT } + )pb")); + EXPECT_THAT(request.source_file_descriptors(0) + .message_type(0) + .field(0) + .options() + .features(), + EqualsProto(R"pb(field_presence: IMPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + string_field_validation: MANDATORY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + raw_features { field_presence: IMPLICIT } + )pb")); +} + +TEST_F(CommandLineInterfaceTest, Plugin_SourceFeatures) { + CreateTempFile("google/protobuf/descriptor.proto", + google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); + CreateTempFile("google/protobuf/unittest_features.proto", + pb::TestFeatures::descriptor()->file()->DebugString()); + CreateTempFile("foo.proto", + R"schema( + edition = "2023"; + import "google/protobuf/unittest_features.proto"; + package foo; + message Foo { + int32 b = 1 [ + features.(pb.test).int_field_feature = 99, + features.(pb.test).int_source_feature = 87 + ]; + } + )schema"); + +#ifdef GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH + std::string plugin_path = GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH; +#else + std::string plugin_path = absl::StrCat( + TestUtil::TestSourceDir(), "/google/protobuf/compiler/fake_plugin"); +#endif + + // Invoke protoc with fake_plugin to get ahold of the CodeGeneratorRequest + // sent by protoc. + Run( + absl::StrCat("protocol_compiler --experimental_editions " + "--fake_plugin_out=$tmpdir --proto_path=$tmpdir " + "foo.proto --plugin=prefix-gen-fake_plugin=", + plugin_path)); + ExpectNoErrors(); + std::string base64_output = ReadFile("foo.proto.request"); + std::string binary_request; + ASSERT_TRUE(absl::Base64Unescape(base64_output, &binary_request)); + CodeGeneratorRequest request; + ASSERT_TRUE(request.ParseFromString(binary_request)); + + { + ASSERT_EQ(request.proto_file(2).name(), "foo.proto"); + const FeatureSet& features = + request.proto_file(2).message_type(0).field(0).options().features(); + EXPECT_THAT(features.raw_features(), + EqualsProto(R"pb([pb.test] { int_field_feature: 99 })pb")); + EXPECT_FALSE(features.GetExtension(pb::test).has_int_source_feature()); + EXPECT_EQ(features.GetExtension(pb::test).int_field_feature(), 99); + } + + { + ASSERT_EQ(request.source_file_descriptors(0).name(), "foo.proto"); + const FeatureSet& features = request.source_file_descriptors(0) + .message_type(0) + .field(0) + .options() + .features(); + EXPECT_THAT(features.raw_features(), + EqualsProto(R"pb([pb.test] { + int_field_feature: 99 + int_source_feature: 87 + })pb")); + EXPECT_EQ(features.GetExtension(pb::test).int_field_feature(), 99); + EXPECT_EQ(features.GetExtension(pb::test).int_source_feature(), 87); + } +} + #endif // PROTOBUF_FUTURE_EDITIONS @@ -2766,13 +2927,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcement) { // The target option on a field indicates what kind of entity it may apply to // when it is used as an option. This test verifies that the enforcement // works correctly on all entity types. - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("foo.proto", R"schema( syntax = "proto2"; package protobuf_unittest; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; message MyOptions { optional string file_option = 1 [targets = TARGET_TYPE_FILE]; optional string extension_range_option = 2 [targets = @@ -2866,13 +3027,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcement) { } TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsValid) { - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("foo.proto", R"schema( syntax = "proto2"; package protobuf_unittest; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; message MyOptions { optional string message_or_file_option = 1 [ targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE]; @@ -2894,13 +3055,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsValid) { } TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) { - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("foo.proto", R"schema( syntax = "proto2"; package protobuf_unittest; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; message MyOptions { optional string message_or_file_option = 1 [ targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE]; @@ -2922,13 +3083,13 @@ TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleTargetsInvalid) { TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleEdgesWithConstraintsValid) { - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("foo.proto", R"schema( syntax = "proto2"; package protobuf_unittest; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; message A { optional B b = 1 [targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_ENUM]; @@ -2949,13 +3110,13 @@ TEST_F(CommandLineInterfaceTest, TEST_F(CommandLineInterfaceTest, TargetTypeEnforcementMultipleEdgesWithConstraintsInvalid) { - CreateTempFile("net/proto2/proto/descriptor.proto", + CreateTempFile("google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); CreateTempFile("foo.proto", R"schema( syntax = "proto2"; package protobuf_unittest; - import "net/proto2/proto/descriptor.proto"; + import "google/protobuf/descriptor.proto"; message A { optional B b = 1 [targets = TARGET_TYPE_ENUM]; } @@ -3129,28 +3290,27 @@ class EncodeDecodeTest : public testing::TestWithParam { TEST_P(EncodeDecodeTest, Encode) { RedirectStdinFromFile(TestUtil::GetTestDataPath( - "third_party/protobuf/" + "google/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt")); std::string args; if (GetParam() != DESCRIPTOR_SET_IN) { - args.append( - TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto")); + args.append("google/protobuf/unittest.proto"); } EXPECT_TRUE( Run(absl::StrCat(args, " --encode=protobuf_unittest.TestAllTypes"))); ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( - "third_party/protobuf/testdata/golden_message_oneof_implemented")); + "google/protobuf/testdata/golden_message_oneof_implemented")); ExpectStderrMatchesText(""); } TEST_P(EncodeDecodeTest, Decode) { RedirectStdinFromFile(TestUtil::GetTestDataPath( - "third_party/protobuf/testdata/golden_message_oneof_implemented")); + "google/protobuf/testdata/golden_message_oneof_implemented")); EXPECT_TRUE( - Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + + Run("google/protobuf/unittest.proto" " --decode=protobuf_unittest.TestAllTypes")); ExpectStdoutMatchesTextFile(TestUtil::GetTestDataPath( - "third_party/protobuf/" + "google/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt")); ExpectStderrMatchesText(""); } @@ -3158,7 +3318,7 @@ TEST_P(EncodeDecodeTest, Decode) { TEST_P(EncodeDecodeTest, Partial) { RedirectStdinFromText(""); EXPECT_TRUE( - Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + + Run("google/protobuf/unittest.proto" " --encode=protobuf_unittest.TestRequired")); ExpectStdoutMatchesText(""); ExpectStderrMatchesText( @@ -3182,7 +3342,7 @@ TEST_P(EncodeDecodeTest, DecodeRaw) { TEST_P(EncodeDecodeTest, UnknownType) { EXPECT_FALSE( - Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + + Run("google/protobuf/unittest.proto" " --encode=NoSuchType")); ExpectStdoutMatchesText(""); ExpectStderrMatchesText("Type not defined: NoSuchType\n"); @@ -3199,25 +3359,24 @@ TEST_P(EncodeDecodeTest, ProtoParseError) { TEST_P(EncodeDecodeTest, EncodeDeterministicOutput) { RedirectStdinFromFile(TestUtil::GetTestDataPath( - "third_party/protobuf/" + "google/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt")); std::string args; if (GetParam() != DESCRIPTOR_SET_IN) { - args.append( - TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto")); + args.append("google/protobuf/unittest.proto"); } EXPECT_TRUE(Run(absl::StrCat( args, " --encode=protobuf_unittest.TestAllTypes --deterministic_output"))); ExpectStdoutMatchesBinaryFile(TestUtil::GetTestDataPath( - "third_party/protobuf/testdata/golden_message_oneof_implemented")); + "google/protobuf/testdata/golden_message_oneof_implemented")); ExpectStderrMatchesText(""); } TEST_P(EncodeDecodeTest, DecodeDeterministicOutput) { RedirectStdinFromFile(TestUtil::GetTestDataPath( - "third_party/protobuf/testdata/golden_message_oneof_implemented")); + "google/protobuf/testdata/golden_message_oneof_implemented")); EXPECT_FALSE( - Run(TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto") + + Run("google/protobuf/unittest.proto" " --decode=protobuf_unittest.TestAllTypes --deterministic_output")); ExpectStderrMatchesText( "Can only use --deterministic_output with --encode.\n"); diff --git a/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc index 856a06c6896b6..349eead6fa28f 100644 --- a/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc @@ -32,7 +32,7 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. // -// This test insures that net/proto2/proto/descriptor.pb.{h,cc} match exactly +// This test insures that google/protobuf/descriptor.pb.{h,cc} match exactly // what would be generated by the protocol compiler. These files are not // generated automatically at build time because they are compiled into the // protocol compiler itself. So, if they were auto-generated, you'd have a @@ -144,9 +144,9 @@ TEST(BootstrapTest, GeneratedFilesMatch) { // of the data to compare to. absl::flat_hash_map vpath_map; absl::flat_hash_map rpath_map; - rpath_map["third_party/protobuf/test_messages_proto2"] = + rpath_map["google/protobuf/test_messages_proto2"] = "net/proto2/z_generated_example/test_messages_proto2"; - rpath_map["third_party/protobuf/test_messages_proto3"] = + rpath_map["google/protobuf/test_messages_proto3"] = "net/proto2/z_generated_example/test_messages_proto3"; rpath_map["net/proto2/internal/proto2_weak"] = "net/proto2/z_generated_example/proto2_weak"; diff --git a/src/google/protobuf/compiler/cpp/generator_unittest.cc b/src/google/protobuf/compiler/cpp/generator_unittest.cc index af3148899d5a3..64efaea4db746 100644 --- a/src/google/protobuf/compiler/cpp/generator_unittest.cc +++ b/src/google/protobuf/compiler/cpp/generator_unittest.cc @@ -56,7 +56,7 @@ class CppGeneratorTest : public CommandLineInterfaceTester { "google/protobuf/descriptor.proto", google::protobuf::DescriptorProto::descriptor()->file()->DebugString()); #ifdef PROTOBUF_FUTURE_EDITIONS - CreateTempFile("third_party/protobuf/cpp_features.proto", + CreateTempFile("google/protobuf/cpp_features.proto", pb::CppFeatures::descriptor()->file()->DebugString()); #endif // PROTOBUF_FUTURE_EDITIONS } @@ -97,7 +97,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumOnNonEnumField) { CreateTempFile("foo.proto", R"schema( edition = "2023"; - import "third_party/protobuf/cpp_features.proto"; + import "google/protobuf/cpp_features.proto"; message Foo { int32 bar = 1 [features.(pb.cpp).legacy_closed_enum = true]; @@ -116,7 +116,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnum) { CreateTempFile("foo.proto", R"schema( edition = "2023"; - import "third_party/protobuf/cpp_features.proto"; + import "google/protobuf/cpp_features.proto"; enum TestEnum { TEST_ENUM_UNKNOWN = 0; @@ -136,7 +136,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumInherited) { CreateTempFile("foo.proto", R"schema( edition = "2023"; - import "third_party/protobuf/cpp_features.proto"; + import "google/protobuf/cpp_features.proto"; option features.(pb.cpp).legacy_closed_enum = true; enum TestEnum { @@ -158,7 +158,7 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumImplicit) { CreateTempFile("foo.proto", R"schema( edition = "2023"; - import "third_party/protobuf/cpp_features.proto"; + import "google/protobuf/cpp_features.proto"; option features.(pb.cpp).legacy_closed_enum = true; enum TestEnum { diff --git a/src/google/protobuf/compiler/cpp/unittest.cc b/src/google/protobuf/compiler/cpp/unittest.cc index 2d03e6239cb17..307159e99862a 100644 --- a/src/google/protobuf/compiler/cpp/unittest.cc +++ b/src/google/protobuf/compiler/cpp/unittest.cc @@ -33,7 +33,7 @@ // Sanjay Ghemawat, Jeff Dean, and others. // // To test the code generator, we actually use it to generate code for -// third_party/protobuf/unittest.proto, then test that. This means that we +// google/protobuf/unittest.proto, then test that. This means that we // are actually testing the parser and other parts of the system at the same // time, and that problems in the generator may show up as compile-time errors // rather than unittest failures, which may be surprising. However, testing @@ -59,7 +59,7 @@ #define HELPERS_TEST_NAME HelpersTest #define DESCRIPTOR_INIT_TEST_NAME DescriptorInitializationTest -#define UNITTEST_PROTO_PATH "third_party/protobuf/unittest.proto" +#define UNITTEST_PROTO_PATH "google/protobuf/unittest.proto" #define UNITTEST ::protobuf_unittest #define UNITTEST_IMPORT ::protobuf_unittest_import diff --git a/src/google/protobuf/compiler/cpp/unittest.inc b/src/google/protobuf/compiler/cpp/unittest.inc index 4be035755ecf7..febda3027905d 100644 --- a/src/google/protobuf/compiler/cpp/unittest.inc +++ b/src/google/protobuf/compiler/cpp/unittest.inc @@ -34,7 +34,7 @@ // Sanjay Ghemawat, Jeff Dean, and others. // // To test the code generator, we actually use it to generate code for -// third_party/protobuf/unittest.proto, then test that. This means that we +// google/protobuf/unittest.proto, then test that. This means that we // are actually testing the parser and other parts of the system at the same // time, and that problems in the generator may show up as compile-time errors // rather than unittest failures, which may be surprising. However, testing @@ -124,7 +124,7 @@ TEST(GENERATED_DESCRIPTOR_TEST_NAME, IdenticalDescriptors) { // Import (parse) unittest.proto. const FileDescriptor* parsed_descriptor = - importer.Import(TestUtil::MaybeTranslatePath(UNITTEST_PROTO_PATH)); + importer.Import(UNITTEST_PROTO_PATH); EXPECT_EQ("", error_collector.text_); ASSERT_TRUE(parsed_descriptor != nullptr); @@ -2217,7 +2217,7 @@ TEST(DESCRIPTOR_INIT_TEST_NAME, Initialized) { EXPECT_EQ(should_have_descriptors, DescriptorPool::generated_pool()->InternalIsFileLoaded( - TestUtil::MaybeTranslatePath(UNITTEST_PROTO_PATH))); + UNITTEST_PROTO_PATH)); } } // namespace cpp_unittest diff --git a/src/google/protobuf/compiler/java/message_serialization_unittest.cc b/src/google/protobuf/compiler/java/message_serialization_unittest.cc index 9a7a6964feeba..60c94ee06c723 100644 --- a/src/google/protobuf/compiler/java/message_serialization_unittest.cc +++ b/src/google/protobuf/compiler/java/message_serialization_unittest.cc @@ -63,7 +63,7 @@ int CompileJavaProto(std::string proto_file_name) { std::string proto_path = absl::StrCat( "--proto_path=", - TestUtil::GetTestDataPath("third_party/protobuf/compiler/java")); + TestUtil::GetTestDataPath("google/protobuf/compiler/java")); std::string java_out = absl::StrCat("--java_out=", TestTempDir()); const char* argv[] = { diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc index 9f6f103a3cf48..0bf2dceb62978 100644 --- a/src/google/protobuf/compiler/parser_unittest.cc +++ b/src/google/protobuf/compiler/parser_unittest.cc @@ -2318,7 +2318,7 @@ TEST_F(ParserValidationErrorTest, ResovledUndefinedOptionError) { // base2.proto: // package baz - // import net/proto2/proto/descriptor.proto + // import google/protobuf/descriptor.proto // message Bar { optional int32 foo = 1; } // extend FileOptions { optional Bar bar = 7672757; } FileDescriptorProto other_file; @@ -2461,8 +2461,7 @@ TEST_F(ParseDescriptorDebugTest, TestAllDescriptorTypes) { // We now have a FileDescriptorProto, but to compare with the expected we // need to link to a FileDecriptor, then output back to a proto. We'll // also need to give it the same name as the original. - parsed.set_name( - TestUtil::MaybeTranslatePath("third_party/protobuf/unittest.proto")); + parsed.set_name("google/protobuf/unittest.proto"); // We need the imported dependency before we can build our parsed proto const FileDescriptor* public_import = protobuf_unittest_import::PublicImportMessage::descriptor()->file(); diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index 0c0eccbf29e9e..bebaca08d4203 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -271,6 +271,7 @@ class PROTOBUF_EXPORT InternalFeatureHelper { private: friend class ::google::protobuf::compiler::CodeGenerator; + friend class ::google::protobuf::compiler::CommandLineInterface; // Provides a restricted view exclusively to code generators. Raw features // haven't been resolved, and are virtually meaningless to everyone else. Code diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc index 7f6799fa58e17..c84107a150c23 100644 --- a/src/google/protobuf/extension_set_unittest.cc +++ b/src/google/protobuf/extension_set_unittest.cc @@ -65,7 +65,7 @@ namespace { using ::google::protobuf::internal::DownCast; using TestUtil::EqualsToSerialized; -// This test closely mirrors third_party/protobuf/compiler/cpp/unittest.cc +// This test closely mirrors google/protobuf/compiler/cpp/unittest.cc // except that it uses extensions rather than regular fields. TEST(ExtensionSetTest, Defaults) { @@ -1368,7 +1368,7 @@ TEST(ExtensionSetTest, Proto3PackedDynamicExtensions) { google::protobuf::FileDescriptorProto file_descriptor_proto; file_descriptor_proto.set_syntax("proto3"); file_descriptor_proto.set_name( - "third_party/protobuf/unittest_proto3_packed_extension.proto"); + "google/protobuf/unittest_proto3_packed_extension.proto"); file_descriptor_proto.set_package("proto3_unittest"); file_descriptor_proto.add_dependency( DescriptorProto::descriptor()->file()->name()); diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc index 5e1859b2afcf5..4472d584606b2 100644 --- a/src/google/protobuf/io/zero_copy_stream_unittest.cc +++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc @@ -582,7 +582,7 @@ TEST_F(IoTest, CompressionOptions) { // Some ad-hoc testing of compression options. std::string golden_filename = - TestUtil::GetTestDataPath("third_party/protobuf/testdata/golden_message"); + TestUtil::GetTestDataPath("google/protobuf/testdata/golden_message"); std::string golden; ABSL_CHECK_OK(File::GetContents(golden_filename, &golden, true)); diff --git a/src/google/protobuf/json/json_test.cc b/src/google/protobuf/json/json_test.cc index dabd158321942..88f7e6d56111c 100644 --- a/src/google/protobuf/json/json_test.cc +++ b/src/google/protobuf/json/json_test.cc @@ -1165,7 +1165,7 @@ TEST_P(JsonTest, TestDuration) { EXPECT_THAT(ToJson(m5->value()), IsOkAndHolds("\"0.500s\"")); } -// These tests are not exhaustive; tests in //third_party/protobuf/conformance +// These tests are not exhaustive; tests in //google/protobuf/conformance // are more comprehensive. TEST_P(JsonTest, TestTimestamp) { auto m = ToProto(R"json( diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc index 1f22bcebb80fb..55511debf7987 100644 --- a/src/google/protobuf/map_test.inc +++ b/src/google/protobuf/map_test.inc @@ -3968,7 +3968,7 @@ TEST(MapSerializationTest, DeterministicSubmessage) { std::string golden; ABSL_CHECK_OK( File::GetContents(TestUtil::GetTestDataPath(absl::StrCat( - "third_party/protobuf/testdata/", filename)), + "google/protobuf/testdata/", filename)), &golden, true)); t.ParseFromString(golden); *(p.mutable_m()) = t; @@ -4010,7 +4010,7 @@ TEST(TextFormatMapTest, DynamicMessage) { std::string expected_text; ABSL_CHECK_OK( - File::GetContents(TestUtil::GetTestDataPath("third_party/protobuf/" + File::GetContents(TestUtil::GetTestDataPath("google/protobuf/" "testdata/map_test_data.txt"), &expected_text, true)); @@ -4026,7 +4026,7 @@ TEST(TextFormatMapTest, Sorted) { std::string expected_text; ABSL_CHECK_OK( - File::GetContents(TestUtil::GetTestDataPath("third_party/protobuf/" + File::GetContents(TestUtil::GetTestDataPath("google/protobuf/" "testdata/map_test_data.txt"), &expected_text, true)); @@ -4047,7 +4047,7 @@ TEST(TextFormatMapTest, ParseCorruptedString) { std::string serialized_message; ABSL_CHECK_OK(File::GetContents( TestUtil::GetTestDataPath( - "third_party/protobuf/testdata/golden_message_maps"), + "google/protobuf/testdata/golden_message_maps"), &serialized_message, true)); UNITTEST::TestMaps message; ABSL_CHECK(message.ParseFromString(serialized_message)); diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc index ec968ccfc4170..73a9740acbe04 100644 --- a/src/google/protobuf/message_unittest.inc +++ b/src/google/protobuf/message_unittest.inc @@ -132,7 +132,7 @@ TEST(MESSAGE_TEST_NAME, SerializeToBrokenOstream) { TEST(MESSAGE_TEST_NAME, ParseFromFileDescriptor) { std::string filename = - TestUtil::GetTestDataPath("third_party/protobuf/testdata/golden_message"); + TestUtil::GetTestDataPath("google/protobuf/testdata/golden_message"); int file = open(filename.c_str(), O_RDONLY | O_BINARY); ASSERT_GE(file, 0); @@ -145,7 +145,7 @@ TEST(MESSAGE_TEST_NAME, ParseFromFileDescriptor) { TEST(MESSAGE_TEST_NAME, ParsePackedFromFileDescriptor) { std::string filename = TestUtil::GetTestDataPath( - "third_party/protobuf/testdata/golden_packed_fields_message"); + "google/protobuf/testdata/golden_packed_fields_message"); int file = open(filename.c_str(), O_RDONLY | O_BINARY); ASSERT_GE(file, 0); diff --git a/src/google/protobuf/test_util2.h b/src/google/protobuf/test_util2.h index 9cc1456ce8422..b3549381c84ac 100644 --- a/src/google/protobuf/test_util2.h +++ b/src/google/protobuf/test_util2.h @@ -45,32 +45,12 @@ namespace google { namespace protobuf { namespace TestUtil { -// Translate net/proto2/* or third_party/protobuf/* to google/protobuf/*. -inline std::string TranslatePathToOpensource(absl::string_view google3_path) { - constexpr absl::string_view net_proto2 = "net/proto2/"; - constexpr absl::string_view third_party_protobuf = "third_party/protobuf/"; - if (!absl::ConsumePrefix(&google3_path, net_proto2)) { - ABSL_CHECK(absl::ConsumePrefix(&google3_path, third_party_protobuf)) - << google3_path; - } - - absl::ConsumePrefix(&google3_path, "internal/"); - absl::ConsumePrefix(&google3_path, "proto/"); - absl::ConsumeSuffix(&google3_path, "public/"); - return absl::StrCat("google/protobuf/", google3_path); -} - -inline std::string MaybeTranslatePath(absl::string_view google3_path) { - return TranslatePathToOpensource(google3_path); - return std::string(google3_path); -} - inline std::string TestSourceDir() { return google::protobuf::TestSourceDir(); } -inline std::string GetTestDataPath(absl::string_view google3_path) { - return absl::StrCat(TestSourceDir(), "/", MaybeTranslatePath(google3_path)); +inline std::string GetTestDataPath(absl::string_view path) { + return absl::StrCat(TestSourceDir(), "/", path); } // Checks the equality of "message" and serialized proto of type "ProtoType". diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc index a93ff732f1753..471387b0826ee 100644 --- a/src/google/protobuf/text_format_unittest.cc +++ b/src/google/protobuf/text_format_unittest.cc @@ -97,7 +97,7 @@ class TextFormatTest : public testing::Test { static void SetUpTestSuite() { ABSL_CHECK_OK(File::GetContents( TestUtil::GetTestDataPath( - "third_party/protobuf/" + "google/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt"), &static_proto_text_format_, true)); } @@ -118,7 +118,7 @@ class TextFormatExtensionsTest : public testing::Test { public: static void SetUpTestSuite() { ABSL_CHECK_OK(File::GetContents( - TestUtil::GetTestDataPath("third_party/protobuf/testdata/" + TestUtil::GetTestDataPath("google/protobuf/testdata/" "text_format_unittest_extensions_data.txt"), &static_proto_text_format_, true)); } From e2cec78455769881b9e8c23babeb3fe8effe81fe Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 13 Jul 2023 16:23:39 -0700 Subject: [PATCH 11/27] Allow code generators to specify whether or not they support editions. Editions are still flag-guarded by the `--experimental_editions` flag for now, but once that's removed in a later release generators will need to explicitly specify that their support. This will avoid cases where generators may happen to work for editions but produce incorrect code. PiperOrigin-RevId: 547959326 --- src/google/protobuf/BUILD.bazel | 34 +----------------- src/google/protobuf/compiler/code_generator.h | 2 ++ .../compiler/code_generator_unittest.cc | 14 ++++++++ .../compiler/command_line_interface.cc | 29 +++++++++++++++ .../command_line_interface_unittest.cc | 35 +++++++++++++++++++ src/google/protobuf/compiler/cpp/generator.h | 2 +- src/google/protobuf/compiler/fake_plugin.cc | 9 +++-- .../protobuf/compiler/mock_code_generator.cc | 14 +++++++- .../protobuf/compiler/mock_code_generator.h | 5 ++- src/google/protobuf/compiler/plugin.pb.cc | 17 +++++---- src/google/protobuf/compiler/plugin.pb.h | 8 +++-- src/google/protobuf/compiler/plugin.proto | 1 + src/google/protobuf/descriptor.cc | 3 -- 13 files changed, 122 insertions(+), 51 deletions(-) diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 5dc0a64bf58f5..6b4f77d5fa2e0 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -739,39 +739,7 @@ proto_library( proto_library( name = "generic_test_protos", - srcs = [ - "map_proto2_unittest.proto", - "map_proto3_unittest.proto", - "map_unittest.proto", - "unittest.proto", - "unittest_arena.proto", - "unittest_custom_options.proto", - "unittest_drop_unknown_fields.proto", - "unittest_embed_optimize_for.proto", - "unittest_empty.proto", - "unittest_enormous_descriptor.proto", - "unittest_import.proto", - "unittest_import_public.proto", - "unittest_lazy_dependencies.proto", - "unittest_lazy_dependencies_custom_option.proto", - "unittest_lazy_dependencies_enum.proto", - "unittest_lite_imports_nonlite.proto", - "unittest_mset.proto", - "unittest_mset_wire_format.proto", - "unittest_no_field_presence.proto", - "unittest_no_generic_services.proto", - "unittest_optimize_for.proto", - "unittest_preserve_unknown_enum.proto", - "unittest_preserve_unknown_enum2.proto", - "unittest_proto3.proto", - "unittest_proto3_arena.proto", - "unittest_proto3_arena_lite.proto", - "unittest_proto3_bad_macros.proto", - "unittest_proto3_lite.proto", - "unittest_proto3_optional.proto", - "unittest_retention.proto", - "unittest_well_known_types.proto", - ], + srcs = [":test_proto_srcs"], strip_import_prefix = "/src", visibility = ["//:__subpackages__"], deps = [ diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h index 17674c90f244a..6350ed12c7680 100644 --- a/src/google/protobuf/compiler/code_generator.h +++ b/src/google/protobuf/compiler/code_generator.h @@ -113,8 +113,10 @@ class PROTOC_EXPORT CodeGenerator { // This must be kept in sync with plugin.proto. See that file for // documentation on each value. + // TODO(b/291092901) Use CodeGeneratorResponse.Feature here. enum Feature { FEATURE_PROTO3_OPTIONAL = 1, + FEATURE_SUPPORTS_EDITIONS = 2, }; // Implement this to indicate what features this code generator supports. diff --git a/src/google/protobuf/compiler/code_generator_unittest.cc b/src/google/protobuf/compiler/code_generator_unittest.cc index 626342d3fe2b7..bf8b1835631bb 100644 --- a/src/google/protobuf/compiler/code_generator_unittest.cc +++ b/src/google/protobuf/compiler/code_generator_unittest.cc @@ -224,6 +224,20 @@ TEST_F(CodeGeneratorTest, GetSourceFeaturesInherited) { EXPECT_EQ(ext.string_source_feature(), "field"); } +TEST_F(CodeGeneratorTest, GetRuntimeProtoTrivial) { + auto file = BuildFile(R"schema( + edition = "2023"; + package protobuf_unittest; + )schema"); + ASSERT_THAT(file, NotNull()); + + FileDescriptorProto proto = TestGenerator::GetRuntimeProto(*file); + const FeatureSet& features = proto.options().features(); + + EXPECT_TRUE(features.has_raw_features()); + EXPECT_THAT(features.raw_features(), EqualsProto(R"pb()pb")); +} + TEST_F(CodeGeneratorTest, GetRuntimeProtoRoot) { auto file = BuildFile(R"schema( edition = "2023"; diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 37bf62bcc180a..f9e966649d925 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -302,6 +302,26 @@ std::string PluginName(absl::string_view plugin_prefix, } +bool EnforceEditionsSupport( + const std::string& codegen_name, uint64_t supported_features, + const std::vector& parsed_files) { + if ((supported_features & CodeGenerator::FEATURE_SUPPORTS_EDITIONS) == 0) { + for (const auto fd : parsed_files) { + if (FileDescriptorLegacy(fd).syntax() == + FileDescriptorLegacy::SYNTAX_EDITIONS) { + std::cerr << fd->name() << ": is an editions file, but code generator " + << codegen_name + << " hasn't been updated to support editions yet. Please ask " + "the owner of this code generator to add support or " + "switch back to proto2/proto3." + << std::endl; + return false; + } + } + } + return true; +} + } // namespace void CommandLineInterface::GetTransitiveDependencies( @@ -2490,6 +2510,12 @@ bool CommandLineInterface::GenerateOutput( return false; } + if (!EnforceEditionsSupport( + output_directive.name, + output_directive.generator->GetSupportedFeatures(), parsed_files)) { + return false; + } + if (!output_directive.generator->GenerateAll(parsed_files, parameters, generator_context, &error)) { // Generator returned an error. @@ -2686,6 +2712,9 @@ bool CommandLineInterface::GeneratePluginOutput( } else if (!EnforceProto3OptionalSupport( plugin_name, response.supported_features(), parsed_files)) { return false; + } else if (!EnforceEditionsSupport(plugin_name, response.supported_features(), + parsed_files)) { + return false; } return true; diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index edde502c6a3d2..4fe1211b7c82b 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -1643,6 +1643,41 @@ TEST_F(CommandLineInterfaceTest, Plugin_SourceFeatures) { } } +TEST_F(CommandLineInterfaceTest, GeneratorNoEditionsSupport) { + CreateTempFile("foo.proto", R"schema( + edition = "2023"; + message Foo { + int32 i = 1; + } + )schema"); + + CreateGeneratorWithMissingFeatures("--no_editions_out", + "Doesn't support editions", + CodeGenerator::FEATURE_SUPPORTS_EDITIONS); + + Run("protocol_compiler --experimental_editions " + "--proto_path=$tmpdir foo.proto --no_editions_out=$tmpdir"); + + ExpectErrorSubstring( + "code generator --no_editions_out hasn't been updated to support " + "editions"); +} + +TEST_F(CommandLineInterfaceTest, PluginNoEditionsSupport) { + CreateTempFile("foo.proto", R"schema( + edition = "2023"; + message Foo { + int32 i = 1; + } + )schema"); + + Run("protocol_compiler --experimental_editions " + "--proto_path=$tmpdir foo.proto --plug_out=no_editions:$tmpdir"); + + ExpectErrorSubstring( + "code generator prefix-gen-plug hasn't been updated to support editions"); +} + #endif // PROTOBUF_FUTURE_EDITIONS diff --git a/src/google/protobuf/compiler/cpp/generator.h b/src/google/protobuf/compiler/cpp/generator.h index 0c1705163e93c..94bd352346b0d 100644 --- a/src/google/protobuf/compiler/cpp/generator.h +++ b/src/google/protobuf/compiler/cpp/generator.h @@ -89,7 +89,7 @@ class PROTOC_EXPORT CppGenerator : public CodeGenerator { std::string* error) const override; uint64_t GetSupportedFeatures() const override { - return FEATURE_PROTO3_OPTIONAL; + return FEATURE_PROTO3_OPTIONAL | FEATURE_SUPPORTS_EDITIONS; } private: diff --git a/src/google/protobuf/compiler/fake_plugin.cc b/src/google/protobuf/compiler/fake_plugin.cc index 63da6fedba44b..980f544d425e0 100644 --- a/src/google/protobuf/compiler/fake_plugin.cc +++ b/src/google/protobuf/compiler/fake_plugin.cc @@ -39,6 +39,9 @@ #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/io/io_win32.h" +using google::protobuf::compiler::CodeGeneratorRequest; +using google::protobuf::compiler::CodeGeneratorResponse; + // This fake protoc plugin does nothing but write out the CodeGeneratorRequest // in base64. This is not very useful except that it gives us a way to make // assertions in tests about the contents of requests that protoc sends to @@ -50,10 +53,12 @@ int main(int argc, char* argv[]) { google::protobuf::io::win32::setmode(STDOUT_FILENO, _O_BINARY); #endif - google::protobuf::compiler::CodeGeneratorRequest request; + CodeGeneratorRequest request; ABSL_CHECK(request.ParseFromFileDescriptor(STDIN_FILENO)); ABSL_CHECK(!request.file_to_generate().empty()); - google::protobuf::compiler::CodeGeneratorResponse response; + CodeGeneratorResponse response; + response.set_supported_features( + CodeGeneratorResponse::FEATURE_SUPPORTS_EDITIONS); response.add_file()->set_name( absl::StrCat(request.file_to_generate(0), ".request")); response.mutable_file(0)->set_content( diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc index d1ff90b61c692..8c5366a5a07e2 100644 --- a/src/google/protobuf/compiler/mock_code_generator.cc +++ b/src/google/protobuf/compiler/mock_code_generator.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "google/protobuf/testing/file.h" @@ -96,7 +97,8 @@ MockCodeGenerator::MockCodeGenerator(absl::string_view name) : name_(name) {} MockCodeGenerator::~MockCodeGenerator() = default; uint64_t MockCodeGenerator::GetSupportedFeatures() const { - uint64_t all_features = CodeGenerator::FEATURE_PROTO3_OPTIONAL; + uint64_t all_features = CodeGenerator::FEATURE_PROTO3_OPTIONAL | + CodeGenerator::FEATURE_SUPPORTS_EDITIONS; return all_features & ~suppressed_features_; } @@ -212,6 +214,16 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, const std::string& parameter, GeneratorContext* context, std::string* error) const { + std::vector> options; + ParseGeneratorParameter(parameter, &options); + for (const auto& option : options) { + const auto& key = option.first; + + if (key == "no_editions") { + suppressed_features_ |= CodeGenerator::FEATURE_SUPPORTS_EDITIONS; + } + } + bool annotate = false; for (int i = 0; i < file->message_type_count(); i++) { if (absl::StartsWith(file->message_type(i)->name(), "MockCodeGenerator_")) { diff --git a/src/google/protobuf/compiler/mock_code_generator.h b/src/google/protobuf/compiler/mock_code_generator.h index 3987b7e063b31..bdb30c91c32c0 100644 --- a/src/google/protobuf/compiler/mock_code_generator.h +++ b/src/google/protobuf/compiler/mock_code_generator.h @@ -118,7 +118,10 @@ class MockCodeGenerator : public CodeGenerator { private: std::string name_; - uint64_t suppressed_features_ = 0; + + // Mark this mutable so that our test plugin can modify it during the Generate + // call via generator flags. + mutable uint64_t suppressed_features_ = 0; static std::string GetOutputFileContent(absl::string_view generator_name, absl::string_view parameter, diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index d0d679e5c40aa..532469ac9d354 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -221,18 +221,19 @@ const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2epro "FileDescriptorProto\022E\n\027source_file_descr" "iptors\030\021 \003(\0132$.google.protobuf.FileDescr" "iptorProto\022;\n\020compiler_version\030\003 \001(\0132!.g" - "oogle.protobuf.compiler.Version\"\301\002\n\025Code" + "oogle.protobuf.compiler.Version\"\340\002\n\025Code" "GeneratorResponse\022\r\n\005error\030\001 \001(\t\022\032\n\022supp" "orted_features\030\002 \001(\004\022B\n\004file\030\017 \003(\01324.goo" "gle.protobuf.compiler.CodeGeneratorRespo" "nse.File\032\177\n\004File\022\014\n\004name\030\001 \001(\t\022\027\n\017insert" "ion_point\030\002 \001(\t\022\017\n\007content\030\017 \001(\t\022\?\n\023gene" "rated_code_info\030\020 \001(\0132\".google.protobuf." - "GeneratedCodeInfo\"8\n\007Feature\022\020\n\014FEATURE_" - "NONE\020\000\022\033\n\027FEATURE_PROTO3_OPTIONAL\020\001Br\n\034c" - "om.google.protobuf.compilerB\014PluginProto" - "sZ)google.golang.org/protobuf/types/plug" - "inpb\252\002\030Google.Protobuf.Compiler" + "GeneratedCodeInfo\"W\n\007Feature\022\020\n\014FEATURE_" + "NONE\020\000\022\033\n\027FEATURE_PROTO3_OPTIONAL\020\001\022\035\n\031F" + "EATURE_SUPPORTS_EDITIONS\020\002Br\n\034com.google" + ".protobuf.compilerB\014PluginProtosZ)google" + ".golang.org/protobuf/types/pluginpb\252\002\030Go" + "ogle.Protobuf.Compiler" }; static const ::_pbi::DescriptorTable* const descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_deps[1] = { @@ -242,7 +243,7 @@ static ::absl::once_flag descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_ const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto = { false, false, - 871, + 902, descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto, "google/protobuf/compiler/plugin.proto", &descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto_once, @@ -285,6 +286,7 @@ bool CodeGeneratorResponse_Feature_IsValid(int value) { switch (value) { case 0: case 1: + case 2: return true; default: return false; @@ -295,6 +297,7 @@ bool CodeGeneratorResponse_Feature_IsValid(int value) { constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_NONE; constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_PROTO3_OPTIONAL; +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_SUPPORTS_EDITIONS; constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MIN; constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MAX; constexpr int CodeGeneratorResponse::Feature_ARRAYSIZE; diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 7cadfa0c4e820..ac6a28d33eaf1 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -94,12 +94,13 @@ namespace compiler { enum CodeGeneratorResponse_Feature : int { CodeGeneratorResponse_Feature_FEATURE_NONE = 0, CodeGeneratorResponse_Feature_FEATURE_PROTO3_OPTIONAL = 1, + CodeGeneratorResponse_Feature_FEATURE_SUPPORTS_EDITIONS = 2, }; PROTOC_EXPORT bool CodeGeneratorResponse_Feature_IsValid(int value); constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MIN = static_cast(0); -constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MAX = static_cast(1); -constexpr int CodeGeneratorResponse_Feature_Feature_ARRAYSIZE = 1 + 1; +constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse_Feature_Feature_MAX = static_cast(2); +constexpr int CodeGeneratorResponse_Feature_Feature_ARRAYSIZE = 2 + 1; PROTOC_EXPORT const ::google::protobuf::EnumDescriptor* CodeGeneratorResponse_Feature_descriptor(); template @@ -112,7 +113,7 @@ const std::string& CodeGeneratorResponse_Feature_Name(T value) { template <> inline const std::string& CodeGeneratorResponse_Feature_Name(CodeGeneratorResponse_Feature value) { return ::google::protobuf::internal::NameOfDenseEnum( + 0, 2>( static_cast(value)); } inline bool CodeGeneratorResponse_Feature_Parse(absl::string_view name, CodeGeneratorResponse_Feature* value) { @@ -934,6 +935,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : using Feature = CodeGeneratorResponse_Feature; static constexpr Feature FEATURE_NONE = CodeGeneratorResponse_Feature_FEATURE_NONE; static constexpr Feature FEATURE_PROTO3_OPTIONAL = CodeGeneratorResponse_Feature_FEATURE_PROTO3_OPTIONAL; + static constexpr Feature FEATURE_SUPPORTS_EDITIONS = CodeGeneratorResponse_Feature_FEATURE_SUPPORTS_EDITIONS; static inline bool Feature_IsValid(int value) { return CodeGeneratorResponse_Feature_IsValid(value); } diff --git a/src/google/protobuf/compiler/plugin.proto b/src/google/protobuf/compiler/plugin.proto index ba07c8f6eb0d4..1a8098681ba44 100644 --- a/src/google/protobuf/compiler/plugin.proto +++ b/src/google/protobuf/compiler/plugin.proto @@ -122,6 +122,7 @@ message CodeGeneratorResponse { enum Feature { FEATURE_NONE = 0; FEATURE_PROTO3_OPTIONAL = 1; + FEATURE_SUPPORTS_EDITIONS = 2; } // Represents a single generated file. diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 4531801c6bb75..fd5c0ba82f6e7 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -2773,9 +2773,6 @@ FileDescriptorProto InternalFeatureHelper::GetGeneratorProto( if (&features != &FeatureSet::default_instance() && !IsLegacyFeatureSet(features)) { *proto.mutable_options()->mutable_features() = features; - } - const auto& raw_features = GetRawFeatures(desc); - if (&raw_features != &FeatureSet::default_instance()) { *proto.mutable_options()->mutable_features()->mutable_raw_features() = GetRawFeatures(desc); } From 16fbb2bf37dd40ab361b305d8370091cd163be50 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 13 Jul 2023 17:03:39 -0700 Subject: [PATCH 12/27] Update stale files --- src/file_lists.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 7f5146005bf8c..34111e8c48dfc 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -737,6 +737,7 @@ set(fake_plugin_files # @//src/google/protobuf/compiler:test_srcs set(compiler_test_files ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/allowlists/allowlist_test.cc + ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator_unittest.cc From 2402814db66ba8a00c8ff108fec7e5d837e06a2b Mon Sep 17 00:00:00 2001 From: Jason Lunn Date: Fri, 14 Jul 2023 20:09:15 -0700 Subject: [PATCH 13/27] Add JRuby 9.3 and 9.4 to the test matrix under both Bazel versions. (#13296) Prepare for 9.2 to be removed. Closes #13296 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13296 from protocolbuffers:jruby_version_bump 82924ab6b38b97073dada29539b5f697ef34cd4c PiperOrigin-RevId: 548279470 --- .github/workflows/test_ruby.yml | 10 ++++++---- protobuf_deps.bzl | 4 ++-- .../v3.0.0/tests/repeated_field_test.rb | 8 +++++--- .../protobuf/jruby/RubyRepeatedField.java | 17 +++++++++++++---- ruby/tests/repeated_field_test.rb | 6 ++++-- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml index a401c32dc50c4..3dfa6b43ce203 100644 --- a/.github/workflows/test_ruby.yml +++ b/.github/workflows/test_ruby.yml @@ -22,9 +22,10 @@ jobs: - { name: Ruby 3.1, ruby: ruby-3.1.0, bazel: 5.1.1} - { name: Ruby 3.2, ruby: ruby-3.2.0, bazel: 5.1.1} - { name: JRuby 9.2, ruby: jruby-9.2.20.1, bazel: 5.1.1} - - { name: JRuby 9.3, ruby: jruby-9.3.4.0, bazel: 5.1.1} + - { name: JRuby 9.3, ruby: jruby-9.3.10.0, bazel: 5.1.1} + - { name: JRuby 9.4, ruby: jruby-9.4.3.0, bazel: 5.1.1} - { name: Ruby 2.7 (Bazel6), ruby: ruby-2.7.0, bazel: 6.0.0} - - { name: JRuby 9.2 (Bazel6), ruby: jruby-9.2.20.1, bazel: 6.0.0} + - { name: JRuby 9.4 (Bazel6), ruby: jruby-9.4.3.0, bazel: 6.0.0} name: Linux ${{ matrix.name }} runs-on: ubuntu-latest @@ -113,9 +114,10 @@ jobs: - { name: Ruby 3.1, ruby: ruby-3.1.0, bazel: 5.1.1} - { name: Ruby 3.2, ruby: ruby-3.2.0, bazel: 5.1.1} - { name: JRuby 9.2, ruby: jruby-9.2.20.1, bazel: 5.1.1} - - { name: JRuby 9.3, ruby: jruby-9.3.4.0, bazel: 5.1.1} + - { name: JRuby 9.3, ruby: jruby-9.3.10.0, bazel: 5.1.1} + - { name: JRuby 9.4, ruby: jruby-9.4.3.0, bazel: 5.1.1} - { name: Ruby 2.7 (Bazel6), ruby: ruby-2.7.0, bazel: 6.0.0} - - { name: JRuby 9.2 (Bazel6), ruby: jruby-9.2.20.1, bazel: 6.0.0} + - { name: JRuby 9.4 (Bazel6), ruby: jruby-9.4.3.0, bazel: 6.0.0} name: Install ${{ matrix.name }} runs-on: ubuntu-latest steps: diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index b39ef74bd3c07..d89139a4cb1f4 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -110,8 +110,8 @@ def protobuf_deps(): _github_archive( name = "rules_ruby", repo = "https://github.com/protocolbuffers/rules_ruby", - commit = "5cf6ff74161d7f985b9bf86bb3c5fb16cef6337b", - sha256 = "c88dd69eb50fcfd7fbc5d7db79adc6631ef0e1d80b3c94efe33ac5ee3ccc37f7", + commit = "8fca842a3006c3d637114aba4f6bf9695bb3a432", + sha256 = "2619f9a23cee6f6a198d9ef284b6f6cbc901545ee9a9aac9ffa6b83dbf17cf0c", ) if not native.existing_rule("rules_jvm_external"): diff --git a/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb b/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb index 5fd943b996c3d..56fa7fe41bd40 100755 --- a/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb +++ b/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb @@ -8,7 +8,7 @@ class RepeatedFieldTest < Test::Unit::TestCase def test_acts_like_enumerator m = TestMessage.new (Enumerable.instance_methods - TestMessage.new.repeated_string.methods).each do |method_name| - assert_equal "does not respond to #{method_name}", m.repeated_string.respond_to?(method_name), true + assert_respond_to m.repeated_string, method_name end end @@ -20,8 +20,10 @@ def test_acts_like_an_array :iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple, :nitems, :iter_for_reverse_each, :indexes, :append, :prepend] arr_methods -= [:union, :difference, :filter!] - arr_methods -= [:intersection, :deconstruct] # ruby 2.7 methods we can ignore - arr_methods -= [:intersect?] # ruby 3.1 methods we can ignore + # ruby 2.7 methods we can ignore + arr_methods -= [:intersection, :deconstruct, :resolve_feature_path] + # ruby 3.1 methods we can ignore + arr_methods -= [:intersect?] arr_methods.each do |method_name| assert_respond_to m.repeated_string, method_name end diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java index 77842d1290aab..90ab5415187b1 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java @@ -74,6 +74,9 @@ public RubyRepeatedField( @JRubyMethod(required = 1, optional = 2) public IRubyObject initialize(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; + // Workaround for https://github.com/jruby/jruby/issues/7851. Can be removed when JRuby 9.4.3.0 + // is no longer supported. + if (args.length < 1) throw runtime.newArgumentError("Expected at least 1 argument"); this.storage = runtime.newArray(); IRubyObject ary = null; if (!(args[0] instanceof RubySymbol)) { @@ -141,14 +144,20 @@ public IRubyObject index(ThreadContext context, IRubyObject[] args) { } else if (arg instanceof RubyRange) { RubyRange range = ((RubyRange) arg); - int first = normalizeArrayIndex(range.first(context)); - int last = normalizeArrayIndex(range.last(context)); + boolean beginless = range.begin(context).isNil(); + int first = + normalizeArrayIndex( + beginless ? RubyNumeric.int2fix(context.runtime, 0) : range.begin(context)); + boolean endless = range.end(context).isNil(); + int last = + normalizeArrayIndex( + endless ? RubyNumeric.int2fix(context.runtime, -1) : range.end(context)); if (last - first < 0) { return context.runtime.newEmptyArray(); } - - return this.storage.subseq(first, last - first + (range.isExcludeEnd() ? 0 : 1)); + boolean excludeEnd = range.isExcludeEnd() && !endless; + return this.storage.subseq(first, last - first + (excludeEnd ? 0 : 1)); } } /* assume 2 arguments */ diff --git a/ruby/tests/repeated_field_test.rb b/ruby/tests/repeated_field_test.rb index 45909d374b485..8e49fdce35318 100755 --- a/ruby/tests/repeated_field_test.rb +++ b/ruby/tests/repeated_field_test.rb @@ -20,8 +20,10 @@ def test_acts_like_an_array :iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple, :nitems, :iter_for_reverse_each, :indexes, :append, :prepend] arr_methods -= [:union, :difference, :filter!] - arr_methods -= [:intersection, :deconstruct] # ruby 2.7 methods we can ignore - arr_methods -= [:intersect?] # ruby 3.1 methods we can ignore + # ruby 2.7 methods we can ignore + arr_methods -= [:intersection, :deconstruct, :resolve_feature_path] + # ruby 3.1 methods we can ignore + arr_methods -= [:intersect?] arr_methods.each do |method_name| assert_respond_to m.repeated_string, method_name end From 14ea2cb2966f6ede44b91d5594d46d8ea45b64ef Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Mon, 17 Jul 2023 15:19:18 -0400 Subject: [PATCH 14/27] Update ruby gemspec required ruby version to >=2.7 --- ruby/google-protobuf.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index e20bcaac01d9a..331b58c033ab2 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.files += Dir.glob('ext/**/*') s.extensions= ["ext/google/protobuf_c/extconf.rb"] s.add_development_dependency "rake-compiler-dock", "= 1.2.1" end - s.required_ruby_version = '>= 2.5' + s.required_ruby_version = '>= 2.7' s.add_development_dependency "rake-compiler", "~> 1.1.0" s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9' end From 2278f6db94519cf24eb94739809cda14dc6a95c5 Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Mon, 17 Jul 2023 15:32:30 -0400 Subject: [PATCH 15/27] Drop JRuby 9.2 and 9.3 from GHA test matrix --- .github/workflows/test_ruby.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml index 3dfa6b43ce203..b9b21bfd0c17d 100644 --- a/.github/workflows/test_ruby.yml +++ b/.github/workflows/test_ruby.yml @@ -21,8 +21,6 @@ jobs: - { name: Ruby 3.0, ruby: ruby-3.0.2, bazel: 5.1.1} - { name: Ruby 3.1, ruby: ruby-3.1.0, bazel: 5.1.1} - { name: Ruby 3.2, ruby: ruby-3.2.0, bazel: 5.1.1} - - { name: JRuby 9.2, ruby: jruby-9.2.20.1, bazel: 5.1.1} - - { name: JRuby 9.3, ruby: jruby-9.3.10.0, bazel: 5.1.1} - { name: JRuby 9.4, ruby: jruby-9.4.3.0, bazel: 5.1.1} - { name: Ruby 2.7 (Bazel6), ruby: ruby-2.7.0, bazel: 6.0.0} - { name: JRuby 9.4 (Bazel6), ruby: jruby-9.4.3.0, bazel: 6.0.0} @@ -113,8 +111,6 @@ jobs: - { name: Ruby 3.0, ruby: ruby-3.0.2, bazel: 5.1.1} - { name: Ruby 3.1, ruby: ruby-3.1.0, bazel: 5.1.1} - { name: Ruby 3.2, ruby: ruby-3.2.0, bazel: 5.1.1} - - { name: JRuby 9.2, ruby: jruby-9.2.20.1, bazel: 5.1.1} - - { name: JRuby 9.3, ruby: jruby-9.3.10.0, bazel: 5.1.1} - { name: JRuby 9.4, ruby: jruby-9.4.3.0, bazel: 5.1.1} - { name: Ruby 2.7 (Bazel6), ruby: ruby-2.7.0, bazel: 6.0.0} - { name: JRuby 9.4 (Bazel6), ruby: jruby-9.4.3.0, bazel: 6.0.0} From 7666e9f521f1a2781bbf61c34767ed0196b7c1ba Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Tue, 18 Jul 2023 10:48:49 -0400 Subject: [PATCH 16/27] Update protobuf's upb dep to latest 24.x commit. --- protobuf_deps.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index d89139a4cb1f4..57f495b2f95b0 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -150,7 +150,7 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "f7e25ebfd1cd91afe202692e50d41026e48df9a9", - sha256 = "ded67aacfcc7c7f1463659e22494b1da132d4888d1c6d0388180e05b0c818077", + commit = "de6a2c9ddc07dd183917b7d3f6add564e214684d", + sha256 = "f49a95849ae3b1d77cc00754e68fbcd9bd651b68ea17149046b2205b4aaae896", patches = ["@com_google_protobuf//build_defs:upb.patch"], ) From 034ec9d9f69f29c184c8387a78ef37299b97725e Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 18 Jul 2023 11:50:33 -0700 Subject: [PATCH 17/27] Updating version.json and repo version numbers to: 24.0-rc2 --- CMakeLists.txt | 2 +- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 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/protoc/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 10 +++++----- 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 +++++++++---------- 23 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d1f762123501..a9bc45674ea57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "4.24.0-rc-1") +set(protobuf_VERSION_STRING "4.24.0-rc-2") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 719c1815da918..883da24bf6294 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '4.24.0-rc1' + s.version = '4.24.0-rc2' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' diff --git a/Protobuf.podspec b/Protobuf.podspec index cd394a5f4b435..b782562bda992 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.24.0-rc1' + s.version = '3.24.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' diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index a32a5062fc94a..1f4ae8df25a91 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.24.0-rc1 + 3.24.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 f27aa46d8e85e..7dfdee3b3cbcb 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.24.0-rc1 + 3.24.0-rc2 10.0 Google Inc. netstandard1.1;netstandard2.0;net45;net50 diff --git a/java/README.md b/java/README.md index 1a16f34f2a951..9c5bd980ac238 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.24.0-rc-1 + 3.24.0-rc-2 ``` @@ -37,14 +37,14 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.24.0-rc-1 + 3.24.0-rc-2 ``` ### Gradle If you are using Gradle, add the following to your `build.gradle` file's -dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.0-rc-1'` Again, +dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.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 e93a88b49c245..08d526dbfe380 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.24.0-RC1 + 3.24.0-RC2 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index cb5bc5479a5df..24abc5c09750f 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC1 + 3.24.0-RC2 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index 17405efb92747..fb220c8af6948 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC1 + 3.24.0-RC2 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index ee58789c6ba5a..c30bde000e9ba 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC1 + 3.24.0-RC2 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index 913a48e44440d..f2f09c431e79f 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.24.0-rc-1 + 3.24.0-rc-2 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 69097e63be3bd..8ce0235df8ebf 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC1 + 3.24.0-RC2 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index cd81d8489d029..b47ceec9a111d 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC1 + 3.24.0-RC2 pom Protocol Buffers [Parent] diff --git a/java/protoc/pom.xml b/java/protoc/pom.xml index 2c01607144654..a19ed57a2d02f 100644 --- a/java/protoc/pom.xml +++ b/java/protoc/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.24.0-RC1 + 3.24.0-RC2 pom Protobuf Compiler diff --git a/java/util/pom.xml b/java/util/pom.xml index 37c4116524828..cab90cf4026e3 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC1 + 3.24.0-RC2 protobuf-java-util diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 66e281be440c8..652901bc538ce 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.24.0RC1" +#define PHP_PROTOBUF_VERSION "3.24.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 9f3483c1a1da5..a359f161b9c26 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,6 +1,6 @@ """ Contains version numbers to be used in other bzl files """ -PROTOC_VERSION = "24.0-rc-1" -PROTOBUF_JAVA_VERSION = "3.24.0-RC1" -PROTOBUF_PYTHON_VERSION = "4.24.0rc1" -PROTOBUF_PHP_VERSION = "3.24.0RC1" -PROTOBUF_RUBY_VERSION = "3.24.0.rc.1" +PROTOC_VERSION = "24.0-rc-2" +PROTOBUF_JAVA_VERSION = "3.24.0-RC2" +PROTOBUF_PYTHON_VERSION = "4.24.0rc2" +PROTOBUF_PHP_VERSION = "3.24.0RC2" +PROTOBUF_RUBY_VERSION = "3.24.0.rc.2" diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 566e75f1168d2..92b48cad7b801 100755 --- 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.24.0rc1' +__version__ = '4.24.0rc2' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 331b58c033ab2..5d7bf9238fe96 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.24.0.rc.1" + s.version = "3.24.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 d625a021cd49d..2be168f6beb71 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.24.0-RC1 + 3.24.0-RC2 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.24.0-RC1 + 3.24.0-RC2 org.jruby diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index c2e595f6014c2..cdfdd2275b1bc 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -270,7 +270,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined #endif -#define PROTOBUF_VERSION_SUFFIX "-rc1" +#define PROTOBUF_VERSION_SUFFIX "-rc2" #ifdef PROTOBUF_ALWAYS_INLINE #error PROTOBUF_ALWAYS_INLINE was previously defined diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index b653484c0fd49..564ed19db1561 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -69,7 +69,7 @@ namespace internal { #define GOOGLE_PROTOBUF_VERSION 4024000 // 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 c473ed391b048..33583bfe55775 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0-dev", + "protoc_version": "24.0-rc2", "lts": false, - "date": "2023-07-11", + "date": "2023-07-18", "languages": { - "cpp": "4.24.0-dev", - "csharp": "3.24.0-dev", - "java": "3.24.0-dev", - "javascript": "3.24.0-dev", - "objectivec": "3.24.0-dev", - "php": "3.24.0-dev", - "python": "4.24.0-dev", - "ruby": "3.24.0-dev" + "cpp": "4.24.0-rc2", + "csharp": "3.24.0-rc2", + "java": "3.24.0-rc2", + "javascript": "3.24.0-rc2", + "objectivec": "3.24.0-rc2", + "php": "3.24.0-rc2", + "python": "4.24.0-rc2", + "ruby": "3.24.0-rc2" } } } \ No newline at end of file From 39bd80b805187470cdcff4a02fd0997241a4eabd Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 18 Jul 2023 11:50:33 -0700 Subject: [PATCH 18/27] Updating version.json to: 24.0-dev --- version.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/version.json b/version.json index 33583bfe55775..79094ed5ac841 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0-rc2", + "protoc_version": "24.0-dev", "lts": false, "date": "2023-07-18", "languages": { - "cpp": "4.24.0-rc2", - "csharp": "3.24.0-rc2", - "java": "3.24.0-rc2", - "javascript": "3.24.0-rc2", - "objectivec": "3.24.0-rc2", - "php": "3.24.0-rc2", - "python": "4.24.0-rc2", - "ruby": "3.24.0-rc2" + "cpp": "4.24.0-dev", + "csharp": "3.24.0-dev", + "java": "3.24.0-dev", + "javascript": "3.24.0-dev", + "objectivec": "3.24.0-dev", + "php": "3.24.0-dev", + "python": "4.24.0-dev", + "ruby": "3.24.0-dev" } } } \ No newline at end of file From 2ed49c95f9abbdf35e741c8a4e85976142fa9ff8 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 20 Jul 2023 09:29:11 -0700 Subject: [PATCH 19/27] In OSS mode omit some extern template specializations. We have seen reports of compilers falling over due to the size of translation units. PiperOrigin-RevId: 549653990 --- src/google/protobuf/compiler/cpp/file.cc | 17 ++- src/google/protobuf/compiler/cpp/helpers.h | 8 ++ src/google/protobuf/compiler/cpp/message.cc | 14 ++- src/google/protobuf/compiler/plugin.pb.cc | 16 --- src/google/protobuf/compiler/plugin.pb.h | 8 -- src/google/protobuf/cpp_features.pb.cc | 4 - src/google/protobuf/cpp_features.pb.h | 2 - src/google/protobuf/descriptor.pb.cc | 120 -------------------- src/google/protobuf/descriptor.pb.h | 60 ---------- 9 files changed, 28 insertions(+), 221 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc index 49b077351c2b7..4fd127f084235 100644 --- a/src/google/protobuf/compiler/cpp/file.cc +++ b/src/google/protobuf/compiler/cpp/file.cc @@ -1242,11 +1242,18 @@ class FileGenerator::ForwardDeclarations { } void PrintTopLevelDecl(io::Printer* p, const Options& options) const { - for (const auto& c : classes_) { - p->Emit({{"class", QualifiedClassName(c.second, options)}}, R"cc( - template <> - $dllexport_decl $$class$* Arena::CreateMaybeMessage<$class$>(Arena*); - )cc"); + if (ShouldGenerateExternSpecializations(options)) { + for (const auto& c : classes_) { + // To reduce total linker input size in large binaries we make these + // functions extern and define then in the pb.cc file. This avoids bloat + // in callers by having duplicate definitions of the template. + // However, it increases the size of the pb.cc translation units so it + // is a tradeoff. + p->Emit({{"class", QualifiedClassName(c.second, options)}}, R"cc( + template <> + $dllexport_decl $$class$* Arena::CreateMaybeMessage<$class$>(Arena*); + )cc"); + } } } diff --git a/src/google/protobuf/compiler/cpp/helpers.h b/src/google/protobuf/compiler/cpp/helpers.h index c88c12a479ff2..6ab842ee94fd8 100644 --- a/src/google/protobuf/compiler/cpp/helpers.h +++ b/src/google/protobuf/compiler/cpp/helpers.h @@ -1008,6 +1008,14 @@ void GenerateUtf8CheckCodeForCord(io::Printer* p, const FieldDescriptor* field, const Options& options, bool for_parse, absl::string_view parameters); +inline bool ShouldGenerateExternSpecializations(const Options& options) { + // For OSS we omit the specializations to reduce codegen size. + // Some compilers can't handle that much input in a single translation unit. + // These specializations are just a link size optimization and do not affect + // correctness or performance, so it is ok to omit them. + return !options.opensource_runtime; +} + struct OneOfRangeImpl { struct Iterator { using iterator_category = std::forward_iterator_tag; diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index a623bf66eb99e..b9dfb7a70e770 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -2953,12 +2953,14 @@ void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* p) { auto v = p->WithVars(ClassVars(descriptor_, options_)); auto t = p->WithVars(MakeTrackerCalls(descriptor_, options_)); Formatter format(p); - format( - "template<> " - "PROTOBUF_NOINLINE $classtype$*\n" - "Arena::CreateMaybeMessage< $classtype$ >(Arena* arena) {\n" - " return Arena::CreateMessageInternal< $classtype$ >(arena);\n" - "}\n"); + if (ShouldGenerateExternSpecializations(options_)) { + format( + "template<> " + "PROTOBUF_NOINLINE $classtype$*\n" + "Arena::CreateMaybeMessage< $classtype$ >(Arena* arena) {\n" + " return Arena::CreateMessageInternal< $classtype$ >(arena);\n" + "}\n"); + } } void MessageGenerator::GenerateClear(io::Printer* p) { diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 532469ac9d354..b4b57ce99d986 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -1584,22 +1584,6 @@ ::google::protobuf::Metadata CodeGeneratorResponse::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::compiler::Version* -Arena::CreateMaybeMessage< ::google::protobuf::compiler::Version >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::compiler::Version >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::compiler::CodeGeneratorRequest* -Arena::CreateMaybeMessage< ::google::protobuf::compiler::CodeGeneratorRequest >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::compiler::CodeGeneratorRequest >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::compiler::CodeGeneratorResponse_File* -Arena::CreateMaybeMessage< ::google::protobuf::compiler::CodeGeneratorResponse_File >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::compiler::CodeGeneratorResponse_File >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::compiler::CodeGeneratorResponse* -Arena::CreateMaybeMessage< ::google::protobuf::compiler::CodeGeneratorResponse >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::compiler::CodeGeneratorResponse >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index ac6a28d33eaf1..70740fd91ba11 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -77,14 +77,6 @@ class Version; struct VersionDefaultTypeInternal; PROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_; } // namespace compiler -template <> -PROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<::google::protobuf::compiler::CodeGeneratorRequest>(Arena*); -template <> -PROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage<::google::protobuf::compiler::CodeGeneratorResponse>(Arena*); -template <> -PROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage<::google::protobuf::compiler::CodeGeneratorResponse_File>(Arena*); -template <> -PROTOC_EXPORT ::google::protobuf::compiler::Version* Arena::CreateMaybeMessage<::google::protobuf::compiler::Version>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc index 0bc05b172ac9d..fe004416c2cdd 100644 --- a/src/google/protobuf/cpp_features.pb.cc +++ b/src/google/protobuf/cpp_features.pb.cc @@ -296,10 +296,6 @@ ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::FeatureSe } // namespace pb namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::pb::CppFeatures* -Arena::CreateMaybeMessage< ::pb::CppFeatures >(Arena* arena) { - return Arena::CreateMessageInternal< ::pb::CppFeatures >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/cpp_features.pb.h b/src/google/protobuf/cpp_features.pb.h index 948569b19281d..0d98464c960d3 100644 --- a/src/google/protobuf/cpp_features.pb.h +++ b/src/google/protobuf/cpp_features.pb.h @@ -61,8 +61,6 @@ PROTOBUF_EXPORT extern CppFeaturesDefaultTypeInternal _CppFeatures_default_insta } // namespace pb namespace google { namespace protobuf { -template <> -PROTOBUF_EXPORT ::pb::CppFeatures* Arena::CreateMaybeMessage<::pb::CppFeatures>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index f2221a6ea2064..5fdfde4d21632 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -13122,126 +13122,6 @@ ::google::protobuf::Metadata GeneratedCodeInfo::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::FileDescriptorSet* -Arena::CreateMaybeMessage< ::google::protobuf::FileDescriptorSet >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FileDescriptorSet >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FileDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::FileDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FileDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::DescriptorProto_ExtensionRange* -Arena::CreateMaybeMessage< ::google::protobuf::DescriptorProto_ExtensionRange >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto_ExtensionRange >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::DescriptorProto_ReservedRange* -Arena::CreateMaybeMessage< ::google::protobuf::DescriptorProto_ReservedRange >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto_ReservedRange >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::DescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::DescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::ExtensionRangeOptions_Declaration* -Arena::CreateMaybeMessage< ::google::protobuf::ExtensionRangeOptions_Declaration >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::ExtensionRangeOptions_Declaration >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::ExtensionRangeOptions* -Arena::CreateMaybeMessage< ::google::protobuf::ExtensionRangeOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::ExtensionRangeOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FieldDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::FieldDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FieldDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::OneofDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::OneofDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::OneofDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::EnumDescriptorProto_EnumReservedRange* -Arena::CreateMaybeMessage< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::EnumDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::EnumDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::EnumDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::EnumValueDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::EnumValueDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::EnumValueDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::ServiceDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::ServiceDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::ServiceDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::MethodDescriptorProto* -Arena::CreateMaybeMessage< ::google::protobuf::MethodDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::MethodDescriptorProto >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FileOptions* -Arena::CreateMaybeMessage< ::google::protobuf::FileOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FileOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::MessageOptions* -Arena::CreateMaybeMessage< ::google::protobuf::MessageOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::MessageOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FieldOptions_EditionDefault* -Arena::CreateMaybeMessage< ::google::protobuf::FieldOptions_EditionDefault >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FieldOptions_EditionDefault >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FieldOptions* -Arena::CreateMaybeMessage< ::google::protobuf::FieldOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FieldOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::OneofOptions* -Arena::CreateMaybeMessage< ::google::protobuf::OneofOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::OneofOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::EnumOptions* -Arena::CreateMaybeMessage< ::google::protobuf::EnumOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::EnumOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::EnumValueOptions* -Arena::CreateMaybeMessage< ::google::protobuf::EnumValueOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::EnumValueOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::ServiceOptions* -Arena::CreateMaybeMessage< ::google::protobuf::ServiceOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::ServiceOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::MethodOptions* -Arena::CreateMaybeMessage< ::google::protobuf::MethodOptions >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::MethodOptions >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::UninterpretedOption_NamePart* -Arena::CreateMaybeMessage< ::google::protobuf::UninterpretedOption_NamePart >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::UninterpretedOption_NamePart >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::UninterpretedOption* -Arena::CreateMaybeMessage< ::google::protobuf::UninterpretedOption >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::UninterpretedOption >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FeatureSet* -Arena::CreateMaybeMessage< ::google::protobuf::FeatureSet >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FeatureSet >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::SourceCodeInfo_Location* -Arena::CreateMaybeMessage< ::google::protobuf::SourceCodeInfo_Location >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::SourceCodeInfo_Location >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::SourceCodeInfo* -Arena::CreateMaybeMessage< ::google::protobuf::SourceCodeInfo >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::SourceCodeInfo >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::GeneratedCodeInfo_Annotation* -Arena::CreateMaybeMessage< ::google::protobuf::GeneratedCodeInfo_Annotation >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::GeneratedCodeInfo_Annotation >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::GeneratedCodeInfo* -Arena::CreateMaybeMessage< ::google::protobuf::GeneratedCodeInfo >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::GeneratedCodeInfo >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 68073b97a7134..9483f3baae8de 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -146,66 +146,6 @@ PROTOBUF_EXPORT extern UninterpretedOptionDefaultTypeInternal _UninterpretedOpti class UninterpretedOption_NamePart; struct UninterpretedOption_NamePartDefaultTypeInternal; PROTOBUF_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::DescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::DescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage<::google::protobuf::DescriptorProto_ExtensionRange>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage<::google::protobuf::DescriptorProto_ReservedRange>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::EnumDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::EnumDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage<::google::protobuf::EnumDescriptorProto_EnumReservedRange>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::EnumOptions* Arena::CreateMaybeMessage<::google::protobuf::EnumOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::EnumValueDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::EnumValueDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::EnumValueOptions* Arena::CreateMaybeMessage<::google::protobuf::EnumValueOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::ExtensionRangeOptions* Arena::CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::ExtensionRangeOptions_Declaration* Arena::CreateMaybeMessage<::google::protobuf::ExtensionRangeOptions_Declaration>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FeatureSet* Arena::CreateMaybeMessage<::google::protobuf::FeatureSet>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FieldDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::FieldDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FieldOptions* Arena::CreateMaybeMessage<::google::protobuf::FieldOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FieldOptions_EditionDefault* Arena::CreateMaybeMessage<::google::protobuf::FieldOptions_EditionDefault>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FileDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::FileDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FileDescriptorSet* Arena::CreateMaybeMessage<::google::protobuf::FileDescriptorSet>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FileOptions* Arena::CreateMaybeMessage<::google::protobuf::FileOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::GeneratedCodeInfo* Arena::CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage<::google::protobuf::GeneratedCodeInfo_Annotation>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::MessageOptions* Arena::CreateMaybeMessage<::google::protobuf::MessageOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::MethodDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::MethodDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::MethodOptions* Arena::CreateMaybeMessage<::google::protobuf::MethodOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::OneofDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::OneofDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::OneofOptions* Arena::CreateMaybeMessage<::google::protobuf::OneofOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::ServiceDescriptorProto* Arena::CreateMaybeMessage<::google::protobuf::ServiceDescriptorProto>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::ServiceOptions* Arena::CreateMaybeMessage<::google::protobuf::ServiceOptions>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::SourceCodeInfo* Arena::CreateMaybeMessage<::google::protobuf::SourceCodeInfo>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::SourceCodeInfo_Location* Arena::CreateMaybeMessage<::google::protobuf::SourceCodeInfo_Location>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::UninterpretedOption* Arena::CreateMaybeMessage<::google::protobuf::UninterpretedOption>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::UninterpretedOption_NamePart* Arena::CreateMaybeMessage<::google::protobuf::UninterpretedOption_NamePart>(Arena*); namespace internal { #if !defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES) PROTOBUF_EXPORT void InitializeFileDescriptorDefaultInstancesSlow(); From a71357d315f2b7c7f3ebe4c01b45de52b53df04f Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Fri, 21 Jul 2023 13:22:21 -0400 Subject: [PATCH 20/27] Update well known types staleness tests files --- src/google/protobuf/any.pb.cc | 4 --- src/google/protobuf/any.pb.h | 2 -- src/google/protobuf/api.pb.cc | 12 -------- src/google/protobuf/api.pb.h | 6 ---- src/google/protobuf/duration.pb.cc | 4 --- src/google/protobuf/duration.pb.h | 2 -- src/google/protobuf/empty.pb.cc | 4 --- src/google/protobuf/empty.pb.h | 2 -- src/google/protobuf/field_mask.pb.cc | 4 --- src/google/protobuf/field_mask.pb.h | 2 -- src/google/protobuf/source_context.pb.cc | 4 --- src/google/protobuf/source_context.pb.h | 2 -- src/google/protobuf/struct.pb.cc | 16 ----------- src/google/protobuf/struct.pb.h | 8 ------ src/google/protobuf/timestamp.pb.cc | 4 --- src/google/protobuf/timestamp.pb.h | 2 -- src/google/protobuf/type.pb.cc | 20 ------------- src/google/protobuf/type.pb.h | 10 ------- src/google/protobuf/wrappers.pb.cc | 36 ------------------------ src/google/protobuf/wrappers.pb.h | 18 ------------ 20 files changed, 162 deletions(-) diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index 9408f6b049a4e..0cdb0bb6bf156 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -380,10 +380,6 @@ ::google::protobuf::Metadata Any::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Any* -Arena::CreateMaybeMessage< ::google::protobuf::Any >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Any >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 3d8bc85af3f16..6777779b1c244 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -58,8 +58,6 @@ namespace protobuf { class Any; struct AnyDefaultTypeInternal; PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::Any* Arena::CreateMaybeMessage<::google::protobuf::Any>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 5f7fff638f39a..9bd78e3355802 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -1265,18 +1265,6 @@ ::google::protobuf::Metadata Mixin::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Api* -Arena::CreateMaybeMessage< ::google::protobuf::Api >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Api >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Method* -Arena::CreateMaybeMessage< ::google::protobuf::Method >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Method >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Mixin* -Arena::CreateMaybeMessage< ::google::protobuf::Mixin >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Mixin >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 9e300c4c0a4ea..0493260bf9bf7 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -66,12 +66,6 @@ PROTOBUF_EXPORT extern MethodDefaultTypeInternal _Method_default_instance_; class Mixin; struct MixinDefaultTypeInternal; PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::Api* Arena::CreateMaybeMessage<::google::protobuf::Api>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Method* Arena::CreateMaybeMessage<::google::protobuf::Method>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Mixin* Arena::CreateMaybeMessage<::google::protobuf::Mixin>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index 4c842a2e51acd..089a29aabb385 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -315,10 +315,6 @@ ::google::protobuf::Metadata Duration::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Duration* -Arena::CreateMaybeMessage< ::google::protobuf::Duration >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Duration >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index dfebb45b8839f..837a5a2c20f47 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -58,8 +58,6 @@ namespace protobuf { class Duration; struct DurationDefaultTypeInternal; PROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::Duration* Arena::CreateMaybeMessage<::google::protobuf::Duration>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index 204cb3691076d..629ec27f8861b 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -150,10 +150,6 @@ ::google::protobuf::Metadata Empty::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Empty* -Arena::CreateMaybeMessage< ::google::protobuf::Empty >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Empty >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 2aab3f1a17d05..9c40e20947a56 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -59,8 +59,6 @@ namespace protobuf { class Empty; struct EmptyDefaultTypeInternal; PROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::Empty* Arena::CreateMaybeMessage<::google::protobuf::Empty>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index d64c979591695..e52b26914b75a 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -292,10 +292,6 @@ ::google::protobuf::Metadata FieldMask::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::FieldMask* -Arena::CreateMaybeMessage< ::google::protobuf::FieldMask >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FieldMask >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index 8ef1aca0ab1be..0622f9f3a5c83 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -58,8 +58,6 @@ namespace protobuf { class FieldMask; struct FieldMaskDefaultTypeInternal; PROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::FieldMask* Arena::CreateMaybeMessage<::google::protobuf::FieldMask>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index 5df40d2d7dad0..1f6169aab8edf 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -311,10 +311,6 @@ ::google::protobuf::Metadata SourceContext::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::SourceContext* -Arena::CreateMaybeMessage< ::google::protobuf::SourceContext >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::SourceContext >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index e2a6c13cb00ba..25cfc455f77b1 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -58,8 +58,6 @@ namespace protobuf { class SourceContext; struct SourceContextDefaultTypeInternal; PROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::SourceContext* Arena::CreateMaybeMessage<::google::protobuf::SourceContext>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 5d214b45aefbe..eb2d0985edaa6 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -1005,22 +1005,6 @@ ::google::protobuf::Metadata ListValue::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Struct_FieldsEntry_DoNotUse* -Arena::CreateMaybeMessage< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Struct* -Arena::CreateMaybeMessage< ::google::protobuf::Struct >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Struct >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Value* -Arena::CreateMaybeMessage< ::google::protobuf::Value >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Value >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::ListValue* -Arena::CreateMaybeMessage< ::google::protobuf::ListValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::ListValue >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 79eebf9753c63..d0cb05a8c8432 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -71,14 +71,6 @@ PROTOBUF_EXPORT extern Struct_FieldsEntry_DoNotUseDefaultTypeInternal _Struct_Fi class Value; struct ValueDefaultTypeInternal; PROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::ListValue* Arena::CreateMaybeMessage<::google::protobuf::ListValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Struct* Arena::CreateMaybeMessage<::google::protobuf::Struct>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<::google::protobuf::Struct_FieldsEntry_DoNotUse>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Value* Arena::CreateMaybeMessage<::google::protobuf::Value>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 8015d85376781..51ab7804516a2 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -315,10 +315,6 @@ ::google::protobuf::Metadata Timestamp::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Timestamp* -Arena::CreateMaybeMessage< ::google::protobuf::Timestamp >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Timestamp >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 9dbfe0c4dc44a..fccf089eab256 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -58,8 +58,6 @@ namespace protobuf { class Timestamp; struct TimestampDefaultTypeInternal; PROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::Timestamp* Arena::CreateMaybeMessage<::google::protobuf::Timestamp>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 378625d9404c3..2779ce15e2460 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -2204,26 +2204,6 @@ ::google::protobuf::Metadata Option::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::Type* -Arena::CreateMaybeMessage< ::google::protobuf::Type >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Type >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Field* -Arena::CreateMaybeMessage< ::google::protobuf::Field >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Field >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Enum* -Arena::CreateMaybeMessage< ::google::protobuf::Enum >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Enum >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::EnumValue* -Arena::CreateMaybeMessage< ::google::protobuf::EnumValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::EnumValue >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Option* -Arena::CreateMaybeMessage< ::google::protobuf::Option >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Option >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 12d8bf4ca6d63..8fbc75c5b5848 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -73,16 +73,6 @@ PROTOBUF_EXPORT extern OptionDefaultTypeInternal _Option_default_instance_; class Type; struct TypeDefaultTypeInternal; PROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::Enum* Arena::CreateMaybeMessage<::google::protobuf::Enum>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::EnumValue* Arena::CreateMaybeMessage<::google::protobuf::EnumValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Field* Arena::CreateMaybeMessage<::google::protobuf::Field>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Option* Arena::CreateMaybeMessage<::google::protobuf::Option>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Type* Arena::CreateMaybeMessage<::google::protobuf::Type>(Arena*); } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 2e249abbcfc97..084608e8c4b68 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -1911,42 +1911,6 @@ ::google::protobuf::Metadata BytesValue::GetMetadata() const { } // namespace google namespace google { namespace protobuf { -template<> PROTOBUF_NOINLINE ::google::protobuf::DoubleValue* -Arena::CreateMaybeMessage< ::google::protobuf::DoubleValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::DoubleValue >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::FloatValue* -Arena::CreateMaybeMessage< ::google::protobuf::FloatValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::FloatValue >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Int64Value* -Arena::CreateMaybeMessage< ::google::protobuf::Int64Value >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Int64Value >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::UInt64Value* -Arena::CreateMaybeMessage< ::google::protobuf::UInt64Value >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::UInt64Value >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::Int32Value* -Arena::CreateMaybeMessage< ::google::protobuf::Int32Value >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::Int32Value >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::UInt32Value* -Arena::CreateMaybeMessage< ::google::protobuf::UInt32Value >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::UInt32Value >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::BoolValue* -Arena::CreateMaybeMessage< ::google::protobuf::BoolValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::BoolValue >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::StringValue* -Arena::CreateMaybeMessage< ::google::protobuf::StringValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::StringValue >(arena); -} -template<> PROTOBUF_NOINLINE ::google::protobuf::BytesValue* -Arena::CreateMaybeMessage< ::google::protobuf::BytesValue >(Arena* arena) { - return Arena::CreateMessageInternal< ::google::protobuf::BytesValue >(arena); -} } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index cdf0ff912e907..489a25d211ea4 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -82,24 +82,6 @@ PROTOBUF_EXPORT extern UInt32ValueDefaultTypeInternal _UInt32Value_default_insta class UInt64Value; struct UInt64ValueDefaultTypeInternal; PROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_; -template <> -PROTOBUF_EXPORT ::google::protobuf::BoolValue* Arena::CreateMaybeMessage<::google::protobuf::BoolValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::BytesValue* Arena::CreateMaybeMessage<::google::protobuf::BytesValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::DoubleValue* Arena::CreateMaybeMessage<::google::protobuf::DoubleValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::FloatValue* Arena::CreateMaybeMessage<::google::protobuf::FloatValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Int32Value* Arena::CreateMaybeMessage<::google::protobuf::Int32Value>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::Int64Value* Arena::CreateMaybeMessage<::google::protobuf::Int64Value>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::StringValue* Arena::CreateMaybeMessage<::google::protobuf::StringValue>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::UInt32Value* Arena::CreateMaybeMessage<::google::protobuf::UInt32Value>(Arena*); -template <> -PROTOBUF_EXPORT ::google::protobuf::UInt64Value* Arena::CreateMaybeMessage<::google::protobuf::UInt64Value>(Arena*); } // namespace protobuf } // namespace google From fff490558816802c5b3d51169f797046f369453f Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Fri, 28 Jul 2023 17:07:02 -0700 Subject: [PATCH 21/27] Drop support for Bazel 5. This moves all our CI to Bazel 6 and drops the additional parameterization we had on Bazel version. PiperOrigin-RevId: 551986376 --- .github/workflows/test_cpp.yml | 60 ++++++++--------- .github/workflows/test_csharp.yml | 8 +-- .github/workflows/test_java.yml | 22 +++---- .github/workflows/test_objectivec.yml | 8 +-- .github/workflows/test_php.yml | 28 ++++---- .github/workflows/test_php_ext.yml | 2 +- .github/workflows/test_python.yml | 8 +-- .github/workflows/test_ruby.yml | 40 +++++------- .github/workflows/test_rust.yml | 4 +- src/google/protobuf/compiler/BUILD.bazel | 10 ++- .../command_line_interface_unittest.cc | 5 ++ .../compiler/test_plugin_injection.bzl | 65 +++++++++++++++++++ 12 files changed, 164 insertions(+), 96 deletions(-) create mode 100644 src/google/protobuf/compiler/test_plugin_injection.bzl diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index ad2a5e300533d..ed90e97833fd6 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -26,20 +26,16 @@ jobs: - { name: No-RTTI, flags: --cxxopt=-fno-rtti } include: # Set defaults - - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:309dae3122031447d714414814d262e5f31cb93c0e248e9c02f9d8cdafd7e3b9 + - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb - targets: //pkg/... //src/... @com_google_protobuf_examples//... # Override cases with custom images - config: { name: "TCMalloc" } - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:4df3b4749e787ba0a671ec0b783d0f1ba05f60be4c9e9fd72c875550a0cde1ea" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:e4493c58e7c3f3a0775e0b19a46bc822e866a5275b7a5463f509af8072f283db" targets: "//src/..." - config: { name: "aarch64" } targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test" - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-3af05275178e16af30961976af126eabbbb2c733" - # TODO(b/278116805) Enable this once Bazel 6 is supported. - #- config: { name: "Bazel6" } - # targets: "//src/..." - # image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.0.0-6361b3a6e5c97e9951d03a4de28542fc45f1adab" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-222e7e87028b7098e088f5ca7cae06d32f483eb5" name: Linux ${{ matrix.config.name }} runs-on: ubuntu-latest steps: @@ -48,7 +44,7 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: image: ${{ matrix.image }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -68,9 +64,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:${{ matrix.version }}-5.4.0-2d15d9e888c9e7f90961dbd3afc8ea209717fb4b + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:${{ matrix.version }}-6.3.0-518b4fcd8d0ded2484c94f02e835526cacfdac2d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: cpp_linux/gcc-${{ matrix.version }} bazel: test //pkg/... //src/... @com_google_protobuf_examples//... @@ -90,19 +86,19 @@ jobs: submodules: recursive - name: Cross compile protoc for ${{ matrix.arch }} id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v1 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-${{ matrix.arch }} - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-release-${{ matrix.arch }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:${{ matrix.arch }}-3af05275178e16af30961976af126eabbbb2c733 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:${{ matrix.arch }}-222e7e87028b7098e088f5ca7cae06d32f483eb5 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: > @@ -137,12 +133,12 @@ jobs: ref: ${{ inputs.safe-checkout }} - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-cmake-${{ matrix.name }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-e6272cdfe97c6df307e17b83f3a7a70844f6fc08 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -162,12 +158,12 @@ jobs: submodules: recursive - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-cmake-install - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.10.3-1da1e086a7d1863b8bdd181ef6388a02dcd62f3a credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -191,12 +187,12 @@ jobs: ref: ${{ inputs.safe-checkout }} - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-cmake-examples - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.10.3-1da1e086a7d1863b8bdd181ef6388a02dcd62f3a credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -231,14 +227,14 @@ jobs: submodules: recursive - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-cmake-gcc-${{ matrix.name }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:12.2-5.4.0-307caa02808127e49720f3e77d6a9f3b3ef5a915 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:12.2-6.3.0-518b4fcd8d0ded2484c94f02e835526cacfdac2d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: >- @@ -261,12 +257,12 @@ jobs: submodules: recursive - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-cmake-${{ matrix.name }} - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-1da1e086a7d1863b8bdd181ef6388a02dcd62f3a credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -285,12 +281,12 @@ jobs: submodules: recursive - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: linux-cmake-32-bit - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/32bit@sha256:f99f051daa8b12f4ebad5927f389bc71372f771ab080290ab451cbaf1648f9ea platform: linux/386 @@ -331,7 +327,7 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel: ${{ matrix.bazel }} @@ -386,7 +382,7 @@ jobs: submodules: recursive - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: ${{ matrix.name }} vsversion: ${{ matrix.vsversion }} @@ -394,7 +390,7 @@ jobs: # Install phase. - name: Configure CMake for install if: matrix.install-flags - uses: protocolbuffers/protobuf-ci/bash@v1 + uses: protocolbuffers/protobuf-ci/bash@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: cmake . ${{ matrix.install-flags }} ${{ env.CCACHE_CMAKE_FLAGS }} @@ -416,7 +412,7 @@ jobs: run: cmake --build . --target clean && rm CMakeCache.txt - name: Configure CMake - uses: protocolbuffers/protobuf-ci/bash@v1 + uses: protocolbuffers/protobuf-ci/bash@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: cmake . ${{ matrix.flags }} ${{ env.CCACHE_CMAKE_FLAGS }} diff --git a/.github/workflows/test_csharp.yml b/.github/workflows/test_csharp.yml index f0cafc3809477..21c1aebecd472 100644 --- a/.github/workflows/test_csharp.yml +++ b/.github/workflows/test_csharp.yml @@ -21,9 +21,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:3.1.415-6.0.100-508417e5215994ade7585d28ba3aad681a25fa5d + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:3.1.415-6.0.100-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: csharp_linux bazel: test //csharp/... --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel @@ -60,7 +60,7 @@ jobs: - name: Build protobuf C# tests under x86_64 docker image # Tests are built "dotnet publish" because we want all the dependencies to the copied to the destination directory # (we want to avoid references to ~/.nuget that won't be available in the subsequent docker run) - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -77,7 +77,7 @@ jobs: # running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user # otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity, # we just run map the user's home to a throwaway temporary directory - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim-arm64v8 skip-staleness-check: true diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 89c487fe97fd6..a23abb3fbad18 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -19,19 +19,19 @@ jobs: include: - name: OpenJDK 8 version: '8' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 targets: //java/... //java/internal:java_version - name: OpenJDK 11 version: '11' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 targets: //java/... //java/internal:java_version - name: OpenJDK 17 version: '17' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:17-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:17-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 targets: //java/... //java/internal:java_version - name: aarch64 version: 'aarch64' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-3af05275178e16af30961976af126eabbbb2c733 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-222e7e87028b7098e088f5ca7cae06d32f483eb5 targets: //java/... //src/google/protobuf/compiler:protoc_aarch64_test name: Linux ${{ matrix.name }} @@ -42,7 +42,7 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: image: ${{ matrix.image }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} @@ -58,9 +58,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run Linkage Monitor test - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: java_linux/8 bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone @@ -75,9 +75,9 @@ jobs: ref: ${{ inputs.safe-checkout }} - name: Build protoc id: build-protoc - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v1 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-x86_64 - name: Move protoc into place and clean up @@ -89,9 +89,9 @@ jobs: mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true working-directory: java - name: Generate pom.xml files from the template - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: java_linux/11 # protobuf-java and protobuf-java-util are the member of the BOM diff --git a/.github/workflows/test_objectivec.yml b/.github/workflows/test_objectivec.yml index c3c04e9e1f0be..ae19ec670162f 100644 --- a/.github/workflows/test_objectivec.yml +++ b/.github/workflows/test_objectivec.yml @@ -39,13 +39,13 @@ jobs: ref: ${{ inputs.safe-checkout }} - name: Setup ccache - uses: protocolbuffers/protobuf-ci/ccache@v1 + uses: protocolbuffers/protobuf-ci/ccache@v2 with: cache-prefix: objectivec_${{ matrix.platform }}_${{ matrix.xc_config }} support-modules: true - name: Run tests - uses: protocolbuffers/protobuf-ci/bash@v1 + uses: protocolbuffers/protobuf-ci/bash@v2 env: CC: ${{ github.workspace }}/ci/clang_wrapper CXX: ${{ github.workspace }}/ci/clang_wrapper++ @@ -81,7 +81,7 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Pod lib lint - uses: protocolbuffers/protobuf-ci/bash@v1 + uses: protocolbuffers/protobuf-ci/bash@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: | @@ -122,7 +122,7 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: bazel ${{ matrix.config.bazel_action }} - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }} diff --git a/.github/workflows/test_php.yml b/.github/workflows/test_php.yml index 2da2f4f1727d5..e61db63b59082 100644 --- a/.github/workflows/test_php.yml +++ b/.github/workflows/test_php.yml @@ -44,14 +44,14 @@ jobs: ref: ${{ inputs.safe-checkout }} submodules: recursive - name: Setup composer - uses: protocolbuffers/protobuf-ci/composer-setup@v1 + uses: protocolbuffers/protobuf-ci/composer-setup@v2 with: cache-prefix: php-${{ matrix.version-short }} directory: php - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-508417e5215994ade7585d28ba3aad681a25fa5d + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} extra-flags: -e COMPOSER_HOME=/workspace/composer-cache command: ${{ matrix.command }} @@ -85,20 +85,20 @@ jobs: - name: Cross compile protoc for i386 id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v1 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-i386 - name: Setup composer - uses: protocolbuffers/protobuf-ci/composer-setup@v1 + uses: protocolbuffers/protobuf-ci/composer-setup@v2 with: cache-prefix: php-${{ matrix.version }} directory: php - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: ${{ env.image }} skip-staleness-check: true @@ -123,20 +123,20 @@ jobs: - name: Cross compile protoc for aarch64 id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v1 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-aarch64 - name: Setup composer - uses: protocolbuffers/protobuf-ci/composer-setup@v1 + uses: protocolbuffers/protobuf-ci/composer-setup@v2 with: cache-prefix: php-8.0 directory: php - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php-aarch64:0cc100b6e03d14c1e8f71ae794dc162ed122fe31@sha256:77b70feba68dced1f0fd21b52a08d3d2e0c5c797bfe68435a0038ce87ecfd310 platform: linux/arm64 @@ -180,13 +180,13 @@ jobs: run: php --version | grep ${{ matrix.version }} || (echo "Invalid PHP version - $(php --version)" && exit 1) - name: Setup composer - uses: protocolbuffers/protobuf-ci/composer-setup@v1 + uses: protocolbuffers/protobuf-ci/composer-setup@v2 with: cache-prefix: php-${{ matrix.version }} directory: php - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: php_macos/${{ matrix.version }} @@ -199,7 +199,7 @@ jobs: popd - name: Run conformance tests - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: php_macos/${{ matrix.version }} diff --git a/.github/workflows/test_php_ext.yml b/.github/workflows/test_php_ext.yml index 1c3f3bb9e3dea..d922859a7ccce 100644 --- a/.github/workflows/test_php_ext.yml +++ b/.github/workflows/test_php_ext.yml @@ -22,7 +22,7 @@ jobs: ref: ${{ inputs.safe-checkout }} - name: Package extension - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: php_ext/${{ matrix.version }} diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index f82aa469fdb04..49c10633a0401 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -30,7 +30,7 @@ jobs: targets: //python/... //python:aarch64_test # TODO(b/262628111) Enable this once conformance tests are fixed. flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-3af05275178e16af30961976af126eabbbb2c733 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-222e7e87028b7098e088f5ca7cae06d32f483eb5 name: Linux ${{ matrix.type }} ${{ matrix.version }} runs-on: ubuntu-latest @@ -40,9 +40,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:{0}-508417e5215994ade7585d28ba3aad681a25fa5d', matrix.version) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:{0}-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea', matrix.version) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }} bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION @@ -85,7 +85,7 @@ jobs: source venv/bin/activate - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 env: KOKORO_PYTHON_VERSION: ${{ matrix.version }} with: diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml index b9b21bfd0c17d..b948369977732 100644 --- a/.github/workflows/test_ruby.yml +++ b/.github/workflows/test_ruby.yml @@ -17,13 +17,11 @@ jobs: fail-fast: false matrix: include: - - { name: Ruby 2.7, ruby: ruby-2.7.0, bazel: 5.1.1} - - { name: Ruby 3.0, ruby: ruby-3.0.2, bazel: 5.1.1} - - { name: Ruby 3.1, ruby: ruby-3.1.0, bazel: 5.1.1} - - { name: Ruby 3.2, ruby: ruby-3.2.0, bazel: 5.1.1} - - { name: JRuby 9.4, ruby: jruby-9.4.3.0, bazel: 5.1.1} - - { name: Ruby 2.7 (Bazel6), ruby: ruby-2.7.0, bazel: 6.0.0} - - { name: JRuby 9.4 (Bazel6), ruby: jruby-9.4.3.0, bazel: 6.0.0} + - { name: Ruby 2.7, ruby: ruby-2.7.0 } + - { name: Ruby 3.0, ruby: ruby-3.0.2 } + - { name: Ruby 3.1, ruby: ruby-3.1.0 } + - { name: Ruby 3.2, ruby: ruby-3.2.0 } + - { name: JRuby 9.4, ruby: jruby-9.4.3.0 } name: Linux ${{ matrix.name }} runs-on: ubuntu-latest @@ -33,9 +31,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-{1}-508417e5215994ade7585d28ba3aad681a25fa5d', matrix.ruby, matrix.bazel) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea', matrix.ruby) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }} bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION @@ -51,14 +49,14 @@ jobs: - name: Cross compile protoc for aarch64 id: cross-compile - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v1 + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-aarch64 - name: Run tests - uses: protocolbuffers/protobuf-ci/docker@v1 + uses: protocolbuffers/protobuf-ci/docker@v2 with: image: arm64v8/ruby:2.7.3-buster skip-staleness-check: true @@ -96,7 +94,7 @@ jobs: run: ruby --version | grep ${{ matrix.version }} || (echo "Invalid Ruby version - $(ruby --version)" && exit 1) - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel@v1 + uses: protocolbuffers/protobuf-ci/bazel@v2 with: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_macos/${{ matrix.version }} @@ -107,13 +105,11 @@ jobs: fail-fast: false matrix: include: - - { name: Ruby 2.7, ruby: ruby-2.7.0, bazel: 5.1.1} - - { name: Ruby 3.0, ruby: ruby-3.0.2, bazel: 5.1.1} - - { name: Ruby 3.1, ruby: ruby-3.1.0, bazel: 5.1.1} - - { name: Ruby 3.2, ruby: ruby-3.2.0, bazel: 5.1.1} - - { name: JRuby 9.4, ruby: jruby-9.4.3.0, bazel: 5.1.1} - - { name: Ruby 2.7 (Bazel6), ruby: ruby-2.7.0, bazel: 6.0.0} - - { name: JRuby 9.4 (Bazel6), ruby: jruby-9.4.3.0, bazel: 6.0.0} + - { name: Ruby 2.7, ruby: ruby-2.7.0 } + - { name: Ruby 3.0, ruby: ruby-3.0.2 } + - { name: Ruby 3.1, ruby: ruby-3.1.0 } + - { name: Ruby 3.2, ruby: ruby-3.2.0 } + - { name: JRuby 9.4, ruby: jruby-9.4.3.0 } name: Install ${{ matrix.name }} runs-on: ubuntu-latest steps: @@ -122,9 +118,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-${{ matrix.bazel }}-508417e5215994ade7585d28ba3aad681a25fa5d + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }} bash: > diff --git a/.github/workflows/test_rust.yml b/.github/workflows/test_rust.yml index ee86f6d64e3e0..086ac5084a717 100644 --- a/.github/workflows/test_rust.yml +++ b/.github/workflows/test_rust.yml @@ -21,9 +21,9 @@ jobs: with: ref: ${{ inputs.safe-checkout }} - name: Run tests - uses: protocolbuffers/protobuf-ci/bazel-docker@v1 + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.0.0-6361b3a6e5c97e9951d03a4de28542fc45f1adab + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: rust_linux bazel: | diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index d5f3a7aecbdb8..9b4c243d18d29 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -12,6 +12,7 @@ load( load("@rules_proto//proto:defs.bzl", "proto_library") load("//build_defs:arch_tests.bzl", "aarch64_test", "x86_64_test") load("//build_defs:cpp_opts.bzl", "COPTS") +load("test_plugin_injection.bzl", "inject_plugin_paths") proto_library( name = "plugin_proto", @@ -267,6 +268,8 @@ cc_test( ], ) +inject_plugin_paths("test_plugin_paths") + cc_test( name = "command_line_interface_unittest", srcs = ["command_line_interface_unittest.cc"], @@ -278,8 +281,10 @@ cc_test( ], }) + [ # Note: This only works on Windows with symlinks and runfiles enabled. - "-DGOOGLE_PROTOBUF_FAKE_PLUGIN_PATH=\\\"$(rootpath :fake_plugin)\\\"", - "-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH=\\\"$(rootpath :test_plugin)\\\"", + # "-DGOOGLE_PROTOBUF_FAKE_PLUGIN_PATH=\\\"$(rootpath :fake_plugin)\\\"", + # "-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH=\\\"$(rootpath :test_plugin)\\\"", + # Workaround for https://github.com/bazelbuild/bazel/issues/19124. + "-DGOOGLE_PROTOBUF_USE_BAZEL_GENERATED_PLUGIN_PATHS=1", ], data = [ ":fake_plugin", @@ -293,6 +298,7 @@ cc_test( ":command_line_interface", ":command_line_interface_tester", ":mock_code_generator", + ":test_plugin_paths", "//:protobuf", "//src/google/protobuf:cc_test_protos", "//src/google/protobuf:test_textproto", diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 4fe1211b7c82b..7cd9a9b06466e 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -73,6 +73,11 @@ #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_custom_options.pb.h" +#ifdef GOOGLE_PROTOBUF_USE_BAZEL_GENERATED_PLUGIN_PATHS +// This is needed because of https://github.com/bazelbuild/bazel/issues/19124. +#include "google/protobuf/compiler/test_plugin_paths.h" +#endif // GOOGLE_PROTOBUF_USE_BAZEL_GENERATED_PLUGIN_PATHS + // Must be included last. #include "google/protobuf/port_def.inc" diff --git a/src/google/protobuf/compiler/test_plugin_injection.bzl b/src/google/protobuf/compiler/test_plugin_injection.bzl new file mode 100644 index 0000000000000..aec25441e806d --- /dev/null +++ b/src/google/protobuf/compiler/test_plugin_injection.bzl @@ -0,0 +1,65 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2008 Google Inc. All rights reserved. +# https:#developers.google.com/protocol-buffers/ +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +load("//build_defs:cpp_opts.bzl", "COPTS") + +# This works around https://github.com/bazelbuild/bazel/issues/19124 by using a generated header to +# inject the Bazel path of the test plugins. The simpler alternative is broken in Bazel 6.3.0, +# which is to just inject these via copts. +def inject_plugin_paths(name): + hdr = name + ".h" + native.genrule( + name = "test_plugin_paths_gen", + outs = [hdr], + srcs = [ + ":fake_plugin", + ":test_plugin", + ], + cmd = """ +cat <<'EOF' >$(OUTS) +#ifndef GOOGLE_PROTOBUF_COMPILER_TEST_PLUGIN_PATHS_H__ +#define GOOGLE_PROTOBUF_COMPILER_TEST_PLUGIN_PATHS_H__ + +#define GOOGLE_PROTOBUF_TEST_PLUGIN_PATH "$(rootpath :test_plugin)" +#define GOOGLE_PROTOBUF_FAKE_PLUGIN_PATH "$(rootpath :fake_plugin)" + +#endif // GOOGLE_PROTOBUF_COMPILER_TEST_PLUGIN_PATHS_H__ +""", + visibility = ["//visibility:private"], + testonly = True, + ) + + native.cc_library( + name = name, + hdrs = [hdr], + strip_include_prefix = "/src", + copts = COPTS, + testonly = True, + ) From bc9002ec75b80c7bc170c2339d0486c002789d69 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Mon, 31 Jul 2023 08:04:21 -0700 Subject: [PATCH 22/27] bazel: Get rid of exec_tools. (#13401) Bazel has removed this attribute in bazelbuild/bazel@c061e57a7004a88eeb2f84d094d9a88b56c146b6. Closes #13401 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13401 from benjaminp:exec_tools 9e718ff0fd11ff1fe70ed3e2536373792504c9c5 PiperOrigin-RevId: 552482730 --- build_defs/internal_shell.bzl | 4 ++-- objectivec/BUILD.bazel | 2 +- src/google/protobuf/BUILD.bazel | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_defs/internal_shell.bzl b/build_defs/internal_shell.bzl index 649184a5184c0..91628a5e57f50 100644 --- a/build_defs/internal_shell.bzl +++ b/build_defs/internal_shell.bzl @@ -32,7 +32,7 @@ def inline_sh_binary( native.genrule( name = name + "_genrule", srcs = srcs, - exec_tools = tools, + tools = tools, outs = [name + ".sh"], cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd, visibility = ["//visibility:private"], @@ -77,7 +77,7 @@ def inline_sh_test( native.genrule( name = name + "_genrule", srcs = srcs, - exec_tools = tools, + tools = tools, outs = [name + ".sh"], cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd, visibility = ["//visibility:private"], diff --git a/objectivec/BUILD.bazel b/objectivec/BUILD.bazel index 10798380698c3..c59bf0e60c7b0 100644 --- a/objectivec/BUILD.bazel +++ b/objectivec/BUILD.bazel @@ -42,7 +42,7 @@ genrule( for wkt in _OBJC_WKT_NAMES for ext in _OBJC_EXTS ]), - exec_tools = ["//:protoc"], + tools = ["//:protoc"], tags = ["manual"], ) diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 6b4f77d5fa2e0..9956816aab960 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -139,7 +139,7 @@ genrule( --proto_path=$$(dirname $$(dirname $$(dirname $(location any.proto)))) \ $(SRCS) """, - exec_tools = ["//:protoc"], + tools = ["//:protoc"], visibility = ["//visibility:private"], ) From fce87eb250c2ecf7174ec2d92df8de058a0bcc65 Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Mon, 31 Jul 2023 16:39:47 -0400 Subject: [PATCH 23/27] Update protobuf repo's upb dependency to latest 24.x commit --- protobuf_deps.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 57f495b2f95b0..259c79d8f01c6 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -150,7 +150,7 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "de6a2c9ddc07dd183917b7d3f6add564e214684d", - sha256 = "f49a95849ae3b1d77cc00754e68fbcd9bd651b68ea17149046b2205b4aaae896", + commit = "636b8f0c9be4091ec3c2d1b4b46536d62d922544", + sha256 = "00d658bb274a3f3f9fac7d385208813d011e588fd2cb5748b64df1f5419cd43f", patches = ["@com_google_protobuf//build_defs:upb.patch"], ) From 3487ae0c01af9130d2ee6436de142cfff9311aba Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 1 Aug 2023 10:27:01 -0700 Subject: [PATCH 24/27] Updating version.json and repo version numbers to: 24.0-rc3 --- CMakeLists.txt | 2 +- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 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/protoc/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 10 +++++----- 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 +++++++++---------- 23 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9bc45674ea57..38bfd46b035a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "4.24.0-rc-2") +set(protobuf_VERSION_STRING "4.24.0-rc-3") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 883da24bf6294..e907cfa29701e 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '4.24.0-rc2' + s.version = '4.24.0-rc3' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' diff --git a/Protobuf.podspec b/Protobuf.podspec index b782562bda992..40fbc87c469b1 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.24.0-rc2' + s.version = '3.24.0-rc3' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 1f4ae8df25a91..030074e6599f6 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.24.0-rc2 + 3.24.0-rc3 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 7dfdee3b3cbcb..b0e256b822a7b 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.24.0-rc2 + 3.24.0-rc3 10.0 Google Inc. netstandard1.1;netstandard2.0;net45;net50 diff --git a/java/README.md b/java/README.md index 9c5bd980ac238..1d3eb60890105 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.24.0-rc-2 + 3.24.0-rc-3 ``` @@ -37,14 +37,14 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.24.0-rc-2 + 3.24.0-rc-3 ``` ### Gradle If you are using Gradle, add the following to your `build.gradle` file's -dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.0-rc-2'` Again, +dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.0-rc-3'` 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 08d526dbfe380..29006712477c3 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.24.0-RC2 + 3.24.0-RC3 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 24abc5c09750f..17209e11e78dd 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC2 + 3.24.0-RC3 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index fb220c8af6948..8e4e52dcd33eb 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC2 + 3.24.0-RC3 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index c30bde000e9ba..4ed7a2e06e637 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC2 + 3.24.0-RC3 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index f2f09c431e79f..b96668d42150b 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.24.0-rc-2 + 3.24.0-rc-3 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 8ce0235df8ebf..d1475c0ef4975 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC2 + 3.24.0-RC3 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index b47ceec9a111d..d0ed278579b1e 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC2 + 3.24.0-RC3 pom Protocol Buffers [Parent] diff --git a/java/protoc/pom.xml b/java/protoc/pom.xml index a19ed57a2d02f..eb72093110e9e 100644 --- a/java/protoc/pom.xml +++ b/java/protoc/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.24.0-RC2 + 3.24.0-RC3 pom Protobuf Compiler diff --git a/java/util/pom.xml b/java/util/pom.xml index cab90cf4026e3..304b2d9eebd87 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC2 + 3.24.0-RC3 protobuf-java-util diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 652901bc538ce..b55185b3103b4 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.24.0RC2" +#define PHP_PROTOBUF_VERSION "3.24.0RC3" // 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 a359f161b9c26..4a66fac11e3cd 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,6 +1,6 @@ """ Contains version numbers to be used in other bzl files """ -PROTOC_VERSION = "24.0-rc-2" -PROTOBUF_JAVA_VERSION = "3.24.0-RC2" -PROTOBUF_PYTHON_VERSION = "4.24.0rc2" -PROTOBUF_PHP_VERSION = "3.24.0RC2" -PROTOBUF_RUBY_VERSION = "3.24.0.rc.2" +PROTOC_VERSION = "24.0-rc-3" +PROTOBUF_JAVA_VERSION = "3.24.0-RC3" +PROTOBUF_PYTHON_VERSION = "4.24.0rc3" +PROTOBUF_PHP_VERSION = "3.24.0RC3" +PROTOBUF_RUBY_VERSION = "3.24.0.rc.3" diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 92b48cad7b801..cd097d191a309 100755 --- 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.24.0rc2' +__version__ = '4.24.0rc3' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 5d7bf9238fe96..c0256d07aacc9 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.24.0.rc.2" + s.version = "3.24.0.rc.3" 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 2be168f6beb71..ae8735c2691f0 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.24.0-RC2 + 3.24.0-RC3 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.24.0-RC2 + 3.24.0-RC3 org.jruby diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index cdfdd2275b1bc..deefe5b518b9e 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -270,7 +270,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined #endif -#define PROTOBUF_VERSION_SUFFIX "-rc2" +#define PROTOBUF_VERSION_SUFFIX "-rc3" #ifdef PROTOBUF_ALWAYS_INLINE #error PROTOBUF_ALWAYS_INLINE was previously defined diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 564ed19db1561..f7e80dc8e1fda 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -69,7 +69,7 @@ namespace internal { #define GOOGLE_PROTOBUF_VERSION 4024000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. -#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc2" +#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc3" // 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 79094ed5ac841..10f72ab07c32b 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0-dev", + "protoc_version": "24.0-rc3", "lts": false, - "date": "2023-07-18", + "date": "2023-08-01", "languages": { - "cpp": "4.24.0-dev", - "csharp": "3.24.0-dev", - "java": "3.24.0-dev", - "javascript": "3.24.0-dev", - "objectivec": "3.24.0-dev", - "php": "3.24.0-dev", - "python": "4.24.0-dev", - "ruby": "3.24.0-dev" + "cpp": "4.24.0-rc3", + "csharp": "3.24.0-rc3", + "java": "3.24.0-rc3", + "javascript": "3.24.0-rc3", + "objectivec": "3.24.0-rc3", + "php": "3.24.0-rc3", + "python": "4.24.0-rc3", + "ruby": "3.24.0-rc3" } } } \ No newline at end of file From e82fc05571ad03112fa36e656a76a3128944111e Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 1 Aug 2023 10:27:01 -0700 Subject: [PATCH 25/27] Updating version.json to: 24.0-dev --- version.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/version.json b/version.json index 10f72ab07c32b..4b1dd6217f611 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0-rc3", + "protoc_version": "24.0-dev", "lts": false, "date": "2023-08-01", "languages": { - "cpp": "4.24.0-rc3", - "csharp": "3.24.0-rc3", - "java": "3.24.0-rc3", - "javascript": "3.24.0-rc3", - "objectivec": "3.24.0-rc3", - "php": "3.24.0-rc3", - "python": "4.24.0-rc3", - "ruby": "3.24.0-rc3" + "cpp": "4.24.0-dev", + "csharp": "3.24.0-dev", + "java": "3.24.0-dev", + "javascript": "3.24.0-dev", + "objectivec": "3.24.0-dev", + "php": "3.24.0-dev", + "python": "4.24.0-dev", + "ruby": "3.24.0-dev" } } } \ No newline at end of file From 093e258a71caacc053cf5ce86977ba3131361a9a Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 8 Aug 2023 10:26:14 -0700 Subject: [PATCH 26/27] Updating version.json and repo version numbers to: 24.0 --- CMakeLists.txt | 2 +- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 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/protoc/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 10 +++++----- 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 +++++++++---------- 23 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38bfd46b035a8..ac0d03c3aa70c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "4.24.0-rc-3") +set(protobuf_VERSION_STRING "4.24.0") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index e907cfa29701e..f472aa5f1bf55 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '4.24.0-rc3' + s.version = '4.24.0' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' diff --git a/Protobuf.podspec b/Protobuf.podspec index 40fbc87c469b1..539394e629cba 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.24.0-rc3' + s.version = '3.24.0' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 030074e6599f6..2a0cf99af8938 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.24.0-rc3 + 3.24.0 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 b0e256b822a7b..dede3312285b7 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.24.0-rc3 + 3.24.0 10.0 Google Inc. netstandard1.1;netstandard2.0;net45;net50 diff --git a/java/README.md b/java/README.md index 1d3eb60890105..fb80b05f27cfe 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.24.0-rc-3 + 3.24.0 ``` @@ -37,14 +37,14 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.24.0-rc-3 + 3.24.0 ``` ### Gradle If you are using Gradle, add the following to your `build.gradle` file's -dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.0-rc-3'` Again, +dependencies: `implementation 'com.google.protobuf:protobuf-java:3.24.0'` 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 29006712477c3..372dcdfda0066 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.24.0-RC3 + 3.24.0 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 17209e11e78dd..84d674094ef3d 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC3 + 3.24.0 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index 8e4e52dcd33eb..254eb8281b533 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC3 + 3.24.0 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index 4ed7a2e06e637..354e65494cafa 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC3 + 3.24.0 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index b96668d42150b..d8201e04683f6 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.24.0-rc-3 + 3.24.0 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index d1475c0ef4975..3b4ff825830bf 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC3 + 3.24.0 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index d0ed278579b1e..1deeca92a88fb 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC3 + 3.24.0 pom Protocol Buffers [Parent] diff --git a/java/protoc/pom.xml b/java/protoc/pom.xml index eb72093110e9e..eec6f636e76f5 100644 --- a/java/protoc/pom.xml +++ b/java/protoc/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.24.0-RC3 + 3.24.0 pom Protobuf Compiler diff --git a/java/util/pom.xml b/java/util/pom.xml index 304b2d9eebd87..f5c6380899bcb 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.24.0-RC3 + 3.24.0 protobuf-java-util diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index b55185b3103b4..c6a856583774f 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.24.0RC3" +#define PHP_PROTOBUF_VERSION "3.24.0" // 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 4a66fac11e3cd..e4284077203f4 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,6 +1,6 @@ """ Contains version numbers to be used in other bzl files """ -PROTOC_VERSION = "24.0-rc-3" -PROTOBUF_JAVA_VERSION = "3.24.0-RC3" -PROTOBUF_PYTHON_VERSION = "4.24.0rc3" -PROTOBUF_PHP_VERSION = "3.24.0RC3" -PROTOBUF_RUBY_VERSION = "3.24.0.rc.3" +PROTOC_VERSION = "24.0" +PROTOBUF_JAVA_VERSION = "3.24.0" +PROTOBUF_PYTHON_VERSION = "4.24.0" +PROTOBUF_PHP_VERSION = "3.24.0" +PROTOBUF_RUBY_VERSION = "3.24.0" diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index cd097d191a309..b5f9fd7467616 100755 --- 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.24.0rc3' +__version__ = '4.24.0' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index c0256d07aacc9..79d42c23b2074 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.24.0.rc.3" + s.version = "3.24.0" 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 ae8735c2691f0..2242464e23bca 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.24.0-RC3 + 3.24.0 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.24.0-RC3 + 3.24.0 org.jruby diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index deefe5b518b9e..5d292a5f4842a 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -270,7 +270,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined #endif -#define PROTOBUF_VERSION_SUFFIX "-rc3" +#define PROTOBUF_VERSION_SUFFIX "" #ifdef PROTOBUF_ALWAYS_INLINE #error PROTOBUF_ALWAYS_INLINE was previously defined diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index f7e80dc8e1fda..90a6306f32c58 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -69,7 +69,7 @@ namespace internal { #define GOOGLE_PROTOBUF_VERSION 4024000 // A suffix string for alpha, beta or rc releases. Empty for stable releases. -#define GOOGLE_PROTOBUF_VERSION_SUFFIX "-rc3" +#define GOOGLE_PROTOBUF_VERSION_SUFFIX "" // 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 4b1dd6217f611..d3640ed9e4360 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0-dev", + "protoc_version": "24.0", "lts": false, - "date": "2023-08-01", + "date": "2023-08-08", "languages": { - "cpp": "4.24.0-dev", - "csharp": "3.24.0-dev", - "java": "3.24.0-dev", - "javascript": "3.24.0-dev", - "objectivec": "3.24.0-dev", - "php": "3.24.0-dev", - "python": "4.24.0-dev", - "ruby": "3.24.0-dev" + "cpp": "4.24.0", + "csharp": "3.24.0", + "java": "3.24.0", + "javascript": "3.24.0", + "objectivec": "3.24.0", + "php": "3.24.0", + "python": "4.24.0", + "ruby": "3.24.0" } } } \ No newline at end of file From 8b20d179a95d88dad77c693fa05199880f8c21dc Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 8 Aug 2023 10:26:14 -0700 Subject: [PATCH 27/27] Updating version.json to: 24.1-dev --- version.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/version.json b/version.json index d3640ed9e4360..a4761c2a111f5 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "24.x": { - "protoc_version": "24.0", + "protoc_version": "24.1-dev", "lts": false, "date": "2023-08-08", "languages": { - "cpp": "4.24.0", - "csharp": "3.24.0", - "java": "3.24.0", - "javascript": "3.24.0", - "objectivec": "3.24.0", - "php": "3.24.0", - "python": "4.24.0", - "ruby": "3.24.0" + "cpp": "4.24.1-dev", + "csharp": "3.24.1-dev", + "java": "3.24.1-dev", + "javascript": "3.24.1-dev", + "objectivec": "3.24.1-dev", + "php": "3.24.1-dev", + "python": "4.24.1-dev", + "ruby": "3.24.1-dev" } } } \ No newline at end of file