Merge branch '3.6.x' into merge-3-6-x

This commit is contained in:
Adam Cozzette 2018-06-25 13:22:10 -07:00
commit 82d3d7d250
59 changed files with 628 additions and 93 deletions

View File

@ -1,3 +1,91 @@
2018-06-01 version 3.6.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
C++
* Starting from this release, we now require C++11. For those we cannot yet
upgrade to C++11, we will try to keep the 3.5.x branch updated with
critical bug fixes only. If you have any concerns about this, please
comment on issue #2780.
* Moved to C++11 types like std::atomic and std::unique_ptr and away from our
old custom-built equivalents.
* Added support for repeated message fields in lite protos using implicit
weak fields. This is an experimental feature that allows the linker to
strip out more unused messages than previously was possible.
* Fixed SourceCodeInfo for interpreted options and extension range options.
* Fixed always_print_enums_as_ints option for JSON serialization.
* Added support for ignoring unknown enum values when parsing JSON.
* Create std::string in Arena memory.
* Fixed ValidateDateTime to correctly check the day.
* Fixed bug in ZeroCopyStreamByteSink.
* Various other cleanups and fixes.
Java
* Dropped support for Java 6.
* Added a UTF-8 decoder that uses Unsafe to directly decode a byte buffer.
* Added deprecation annotations to generated code for deprecated oneof
fields.
* Fixed map field serialization in DynamicMessage.
* Cleanup and documentation for Java Lite runtime.
* Various other fixes and cleanups
* Fixed unboxed arraylists to handle an edge case
* Improved performance for copying between unboxed arraylists
* Fixed lite protobuf to avoid Java compiler warnings
* Improved test coverage for lite runtime
* Performance improvements for lite runtime
Python
* Fixed bytes/string map key incompatibility between C++ and pure-Python
implementations (issue #4029)
* Added __init__.py files to compiler and util subpackages
* Use /MT for all Windows versions
* Fixed an issue affecting the Python-C++ implementation when used with
Cython (issue #2896)
* Various text format fixes
* Various fixes to resolve behavior differences between the pure-Python and
Python-C++ implementations
PHP
* Added php_metadata_namespace to control the file path of generated metadata
file.
* Changed generated classes of nested message/enum. E.g., Foo.Bar, which
previously generates Foo_Bar, now generates Foo/Bar
* Added array constructor. When creating a message, users can pass a php
array whose content is field name to value pairs into constructor. The
created message will be initialized according to the array. Note that
message field should use a message value instead of a sub-array.
* Various bug fixes.
Objective-C
* We removed some helper class methods from GPBDictionary to shrink the size
of the library, the functionary is still there, but you may need to do some
specific +alloc / -init… methods instead.
* Minor improvements in the performance of object field getters/setters by
avoiding some memory management overhead.
* Fix a memory leak during the raising of some errors.
* Make header importing completely order independent.
* Small code improvements for things the undefined behaviors compiler option
was flagging.
Ruby
* Added ruby_package file option to control the module of generated class.
* Various bug fixes.
Javascript
* Allow setting string to int64 field.
Csharp
* Unknown fields are now parsed and then sent back on the wire. They can be
discarded at parse time via a CodedInputStream option.
* Movement towards working with .NET 3.5 and Unity
* Expression trees are no longer used
* AOT generics issues in Unity/il2cpp have a workaround (see this commit for
details)
* Floating point values are now compared bitwise (affects NaN value
comparisons)
* The default size limit when parsing is now 2GB rather than 64MB
* MessageParser now supports parsing from a slice of a byte array
* JSON list parsing now accepts null values where the underlying proto
representation does
2017-12-20 version 3.5.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) 2017-12-20 version 3.5.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Planned Future Changes Planned Future Changes
* Make C++ implementation C++11 only: we plan to require C++11 to build * Make C++ implementation C++11 only: we plan to require C++11 to build

View File

@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library. # dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Protobuf' s.name = 'Protobuf'
s.version = '3.5.2' s.version = '3.6.0'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/google/protobuf' s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License' s.license = '3-Clause BSD License'

View File

@ -16,6 +16,12 @@ environment:
BUILD_DLL: ON BUILD_DLL: ON
UNICODE: ON UNICODE: ON
- platform: Win64
language: cpp
image: Visual Studio 2017
BUILD_DLL: OFF
UNICODE: ON
- platform: Win64 - platform: Win64
language: csharp language: csharp
image: Visual Studio 2017 image: Visual Studio 2017

View File

@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release # In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.) # the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[3.5.2],[protobuf@googlegroups.com],[protobuf]) AC_INIT([Protocol Buffers],[3.6.0],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable]) AM_MAINTAINER_MODE([enable])

View File

@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title> <title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary> <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description> <description>See project site for more info.</description>
<version>3.5.2</version> <version>3.6.0</version>
<authors>Google Inc.</authors> <authors>Google Inc.</authors>
<owners>protobuf-packages</owners> <owners>protobuf-packages</owners>
<licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl> <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>

View File

@ -4,7 +4,7 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description> <Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright> <Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle> <AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.5.2</VersionPrefix> <VersionPrefix>3.6.0</VersionPrefix>
<Authors>Google Inc.</Authors> <Authors>Google Inc.</Authors>
<TargetFrameworks>netstandard1.0;net45</TargetFrameworks> <TargetFrameworks>netstandard1.0;net45</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>

View File

@ -34,10 +34,6 @@ using Google.Protobuf.Compatibility;
using System; using System;
using System.Reflection; using System.Reflection;
#if NET35
using Google.Protobuf.Compatibility;
#endif
namespace Google.Protobuf.Reflection namespace Google.Protobuf.Reflection
{ {
/// <summary> /// <summary>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.5.2</version> <version>3.6.0</version>
</parent> </parent>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>

View File

@ -11,7 +11,7 @@
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.5.2</version> <version>3.6.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name> <name>Protocol Buffers [Parent]</name>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.5.2</version> <version>3.6.0</version>
</parent> </parent>
<artifactId>protobuf-java-util</artifactId> <artifactId>protobuf-java-util</artifactId>

View File

@ -443,7 +443,8 @@ jspb.Map.prototype.serializeBinary = function(
/** /**
* Read one key/value message from the given BinaryReader. Compatible as the * Read one key/value message from the given BinaryReader. Compatible as the
* `reader` callback parameter to jspb.BinaryReader.readMessage, to be called * `reader` callback parameter to jspb.BinaryReader.readMessage, to be called
* when a key/value pair submessage is encountered. * when a key/value pair submessage is encountered. If the Key is undefined,
* we should default it to 0.
* @template K, V * @template K, V
* @param {!jspb.Map} map * @param {!jspb.Map} map
* @param {!jspb.BinaryReader} reader * @param {!jspb.BinaryReader} reader
@ -457,12 +458,17 @@ jspb.Map.prototype.serializeBinary = function(
* readMessage, in which case the second callback arg form is used. * readMessage, in which case the second callback arg form is used.
* *
* @param {?function(V,!jspb.BinaryReader)=} opt_valueReaderCallback * @param {?function(V,!jspb.BinaryReader)=} opt_valueReaderCallback
* The BinaryReader parsing callback for type V, if V is a message type. * The BinaryReader parsing callback for type V, if V is a message type
*
* @param {K=} opt_defaultKey
* The default value for the type of map keys. Accepting map
* entries with unset keys is required for maps to be backwards compatible
* with the repeated message representation described here: goo.gl/zuoLAC
* *
*/ */
jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn, jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn,
opt_valueReaderCallback) { opt_valueReaderCallback, opt_defaultKey) {
var key = undefined; var key = opt_defaultKey;
var value = undefined; var value = undefined;
while (reader.nextField()) { while (reader.nextField()) {
@ -470,6 +476,7 @@ jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn,
break; break;
} }
var field = reader.getFieldNumber(); var field = reader.getFieldNumber();
if (field == 1) { if (field == 1) {
// Key. // Key.
key = keyReaderFn.call(reader); key = keyReaderFn.call(reader);

View File

@ -35,6 +35,11 @@ goog.require('goog.userAgent');
goog.require('proto.jspb.test.MapValueEnum'); goog.require('proto.jspb.test.MapValueEnum');
goog.require('proto.jspb.test.MapValueMessage'); goog.require('proto.jspb.test.MapValueMessage');
goog.require('proto.jspb.test.TestMapFields'); goog.require('proto.jspb.test.TestMapFields');
goog.require('proto.jspb.test.TestMapFieldsOptionalKeys');
goog.require('proto.jspb.test.MapEntryOptionalKeysStringKey');
goog.require('proto.jspb.test.MapEntryOptionalKeysInt32Key');
goog.require('proto.jspb.test.MapEntryOptionalKeysInt64Key');
goog.require('proto.jspb.test.MapEntryOptionalKeysBoolKey');
// CommonJS-LoadFromFile: test_pb proto.jspb.test // CommonJS-LoadFromFile: test_pb proto.jspb.test
goog.require('proto.jspb.test.MapValueMessageNoBinary'); goog.require('proto.jspb.test.MapValueMessageNoBinary');
@ -76,7 +81,7 @@ function toArray(iter) {
* Helper: generate test methods for this TestMapFields class. * Helper: generate test methods for this TestMapFields class.
* @param {?} msgInfo * @param {?} msgInfo
* @param {?} submessageCtor * @param {?} submessageCtor
* @param {!string} suffix * @param {string} suffix
*/ */
function makeTests(msgInfo, submessageCtor, suffix) { function makeTests(msgInfo, submessageCtor, suffix) {
/** /**
@ -260,6 +265,39 @@ function makeTests(msgInfo, submessageCtor, suffix) {
var decoded = msgInfo.deserializeBinary(serialized); var decoded = msgInfo.deserializeBinary(serialized);
checkMapFields(decoded); checkMapFields(decoded);
}); });
/**
* Tests deserialization of undefined map keys go to default values in binary format.
*/
it('testMapDeserializationForUndefinedKeys', function() {
var testMessageOptionalKeys = new proto.jspb.test.TestMapFieldsOptionalKeys();
var mapEntryStringKey = new proto.jspb.test.MapEntryOptionalKeysStringKey();
mapEntryStringKey.setValue("a");
testMessageOptionalKeys.setMapStringString(mapEntryStringKey);
var mapEntryInt32Key = new proto.jspb.test.MapEntryOptionalKeysInt32Key();
mapEntryInt32Key.setValue("b");
testMessageOptionalKeys.setMapInt32String(mapEntryInt32Key);
var mapEntryInt64Key = new proto.jspb.test.MapEntryOptionalKeysInt64Key();
mapEntryInt64Key.setValue("c");
testMessageOptionalKeys.setMapInt64String(mapEntryInt64Key);
var mapEntryBoolKey = new proto.jspb.test.MapEntryOptionalKeysBoolKey();
mapEntryBoolKey.setValue("d");
testMessageOptionalKeys.setMapBoolString(mapEntryBoolKey);
var deserializedMessage = msgInfo.deserializeBinary(
testMessageOptionalKeys.serializeBinary()
);
checkMapEquals(deserializedMessage.getMapStringStringMap(), [
['', 'a']
]);
checkMapEquals(deserializedMessage.getMapInt32StringMap(), [
[0, 'b']
]);
checkMapEquals(deserializedMessage.getMapInt64StringMap(), [
[0, 'c']
]);
checkMapEquals(deserializedMessage.getMapBoolStringMap(), [
[false, 'd']
]);
});
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "google-protobuf", "name": "google-protobuf",
"version": "3.5.2", "version": "3.6.0",
"description": "Protocol Buffers for JavaScript", "description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js", "main": "google-protobuf.js",
"files": [ "files": [

View File

@ -201,6 +201,38 @@ message TestMapFields {
map<string, TestMapFields> map_string_testmapfields = 12; map<string, TestMapFields> map_string_testmapfields = 12;
} }
// These proto are 'mock map' entries to test the above map deserializing with
// undefined keys. Make sure TestMapFieldsOptionalKeys is written to be
// deserialized by TestMapFields
message MapEntryOptionalKeysStringKey {
optional string key = 1;
optional string value = 2;
}
message MapEntryOptionalKeysInt32Key {
optional int32 key = 1;
optional string value = 2;
}
message MapEntryOptionalKeysInt64Key {
optional int64 key = 1;
optional string value = 2;
}
message MapEntryOptionalKeysBoolKey {
optional bool key = 1;
optional string value = 2;
}
message TestMapFieldsOptionalKeys {
optional MapEntryOptionalKeysStringKey map_string_string = 1;
optional MapEntryOptionalKeysInt32Key map_int32_string= 8;
optional MapEntryOptionalKeysInt64Key map_int64_string = 9;
optional MapEntryOptionalKeysBoolKey map_bool_string = 10;
}
// End mock-map entries
enum MapValueEnum { enum MapValueEnum {
MAP_VALUE_FOO = 0; MAP_VALUE_FOO = 0;
MAP_VALUE_BAR = 1; MAP_VALUE_BAR = 1;

View File

@ -0,0 +1,14 @@
#!/bin/bash
set -ex
# change to repo root
cd $(dirname $0)/../../..
source kokoro/release/linux/prepare_build.sh
# ruby environment
source kokoro/release/linux/ruby/ruby_build_environment.sh
# build artifacts
bash kokoro/release/linux/ruby/ruby_build.sh

View File

@ -0,0 +1,16 @@
#!/bin/bash
# Move docker's storage location to scratch disk so we don't run out of space.
echo 'DOCKER_OPTS="${DOCKER_OPTS} --graph=/tmpfs/docker"' | sudo tee --append /etc/default/docker
# Use container registry mirror for pulling docker images (should make downloads faster)
# See https://cloud.google.com/container-registry/docs/using-dockerhub-mirroring
echo 'DOCKER_OPTS="${DOCKER_OPTS} --registry-mirror=https://mirror.gcr.io"' | sudo tee --append /etc/default/docker
sudo service docker restart
# Download Docker images from DockerHub
export DOCKERHUB_ORGANIZATION=grpctesting
# All artifacts come here
mkdir artifacts
export ARTIFACT_DIR=$(pwd)/artifacts

View File

@ -0,0 +1,8 @@
# Configuration for Linux release builds
build_file: "protobuf/kokoro/release/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

View File

@ -0,0 +1,15 @@
#!/bin/bash
# Build protoc
if test ! -e src/protoc; then
./autogen.sh
./configure
make -j4
fi
umask 0022
pushd ruby
bundle install && bundle exec rake gem:native
ls pkg
mv pkg/* $ARTIFACT_DIR
popd

View File

@ -0,0 +1,8 @@
#!/bin/bash
set +ex
[[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh
set -e # rvm commands are very verbose
rvm --default use ruby-2.4.1
gem install bundler --update
set -ex

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -ex
# change to repo root
cd $(dirname $0)/../../..
# all artifacts come here
mkdir artifacts
export ARTIFACT_DIR=$(pwd)/artifacts
# ruby environment
bash kokoro/release/macos/ruby/ruby_build_environment.sh
gem install rubygems-update
update_rubygems
# build artifacts
bash kokoro/release/macos/ruby/ruby_build.sh

View File

@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

View File

@ -0,0 +1,15 @@
#!/bin/bash
# Build protoc
if test ! -e src/protoc; then
./autogen.sh
./configure
make -j4
fi
umask 0022
pushd ruby
bundle install && bundle exec rake gem:native
ls pkg
mv pkg/* $ARTIFACT_DIR
popd

View File

@ -0,0 +1,57 @@
#!/bin/bash
set -ex
set +ex # rvm script is very verbose and exits with errorcode
source $HOME/.rvm/scripts/rvm
set -e # rvm commands are very verbose
time rvm install 2.5.0
rvm use 2.5.0 --default
gem install rake-compiler --no-ri --no-doc
gem install bundler --no-ri --no-doc
rvm osx-ssl-certs status all
rvm osx-ssl-certs update all
set -ex
rm -rf ~/.rake-compiler
CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX)
curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY"
# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details
patch "$CROSS_RUBY" << EOF
--- cross-ruby.rake 2018-04-10 11:32:16.000000000 -0700
+++ patched 2018-04-10 11:40:25.000000000 -0700
@@ -133,8 +133,10 @@
"--host=#{MINGW_HOST}",
"--target=#{MINGW_TARGET}",
"--build=#{RUBY_BUILD}",
- '--enable-shared',
+ '--enable-static',
+ '--disable-shared',
'--disable-install-doc',
+ '--without-gmp',
'--with-ext='
]
@@ -151,6 +153,7 @@
# make
file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t|
chdir File.dirname(t.prerequisites.first) do
+ sh "test -s verconf.h || rm -f verconf.h" # if verconf.h has size 0, make sure it gets re-built by make
sh MAKE
end
end
EOF
MAKE="make -j8"
for v in 2.5.0 2.4.0 2.3.0 2.2.2 2.1.6 2.0.0-p645 ; do
ccache -c
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
done
sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY"
mv "$CROSS_RUBY" ~/.rake-compiler/config.yml

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -x
CXXFLAGS_COMMON="-DNDEBUG -mmacosx-version-min=10.9"
cd github/protobuf
./autogen.sh
mkdir build32 && cd build32
export CXXFLAGS="$CXXFLAGS_COMMON -m32"
../configure --disable-shared
make -j4
file src/protoc
otool -L src/protoc | grep dylib
cd ..
mkdir build64 && cd build64
export CXXFLAGS="$CXXFLAGS_COMMON -m64"
../configure --disable-shared
make -j4
file src/protoc
otool -L src/protoc | grep dylib
cd ..

View File

@ -0,0 +1,8 @@
# Configuration for Mac OSX protoc release builds
build_file: "protobuf/kokoro/release/protoc/macos/build.sh"
action {
define_artifacts {
regex: "**/protoc"
}
}

View File

@ -0,0 +1,27 @@
set PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH%
set generator32=Visual Studio 14
set generator64=Visual Studio 14 Win64
set vcplatform32=win32
set vcplatform64=x64
set configuration=Release
echo Building protoc
cd github\protobuf
mkdir build32
cd build32
cmake -G "%generator32%" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_UNICODE=ON ../cmake
msbuild protobuf.sln /p:Platform=%vcplatform32% || goto error
cd ..
mkdir build64
cd build64
cmake -G "%generator64%" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_UNICODE=ON ../cmake
msbuild protobuf.sln /p:Platform=%vcplatform64% || goto error
cd ..
goto :EOF
:error
echo Failed!
exit /b %ERRORLEVEL%

View File

@ -0,0 +1,8 @@
# Configuration for Windows protoc release builds
build_file: "protobuf/kokoro/release/protoc/windows/build.bat"
action {
define_artifacts {
regex: "**/protoc.exe"
}
}

View File

@ -10,11 +10,11 @@
<email>protobuf-opensource@google.com</email> <email>protobuf-opensource@google.com</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2018-03-06</date> <date>2018-06-06</date>
<time>11:02:07</time> <time>11:02:07</time>
<version> <version>
<release>3.5.2</release> <release>3.6.0</release>
<api>3.5.2</api> <api>3.6.0</api>
</version> </version>
<stability> <stability>
<release>stable</release> <release>stable</release>
@ -229,6 +229,22 @@ GA release.
<time>11:02:07</time> <time>11:02:07</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes> <notes>
G A release.
</notes>
</release>
<release>
<version>
<release>3.6.0</release>
<api>3.6.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2018-06-06</date>
<time>11:02:07</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
G A release. G A release.
</notes> </notes>
</release> </release>

View File

@ -37,7 +37,7 @@
#include "upb.h" #include "upb.h"
#define PHP_PROTOBUF_EXTNAME "protobuf" #define PHP_PROTOBUF_EXTNAME "protobuf"
#define PHP_PROTOBUF_VERSION "3.5.2" #define PHP_PROTOBUF_VERSION "3.6.0"
#define MAX_LENGTH_OF_INT64 20 #define MAX_LENGTH_OF_INT64 20
#define SIZEOF_INT64 8 #define SIZEOF_INT64 8

View File

@ -44,6 +44,7 @@ class Descriptor
private $nested_type = []; private $nested_type = [];
private $enum_type = []; private $enum_type = [];
private $klass; private $klass;
private $legacy_klass;
private $options; private $options;
private $oneof_decl = []; private $oneof_decl = [];
@ -151,6 +152,16 @@ class Descriptor
return $this->klass; return $this->klass;
} }
public function setLegacyClass($klass)
{
$this->legacy_klass = $klass;
}
public function getLegacyClass()
{
return $this->legacy_klass;
}
public function setOptions($options) public function setOptions($options)
{ {
$this->options = $options; $this->options = $options;
@ -167,16 +178,19 @@ class Descriptor
$message_name_without_package = ""; $message_name_without_package = "";
$classname = ""; $classname = "";
$legacy_classname = "";
$fullname = ""; $fullname = "";
GPBUtil::getFullClassName( GPBUtil::getFullClassName(
$proto, $proto,
$containing, $containing,
$file_proto, $file_proto,
$message_name_without_package, $message_name_without_package,
$legacy_classname,
$classname, $classname,
$fullname); $fullname);
$desc->setFullName($fullname); $desc->setFullName($fullname);
$desc->setClass($classname); $desc->setClass($classname);
$desc->setLegacyClass($legacy_classname);
$desc->setOptions($proto->getOptions()); $desc->setOptions($proto->getOptions());
foreach ($proto->getField() as $field_proto) { foreach ($proto->getField() as $field_proto) {

View File

@ -92,6 +92,7 @@ class DescriptorPool
$this->proto_to_class[$descriptor->getFullName()] = $this->proto_to_class[$descriptor->getFullName()] =
$descriptor->getClass(); $descriptor->getClass();
$this->class_to_desc[$descriptor->getClass()] = $descriptor; $this->class_to_desc[$descriptor->getClass()] = $descriptor;
$this->class_to_desc[$descriptor->getLegacyClass()] = $descriptor;
foreach ($descriptor->getNestedType() as $nested_type) { foreach ($descriptor->getNestedType() as $nested_type) {
$this->addDescriptor($nested_type); $this->addDescriptor($nested_type);
} }
@ -105,6 +106,7 @@ class DescriptorPool
$this->proto_to_class[$descriptor->getFullName()] = $this->proto_to_class[$descriptor->getFullName()] =
$descriptor->getClass(); $descriptor->getClass();
$this->class_to_enum_desc[$descriptor->getClass()] = $descriptor; $this->class_to_enum_desc[$descriptor->getClass()] = $descriptor;
$this->class_to_enum_desc[$descriptor->getLegacyClass()] = $descriptor;
} }
public function getDescriptorByClassName($klass) public function getDescriptorByClassName($klass)

View File

@ -9,6 +9,7 @@ class EnumDescriptor
use HasPublicDescriptorTrait; use HasPublicDescriptorTrait;
private $klass; private $klass;
private $legacy_klass;
private $full_name; private $full_name;
private $value; private $value;
private $name_to_value; private $name_to_value;
@ -66,12 +67,23 @@ class EnumDescriptor
return $this->klass; return $this->klass;
} }
public function setLegacyClass($klass)
{
$this->legacy_klass = $klass;
}
public function getLegacyClass()
{
return $this->legacy_klass;
}
public static function buildFromProto($proto, $file_proto, $containing) public static function buildFromProto($proto, $file_proto, $containing)
{ {
$desc = new EnumDescriptor(); $desc = new EnumDescriptor();
$enum_name_without_package = ""; $enum_name_without_package = "";
$classname = ""; $classname = "";
$legacy_classname = "";
$fullname = ""; $fullname = "";
GPBUtil::getFullClassName( GPBUtil::getFullClassName(
$proto, $proto,
@ -79,9 +91,11 @@ class EnumDescriptor
$file_proto, $file_proto,
$enum_name_without_package, $enum_name_without_package,
$classname, $classname,
$legacy_classname,
$fullname); $fullname);
$desc->setFullName($fullname); $desc->setFullName($fullname);
$desc->setClass($classname); $desc->setClass($classname);
$desc->setLegacyClass($legacy_classname);
$values = $proto->getValue(); $values = $proto->getValue();
foreach ($values as $value) { foreach ($values as $value) {
$desc->addValue($value->getNumber(), $value); $desc->addValue($value->getNumber(), $value);

View File

@ -215,9 +215,10 @@ class GPBUtil
"Expect repeated field of different type."); "Expect repeated field of different type.");
} }
if ($var->getType() === GPBType::MESSAGE && if ($var->getType() === GPBType::MESSAGE &&
$var->getClass() !== $klass) { $var->getClass() !== $klass &&
$var->getLegacyClass() !== $klass) {
throw new \Exception( throw new \Exception(
"Expect repeated field of different message."); "Expect repeated field of " . $klass . ".");
} }
return $var; return $var;
} }
@ -242,9 +243,10 @@ class GPBUtil
throw new \Exception("Expect map field of value type."); throw new \Exception("Expect map field of value type.");
} }
if ($var->getValueType() === GPBType::MESSAGE && if ($var->getValueType() === GPBType::MESSAGE &&
$var->getValueClass() !== $klass) { $var->getValueClass() !== $klass &&
$var->getLegacyValueClass() !== $klass) {
throw new \Exception( throw new \Exception(
"Expect map field of different value message."); "Expect map field of " . $klass . ".");
} }
return $var; return $var;
} }
@ -299,6 +301,17 @@ class GPBUtil
return ""; return "";
} }
public static function getLegacyClassNameWithoutPackage(
$name,
$file_proto)
{
$parts = explode('.', $name);
foreach ($parts as $i => $part) {
$parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i];
}
return implode('\\', $parts);
}
public static function getClassNameWithoutPackage( public static function getClassNameWithoutPackage(
$name, $name,
$file_proto) $file_proto)
@ -316,6 +329,7 @@ class GPBUtil
$file_proto, $file_proto,
&$message_name_without_package, &$message_name_without_package,
&$classname, &$classname,
&$legacy_classname,
&$fullname) &$fullname)
{ {
// Full name needs to start with '.'. // Full name needs to start with '.'.
@ -334,21 +348,28 @@ class GPBUtil
$class_name_without_package = $class_name_without_package =
static::getClassNameWithoutPackage($message_name_without_package, $file_proto); static::getClassNameWithoutPackage($message_name_without_package, $file_proto);
$legacy_class_name_without_package =
static::getLegacyClassNameWithoutPackage(
$message_name_without_package, $file_proto);
$option = $file_proto->getOptions(); $option = $file_proto->getOptions();
if (!is_null($option) && $option->hasPhpNamespace()) { if (!is_null($option) && $option->hasPhpNamespace()) {
$namespace = $option->getPhpNamespace(); $namespace = $option->getPhpNamespace();
if ($namespace !== "") { if ($namespace !== "") {
$classname = $namespace . "\\" . $class_name_without_package; $classname = $namespace . "\\" . $class_name_without_package;
$legacy_classname =
$namespace . "\\" . $legacy_class_name_without_package;
return; return;
} else { } else {
$classname = $class_name_without_package; $classname = $class_name_without_package;
$legacy_classname = $legacy_class_name_without_package;
return; return;
} }
} }
if ($package === "") { if ($package === "") {
$classname = $class_name_without_package; $classname = $class_name_without_package;
$legacy_classname = $legacy_class_name_without_package;
} else { } else {
$parts = array_map('ucwords', explode('.', $package)); $parts = array_map('ucwords', explode('.', $package));
foreach ($parts as $i => $part) { foreach ($parts as $i => $part) {
@ -358,6 +379,9 @@ class GPBUtil
implode('\\', $parts) . implode('\\', $parts) .
"\\".self::getClassNamePrefix($class_name_without_package,$file_proto). "\\".self::getClassNamePrefix($class_name_without_package,$file_proto).
$class_name_without_package; $class_name_without_package;
$legacy_classname =
implode('\\', array_map('ucwords', explode('.', $package))).
"\\".$legacy_class_name_without_package;
} }
} }

View File

@ -58,7 +58,11 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
/** /**
* @ignore * @ignore
*/ */
private $value_klass; private $klass;
/**
* @ignore
*/
private $legacy_klass;
/** /**
* Constructs an instance of MapField. * Constructs an instance of MapField.
@ -75,6 +79,17 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
$this->key_type = $key_type; $this->key_type = $key_type;
$this->value_type = $value_type; $this->value_type = $value_type;
$this->klass = $klass; $this->klass = $klass;
if ($this->value_type == GPBType::MESSAGE) {
$pool = DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass);
if ($desc == NULL) {
new $klass; // No msg class instance has been created before.
$desc = $pool->getDescriptorByClassName($klass);
}
$this->klass = $desc->getClass();
$this->legacy_klass = $desc->getLegacyClass();
}
} }
/** /**
@ -101,6 +116,14 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
return $this->klass; return $this->klass;
} }
/**
* @ignore
*/
public function getLegacyValueClass()
{
return $this->legacy_klass;
}
/** /**
* Return the element at the given key. * Return the element at the given key.
* *

View File

@ -59,6 +59,10 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
* @ignore * @ignore
*/ */
private $klass; private $klass;
/**
* @ignore
*/
private $legacy_klass;
/** /**
* Constructs an instance of RepeatedField. * Constructs an instance of RepeatedField.
@ -71,7 +75,16 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
{ {
$this->container = []; $this->container = [];
$this->type = $type; $this->type = $type;
$this->klass = $klass; if ($this->type == GPBType::MESSAGE) {
$pool = DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass);
if ($desc == NULL) {
new $klass; // No msg class instance has been created before.
$desc = $pool->getDescriptorByClassName($klass);
}
$this->klass = $desc->getClass();
$this->legacy_klass = $desc->getLegacyClass();
}
} }
/** /**
@ -90,6 +103,14 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
return $this->klass; return $this->klass;
} }
/**
* @ignore
*/
public function getLegacyClass()
{
return $this->legacy_klass;
}
/** /**
* Return the element at the given index. * Return the element at the given index.
* *

View File

@ -2,12 +2,14 @@
function use_php() { function use_php() {
VERSION=$1 VERSION=$1
PHP=`which php`
PHP_CONFIG=`which php-config` OLD_PATH=$PATH
PHPIZE=`which phpize` OLD_CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH
ln -sfn "/usr/local/php-${VERSION}/bin/php" $PHP OLD_C_INCLUDE_PATH=$C_INCLUDE_PATH
ln -sfn "/usr/local/php-${VERSION}/bin/php-config" $PHP_CONFIG
ln -sfn "/usr/local/php-${VERSION}/bin/phpize" $PHPIZE export PATH=/usr/local/php-${VERSION}/bin:$OLD_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$OLD_CPLUS_INCLUDE_PATH
export C_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$OLD_C_INCLUDE_PATH
} }
function generate_proto() { function generate_proto() {
@ -18,7 +20,22 @@ function generate_proto() {
mkdir generated mkdir generated
$PROTOC1 --php_out=generated proto/test_include.proto $PROTOC1 --php_out=generated proto/test_include.proto
$PROTOC2 --php_out=generated proto/test.proto proto/test_no_namespace.proto proto/test_prefix.proto $PROTOC2 --php_out=generated \
proto/test.proto \
proto/test_no_namespace.proto \
proto/test_prefix.proto \
proto/test_php_namespace.proto \
proto/test_empty_php_namespace.proto \
proto/test_reserved_enum_lower.proto \
proto/test_reserved_enum_upper.proto \
proto/test_reserved_enum_value_lower.proto \
proto/test_reserved_enum_value_upper.proto \
proto/test_reserved_message_lower.proto \
proto/test_reserved_message_upper.proto \
proto/test_service.proto \
proto/test_service_namespace.proto \
proto/test_descriptors.proto
pushd ../../src pushd ../../src
$PROTOC2 --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto $PROTOC2 --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
popd popd
@ -52,9 +69,9 @@ cd $(dirname $0)
# The old version of protobuf that we are testing compatibility against. # The old version of protobuf that we are testing compatibility against.
case "$1" in case "$1" in
""|3.3.0) ""|3.5.0)
OLD_VERSION=3.3.0 OLD_VERSION=3.5.0
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.3.0/protoc-3.3.0-linux-x86_64.exe OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe
;; ;;
*) *)
echo "[ERROR]: Unknown version number: $1" echo "[ERROR]: Unknown version number: $1"
@ -81,7 +98,7 @@ git checkout v$OLD_VERSION
popd popd
# Build and copy the new runtime # Build and copy the new runtime
use_php 5.5 use_php 7.1
pushd ../ext/google/protobuf pushd ../ext/google/protobuf
make clean || true make clean || true
phpize && ./configure && make phpize && ./configure && make
@ -99,12 +116,12 @@ chmod +x old_protoc
NEW_PROTOC=`pwd`/../../src/protoc NEW_PROTOC=`pwd`/../../src/protoc
OLD_PROTOC=`pwd`/old_protoc OLD_PROTOC=`pwd`/old_protoc
cd protobuf/php cd protobuf/php
cp -r /usr/local/vendor-5.5 vendor composer install
wget https://phar.phpunit.de/phpunit-4.8.0.phar -O /usr/bin/phpunit
# Remove implementation detail tests. # Remove implementation detail tests.
tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php ) tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php )
sed -i.bak '/php_implementation_test.php/d' phpunit.xml sed -i.bak '/php_implementation_test.php/d' phpunit.xml
sed -i.bak '/generated_phpdoc_test.php/d' phpunit.xml
for t in "${tests[@]}" for t in "${tests[@]}"
do do
remove_error_test tests/$t remove_error_test tests/$t
@ -118,7 +135,7 @@ cd tests
generate_proto $OLD_PROTOC $OLD_PROTOC generate_proto $OLD_PROTOC $OLD_PROTOC
./test.sh ./test.sh
pushd .. pushd ..
phpunit ./vendor/bin/phpunit
popd popd
# Test A.2: # Test A.2:
@ -127,7 +144,7 @@ popd
generate_proto $NEW_PROTOC $OLD_PROTOC generate_proto $NEW_PROTOC $OLD_PROTOC
./test.sh ./test.sh
pushd .. pushd ..
phpunit ./vendor/bin/phpunit
popd popd
# Test A.3: # Test A.3:
@ -136,5 +153,5 @@ popd
generate_proto $OLD_PROTOC $NEW_PROTOC generate_proto $OLD_PROTOC $NEW_PROTOC
./test.sh ./test.sh
pushd .. pushd ..
phpunit ./vendor/bin/phpunit
popd popd

View File

@ -27,7 +27,7 @@ fi
set -ex set -ex
LANGUAGES="cpp csharp java javanano js objectivec python ruby php all" LANGUAGES="cpp csharp java js objectivec python ruby php all"
BASENAME=`basename $1 .tar.gz` BASENAME=`basename $1 .tar.gz`
VERSION=${BASENAME:9} VERSION=${BASENAME:9}

View File

@ -10,7 +10,7 @@
</parent> </parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId> <artifactId>protoc</artifactId>
<version>3.5.2</version> <version>3.6.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Protobuf Compiler</name> <name>Protobuf Compiler</name>
<description> <description>

View File

@ -30,7 +30,7 @@
# Copyright 2007 Google Inc. All Rights Reserved. # Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '3.5.2' __version__ = '3.6.0'
if __name__ != '__main__': if __name__ != '__main__':
try: try:

View File

@ -204,11 +204,9 @@ if __name__ == '__main__':
v, _, _ = platform.mac_ver() v, _, _ = platform.mac_ver()
if v: if v:
v = float('.'.join(v.split('.')[:2])) extra_compile_args.append('-std=c++11')
if v >= 10.12:
extra_compile_args.append('-std=c++11')
elif os.getenv('KOKORO_BUILD_NUMBER') or os.getenv('KOKORO_BUILD_ID'): elif os.getenv('KOKORO_BUILD_NUMBER') or os.getenv('KOKORO_BUILD_ID'):
extra_compile_args.append('-std=c++11') extra_compile_args.append('-std=c++11')
if warnings_as_errors in sys.argv: if warnings_as_errors in sys.argv:
extra_compile_args.append('-Werror') extra_compile_args.append('-Werror')

View File

@ -2,7 +2,9 @@
require 'mkmf' require 'mkmf'
$CFLAGS += " -std=c99 -O3 -DNDEBUG" unless RUBY_PLATFORM =~ /mswin|mingw/
$CFLAGS += " -std=c99 -O3 -DNDEBUG"
end
if RUBY_PLATFORM =~ /linux/ if RUBY_PLATFORM =~ /linux/

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "google-protobuf" s.name = "google-protobuf"
s.version = "3.5.2" s.version = "3.6.0"
s.licenses = ["BSD-3-Clause"] s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers" s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format." s.description = "Protocol Buffers are Google's data interchange format."

View File

@ -164,7 +164,7 @@ nobase_include_HEADERS = \
lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la
libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS) libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS)
libprotobuf_lite_la_LDFLAGS = -version-info 15:1:0 -export-dynamic -no-undefined libprotobuf_lite_la_LDFLAGS = -version-info 16:0:0 -export-dynamic -no-undefined
if HAVE_LD_VERSION_SCRIPT if HAVE_LD_VERSION_SCRIPT
libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map libprotobuf_lite_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf-lite.map
EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map EXTRA_libprotobuf_lite_la_DEPENDENCIES = libprotobuf-lite.map
@ -210,7 +210,7 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/io/zero_copy_stream_impl_lite.cc google/protobuf/io/zero_copy_stream_impl_lite.cc
libprotobuf_la_LIBADD = $(PTHREAD_LIBS) libprotobuf_la_LIBADD = $(PTHREAD_LIBS)
libprotobuf_la_LDFLAGS = -version-info 15:1:0 -export-dynamic -no-undefined libprotobuf_la_LDFLAGS = -version-info 16:0:0 -export-dynamic -no-undefined
if HAVE_LD_VERSION_SCRIPT if HAVE_LD_VERSION_SCRIPT
libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map libprotobuf_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotobuf.map
EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map EXTRA_libprotobuf_la_DEPENDENCIES = libprotobuf.map
@ -301,7 +301,7 @@ libprotobuf_la_SOURCES = \
nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES) nodist_libprotobuf_la_SOURCES = $(nodist_libprotobuf_lite_la_SOURCES)
libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la
libprotoc_la_LDFLAGS = -version-info 15:1:0 -export-dynamic -no-undefined libprotoc_la_LDFLAGS = -version-info 16:0:0 -export-dynamic -no-undefined
if HAVE_LD_VERSION_SCRIPT if HAVE_LD_VERSION_SCRIPT
libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map
EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -2962,8 +2962,12 @@ void Generator::GenerateClassDeserializeBinaryField(
if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) {
printer->Print(", $messageType$.deserializeBinaryFromReader", printer->Print(", $messageType$.deserializeBinaryFromReader",
"messageType", GetMessagePath(options, value_field->message_type())); "messageType", GetMessagePath(options, value_field->message_type()));
} else {
printer->Print(", null");
} }
printer->Print(", $defaultKey$",
"defaultKey", JSFieldDefault(key_field)
);
printer->Print(");\n"); printer->Print(");\n");
printer->Print(" });\n"); printer->Print(" });\n");
} else { } else {

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -775,10 +775,10 @@ class FileDescriptorTables {
SymbolsByParentMap symbols_by_parent_; SymbolsByParentMap symbols_by_parent_;
mutable FieldsByNameMap fields_by_lowercase_name_; mutable FieldsByNameMap fields_by_lowercase_name_;
mutable FieldsByNameMap* fields_by_lowercase_name_tmp_; std::unique_ptr<FieldsByNameMap> fields_by_lowercase_name_tmp_;
mutable GoogleOnceDynamic fields_by_lowercase_name_once_; mutable GoogleOnceDynamic fields_by_lowercase_name_once_;
mutable FieldsByNameMap fields_by_camelcase_name_; mutable FieldsByNameMap fields_by_camelcase_name_;
mutable FieldsByNameMap* fields_by_camelcase_name_tmp_; std::unique_ptr<FieldsByNameMap> fields_by_camelcase_name_tmp_;
mutable GoogleOnceDynamic fields_by_camelcase_name_once_; mutable GoogleOnceDynamic fields_by_camelcase_name_once_;
FieldsByNumberMap fields_by_number_; // Not including extensions. FieldsByNumberMap fields_by_number_; // Not including extensions.
EnumValuesByNumberMap enum_values_by_number_; EnumValuesByNumberMap enum_values_by_number_;
@ -1146,10 +1146,8 @@ bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) {
void FileDescriptorTables::FinalizeTables() { void FileDescriptorTables::FinalizeTables() {
// Clean up the temporary maps used by AddFieldByStylizedNames(). // Clean up the temporary maps used by AddFieldByStylizedNames().
delete fields_by_lowercase_name_tmp_; fields_by_lowercase_name_tmp_ = nullptr;
fields_by_lowercase_name_tmp_ = NULL; fields_by_camelcase_name_tmp_ = nullptr;
delete fields_by_camelcase_name_tmp_;
fields_by_camelcase_name_tmp_ = NULL;
} }
void FileDescriptorTables::AddFieldByStylizedNames( void FileDescriptorTables::AddFieldByStylizedNames(
@ -1164,7 +1162,7 @@ void FileDescriptorTables::AddFieldByStylizedNames(
// entries from fields_by_number_. // entries from fields_by_number_.
PointerStringPair lowercase_key(parent, field->lowercase_name().c_str()); PointerStringPair lowercase_key(parent, field->lowercase_name().c_str());
if (!InsertIfNotPresent(fields_by_lowercase_name_tmp_, lowercase_key, if (!InsertIfNotPresent(fields_by_lowercase_name_tmp_.get(), lowercase_key,
field)) { field)) {
InsertIfNotPresent( InsertIfNotPresent(
&fields_by_lowercase_name_, lowercase_key, &fields_by_lowercase_name_, lowercase_key,
@ -1172,7 +1170,7 @@ void FileDescriptorTables::AddFieldByStylizedNames(
} }
PointerStringPair camelcase_key(parent, field->camelcase_name().c_str()); PointerStringPair camelcase_key(parent, field->camelcase_name().c_str());
if (!InsertIfNotPresent(fields_by_camelcase_name_tmp_, camelcase_key, if (!InsertIfNotPresent(fields_by_camelcase_name_tmp_.get(), camelcase_key,
field)) { field)) {
InsertIfNotPresent( InsertIfNotPresent(
&fields_by_camelcase_name_, camelcase_key, &fields_by_camelcase_name_, camelcase_key,

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -335,7 +335,16 @@ struct LIBPROTOBUF_EXPORT SCCInfoBase {
kRunning = 1, kRunning = 1,
kUninitialized = -1, // initial state kUninitialized = -1, // initial state
}; };
#ifndef _MSC_VER
std::atomic<int> visit_status; std::atomic<int> visit_status;
#else
// MSVC doesnt make std::atomic constant initialized. This union trick
// makes it so.
union {
int visit_status_to_make_linker_init;
std::atomic<int> visit_status;
};
#endif
int num_deps; int num_deps;
void (*init_func)(); void (*init_func)();
// This is followed by an array of num_deps // This is followed by an array of num_deps

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -101,27 +101,27 @@ namespace internal {
// The current version, represented as a single integer to make comparison // The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro // easier: major * 10^6 + minor * 10^3 + micro
#define GOOGLE_PROTOBUF_VERSION 3005001 #define GOOGLE_PROTOBUF_VERSION 3006000
// A suffix string for alpha, beta or rc releases. Empty for stable releases. // A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX "" #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
// The minimum library version which works with the current version of the // The minimum library version which works with the current version of the
// headers. // headers.
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3005000 #define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3006000
// The minimum header version which works with the current version of // The minimum header version which works with the current version of
// the library. This constant should only be used by protoc's C++ code // the library. This constant should only be used by protoc's C++ code
// generator. // generator.
static const int kMinHeaderVersionForLibrary = 3005000; static const int kMinHeaderVersionForLibrary = 3006000;
// The minimum protoc version which works with the current version of the // The minimum protoc version which works with the current version of the
// headers. // headers.
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3005000 #define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3006000
// The minimum header version which works with the current version of // The minimum header version which works with the current version of
// protoc. This constant should only be used in VerifyVersion(). // protoc. This constant should only be used in VerifyVersion().
static const int kMinHeaderVersionForProtoc = 3005000; static const int kMinHeaderVersionForProtoc = 3006000;
// Verifies that the headers and libraries are compatible. Use the macro // Verifies that the headers and libraries are compatible. Use the macro
// below to call this. // below to call this.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

View File

@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3005000 #if GOOGLE_PROTOBUF_VERSION < 3006000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.