Skip to content

Commit

Permalink
Sync from Piper @475378801
Browse files Browse the repository at this point in the history
PROTOBUF_SYNC_PIPER
  • Loading branch information
mkruskal-google committed Sep 19, 2022
2 parents 7764c86 + 0264866 commit d85c994
Show file tree
Hide file tree
Showing 170 changed files with 3,395 additions and 3,679 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build --cxxopt=-std=c++14
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
31 changes: 18 additions & 13 deletions .github/workflows/generated_cmake.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
name: Generated CMake File Lists
name: Generate CMake File Lists

on:
- push
- pull_request
push:
branches:
- main
- '[0-9]+.x'
# The 21.x branch predates support for auto-generation of the CMake file
# lists, so we make sure to exclude it.
- '!21.x'

jobs:
cmake:
if: github.repository == 'protocolbuffers/protobuf'
runs-on: ubuntu-latest

strategy:
fail-fast: false # Don't cancel all jobs if one fails.

steps:
- uses: actions/checkout@v2
- name: Set up Bazel read-only caching
run: echo "BAZEL_CACHE_AUTH=--remote_upload_local_results=false" >> $GITHUB_ENV
- name: Generate CMake files
run: cd ${{ github.workspace }} && bazel build //pkg:gen_src_file_lists --test_output=errors $BAZEL_CACHE $BAZEL_CACHE_AUTH
- name: Compare to Golden file
run: diff -du bazel-bin/pkg/src_file_lists.cmake src/file_lists.cmake
- name: Report
run: echo "::error file=cmake/update_file_lists.sh::CMake files are stale, please run cmake/update_file_lists.sh"
if: failure()
- uses: actions/checkout@v3
with:
# Note: this token has an expiration date, so if the workflow starts
# failing then you may need to generate a fresh token.
token: ${{ secrets.BOT_ACCESS_TOKEN }}
- name: Configure name and email address in Git
run: cd ${{ github.workspace }} && git config user.name "Protobuf Team Bot" && git config user.email "protobuf-team-bot@google.com"
- name: Commit and push update
run: cd ${{ github.workspace }} && ./cmake/push_auto_update.sh
10 changes: 0 additions & 10 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,8 @@ alias(
proto_lang_toolchain(
name = "cc_toolchain",
blacklisted_protos = [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:api_proto",
"@com_google_protobuf//:compiler_plugin_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:source_context_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:type_proto",
"@com_google_protobuf//:wrappers_proto",
],
command_line = "--cpp_out=$(OUT)",
runtime = ":protobuf",
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
Compiler
* Print full path name of source .proto file on error

2022-09-13 version 21.6 (C++/Java/Python/PHP/Objective-C/C#/Ruby)

C++
* Reduce memory consumption of MessageSet parsing

2022-08-09 version 21.5 (C++/Java/Python/PHP/Objective-C/C#/Ruby)

PHP
Expand Down
29 changes: 25 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ endif()
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
# Honor visibility properties for all target types.
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()

# Project
project(protobuf C CXX)
Expand All @@ -32,15 +36,32 @@ if(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE)
get_filename_component(protobuf_SOURCE_DIR ${protobuf_SOURCE_DIR} DIRECTORY)
endif()

# Add c++14 flags
if (CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14")
else()
# Add C++14 flags
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CYGWIN)
string(REGEX_MATCH "-std=gnu\\+\\+([0-9]+)" _protobuf_CXX_STD "${CMAKE_CXX_FLAGS}")
endif()
if(NOT _protobuf_CXX_STD)
set(_protobuf_CXX_STD "${CMAKE_CXX_STANDARD}")
endif()
if(_protobuf_CXX_STD LESS "14")
message(FATAL_ERROR "Protocol Buffers requires at least C++14, but is configured for C++${_protobuf_CXX_STD}")
endif()
if(CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++${_protobuf_CXX_STD}")
else()
set(CMAKE_CXX_STANDARD ${_protobuf_CXX_STD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

# For -fvisibility=hidden and -fvisibility-inlines-hidden
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

# The Intel compiler isn't able to deal with noinline member functions of
# template classes defined in headers. As such it spams the output with
# warning #2196: routine is both "inline" and "noinline"
Expand Down
2 changes: 1 addition & 1 deletion Protobuf.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
s.version = '3.21.5'
s.version = '3.21.6'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = 'BSD-3-Clause'
Expand Down
2 changes: 1 addition & 1 deletion conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Ruby:
JRuby:

$ [[ $(ruby --version) == "jruby"* ]] || echo "Switch to Java Ruby!"
$ bazel test //ruby:conformance_test --define=ruby_platform=java \
$ bazel test //ruby:conformance_test_jruby --define=ruby_platform=java \
--action_env=PATH --action_env=GEM_PATH --action_env=GEM_HOME

Testing other Protocol Buffer implementations
Expand Down
2 changes: 1 addition & 1 deletion csharp/Google.Protobuf.Tools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
<version>3.21.5</version>
<version>3.21.6</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl>
Expand Down
10 changes: 8 additions & 2 deletions csharp/src/Google.Protobuf.Test/JsonParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ public void NumberToDouble_Invalid(string jsonValue)
[TestCase("-3.402823e38", -3.402823e38f)]
[TestCase("1.5e1", 15f)]
[TestCase("15e-1", 1.5f)]
[TestCase("3.4028235e38", float.MaxValue)]
[TestCase("-3.4028235e38", float.MinValue)]
[TestCase("3.4028235e+38", float.MaxValue)]
[TestCase("-3.4028235e+38", float.MinValue)]
public void NumberToFloat_Valid(string jsonValue, float expectedParsedValue)
{
string json = "{ \"singleFloat\": " + jsonValue + "}";
Expand All @@ -584,8 +588,10 @@ public void NumberToFloat_Valid(string jsonValue, float expectedParsedValue)
}

[Test]
[TestCase("3.402824e38", typeof(InvalidProtocolBufferException))]
[TestCase("-3.402824e38", typeof(InvalidProtocolBufferException))]
[TestCase("3.4028236e38", typeof(InvalidProtocolBufferException))]
[TestCase("-3.4028236e38", typeof(InvalidProtocolBufferException))]
[TestCase("3.4028236e+38", typeof(InvalidProtocolBufferException))]
[TestCase("-3.4028236e+38", typeof(InvalidProtocolBufferException))]
[TestCase("1,0", typeof(InvalidJsonException))]
[TestCase("1.0.0", typeof(InvalidJsonException))]
[TestCase("+1", typeof(InvalidJsonException))]
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Google.Protobuf/Google.Protobuf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.21.5</VersionPrefix>
<VersionPrefix>3.21.6</VersionPrefix>
<LangVersion>10.0</LangVersion>
<Authors>Google Inc.</Authors>
<TargetFrameworks>netstandard1.1;netstandard2.0;net45;net50</TargetFrameworks>
Expand Down
16 changes: 6 additions & 10 deletions csharp/src/Google.Protobuf/JsonParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -642,19 +642,15 @@ private static object ParseSingleNumberValue(FieldDescriptor field, JsonToken to
{
return float.NaN;
}
if (value > float.MaxValue || value < float.MinValue)
float converted = (float) value;
// If the value is out of range of float, the cast representation will be infinite.
// If the original value was infinite as well, that's fine - we'll return the 32-bit
// version (with the correct sign).
if (float.IsInfinity(converted) && !double.IsInfinity(value))
{
if (double.IsPositiveInfinity(value))
{
return float.PositiveInfinity;
}
if (double.IsNegativeInfinity(value))
{
return float.NegativeInfinity;
}
throw new InvalidProtocolBufferException($"Value out of range: {value}");
}
return (float) value;
return converted;
case FieldType.Enum:
CheckInteger(value);
// Just return it as an int, and let the CLR convert it.
Expand Down
8 changes: 4 additions & 4 deletions csharp/src/Google.Protobuf/Reflection/Descriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6641,6 +6641,10 @@ public void ClearDeprecated() {

private bool mapEntry_;
/// <summary>
/// NOTE: Do not set the option in .proto files. Always use the maps syntax
/// instead. The option should only be implicitly set by the proto compiler
/// parser.
///
/// Whether the message is an automatically generated map entry type for the
/// maps field.
///
Expand All @@ -6658,10 +6662,6 @@ public void ClearDeprecated() {
/// use a native map in the target language to hold the keys and values.
/// The reflection APIs in such implementations still need to work as
/// if the field is a repeated message field.
///
/// NOTE: Do not set the option in .proto files. Always use the maps syntax
/// instead. The option should only be implicitly set by the proto compiler
/// parser.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
Expand Down
4 changes: 4 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,7 @@ with info about your project (name and website) so we can add an entry for you.
1. mypy-protobuf
* Website: https://github.com/nipunn1313/mypy-protobuf
* Extension: 1151-1154

1. Pigweed protobuf compiler
* Website: https://pigweed.dev/pw_protobuf
* Extension: 1155
1 change: 1 addition & 0 deletions examples/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
6 changes: 3 additions & 3 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are using Maven, use the following:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</dependency>
```

Expand All @@ -37,15 +37,15 @@ protobuf-java-util package:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</dependency>
```

### Gradle

If you are using Gradle, add the following to your `build.gradle` file's dependencies:
```
implementation 'com.google.protobuf:protobuf-java:3.21.5'
implementation 'com.google.protobuf:protobuf-java:3.21.6'
```
Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using.

Expand Down
2 changes: 1 addition & 1 deletion java/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
<packaging>pom</packaging>

<name>Protocol Buffers [BOM]</name>
Expand Down
2 changes: 1 addition & 1 deletion java/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</parent>

<artifactId>protobuf-java</artifactId>
Expand Down
25 changes: 12 additions & 13 deletions java/core/src/main/java/com/google/protobuf/TextFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ private TextFormat() {}

private static final String DEBUG_STRING_SILENT_MARKER = "\t ";


/**
* Outputs a textual representation of the Protocol Message supplied into the parameter output.
* (This representation is the new version of the classic "ProtocolPrinter" output from the
Expand Down Expand Up @@ -739,9 +738,9 @@ private void printSingleField(
// Groups must be serialized with their original capitalization.
generator.print(field.getMessageType().getName());
} else {
generator.print(field.getName());
}
generator.print(field.getName());
}
}

if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
generator.print(" {");
Expand Down Expand Up @@ -1836,16 +1835,16 @@ private void mergeField(
extension = target.findExtensionByName(extensionRegistry, name);

if (extension == null) {
String message =
(tokenizer.getPreviousLine() + 1)
+ ":"
+ (tokenizer.getPreviousColumn() + 1)
+ ":\t"
+ type.getFullName()
+ ".["
+ name
+ "]";
unknownFields.add(new UnknownField(message, UnknownField.Type.EXTENSION));
String message =
(tokenizer.getPreviousLine() + 1)
+ ":"
+ (tokenizer.getPreviousColumn() + 1)
+ ":\t"
+ type.getFullName()
+ ".["
+ name
+ "]";
unknownFields.add(new UnknownField(message, UnknownField.Type.EXTENSION));
} else {
if (extension.descriptor.getContainingType() != type) {
throw tokenizer.parseExceptionPreviousToken(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,3 @@ message ReservedAsMapFieldWithEnumValue {
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}
package map_for_proto2_lite_test;
option java_package = "map_lite_test";
option optimize_for = LITE_RUNTIME;
2 changes: 1 addition & 1 deletion java/kotlin-lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</parent>

<artifactId>protobuf-kotlin-lite</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</parent>

<artifactId>protobuf-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protobuf Java Lite runtime. If you are using Maven, include the following:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-javalite</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion java/lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</parent>

<artifactId>protobuf-javalite</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
<packaging>pom</packaging>

<name>Protocol Buffers [Parent]</name>
Expand Down
2 changes: 1 addition & 1 deletion java/util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.5</version>
<version>3.21.6</version>
</parent>

<artifactId>protobuf-java-util</artifactId>
Expand Down
Loading

0 comments on commit d85c994

Please sign in to comment.