Skip to content

Commit

Permalink
Merge pull request protocolbuffers#3461 from TeBoring/3.4.x
Browse files Browse the repository at this point in the history
Merge master into 3.4.x
  • Loading branch information
liujisi authored Aug 7, 2017
2 parents 176713d + 8f4b8e4 commit 3afcded
Show file tree
Hide file tree
Showing 46 changed files with 1,627 additions and 126 deletions.
11 changes: 10 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,12 @@ php_EXTRA_DIST= \
php/ext/google/protobuf/upb.c \
php/ext/google/protobuf/protobuf.c \
php/src/phpdoc.dist.xml \
php/src/Google/Protobuf/Descriptor.php \
php/src/Google/Protobuf/DescriptorPool.php \
php/src/Google/Protobuf/EnumDescriptor.php \
php/src/Google/Protobuf/EnumValueDescriptor.php \
php/src/Google/Protobuf/FieldDescriptor.php \
php/src/Google/Protobuf/OneofDescriptor.php \
php/src/Google/Protobuf/Internal/CodedInputStream.php \
php/src/Google/Protobuf/Internal/CodedOutputStream.php \
php/src/Google/Protobuf/Internal/DescriptorPool.php \
Expand All @@ -612,7 +618,6 @@ php_EXTRA_DIST= \
php/src/Google/Protobuf/Internal/EnumDescriptorProto.php \
php/src/Google/Protobuf/Internal/EnumOptions.php \
php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php \
php/src/Google/Protobuf/Internal/EnumValueDescriptor.php \
php/src/Google/Protobuf/Internal/EnumValueOptions.php \
php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php \
php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \
Expand All @@ -628,13 +633,15 @@ php_EXTRA_DIST= \
php/src/Google/Protobuf/Internal/FileOptions.php \
php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php \
php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \
php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php \
php/src/Google/Protobuf/Internal/GPBDecodeException.php \
php/src/Google/Protobuf/Internal/GPBJsonWire.php \
php/src/Google/Protobuf/Internal/GPBLabel.php \
php/src/Google/Protobuf/Internal/GPBType.php \
php/src/Google/Protobuf/Internal/GPBUtil.php \
php/src/Google/Protobuf/Internal/GPBWireType.php \
php/src/Google/Protobuf/Internal/GPBWire.php \
php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php \
php/src/Google/Protobuf/Internal/MapEntry.php \
php/src/Google/Protobuf/Internal/MapFieldIter.php \
php/src/Google/Protobuf/Internal/MapField.php \
Expand All @@ -661,6 +668,7 @@ php_EXTRA_DIST= \
php/tests/array_test.php \
php/tests/autoload.php \
php/tests/compatibility_test.sh \
php/tests/descriptors_test.php \
php/tests/encode_decode_test.php \
php/tests/gdb_test.sh \
php/tests/generated_class_test.php \
Expand All @@ -669,6 +677,7 @@ php_EXTRA_DIST= \
php/tests/map_field_test.php \
php/tests/memory_leak_test.php \
php/tests/php_implementation_test.php \
php/tests/proto/test_descriptors.proto \
php/tests/proto/test_empty_php_namespace.proto \
php/tests/proto/test_import_descriptor_proto.proto \
php/tests/proto/test_include.proto \
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
},
"autoload": {
"psr-4": {
"Google\\Protobuf\\Internal\\": "php/src/Google/Protobuf/Internal",
"GPBMetadata\\Google\\Protobuf\\Internal\\": "php/src/GPBMetadata/Google/Protobuf/Internal"
"Google\\Protobuf\\": "php/src/Google/Protobuf",
"GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf"
}
}
}
20 changes: 11 additions & 9 deletions conformance/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

conformance_protoc_inputs = \
conformance.proto \
$(top_srcdir)/src/google/protobuf/test_messages_proto3.proto
# proto2 input files, should be separated with proto3, as we
# can't generate proto2 files for ruby, php and objc
$(top_srcdir)/src/google/protobuf/test_messages_proto3.proto

# proto2 input files, should be separated with proto3, as we
# can't generate proto2 files for ruby, php and objc
conformance_proto2_protoc_inputs = \
$(top_srcdir)/src/google/protobuf/test_messages_proto2.proto
$(top_srcdir)/src/google/protobuf/test_messages_proto2.proto

well_known_type_protoc_inputs = \
$(top_srcdir)/src/google/protobuf/any.proto \
Expand Down Expand Up @@ -86,6 +86,8 @@ other_language_protoc_outputs = \
google/protobuf/struct.pb.h \
google/protobuf/struct.rb \
google/protobuf/struct_pb2.py \
google/protobuf/TestMessagesProto2.pbobjc.h \
google/protobuf/TestMessagesProto2.pbobjc.m \
google/protobuf/TestMessagesProto3.pbobjc.h \
google/protobuf/TestMessagesProto3.pbobjc.m \
google/protobuf/test_messages_proto3.pb.cc \
Expand Down Expand Up @@ -228,7 +230,7 @@ if OBJC_CONFORMANCE_TEST
bin_PROGRAMS += conformance-objc

conformance_objc_SOURCES = conformance_objc.m ../objectivec/GPBProtocolBuffers.m
nodist_conformance_objc_SOURCES = Conformance.pbobjc.m google/protobuf/TestMessagesProto3.pbobjc.m
nodist_conformance_objc_SOURCES = Conformance.pbobjc.m google/protobuf/TestMessagesProto2.pbobjc.m google/protobuf/TestMessagesProto3.pbobjc.m
# On travis, the build fails without the isysroot because whatever system
# headers are being found don't include generics support for
# NSArray/NSDictionary, the only guess is their image at one time had an odd
Expand All @@ -237,7 +239,7 @@ conformance_objc_CPPFLAGS = -I$(top_srcdir)/objectivec -isysroot `xcrun --sdk ma
conformance_objc_LDFLAGS = -framework Foundation
# Explicit dep beacuse BUILT_SOURCES are only done before a "make all/check"
# so a direct "make test_objc" could fail if parallel enough.
conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobuf/TestMessagesProto3.pbobjc.h
conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobuf/TestMessagesProto2.pbobjc.h google/protobuf/TestMessagesProto3.pbobjc.h

endif

Expand All @@ -253,7 +255,7 @@ if USE_EXTERNAL_PROTOC
# Some implementations include pre-generated versions of well-known types.
protoc_middleman: $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --objc_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:. $(conformance_protoc_inputs)
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs)
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --objc_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs)
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --ruby_out=. --python_out=. --php_out=. --js_out=import_style=commonjs,binary:google-protobuf $(well_known_type_protoc_inputs)
## $(PROTOC) -I$(srcdir) -I$(top_srcdir) --java_out=lite:lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
touch protoc_middleman
Expand All @@ -265,7 +267,7 @@ else
# building out-of-tree.
protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --objc_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_protoc_inputs) )
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_proto2_protoc_inputs) )
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --objc_out=. --python_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd $(conformance_proto2_protoc_inputs) )
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd --ruby_out=$$oldpwd --python_out=$$oldpwd --php_out=$$oldpwd --js_out=import_style=commonjs,binary:$$oldpwd/google-protobuf $(well_known_type_protoc_inputs) )
## @mkdir -p lite
## oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --java_out=lite:$$oldpwd/lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs) )
Expand Down
4 changes: 3 additions & 1 deletion conformance/conformance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ message ConformanceRequest {
// Which format should the testee serialize its message to?
WireFormat requested_output_format = 3;

// should be set to either "proto2" or "proto3"
// The full name for the test message to use; for the moment, either:
// protobuf_test_messages.proto3.TestAllTypesProto3 or
// protobuf_test_messages.proto2.TestAllTypesProto2.
string message_type = 4;
}

Expand Down
28 changes: 14 additions & 14 deletions conformance/conformance_objc.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#import <Foundation/Foundation.h>

#import "Conformance.pbobjc.h"
#import "google/protobuf/TestMessagesProto2.pbobjc.h"
#import "google/protobuf/TestMessagesProto3.pbobjc.h"

static void Die(NSString *format, ...) __dead2;
Expand Down Expand Up @@ -63,28 +64,27 @@ static void Die(NSString *format, ...) {

static ConformanceResponse *DoTest(ConformanceRequest *request) {
ConformanceResponse *response = [ConformanceResponse message];
TestAllTypesProto3 *testMessage = nil;
GPBMessage *testMessage = nil;

switch (request.payloadOneOfCase) {
case ConformanceRequest_Payload_OneOfCase_GPBUnsetOneOfCase:
Die(@"Request didn't have a payload: %@", request);
break;

case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: {
if ([request.messageType isEqualToString:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) {
NSError *error = nil;
testMessage = [TestAllTypesProto3 parseFromData:request.protobufPayload
error:&error];
if (!testMessage) {
response.parseError =
[NSString stringWithFormat:@"Parse error: %@", error];
}
} else if ([request.messageType isEqualToString:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
response.skipped = @"ObjC doesn't support proto2";
break;
Class msgClass = nil;
if ([request.messageType isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) {
msgClass = [Proto3TestAllTypesProto3 class];
} else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
msgClass = [TestAllTypesProto2 class];
} else {
Die(@"Protobuf request doesn't have specific payload type");
break;
Die(@"Protobuf request had an unknown message_type: %@", request.messageType);
}
NSError *error = nil;
testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
if (!testMessage) {
response.parseError =
[NSString stringWithFormat:@"Parse error: %@", error];
}
break;
}
Expand Down
4 changes: 3 additions & 1 deletion csharp/src/Google.Protobuf.Conformance/Conformance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public string JsonPayload {
public const int MessageTypeFieldNumber = 4;
private string messageType_ = "";
/// <summary>
/// should be set to either "proto2" or "proto3"
/// The full name for the test message to use; for the moment, either:
/// protobuf_test_messages.proto3.TestAllTypesProto3 or
/// protobuf_test_messages.proto2.TestAllTypesProto2.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string MessageType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ static TestMessagesProto3Reflection() {
"AjgBIjkKCk5lc3RlZEVudW0SBwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAIS",
"EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGQiGwoORm9yZWlnbk1l",
"c3NhZ2USCQoBYxgBIAEoBSpACgtGb3JlaWduRW51bRIPCgtGT1JFSUdOX0ZP",
"TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkIvCihjb20u",
"Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQFiBnBy",
"b3RvMw=="));
"TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkI4Cihjb20u",
"Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQGiAgZQ",
"cm90bzNiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] {
Expand Down
1 change: 1 addition & 0 deletions docs/third_party.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ There are miscellaneous other things you may find useful as a Protocol Buffers d
* [Linter for .proto files](https://github.com/ckaznocha/protoc-gen-lint)
* [Protocol Buffers Dynamic Schema - create protobuf schemas programmatically (Java)] (https://github.com/os72/protobuf-dynamic)
* [Make protoc plugins in NodeJS](https://github.com/konsumer/node-protoc-plugin)
* [ProfaneDB - A Protocol Buffers database](https://profanedb.gitlab.io)
2 changes: 1 addition & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ list_people_gotest: list_people.go list_people_go
go test list_people.go list_people_test.go

javac_middleman: AddPerson.java ListPeople.java protoc_middleman
javac AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
javac -cp ../java/core/target/*.jar AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
@touch javac_middleman

add_person_java: javac_middleman
Expand Down
7 changes: 7 additions & 0 deletions examples/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ These examples are part of the Protocol Buffers tutorial, located at:
"-lpthread" from the linker commands (perhaps replacing it with something else).
We didn't do this automatically because we wanted to keep the example simple.

## Java ##

protobuf-java-*.jar can be generated by:
cd ../java
mvn package
and will be used by "make java"

## Go ##

The Go example requires a plugin to the protocol buffer compiler, so it is not
Expand Down
2 changes: 1 addition & 1 deletion jenkins/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ RUN cd /tmp && \
rm -rf protobuf && \
git clone https://github.com/google/protobuf.git && \
cd protobuf && \
git reset --hard 8d97b3d8b5a33650e822460b3b561802c969e86e && \
git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
cd php && \
ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
Expand Down
2 changes: 1 addition & 1 deletion jenkins/docker32/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ RUN composer config -g -- secure-http false
RUN cd /tmp && \
git clone https://github.com/google/protobuf.git && \
cd protobuf/php && \
git reset --hard 8d97b3d8b5a33650e822460b3b561802c969e86e && \
git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
Expand Down
8 changes: 2 additions & 6 deletions php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
},
"autoload": {
"psr-4": {
"Foo\\": "tests/generated/Foo",
"Bar\\": "tests/generated/Bar",
"Google\\Protobuf\\": "tests/generated/Google/Protobuf",
"Google\\Protobuf\\Internal\\": "src/Google/Protobuf/Internal",
"GPBMetadata\\": "tests/generated/GPBMetadata",
"GPBMetadata\\Google\\Protobuf\\Internal\\": "src/GPBMetadata/Google/Protobuf/Internal",
"Google\\Protobuf\\": "src/Google/Protobuf",
"GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf",
"": "tests/generated"
}
}
Expand Down
Loading

0 comments on commit 3afcded

Please sign in to comment.