Merge branch '3.8.x' into 3.8.x-201905311515
This commit is contained in:
commit
634d704d23
71
CHANGES.txt
71
CHANGES.txt
@ -1,3 +1,74 @@
|
||||
2019-04-29 version 3.8.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
C++
|
||||
* Use std::atomic<int32> in case of myriad2 platform
|
||||
* Always declare enums to be int-sized
|
||||
* Added DebugString() and ShortDebugString() methods on MessageLite
|
||||
* Specialized different parse loop control flows
|
||||
* Make hasbits potentially in register. The or's start forming an obstacle because it's a read modify store on the same mem address on each iteration.
|
||||
* Move to an internal MACRO for parser validity checks.
|
||||
* Improve map parsing performance.
|
||||
* Make MergePartialFromCodedStream non virtual. This allows direct calls, potential inlining and is also a code health improvement
|
||||
* Add an overall limit to parse_context to prevent reading past it. This allows to remove a annoying level of indirection.
|
||||
* Fix a mistake, we shouldn't verify map key/value strings for utf8 in opt mode for proto2.
|
||||
* Further improvements to cut binary size.
|
||||
* Prepare to make MergePartialFromCodedStream non-virtual.
|
||||
* A report on some interesting behavior change in python (caused by b/27494216) made me realize there is a check that needs to be done in case the parse ended on a end group tag.
|
||||
* Add a note of caution to the comments around skip in CodedOutputStream.
|
||||
* Simplify end check.
|
||||
* Add overload for ParseMessage for MessageLite/Message types. If the explicit type is not known inlining won't help de-virtualizing the virtual call.
|
||||
* Reduce linker input. It turns out that ParseMessage is not inlined, producing template instantiations that are used only once and save nothing but cost more.
|
||||
* Improve the parser.
|
||||
* [c++17] Changed proto2::RepeatedPtrField iterators to no longer derive from the deprecated std::iterator class.
|
||||
* Change the default value of case_insensitive_enum_parsing to false for JsonStringToMessage.
|
||||
* Add a warning if a field name doesn't match the style guide.
|
||||
* Fix TextFormat not round-trip correctly when float value is max float.
|
||||
* Added locationed info for some errors at compiler
|
||||
* Python reserved keywords are now working with getattr()/setattr() for most descriptors.
|
||||
* Added AllowUnknownField() in text_format
|
||||
* Append '_' to C++ reserved keywords for message, enum, extension
|
||||
* Fix MSVC warning C4244 in protobuf's parse_context.h.
|
||||
* Updating Iterators to be compatible with C++17 in MSVC.
|
||||
* Use capability annotation in mutex.h
|
||||
* Fix "UndefinedBehaviorSanitizer: cfi-bad-type"
|
||||
* CriticalSectionLock class as a lightweight replacement for std::mutex on Windows platforms.
|
||||
* Removed vestigial wire_format_lite_inl.h
|
||||
|
||||
C#
|
||||
* Added System.Memory dependency.
|
||||
|
||||
Java
|
||||
* Make Java protoc code generator ignore optimize_for LITE_RUNTIME. Users should instead use the Java lite protoc plugin.
|
||||
* Change Extension getMessageDefaultInstance() to return Message instead of MessageLite.
|
||||
* Prevent malicious input streams from leaking buffers for ByteString or ByteBuffer parsing.
|
||||
* Release new Javalite runtime.
|
||||
* Show warning in case potential file name conflict.
|
||||
* Allow Java reserved keywords to be used in extensions.
|
||||
* Added setAllowUnknownFields() in text format
|
||||
* Add memoization to ExtensionRegistryLite.getEmptyRegistry()
|
||||
* Improve performance of CodedOutputStream.writeUInt32NoTag
|
||||
* Add an optimized mismatch-finding algorithm to UnsafeUtil.
|
||||
* When serializing uint32 varints, check that we have MAX_VARINT32_SIZE bytes left, not just MAX_VARINT_SIZE.
|
||||
* Minor optimization to RopeByteString.PieceIterator
|
||||
|
||||
JavaScript
|
||||
* Simplify generated toObject code when the default value is used.
|
||||
|
||||
Python
|
||||
* Changes implementation of Name() for enums that allow aliases in proto2 in Python to be in line with claims in C++ implementation (to return first value).
|
||||
* Added double_format option in text format printer.
|
||||
* Added iter and __contains__ to extension dict
|
||||
* Added allow_unknown_field option in python text format parser
|
||||
* Fixed Timestamp.ToDatetime() loses precision issue
|
||||
* Support unknown field in text format printer.
|
||||
* Float field will be convert to inf if bigger than struct.unpack('f', b'\xff\xff\x7f\x7f')[0] which is about 3.4028234664e+38,
|
||||
convert to -inf if smaller than -3.4028234664e+38
|
||||
* Allowed casting str->bytes in Message.__setstate__
|
||||
|
||||
Ruby
|
||||
* Helper methods to get enum name for Ruby.
|
||||
|
||||
|
||||
2019-01-24 version 3.7.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
||||
C++
|
||||
|
@ -1235,6 +1235,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
|
||||
python/release/wheel/protobuf_optimized_pip.sh \
|
||||
python/release/wheel/README.md \
|
||||
six.BUILD \
|
||||
third_party/zlib.BUILD \
|
||||
util/python/BUILD
|
||||
|
||||
|
||||
|
@ -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.7.1'
|
||||
s.version = '3.8.0'
|
||||
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
|
||||
s.homepage = 'https://github.com/protocolbuffers/protobuf'
|
||||
s.license = '3-Clause BSD License'
|
||||
|
@ -17,7 +17,7 @@ AC_PREREQ(2.59)
|
||||
# In the SVN trunk, the version should always be the next anticipated release
|
||||
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
|
||||
# the size of one file name in the dist tarfile over the 99-char limit.)
|
||||
AC_INIT([Protocol Buffers],[3.7.1],[protobuf@googlegroups.com],[protobuf])
|
||||
AC_INIT([Protocol Buffers],[3.8.0],[protobuf@googlegroups.com],[protobuf])
|
||||
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
|
||||
|
@ -51,11 +51,6 @@ Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput
|
||||
Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput
|
||||
Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput
|
||||
Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput
|
||||
Required.Proto3.JsonInput.TimestampJsonInputTooSmall
|
||||
Required.Proto3.JsonInput.TimestampMinValue.JsonOutput
|
||||
Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput
|
||||
Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput
|
||||
Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput
|
||||
Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
|
||||
Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
|
||||
Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
|
||||
|
@ -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.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
<authors>Google Inc.</authors>
|
||||
<owners>protobuf-packages</owners>
|
||||
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
|
||||
|
@ -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.7.1</VersionPrefix>
|
||||
<VersionPrefix>3.8.0</VersionPrefix>
|
||||
<LangVersion>6</LangVersion>
|
||||
<Authors>Google Inc.</Authors>
|
||||
<TargetFrameworks>netstandard1.0;netstandard2.0;net45</TargetFrameworks>
|
||||
@ -32,11 +32,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<PackageReference Include="System.Memory" Version="4.5.2" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.0.0-beta2-18618-05"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-bom</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Protocol Buffers [BOM]</name>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-parent</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-parent</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<version>3.8.0-rc-1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>protobuf-javalite</artifactId>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-parent</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Protocol Buffers [Parent]</name>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-parent</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>protobuf-java-util</artifactId>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "google-protobuf",
|
||||
"version": "3.7.1",
|
||||
"version": "3.8.0",
|
||||
"description": "Protocol Buffers for JavaScript",
|
||||
"main": "google-protobuf.js",
|
||||
"files": [
|
||||
|
@ -10,11 +10,11 @@
|
||||
<email>protobuf-opensource@google.com</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2019-03-25</date>
|
||||
<time>13:23:39</time>
|
||||
<date>2019-05-21</date>
|
||||
<time>14:07:13</time>
|
||||
<version>
|
||||
<release>3.7.1</release>
|
||||
<api>3.7.1</api>
|
||||
<release>3.8.0</release>
|
||||
<api>3.8.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
@ -26,6 +26,7 @@
|
||||
<dir baseinstalldir="/" name="/">
|
||||
<file baseinstalldir="/" name="config.m4" role="src"/>
|
||||
<file baseinstalldir="/" name="array.c" role="src"/>
|
||||
<file baseinstalldir="/" name="builtin_descriptors.inc" role="src"/>
|
||||
<file baseinstalldir="/" name="def.c" role="src"/>
|
||||
<file baseinstalldir="/" name="encode_decode.c" role="src"/>
|
||||
<file baseinstalldir="/" name="map.c" role="src"/>
|
||||
@ -318,5 +319,33 @@ G A release.
|
||||
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
|
||||
<notes>GA release.</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version>
|
||||
<release>3.8.0RC1</release>
|
||||
<api>3.8.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2019-04-23</date>
|
||||
<time>16:14:52</time>
|
||||
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
|
||||
<notes>GA release.</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version>
|
||||
<release>3.8.0</release>
|
||||
<api>3.8.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<date>2019-05-21</date>
|
||||
<time>14:07:13</time>
|
||||
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
|
||||
<notes>GA release.</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "upb.h"
|
||||
|
||||
#define PHP_PROTOBUF_EXTNAME "protobuf"
|
||||
#define PHP_PROTOBUF_VERSION "3.7.1"
|
||||
#define PHP_PROTOBUF_VERSION "3.8.0"
|
||||
|
||||
#define MAX_LENGTH_OF_INT64 20
|
||||
#define SIZEOF_INT64 8
|
||||
|
@ -10460,6 +10460,48 @@ static void start_timestamp_zone(upb_json_parser *p, const char *ptr) {
|
||||
capture_begin(p, ptr);
|
||||
}
|
||||
|
||||
#define EPOCH_YEAR 1970
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
static bool isleap(int year) {
|
||||
return (year % 4) == 0 && (year % 100 != 0 || (year % 400) == 0);
|
||||
}
|
||||
|
||||
const unsigned short int __mon_yday[2][13] = {
|
||||
/* Normal years. */
|
||||
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
|
||||
/* Leap years. */
|
||||
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
|
||||
};
|
||||
|
||||
int64_t epoch(int year, int yday, int hour, int min, int sec) {
|
||||
int64_t years = year - EPOCH_YEAR;
|
||||
|
||||
int64_t leap_days = years / 4 - years / 100 + years / 400;
|
||||
|
||||
int64_t days = years * 365 + yday + leap_days;
|
||||
int64_t hours = days * 24 + hour;
|
||||
int64_t mins = hours * 60 + min;
|
||||
int64_t secs = mins * 60 + sec;
|
||||
return secs;
|
||||
}
|
||||
|
||||
|
||||
static int64_t upb_mktime(const struct tm *tp) {
|
||||
int sec = tp->tm_sec;
|
||||
int min = tp->tm_min;
|
||||
int hour = tp->tm_hour;
|
||||
int mday = tp->tm_mday;
|
||||
int mon = tp->tm_mon;
|
||||
int year = tp->tm_year + TM_YEAR_BASE;
|
||||
|
||||
/* Calculate day of year from year, month, and day of month. */
|
||||
int mon_yday = ((__mon_yday[isleap(year)][mon]) - 1);
|
||||
int yday = mon_yday + mday;
|
||||
|
||||
return epoch(year, yday, hour, min, sec);
|
||||
}
|
||||
|
||||
static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
|
||||
size_t len;
|
||||
const char *buf;
|
||||
@ -10487,7 +10529,7 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
|
||||
}
|
||||
|
||||
/* Normalize tm */
|
||||
seconds = mktime(&p->tm);
|
||||
seconds = upb_mktime(&p->tm);
|
||||
|
||||
/* Check timestamp boundary */
|
||||
if (seconds < -62135596800) {
|
||||
|
@ -55,7 +55,7 @@ class DescriptorPool
|
||||
return self::$pool;
|
||||
}
|
||||
|
||||
public function internalAddGeneratedFile($data)
|
||||
public function internalAddGeneratedFile($data, $use_nested = false)
|
||||
{
|
||||
$files = new FileDescriptorSet();
|
||||
$files->mergeFromString($data);
|
||||
|
@ -24,3 +24,14 @@ message TestWrapperSetters {
|
||||
|
||||
map<string, google.protobuf.StringValue> map_string_value = 13;
|
||||
}
|
||||
|
||||
message TestWrapperAccessorConflicts {
|
||||
int32 normal_vs_wrapper_value = 1;
|
||||
google.protobuf.Int32Value normal_vs_wrapper = 2;
|
||||
|
||||
int32 normal_vs_normal_value = 3;
|
||||
int32 normal_vs_normal = 4;
|
||||
|
||||
google.protobuf.Int32Value wrapper_vs_wrapper_value = 5;
|
||||
google.protobuf.Int32Value wrapper_vs_wrapper = 6;
|
||||
}
|
||||
|
@ -16,6 +16,44 @@ use Google\Protobuf\UInt64Value;
|
||||
|
||||
class WrapperTypeSettersTest extends TestBase
|
||||
{
|
||||
public function testConflictNormalVsWrapper()
|
||||
{
|
||||
$m = new Foo\TestWrapperAccessorConflicts();
|
||||
|
||||
$m->setNormalVsWrapperValue1(1);
|
||||
$this->assertSame(1, $m->getNormalVsWrapperValue1());
|
||||
|
||||
$m->setNormalVsWrapperValue2(1);
|
||||
$this->assertSame(1, $m->getNormalVsWrapperValue2());
|
||||
|
||||
$wrapper = new Int32Value(["value" => 1]);
|
||||
$m->setNormalVsWrapper($wrapper);
|
||||
$this->assertSame(1, $m->getNormalVsWrapper()->getValue());
|
||||
}
|
||||
|
||||
public function testConflictNormalVsNormal()
|
||||
{
|
||||
$m = new Foo\TestWrapperAccessorConflicts();
|
||||
|
||||
$m->setNormalVsNormalValue(1);
|
||||
$this->assertSame(1, $m->getNormalVsNormalValue());
|
||||
|
||||
$m->setNormalVsNormal(1);
|
||||
$this->assertSame(1, $m->getNormalVsNormal());
|
||||
}
|
||||
|
||||
public function testConflictWrapperVsWrapper()
|
||||
{
|
||||
$m = new Foo\TestWrapperAccessorConflicts();
|
||||
|
||||
$m->setWrapperVsWrapperValueValue(1);
|
||||
$this->assertSame(1, $m->getWrapperVsWrapperValueValue());
|
||||
|
||||
$wrapper = new Int32Value(["value" => 1]);
|
||||
$m->setWrapperVsWrapperValue5($wrapper);
|
||||
$this->assertSame(1, $m->getWrapperVsWrapperValue5()->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider gettersAndSettersDataProvider
|
||||
*/
|
||||
|
@ -8,6 +8,5 @@ Description: Google's Data Interchange Format
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lprotobuf @PTHREAD_LIBS@
|
||||
Libs.private: @LIBS@
|
||||
|
||||
Cflags: -I${includedir} @PTHREAD_CFLAGS@
|
||||
Conflicts: protobuf-lite
|
||||
|
@ -8,7 +8,7 @@
|
||||
</parent>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protoc</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Protobuf Compiler</name>
|
||||
<description>
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
# Copyright 2007 Google Inc. All Rights Reserved.
|
||||
|
||||
__version__ = '3.7.1'
|
||||
__version__ = '3.8.0'
|
||||
|
||||
if __name__ != '__main__':
|
||||
try:
|
||||
|
@ -14299,6 +14299,47 @@ static void start_timestamp_zone(upb_json_parser *p, const char *ptr) {
|
||||
capture_begin(p, ptr);
|
||||
}
|
||||
|
||||
#define EPOCH_YEAR 1970
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
static bool isleap(int year) {
|
||||
return (year % 4) == 0 && (year % 100 != 0 || (year % 400) == 0);
|
||||
}
|
||||
|
||||
const unsigned short int __mon_yday[2][13] = {
|
||||
/* Normal years. */
|
||||
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
|
||||
/* Leap years. */
|
||||
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
|
||||
};
|
||||
|
||||
int64_t epoch(int year, int yday, int hour, int min, int sec) {
|
||||
int64_t years = year - EPOCH_YEAR;
|
||||
|
||||
int64_t leap_days = years / 4 - years / 100 + years / 400;
|
||||
|
||||
int64_t days = years * 365 + yday + leap_days;
|
||||
int64_t hours = days * 24 + hour;
|
||||
int64_t mins = hours * 60 + min;
|
||||
int64_t secs = mins * 60 + sec;
|
||||
return secs;
|
||||
}
|
||||
|
||||
static int64_t upb_mktime(const struct tm *tp) {
|
||||
int sec = tp->tm_sec;
|
||||
int min = tp->tm_min;
|
||||
int hour = tp->tm_hour;
|
||||
int mday = tp->tm_mday;
|
||||
int mon = tp->tm_mon;
|
||||
int year = tp->tm_year + TM_YEAR_BASE;
|
||||
|
||||
/* Calculate day of year from year, month, and day of month. */
|
||||
int mon_yday = ((__mon_yday[isleap(year)][mon]) - 1);
|
||||
int yday = mon_yday + mday;
|
||||
|
||||
return epoch(year, yday, hour, min, sec);
|
||||
}
|
||||
|
||||
static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
|
||||
size_t len;
|
||||
const char *buf;
|
||||
@ -14325,7 +14366,7 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
|
||||
}
|
||||
|
||||
/* Normalize tm */
|
||||
seconds = mktime(&p->tm) - timezone;
|
||||
seconds = upb_mktime(&p->tm);
|
||||
seconds += 3600 * hours;
|
||||
|
||||
/* Check timestamp boundary */
|
||||
|
@ -1,6 +1,6 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "google-protobuf"
|
||||
s.version = "3.7.1"
|
||||
s.version = "3.8.0"
|
||||
s.licenses = ["BSD-3-Clause"]
|
||||
s.summary = "Protocol Buffers"
|
||||
s.description = "Protocol Buffers are Google's data interchange format."
|
||||
@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
||||
s.test_files = ["tests/basic.rb",
|
||||
"tests/stress.rb",
|
||||
"tests/generated_code_test.rb"]
|
||||
s.required_ruby_version = '>= 2.3'
|
||||
s.add_development_dependency "rake-compiler", "~> 0.9.5"
|
||||
s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9'
|
||||
s.add_development_dependency "rubygems-tasks", "~> 0.2.4"
|
||||
|
@ -18,7 +18,7 @@ else
|
||||
PTHREAD_DEF =
|
||||
endif
|
||||
|
||||
PROTOBUF_VERSION = 18:1:0
|
||||
PROTOBUF_VERSION = 19:0:0
|
||||
|
||||
if GCC
|
||||
# Turn on all warnings except for sign comparison (we ignore sign comparison
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -655,27 +655,58 @@ void GenerateOneofField(const OneofDescriptor* oneof, io::Printer* printer) {
|
||||
|
||||
void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
|
||||
io::Printer* printer) {
|
||||
bool need_other_name_for_accessor = false;
|
||||
bool need_other_name_for_wrapper_accessor = false;
|
||||
const Descriptor* desc = field->containing_type();
|
||||
|
||||
if (!field->is_repeated() &&
|
||||
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
|
||||
IsWrapperType(field)) {
|
||||
// Check if there is any field called xxx_value
|
||||
const FieldDescriptor* other =
|
||||
desc->FindFieldByName(StrCat(field->name(), "_value"));
|
||||
if (other != NULL) {
|
||||
need_other_name_for_wrapper_accessor = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (strings::EndsWith(field->name(), "_value")) {
|
||||
std::size_t pos = (field->name()).find("_value");
|
||||
string name = (field->name()).substr(0, pos);
|
||||
const FieldDescriptor* other = desc->FindFieldByName(name);
|
||||
if (other != NULL &&
|
||||
!other->is_repeated() &&
|
||||
other->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
|
||||
IsWrapperType(other)) {
|
||||
need_other_name_for_accessor = true;
|
||||
}
|
||||
}
|
||||
|
||||
const OneofDescriptor* oneof = field->containing_oneof();
|
||||
|
||||
// Generate getter.
|
||||
if (oneof != NULL) {
|
||||
GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter);
|
||||
printer->Print(
|
||||
"public function get^camel_name^()\n"
|
||||
"public function get^camel_name^^field_number^()\n"
|
||||
"{\n"
|
||||
" return $this->readOneof(^number^);\n"
|
||||
"}\n\n",
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true),
|
||||
"number", IntToString(field->number()));
|
||||
"number", IntToString(field->number()),
|
||||
"field_number", need_other_name_for_accessor ?
|
||||
StrCat(field->number()) : "");
|
||||
} else {
|
||||
GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter);
|
||||
printer->Print(
|
||||
"public function get^camel_name^()\n"
|
||||
"public function get^camel_name^^field_number^()\n"
|
||||
"{\n"
|
||||
" return $this->^name^;\n"
|
||||
"}\n\n",
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true), "name",
|
||||
field->name());
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true),
|
||||
"name", field->name(),
|
||||
"field_number", need_other_name_for_accessor ?
|
||||
StrCat(field->number()) : "");
|
||||
}
|
||||
|
||||
// For wrapper types, generate an additional getXXXValue getter
|
||||
@ -684,21 +715,28 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
|
||||
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
|
||||
IsWrapperType(field)) {
|
||||
GenerateWrapperFieldGetterDocComment(printer, field);
|
||||
|
||||
printer->Print(
|
||||
"public function get^camel_name^Value()\n"
|
||||
"public function get^camel_name^Value^field_number1^()\n"
|
||||
"{\n"
|
||||
" $wrapper = $this->get^camel_name^();\n"
|
||||
" $wrapper = $this->get^camel_name^^field_number2^();\n"
|
||||
" return is_null($wrapper) ? null : $wrapper->getValue();\n"
|
||||
"}\n\n",
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true));
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true),
|
||||
"field_number1", need_other_name_for_wrapper_accessor ?
|
||||
StrCat(field->number()) : "",
|
||||
"field_number2", need_other_name_for_accessor ?
|
||||
StrCat(field->number()) : "");
|
||||
}
|
||||
|
||||
// Generate setter.
|
||||
GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter);
|
||||
printer->Print(
|
||||
"public function set^camel_name^($var)\n"
|
||||
"public function set^camel_name^^field_number^($var)\n"
|
||||
"{\n",
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true));
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true),
|
||||
"field_number", need_other_name_for_accessor ?
|
||||
StrCat(field->number()) : "");
|
||||
|
||||
Indent(printer);
|
||||
|
||||
@ -798,13 +836,17 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
|
||||
IsWrapperType(field)) {
|
||||
GenerateWrapperFieldSetterDocComment(printer, field);
|
||||
printer->Print(
|
||||
"public function set^camel_name^Value($var)\n"
|
||||
"public function set^camel_name^Value^field_number1^($var)\n"
|
||||
"{\n"
|
||||
" $wrappedVar = is_null($var) ? null : new \\^wrapper_type^(['value' => $var]);\n"
|
||||
" return $this->set^camel_name^($wrappedVar);\n"
|
||||
" return $this->set^camel_name^^field_number2^($wrappedVar);\n"
|
||||
"}\n\n",
|
||||
"camel_name", UnderscoresToCamelCase(field->name(), true),
|
||||
"wrapper_type", LegacyFullClassName(field->message_type(), is_descriptor));
|
||||
"wrapper_type", LegacyFullClassName(field->message_type(), is_descriptor),
|
||||
"field_number1", need_other_name_for_wrapper_accessor ?
|
||||
StrCat(field->number()) : "",
|
||||
"field_number2", need_other_name_for_accessor ?
|
||||
StrCat(field->number()) : "");
|
||||
}
|
||||
|
||||
// Generate has method for proto2 only.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -285,14 +285,14 @@
|
||||
|
||||
// Shared google3/opensource definitions. //////////////////////////////////////
|
||||
|
||||
#define PROTOBUF_VERSION 3007001
|
||||
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3007000
|
||||
#define PROTOBUF_MIN_PROTOC_VERSION 3007000
|
||||
#define PROTOBUF_VERSION 3008000
|
||||
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3008000
|
||||
#define PROTOBUF_MIN_PROTOC_VERSION 3008000
|
||||
#define PROTOBUF_VERSION_SUFFIX ""
|
||||
|
||||
// The minimum library version which works with the current version of the
|
||||
// headers.
|
||||
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3007000
|
||||
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3008000
|
||||
|
||||
#if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI
|
||||
#define PROTOBUF_RTTI 0
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -81,7 +81,7 @@ 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 3007001
|
||||
#define GOOGLE_PROTOBUF_VERSION 3008000
|
||||
|
||||
// A suffix string for alpha, beta or rc releases. Empty for stable releases.
|
||||
#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
|
||||
@ -89,15 +89,15 @@ namespace internal {
|
||||
// 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 = 3007000;
|
||||
static const int kMinHeaderVersionForLibrary = 3008000;
|
||||
|
||||
// The minimum protoc version which works with the current version of the
|
||||
// headers.
|
||||
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3007000
|
||||
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3008000
|
||||
|
||||
// The minimum header version which works with the current version of
|
||||
// protoc. This constant should only be used in VerifyVersion().
|
||||
static const int kMinHeaderVersionForProtoc = 3007000;
|
||||
static const int kMinHeaderVersionForProtoc = 3008000;
|
||||
|
||||
// Verifies that the headers and libraries are compatible. Use the macro
|
||||
// below to call this.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3007000
|
||||
#if PROTOBUF_VERSION < 3008000
|
||||
#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
|
||||
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#if 3008000 < 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.
|
||||
|
@ -177,13 +177,13 @@ def UpdateCsharp():
|
||||
RewriteXml('csharp/src/Google.Protobuf/Google.Protobuf.csproj',
|
||||
lambda document : ReplaceText(
|
||||
Find(Find(document.documentElement, 'PropertyGroup'), 'VersionPrefix'),
|
||||
GetFullVersion(rc_suffix = '-rc.')),
|
||||
GetFullVersion(rc_suffix = '-rc')),
|
||||
add_xml_prefix=False)
|
||||
|
||||
RewriteXml('csharp/Google.Protobuf.Tools.nuspec',
|
||||
lambda document : ReplaceText(
|
||||
Find(Find(document.documentElement, 'metadata'), 'version'),
|
||||
GetFullVersion(rc_suffix = '-rc.')))
|
||||
GetFullVersion(rc_suffix = '-rc')))
|
||||
|
||||
|
||||
def UpdateJava():
|
||||
@ -247,7 +247,7 @@ def UpdateObjectiveC():
|
||||
RewriteTextFile('Protobuf.podspec',
|
||||
lambda line : re.sub(
|
||||
r"^ s.version = '.*'$",
|
||||
" s.version = '%s'" % GetFullVersion(rc_suffix = '-rc.'),
|
||||
" s.version = '%s'" % GetFullVersion(rc_suffix = '-rc'),
|
||||
line))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user