Skip to content

Commit 3afcded

Browse files
authored
Merge pull request protocolbuffers#3461 from TeBoring/3.4.x
Merge master into 3.4.x
2 parents 176713d + 8f4b8e4 commit 3afcded

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1627
-126
lines changed

Makefile.am

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,12 @@ php_EXTRA_DIST= \
600600
php/ext/google/protobuf/upb.c \
601601
php/ext/google/protobuf/protobuf.c \
602602
php/src/phpdoc.dist.xml \
603+
php/src/Google/Protobuf/Descriptor.php \
604+
php/src/Google/Protobuf/DescriptorPool.php \
605+
php/src/Google/Protobuf/EnumDescriptor.php \
606+
php/src/Google/Protobuf/EnumValueDescriptor.php \
607+
php/src/Google/Protobuf/FieldDescriptor.php \
608+
php/src/Google/Protobuf/OneofDescriptor.php \
603609
php/src/Google/Protobuf/Internal/CodedInputStream.php \
604610
php/src/Google/Protobuf/Internal/CodedOutputStream.php \
605611
php/src/Google/Protobuf/Internal/DescriptorPool.php \
@@ -612,7 +618,6 @@ php_EXTRA_DIST= \
612618
php/src/Google/Protobuf/Internal/EnumDescriptorProto.php \
613619
php/src/Google/Protobuf/Internal/EnumOptions.php \
614620
php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php \
615-
php/src/Google/Protobuf/Internal/EnumValueDescriptor.php \
616621
php/src/Google/Protobuf/Internal/EnumValueOptions.php \
617622
php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php \
618623
php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \
@@ -628,13 +633,15 @@ php_EXTRA_DIST= \
628633
php/src/Google/Protobuf/Internal/FileOptions.php \
629634
php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php \
630635
php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \
636+
php/src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php \
631637
php/src/Google/Protobuf/Internal/GPBDecodeException.php \
632638
php/src/Google/Protobuf/Internal/GPBJsonWire.php \
633639
php/src/Google/Protobuf/Internal/GPBLabel.php \
634640
php/src/Google/Protobuf/Internal/GPBType.php \
635641
php/src/Google/Protobuf/Internal/GPBUtil.php \
636642
php/src/Google/Protobuf/Internal/GPBWireType.php \
637643
php/src/Google/Protobuf/Internal/GPBWire.php \
644+
php/src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php \
638645
php/src/Google/Protobuf/Internal/MapEntry.php \
639646
php/src/Google/Protobuf/Internal/MapFieldIter.php \
640647
php/src/Google/Protobuf/Internal/MapField.php \
@@ -661,6 +668,7 @@ php_EXTRA_DIST= \
661668
php/tests/array_test.php \
662669
php/tests/autoload.php \
663670
php/tests/compatibility_test.sh \
671+
php/tests/descriptors_test.php \
664672
php/tests/encode_decode_test.php \
665673
php/tests/gdb_test.sh \
666674
php/tests/generated_class_test.php \
@@ -669,6 +677,7 @@ php_EXTRA_DIST= \
669677
php/tests/map_field_test.php \
670678
php/tests/memory_leak_test.php \
671679
php/tests/php_implementation_test.php \
680+
php/tests/proto/test_descriptors.proto \
672681
php/tests/proto/test_empty_php_namespace.proto \
673682
php/tests/proto/test_import_descriptor_proto.proto \
674683
php/tests/proto/test_include.proto \

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
},
1717
"autoload": {
1818
"psr-4": {
19-
"Google\\Protobuf\\Internal\\": "php/src/Google/Protobuf/Internal",
20-
"GPBMetadata\\Google\\Protobuf\\Internal\\": "php/src/GPBMetadata/Google/Protobuf/Internal"
19+
"Google\\Protobuf\\": "php/src/Google/Protobuf",
20+
"GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf"
2121
}
2222
}
2323
}

conformance/Makefile.am

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
conformance_protoc_inputs = \
44
conformance.proto \
5-
$(top_srcdir)/src/google/protobuf/test_messages_proto3.proto
6-
7-
# proto2 input files, should be separated with proto3, as we
8-
# can't generate proto2 files for ruby, php and objc
5+
$(top_srcdir)/src/google/protobuf/test_messages_proto3.proto
6+
7+
# proto2 input files, should be separated with proto3, as we
8+
# can't generate proto2 files for ruby, php and objc
99
conformance_proto2_protoc_inputs = \
10-
$(top_srcdir)/src/google/protobuf/test_messages_proto2.proto
10+
$(top_srcdir)/src/google/protobuf/test_messages_proto2.proto
1111

1212
well_known_type_protoc_inputs = \
1313
$(top_srcdir)/src/google/protobuf/any.proto \
@@ -86,6 +86,8 @@ other_language_protoc_outputs = \
8686
google/protobuf/struct.pb.h \
8787
google/protobuf/struct.rb \
8888
google/protobuf/struct_pb2.py \
89+
google/protobuf/TestMessagesProto2.pbobjc.h \
90+
google/protobuf/TestMessagesProto2.pbobjc.m \
8991
google/protobuf/TestMessagesProto3.pbobjc.h \
9092
google/protobuf/TestMessagesProto3.pbobjc.m \
9193
google/protobuf/test_messages_proto3.pb.cc \
@@ -228,7 +230,7 @@ if OBJC_CONFORMANCE_TEST
228230
bin_PROGRAMS += conformance-objc
229231

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

242244
endif
243245

@@ -253,7 +255,7 @@ if USE_EXTERNAL_PROTOC
253255
# Some implementations include pre-generated versions of well-known types.
254256
protoc_middleman: $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
255257
$(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)
256-
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs)
258+
$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=. --objc_out=. --python_out=. --js_out=import_style=commonjs,binary:. $(conformance_proto2_protoc_inputs)
257259
$(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)
258260
## $(PROTOC) -I$(srcdir) -I$(top_srcdir) --java_out=lite:lite $(conformance_protoc_inputs) $(well_known_type_protoc_inputs)
259261
touch protoc_middleman
@@ -265,7 +267,7 @@ else
265267
# building out-of-tree.
266268
protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(conformance_protoc_inputs) $(conformance_proto2_protoc_inputs) $(well_known_type_protoc_inputs) google-protobuf
267269
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) )
268-
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) )
270+
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) )
269271
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) )
270272
## @mkdir -p lite
271273
## 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) )

conformance/conformance.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ message ConformanceRequest {
7878
// Which format should the testee serialize its message to?
7979
WireFormat requested_output_format = 3;
8080

81-
// should be set to either "proto2" or "proto3"
81+
// The full name for the test message to use; for the moment, either:
82+
// protobuf_test_messages.proto3.TestAllTypesProto3 or
83+
// protobuf_test_messages.proto2.TestAllTypesProto2.
8284
string message_type = 4;
8385
}
8486

conformance/conformance_objc.m

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#import <Foundation/Foundation.h>
3232

3333
#import "Conformance.pbobjc.h"
34+
#import "google/protobuf/TestMessagesProto2.pbobjc.h"
3435
#import "google/protobuf/TestMessagesProto3.pbobjc.h"
3536

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

6465
static ConformanceResponse *DoTest(ConformanceRequest *request) {
6566
ConformanceResponse *response = [ConformanceResponse message];
66-
TestAllTypesProto3 *testMessage = nil;
67+
GPBMessage *testMessage = nil;
6768

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

7374
case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: {
74-
if ([request.messageType isEqualToString:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) {
75-
NSError *error = nil;
76-
testMessage = [TestAllTypesProto3 parseFromData:request.protobufPayload
77-
error:&error];
78-
if (!testMessage) {
79-
response.parseError =
80-
[NSString stringWithFormat:@"Parse error: %@", error];
81-
}
82-
} else if ([request.messageType isEqualToString:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
83-
response.skipped = @"ObjC doesn't support proto2";
84-
break;
75+
Class msgClass = nil;
76+
if ([request.messageType isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) {
77+
msgClass = [Proto3TestAllTypesProto3 class];
78+
} else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
79+
msgClass = [TestAllTypesProto2 class];
8580
} else {
86-
Die(@"Protobuf request doesn't have specific payload type");
87-
break;
81+
Die(@"Protobuf request had an unknown message_type: %@", request.messageType);
82+
}
83+
NSError *error = nil;
84+
testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
85+
if (!testMessage) {
86+
response.parseError =
87+
[NSString stringWithFormat:@"Parse error: %@", error];
8888
}
8989
break;
9090
}

csharp/src/Google.Protobuf.Conformance/Conformance.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ public string JsonPayload {
142142
public const int MessageTypeFieldNumber = 4;
143143
private string messageType_ = "";
144144
/// <summary>
145-
/// should be set to either "proto2" or "proto3"
145+
/// The full name for the test message to use; for the moment, either:
146+
/// protobuf_test_messages.proto3.TestAllTypesProto3 or
147+
/// protobuf_test_messages.proto2.TestAllTypesProto2.
146148
/// </summary>
147149
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
148150
public string MessageType {

csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ static TestMessagesProto3Reflection() {
198198
"AjgBIjkKCk5lc3RlZEVudW0SBwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAIS",
199199
"EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGQiGwoORm9yZWlnbk1l",
200200
"c3NhZ2USCQoBYxgBIAEoBSpACgtGb3JlaWduRW51bRIPCgtGT1JFSUdOX0ZP",
201-
"TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkIvCihjb20u",
202-
"Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQFiBnBy",
203-
"b3RvMw=="));
201+
"TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkI4Cihjb20u",
202+
"Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQGiAgZQ",
203+
"cm90bzNiBnByb3RvMw=="));
204204
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
205205
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, },
206206
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] {

docs/third_party.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,4 @@ There are miscellaneous other things you may find useful as a Protocol Buffers d
156156
* [Linter for .proto files](https://github.com/ckaznocha/protoc-gen-lint)
157157
* [Protocol Buffers Dynamic Schema - create protobuf schemas programmatically (Java)] (https://github.com/os72/protobuf-dynamic)
158158
* [Make protoc plugins in NodeJS](https://github.com/konsumer/node-protoc-plugin)
159+
* [ProfaneDB - A Protocol Buffers database](https://profanedb.gitlab.io)

examples/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ list_people_gotest: list_people.go list_people_go
5151
go test list_people.go list_people_test.go
5252

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

5757
add_person_java: javac_middleman

examples/README.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ These examples are part of the Protocol Buffers tutorial, located at:
2828
"-lpthread" from the linker commands (perhaps replacing it with something else).
2929
We didn't do this automatically because we wanted to keep the example simple.
3030

31+
## Java ##
32+
33+
protobuf-java-*.jar can be generated by:
34+
cd ../java
35+
mvn package
36+
and will be used by "make java"
37+
3138
## Go ##
3239

3340
The Go example requires a plugin to the protocol buffer compiler, so it is not

jenkins/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ RUN cd /tmp && \
182182
rm -rf protobuf && \
183183
git clone https://github.com/google/protobuf.git && \
184184
cd protobuf && \
185-
git reset --hard 8d97b3d8b5a33650e822460b3b561802c969e86e && \
185+
git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
186186
cd php && \
187187
ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
188188
ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \

jenkins/docker32/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ RUN composer config -g -- secure-http false
9898
RUN cd /tmp && \
9999
git clone https://github.com/google/protobuf.git && \
100100
cd protobuf/php && \
101-
git reset --hard 8d97b3d8b5a33650e822460b3b561802c969e86e && \
101+
git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
102102
ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
103103
ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
104104
ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \

php/composer.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@
1313
},
1414
"autoload": {
1515
"psr-4": {
16-
"Foo\\": "tests/generated/Foo",
17-
"Bar\\": "tests/generated/Bar",
18-
"Google\\Protobuf\\": "tests/generated/Google/Protobuf",
19-
"Google\\Protobuf\\Internal\\": "src/Google/Protobuf/Internal",
20-
"GPBMetadata\\": "tests/generated/GPBMetadata",
21-
"GPBMetadata\\Google\\Protobuf\\Internal\\": "src/GPBMetadata/Google/Protobuf/Internal",
16+
"Google\\Protobuf\\": "src/Google/Protobuf",
17+
"GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf",
2218
"": "tests/generated"
2319
}
2420
}

0 commit comments

Comments
 (0)