├── .gitignore ├── .travis.yml ├── BUILD ├── CHANGES.txt ├── CONTRIBUTORS.txt ├── LICENSE ├── Makefile.am ├── Protobuf.podspec ├── README.md ├── WORKSPACE ├── appveyor.bat ├── appveyor.yml ├── autogen.sh ├── benchmarks ├── ProtoBench.java ├── google_message1.dat ├── google_message2.dat ├── google_size.proto ├── google_speed.proto └── readme.txt ├── cmake ├── CMakeLists.txt ├── README.md ├── extract_includes.bat.in ├── install.cmake ├── libprotobuf-lite.cmake ├── libprotobuf.cmake ├── libprotoc.cmake ├── protobuf-config-version.cmake.in ├── protobuf-config.cmake.in ├── protobuf-module.cmake.in ├── protoc.cmake └── tests.cmake ├── configure.ac ├── conformance ├── ConformanceJava.java ├── ConformanceJavaLite.java ├── Makefile.am ├── README.md ├── conformance.proto ├── conformance_cpp.cc ├── conformance_objc.m ├── conformance_python.py ├── conformance_ruby.rb ├── conformance_test.cc ├── conformance_test.h ├── conformance_test_runner.cc ├── failure_list_cpp.txt ├── failure_list_csharp.txt ├── failure_list_java.txt ├── failure_list_objc.txt ├── failure_list_python-post26.txt ├── failure_list_python.txt ├── failure_list_python_cpp.txt ├── failure_list_ruby.txt └── third_party │ └── jsoncpp │ ├── json.h │ └── jsoncpp.cpp ├── csharp ├── .gitignore ├── CHANGES.txt ├── Google.Protobuf.Tools.nuspec ├── README.md ├── build_packages.bat ├── buildall.sh ├── generate_protos.sh ├── keys │ ├── Google.Protobuf.public.snk │ ├── Google.Protobuf.snk │ └── README.md ├── protos │ └── unittest_issues.proto └── src │ ├── AddressBook │ ├── AddPerson.cs │ ├── AddressBook.csproj │ ├── Addressbook.cs │ ├── ListPeople.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SampleUsage.cs │ └── app.config │ ├── Google.Protobuf.Conformance │ ├── App.config │ ├── Conformance.cs │ ├── Google.Protobuf.Conformance.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── Google.Protobuf.JsonDump │ ├── Google.Protobuf.JsonDump.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── app.config │ ├── Google.Protobuf.Test │ ├── ByteStringTest.cs │ ├── CodedInputStreamExtensions.cs │ ├── CodedInputStreamTest.cs │ ├── CodedOutputStreamTest.cs │ ├── Collections │ │ ├── MapFieldTest.cs │ │ └── RepeatedFieldTest.cs │ ├── Compatibility │ │ ├── PropertyInfoExtensionsTest.cs │ │ └── TypeExtensionsTest.cs │ ├── DeprecatedMemberTest.cs │ ├── EqualityTester.cs │ ├── FieldCodecTest.cs │ ├── GeneratedMessageTest.cs │ ├── Google.Protobuf.Test.csproj │ ├── IssuesTest.cs │ ├── JsonFormatterTest.cs │ ├── JsonParserTest.cs │ ├── JsonTokenizerTest.cs │ ├── Properties │ │ ├── AppManifest.xml │ │ └── AssemblyInfo.cs │ ├── Reflection │ │ ├── DescriptorsTest.cs │ │ ├── FieldAccessTest.cs │ │ └── TypeRegistryTest.cs │ ├── SampleEnum.cs │ ├── SampleMessages.cs │ ├── TestCornerCases.cs │ ├── TestProtos │ │ ├── ForeignMessagePartial.cs │ │ ├── MapUnittestProto3.cs │ │ ├── UnittestImportProto3.cs │ │ ├── UnittestImportPublicProto3.cs │ │ ├── UnittestIssues.cs │ │ ├── UnittestProto3.cs │ │ └── UnittestWellKnownTypes.cs │ ├── WellKnownTypes │ │ ├── AnyTest.cs │ │ ├── DurationTest.cs │ │ ├── FieldMaskTest.cs │ │ ├── TimestampTest.cs │ │ └── WrappersTest.cs │ └── packages.config │ ├── Google.Protobuf.sln │ ├── Google.Protobuf │ ├── ByteArray.cs │ ├── ByteString.cs │ ├── CodedInputStream.cs │ ├── CodedOutputStream.ComputeSize.cs │ ├── CodedOutputStream.cs │ ├── Collections │ │ ├── MapField.cs │ │ ├── ReadOnlyDictionary.cs │ │ └── RepeatedField.cs │ ├── Compatibility │ │ ├── PropertyInfoExtensions.cs │ │ └── TypeExtensions.cs │ ├── FieldCodec.cs │ ├── FrameworkPortability.cs │ ├── Google.Protobuf.csproj │ ├── Google.Protobuf.nuspec │ ├── ICustomDiagnosticMessage.cs │ ├── IDeepCloneable.cs │ ├── IMessage.cs │ ├── InvalidJsonException.cs │ ├── InvalidProtocolBufferException.cs │ ├── JsonFormatter.cs │ ├── JsonParser.cs │ ├── JsonToken.cs │ ├── JsonTokenizer.cs │ ├── LimitedInputStream.cs │ ├── MessageExtensions.cs │ ├── MessageParser.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ProtoPreconditions.cs │ ├── Reflection │ │ ├── Descriptor.cs │ │ ├── DescriptorBase.cs │ │ ├── DescriptorPool.cs │ │ ├── DescriptorUtil.cs │ │ ├── DescriptorValidationException.cs │ │ ├── EnumDescriptor.cs │ │ ├── EnumValueDescriptor.cs │ │ ├── FieldAccessorBase.cs │ │ ├── FieldDescriptor.cs │ │ ├── FieldType.cs │ │ ├── FileDescriptor.cs │ │ ├── GeneratedClrTypeInfo.cs │ │ ├── IDescriptor.cs │ │ ├── IFieldAccessor.cs │ │ ├── MapFieldAccessor.cs │ │ ├── MessageDescriptor.cs │ │ ├── MethodDescriptor.cs │ │ ├── OneofAccessor.cs │ │ ├── OneofDescriptor.cs │ │ ├── OriginalNameAttribute.cs │ │ ├── PackageDescriptor.cs │ │ ├── PartialClasses.cs │ │ ├── ReflectionUtil.cs │ │ ├── RepeatedFieldAccessor.cs │ │ ├── ServiceDescriptor.cs │ │ ├── SingleFieldAccessor.cs │ │ └── TypeRegistry.cs │ ├── WellKnownTypes │ │ ├── Any.cs │ │ ├── AnyPartial.cs │ │ ├── Api.cs │ │ ├── Duration.cs │ │ ├── DurationPartial.cs │ │ ├── Empty.cs │ │ ├── FieldMask.cs │ │ ├── FieldMaskPartial.cs │ │ ├── SourceContext.cs │ │ ├── Struct.cs │ │ ├── TimeExtensions.cs │ │ ├── Timestamp.cs │ │ ├── TimestampPartial.cs │ │ ├── Type.cs │ │ ├── ValuePartial.cs │ │ ├── Wrappers.cs │ │ └── WrappersPartial.cs │ ├── WireFormat.cs │ └── packages.config │ └── packages │ └── repositories.config ├── docs ├── swift │ └── DesignDoc.md └── third_party.md ├── editors ├── README.txt ├── proto.vim └── protobuf-mode.el ├── examples ├── AddPerson.java ├── ListPeople.java ├── Makefile ├── README.txt ├── add_person.cc ├── add_person.go ├── add_person.py ├── add_person_test.go ├── addressbook.proto ├── list_people.cc ├── list_people.go ├── list_people.py └── list_people_test.go ├── generate_descriptor_proto.sh ├── gmock.BUILD ├── java ├── README.md ├── core │ ├── generate-sources-build.xml │ ├── generate-test-sources-build.xml │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── google │ │ │ └── protobuf │ │ │ ├── AbstractMessage.java │ │ │ ├── AbstractMessageLite.java │ │ │ ├── AbstractParser.java │ │ │ ├── AbstractProtobufList.java │ │ │ ├── BlockingRpcChannel.java │ │ │ ├── BlockingService.java │ │ │ ├── BooleanArrayList.java │ │ │ ├── ByteBufferWriter.java │ │ │ ├── ByteOutput.java │ │ │ ├── ByteString.java │ │ │ ├── CodedInputStream.java │ │ │ ├── CodedOutputStream.java │ │ │ ├── Descriptors.java │ │ │ ├── DoubleArrayList.java │ │ │ ├── DynamicMessage.java │ │ │ ├── ExperimentalApi.java │ │ │ ├── Extension.java │ │ │ ├── ExtensionLite.java │ │ │ ├── ExtensionRegistry.java │ │ │ ├── ExtensionRegistryLite.java │ │ │ ├── FieldSet.java │ │ │ ├── FloatArrayList.java │ │ │ ├── GeneratedMessage.java │ │ │ ├── GeneratedMessageLite.java │ │ │ ├── IntArrayList.java │ │ │ ├── Internal.java │ │ │ ├── InvalidProtocolBufferException.java │ │ │ ├── LazyField.java │ │ │ ├── LazyFieldLite.java │ │ │ ├── LazyStringArrayList.java │ │ │ ├── LazyStringList.java │ │ │ ├── LongArrayList.java │ │ │ ├── MapEntry.java │ │ │ ├── MapEntryLite.java │ │ │ ├── MapField.java │ │ │ ├── MapFieldLite.java │ │ │ ├── Message.java │ │ │ ├── MessageLite.java │ │ │ ├── MessageLiteOrBuilder.java │ │ │ ├── MessageLiteToString.java │ │ │ ├── MessageOrBuilder.java │ │ │ ├── MessageReflection.java │ │ │ ├── MutabilityOracle.java │ │ │ ├── NioByteString.java │ │ │ ├── Parser.java │ │ │ ├── ProtobufArrayList.java │ │ │ ├── ProtocolMessageEnum.java │ │ │ ├── ProtocolStringList.java │ │ │ ├── RepeatedFieldBuilder.java │ │ │ ├── RopeByteString.java │ │ │ ├── RpcCallback.java │ │ │ ├── RpcChannel.java │ │ │ ├── RpcController.java │ │ │ ├── RpcUtil.java │ │ │ ├── Service.java │ │ │ ├── ServiceException.java │ │ │ ├── SingleFieldBuilder.java │ │ │ ├── SmallSortedMap.java │ │ │ ├── TextFormat.java │ │ │ ├── TextFormatEscaper.java │ │ │ ├── TextFormatParseInfoTree.java │ │ │ ├── TextFormatParseLocation.java │ │ │ ├── UninitializedMessageException.java │ │ │ ├── UnknownFieldSet.java │ │ │ ├── UnknownFieldSetLite.java │ │ │ ├── UnmodifiableLazyStringList.java │ │ │ ├── UnsafeByteOperations.java │ │ │ ├── Utf8.java │ │ │ └── WireFormat.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── protobuf │ │ │ ├── AbstractMessageTest.java │ │ │ ├── AnyTest.java │ │ │ ├── BooleanArrayListTest.java │ │ │ ├── BoundedByteStringTest.java │ │ │ ├── ByteBufferWriterTest.java │ │ │ ├── ByteStringTest.java │ │ │ ├── CheckUtf8Test.java │ │ │ ├── CodedInputStreamTest.java │ │ │ ├── CodedOutputStreamTest.java │ │ │ ├── DeprecatedFieldTest.java │ │ │ ├── DescriptorsTest.java │ │ │ ├── DoubleArrayListTest.java │ │ │ ├── DynamicMessageTest.java │ │ │ ├── EnumTest.java │ │ │ ├── FieldPresenceTest.java │ │ │ ├── FloatArrayListTest.java │ │ │ ├── ForceFieldBuildersPreRun.java │ │ │ ├── GeneratedMessageTest.java │ │ │ ├── IntArrayListTest.java │ │ │ ├── IsValidUtf8Test.java │ │ │ ├── IsValidUtf8TestUtil.java │ │ │ ├── LazyFieldLiteTest.java │ │ │ ├── LazyFieldTest.java │ │ │ ├── LazyMessageLiteTest.java │ │ │ ├── LazyStringArrayListTest.java │ │ │ ├── LazyStringEndToEndTest.java │ │ │ ├── LiteEqualsAndHashTest.java │ │ │ ├── LiteTest.java │ │ │ ├── LiteralByteStringTest.java │ │ │ ├── LongArrayListTest.java │ │ │ ├── MapForProto2LiteTest.java │ │ │ ├── MapForProto2Test.java │ │ │ ├── MapTest.java │ │ │ ├── MessageTest.java │ │ │ ├── NestedBuildersTest.java │ │ │ ├── NioByteStringTest.java │ │ │ ├── ParseExceptionsTest.java │ │ │ ├── ParserTest.java │ │ │ ├── ProtobufArrayListTest.java │ │ │ ├── RepeatedFieldBuilderTest.java │ │ │ ├── RopeByteStringSubstringTest.java │ │ │ ├── RopeByteStringTest.java │ │ │ ├── ServiceTest.java │ │ │ ├── SingleFieldBuilderTest.java │ │ │ ├── SmallSortedMapTest.java │ │ │ ├── TestBadIdentifiers.java │ │ │ ├── TestUtil.java │ │ │ ├── TestUtilLite.java │ │ │ ├── TextFormatParseInfoTreeTest.java │ │ │ ├── TextFormatParseLocationTest.java │ │ │ ├── TextFormatTest.java │ │ │ ├── UnknownEnumValueTest.java │ │ │ ├── UnknownFieldSetLiteTest.java │ │ │ ├── UnknownFieldSetTest.java │ │ │ ├── UnmodifiableLazyStringListTest.java │ │ │ ├── WellKnownTypesTest.java │ │ │ └── WireFormatTest.java │ │ └── proto │ │ └── com │ │ └── google │ │ └── protobuf │ │ ├── any_test.proto │ │ ├── field_presence_test.proto │ │ ├── lazy_fields_lite.proto │ │ ├── lite_equals_and_hash.proto │ │ ├── map_for_proto2_lite_test.proto │ │ ├── map_for_proto2_test.proto │ │ ├── map_initialization_order_test.proto │ │ ├── map_test.proto │ │ ├── multiple_files_test.proto │ │ ├── nested_builders_test.proto │ │ ├── nested_extension.proto │ │ ├── nested_extension_lite.proto │ │ ├── non_nested_extension.proto │ │ ├── non_nested_extension_lite.proto │ │ ├── outer_class_name_test.proto │ │ ├── outer_class_name_test2.proto │ │ ├── outer_class_name_test3.proto │ │ ├── test_bad_identifiers.proto │ │ ├── test_check_utf8.proto │ │ ├── test_check_utf8_size.proto │ │ ├── test_custom_options.proto │ │ └── test_extra_interfaces.proto ├── lite │ ├── generate-sources-build.xml │ ├── generate-test-sources-build.xml │ └── pom.xml ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── google │ │ └── protobuf │ │ ├── AbstractMessage.java │ │ ├── AbstractMessageLite.java │ │ ├── AbstractParser.java │ │ ├── AbstractProtobufList.java │ │ ├── BlockingRpcChannel.java │ │ └── BlockingService.java └── util │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── google │ │ └── protobuf │ │ └── util │ │ ├── FieldMaskTree.java │ │ ├── FieldMaskUtil.java │ │ ├── JsonFormat.java │ │ └── TimeUtil.java │ └── test │ ├── java │ └── com │ │ └── google │ │ └── protobuf │ │ └── util │ │ ├── FieldMaskTreeTest.java │ │ ├── FieldMaskUtilTest.java │ │ ├── JsonFormatTest.java │ │ └── TimeUtilTest.java │ └── proto │ └── com │ └── google │ └── protobuf │ └── util │ └── json_test.proto ├── javanano ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── google │ │ └── protobuf │ │ └── nano │ │ ├── CodedInputByteBufferNano.java │ │ ├── CodedOutputByteBufferNano.java │ │ ├── ExtendableMessageNano.java │ │ ├── Extension.java │ │ ├── FieldArray.java │ │ ├── FieldData.java │ │ ├── InternalNano.java │ │ ├── InvalidProtocolBufferNanoException.java │ │ ├── MapFactories.java │ │ ├── MessageNano.java │ │ ├── MessageNanoPrinter.java │ │ ├── UnknownFieldData.java │ │ └── WireFormatNano.java │ └── test │ └── java │ └── com │ └── google │ └── protobuf │ └── nano │ ├── NanoTest.java │ ├── map_test.proto │ ├── unittest_accessors_nano.proto │ ├── unittest_enum_class_multiple_nano.proto │ ├── unittest_enum_class_nano.proto │ ├── unittest_enum_validity_nano.proto │ ├── unittest_extension_nano.proto │ ├── unittest_extension_packed_nano.proto │ ├── unittest_extension_repeated_nano.proto │ ├── unittest_extension_singular_nano.proto │ ├── unittest_has_nano.proto │ ├── unittest_import_nano.proto │ ├── unittest_multiple_nameclash_nano.proto │ ├── unittest_multiple_nano.proto │ ├── unittest_nano.proto │ ├── unittest_recursive_nano.proto │ ├── unittest_reference_types_nano.proto │ ├── unittest_repeated_merge_nano.proto │ ├── unittest_repeated_packables_nano.proto │ ├── unittest_simple_nano.proto │ ├── unittest_single_nano.proto │ └── unittest_stringutf8_nano.proto ├── jenkins ├── README.md ├── build_and_run_docker.sh ├── buildcmds │ ├── README.md │ └── pull_request.sh ├── docker │ └── Dockerfile ├── make_test_output.py └── pull_request_in_docker.sh ├── js ├── README.md ├── binary │ ├── arith.js │ ├── arith_test.js │ ├── constants.js │ ├── decoder.js │ ├── decoder_test.js │ ├── encoder.js │ ├── proto_test.js │ ├── reader.js │ ├── reader_test.js │ ├── utils.js │ ├── utils_test.js │ ├── writer.js │ └── writer_test.js ├── commonjs │ ├── export.js │ ├── export_asserts.js │ ├── export_testdeps.js │ ├── import_test.js │ ├── jasmine.json │ ├── rewrite_tests_for_commonjs.js │ ├── test6 │ │ └── test6.proto │ └── test7 │ │ └── test7.proto ├── data.proto ├── debug.js ├── debug_test.js ├── gulpfile.js ├── jasmine.json ├── message.js ├── message_test.js ├── node_loader.js ├── package.json ├── proto3_test.js ├── proto3_test.proto ├── test.proto ├── test2.proto ├── test3.proto ├── test4.proto ├── test5.proto ├── test_bootstrap.js ├── testbinary.proto └── testempty.proto ├── m4 ├── ac_system_extensions.m4 ├── acx_check_suncc.m4 ├── acx_pthread.m4 └── stl_hash.m4 ├── more_tests └── Makefile ├── objectivec ├── DevTools │ ├── check_version_stamps.sh │ ├── compile_testing_protos.sh │ ├── full_mac_build.sh │ ├── pddm.py │ └── pddm_tests.py ├── GPBArray.h ├── GPBArray.m ├── GPBArray_PackagePrivate.h ├── GPBBootstrap.h ├── GPBCodedInputStream.h ├── GPBCodedInputStream.m ├── GPBCodedInputStream_PackagePrivate.h ├── GPBCodedOutputStream.h ├── GPBCodedOutputStream.m ├── GPBCodedOutputStream_PackagePrivate.h ├── GPBDescriptor.h ├── GPBDescriptor.m ├── GPBDescriptor_PackagePrivate.h ├── GPBDictionary.h ├── GPBDictionary.m ├── GPBDictionary_PackagePrivate.h ├── GPBExtensionInternals.h ├── GPBExtensionInternals.m ├── GPBExtensionRegistry.h ├── GPBExtensionRegistry.m ├── GPBMessage.h ├── GPBMessage.m ├── GPBMessage_PackagePrivate.h ├── GPBProtocolBuffers.h ├── GPBProtocolBuffers.m ├── GPBProtocolBuffers_RuntimeSupport.h ├── GPBRootObject.h ├── GPBRootObject.m ├── GPBRootObject_PackagePrivate.h ├── GPBRuntimeTypes.h ├── GPBUnknownField.h ├── GPBUnknownField.m ├── GPBUnknownFieldSet.h ├── GPBUnknownFieldSet.m ├── GPBUnknownFieldSet_PackagePrivate.h ├── GPBUnknownField_PackagePrivate.h ├── GPBUtilities.h ├── GPBUtilities.m ├── GPBUtilities_PackagePrivate.h ├── GPBWellKnownTypes.h ├── GPBWellKnownTypes.m ├── GPBWireFormat.h ├── GPBWireFormat.m ├── ProtocolBuffers_OSX.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ ├── PerformanceTests.xcscheme │ │ └── ProtocolBuffers.xcscheme ├── ProtocolBuffers_iOS.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ ├── xcbaselines │ │ └── 8BBEA4A5147C727100C4ADB7.xcbaseline │ │ │ ├── FFE465CA-0E74-40E8-9F09-500B66B7DCB2.plist │ │ │ └── Info.plist │ │ └── xcschemes │ │ ├── PerformanceTests.xcscheme │ │ └── ProtocolBuffers.xcscheme ├── README.md ├── Tests │ ├── GPBARCUnittestProtos.m │ ├── GPBArrayTests.m │ ├── GPBCodedInputStreamTests.m │ ├── GPBCodedOuputStreamTests.m │ ├── GPBConcurrencyTests.m │ ├── GPBDescriptorTests.m │ ├── GPBDictionaryTests+Bool.m │ ├── GPBDictionaryTests+Int32.m │ ├── GPBDictionaryTests+Int64.m │ ├── GPBDictionaryTests+String.m │ ├── GPBDictionaryTests+UInt32.m │ ├── GPBDictionaryTests+UInt64.m │ ├── GPBDictionaryTests.pddm │ ├── GPBMessageTests+Merge.m │ ├── GPBMessageTests+Runtime.m │ ├── GPBMessageTests+Serialization.m │ ├── GPBMessageTests.m │ ├── GPBObjectiveCPlusPlusTest.mm │ ├── GPBPerfTests.m │ ├── GPBSwiftTests.swift │ ├── GPBTestUtilities.h │ ├── GPBTestUtilities.m │ ├── GPBUnittestProtos.m │ ├── GPBUnknownFieldSetTest.m │ ├── GPBUtilitiesTests.m │ ├── GPBWellKnownTypesTest.m │ ├── GPBWireFormatTests.m │ ├── UnitTests-Bridging-Header.h │ ├── UnitTests-Info.plist │ ├── golden_message │ ├── golden_packed_fields_message │ ├── iOSTestHarness │ │ ├── AppDelegate.m │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── iPad6.png │ │ │ │ ├── iPad6_2x.png │ │ │ │ ├── iPad7.png │ │ │ │ ├── iPad7_2x.png │ │ │ │ ├── iPhone6.png │ │ │ │ ├── iPhone6_2x.png │ │ │ │ ├── iPhone7_2x.png │ │ │ │ └── iPhone7_3x.png │ │ │ └── LaunchImage.launchimage │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.xib │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ ├── text_format_map_unittest_data.txt │ ├── text_format_unittest_data.txt │ ├── unittest_cycle.proto │ ├── unittest_objc.proto │ ├── unittest_objc_startup.proto │ ├── unittest_runtime_proto2.proto │ └── unittest_runtime_proto3.proto ├── generate_well_known_types.sh └── google │ └── protobuf │ ├── Any.pbobjc.h │ ├── Any.pbobjc.m │ ├── Api.pbobjc.h │ ├── Api.pbobjc.m │ ├── Duration.pbobjc.h │ ├── Duration.pbobjc.m │ ├── Empty.pbobjc.h │ ├── Empty.pbobjc.m │ ├── FieldMask.pbobjc.h │ ├── FieldMask.pbobjc.m │ ├── SourceContext.pbobjc.h │ ├── SourceContext.pbobjc.m │ ├── Struct.pbobjc.h │ ├── Struct.pbobjc.m │ ├── Timestamp.pbobjc.h │ ├── Timestamp.pbobjc.m │ ├── Type.pbobjc.h │ ├── Type.pbobjc.m │ ├── Wrappers.pbobjc.h │ └── Wrappers.pbobjc.m ├── php ├── ext │ └── google │ │ └── protobuf │ │ ├── config.m4 │ │ ├── def.c │ │ ├── message.c │ │ ├── protobuf.c │ │ ├── protobuf.h │ │ ├── storage.c │ │ ├── test.php │ │ ├── upb.c │ │ └── upb.h └── tests │ └── autoload.php ├── post_process_dist.sh ├── protobuf-lite.pc.in ├── protobuf.bzl ├── protobuf.pc.in ├── protoc-artifacts ├── Dockerfile ├── README.md ├── build-protoc.sh └── pom.xml ├── python ├── MANIFEST.in ├── README.md ├── google │ ├── __init__.py │ └── protobuf │ │ ├── __init__.py │ │ ├── descriptor.py │ │ ├── descriptor_database.py │ │ ├── descriptor_pool.py │ │ ├── internal │ │ ├── __init__.py │ │ ├── _parameterized.py │ │ ├── any_test.proto │ │ ├── api_implementation.cc │ │ ├── api_implementation.py │ │ ├── containers.py │ │ ├── decoder.py │ │ ├── descriptor_database_test.py │ │ ├── descriptor_pool_test.py │ │ ├── descriptor_pool_test1.proto │ │ ├── descriptor_pool_test2.proto │ │ ├── descriptor_test.py │ │ ├── encoder.py │ │ ├── enum_type_wrapper.py │ │ ├── factory_test1.proto │ │ ├── factory_test2.proto │ │ ├── generator_test.py │ │ ├── import_test_package │ │ │ ├── __init__.py │ │ │ ├── inner.proto │ │ │ └── outer.proto │ │ ├── json_format_test.py │ │ ├── message_factory_test.py │ │ ├── message_listener.py │ │ ├── message_set_extensions.proto │ │ ├── message_test.py │ │ ├── missing_enum_values.proto │ │ ├── more_extensions.proto │ │ ├── more_extensions_dynamic.proto │ │ ├── more_messages.proto │ │ ├── packed_field_test.proto │ │ ├── proto_builder_test.py │ │ ├── python_message.py │ │ ├── reflection_test.py │ │ ├── service_reflection_test.py │ │ ├── symbol_database_test.py │ │ ├── test_bad_identifiers.proto │ │ ├── test_util.py │ │ ├── text_encoding_test.py │ │ ├── text_format_test.py │ │ ├── type_checkers.py │ │ ├── unknown_fields_test.py │ │ ├── well_known_types.py │ │ ├── well_known_types_test.py │ │ ├── wire_format.py │ │ └── wire_format_test.py │ │ ├── json_format.py │ │ ├── message.py │ │ ├── message_factory.py │ │ ├── proto_builder.py │ │ ├── pyext │ │ ├── README │ │ ├── __init__.py │ │ ├── cpp_message.py │ │ ├── descriptor.cc │ │ ├── descriptor.h │ │ ├── descriptor_containers.cc │ │ ├── descriptor_containers.h │ │ ├── descriptor_database.cc │ │ ├── descriptor_database.h │ │ ├── descriptor_pool.cc │ │ ├── descriptor_pool.h │ │ ├── extension_dict.cc │ │ ├── extension_dict.h │ │ ├── map_container.cc │ │ ├── map_container.h │ │ ├── message.cc │ │ ├── message.h │ │ ├── proto2_api_test.proto │ │ ├── python.proto │ │ ├── python_protobuf.h │ │ ├── repeated_composite_container.cc │ │ ├── repeated_composite_container.h │ │ ├── repeated_scalar_container.cc │ │ ├── repeated_scalar_container.h │ │ └── scoped_pyobject_ptr.h │ │ ├── reflection.py │ │ ├── service.py │ │ ├── service_reflection.py │ │ ├── symbol_database.py │ │ ├── text_encoding.py │ │ └── text_format.py ├── mox.py ├── setup.py ├── stubout.py └── tox.ini ├── ruby ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── ext │ └── google │ │ └── protobuf_c │ │ ├── defs.c │ │ ├── encode_decode.c │ │ ├── extconf.rb │ │ ├── map.c │ │ ├── message.c │ │ ├── protobuf.c │ │ ├── protobuf.h │ │ ├── repeated_field.c │ │ ├── storage.c │ │ ├── upb.c │ │ └── upb.h ├── google-protobuf.gemspec ├── lib │ └── google │ │ ├── protobuf.rb │ │ └── protobuf │ │ ├── message_exts.rb │ │ └── repeated_field.rb ├── pom.xml ├── src │ └── main │ │ ├── java │ │ ├── com │ │ │ └── google │ │ │ │ └── protobuf │ │ │ │ └── jruby │ │ │ │ ├── RubyBuilder.java │ │ │ │ ├── RubyDescriptor.java │ │ │ │ ├── RubyDescriptorPool.java │ │ │ │ ├── RubyEnum.java │ │ │ │ ├── RubyEnumBuilderContext.java │ │ │ │ ├── RubyEnumDescriptor.java │ │ │ │ ├── RubyFieldDescriptor.java │ │ │ │ ├── RubyMap.java │ │ │ │ ├── RubyMessage.java │ │ │ │ ├── RubyMessageBuilderContext.java │ │ │ │ ├── RubyOneofBuilderContext.java │ │ │ │ ├── RubyOneofDescriptor.java │ │ │ │ ├── RubyProtobuf.java │ │ │ │ ├── RubyRepeatedField.java │ │ │ │ ├── SentinelOuterClass.java │ │ │ │ └── Utils.java │ │ └── google │ │ │ └── ProtobufJavaService.java │ │ └── sentinel.proto ├── tests │ ├── basic.rb │ ├── generated_code.proto │ ├── generated_code_test.rb │ ├── repeated_field_test.rb │ └── stress.rb └── travis-test.sh ├── six.BUILD ├── src ├── Makefile.am ├── README.md ├── google │ └── protobuf │ │ ├── any.cc │ │ ├── any.h │ │ ├── any.pb.cc │ │ ├── any.pb.h │ │ ├── any.proto │ │ ├── any_test.cc │ │ ├── any_test.proto │ │ ├── api.pb.cc │ │ ├── api.pb.h │ │ ├── api.proto │ │ ├── arena.cc │ │ ├── arena.h │ │ ├── arena_nc.cc │ │ ├── arena_nc_test.py │ │ ├── arena_test_util.cc │ │ ├── arena_test_util.h │ │ ├── arena_unittest.cc │ │ ├── arenastring.cc │ │ ├── arenastring.h │ │ ├── arenastring_unittest.cc │ │ ├── compiler │ │ ├── code_generator.cc │ │ ├── code_generator.h │ │ ├── command_line_interface.cc │ │ ├── command_line_interface.h │ │ ├── command_line_interface_unittest.cc │ │ ├── cpp │ │ │ ├── cpp_bootstrap_unittest.cc │ │ │ ├── cpp_enum.cc │ │ │ ├── cpp_enum.h │ │ │ ├── cpp_enum_field.cc │ │ │ ├── cpp_enum_field.h │ │ │ ├── cpp_extension.cc │ │ │ ├── cpp_extension.h │ │ │ ├── cpp_field.cc │ │ │ ├── cpp_field.h │ │ │ ├── cpp_file.cc │ │ │ ├── cpp_file.h │ │ │ ├── cpp_generator.cc │ │ │ ├── cpp_generator.h │ │ │ ├── cpp_helpers.cc │ │ │ ├── cpp_helpers.h │ │ │ ├── cpp_map_field.cc │ │ │ ├── cpp_map_field.h │ │ │ ├── cpp_message.cc │ │ │ ├── cpp_message.h │ │ │ ├── cpp_message_field.cc │ │ │ ├── cpp_message_field.h │ │ │ ├── cpp_options.h │ │ │ ├── cpp_plugin_unittest.cc │ │ │ ├── cpp_primitive_field.cc │ │ │ ├── cpp_primitive_field.h │ │ │ ├── cpp_service.cc │ │ │ ├── cpp_service.h │ │ │ ├── cpp_string_field.cc │ │ │ ├── cpp_string_field.h │ │ │ ├── cpp_test_bad_identifiers.proto │ │ │ ├── cpp_test_large_enum_value.proto │ │ │ ├── cpp_unittest.cc │ │ │ ├── cpp_unittest.h │ │ │ └── metadata_test.cc │ │ ├── csharp │ │ │ ├── csharp_doc_comment.cc │ │ │ ├── csharp_doc_comment.h │ │ │ ├── csharp_enum.cc │ │ │ ├── csharp_enum.h │ │ │ ├── csharp_enum_field.cc │ │ │ ├── csharp_enum_field.h │ │ │ ├── csharp_field_base.cc │ │ │ ├── csharp_field_base.h │ │ │ ├── csharp_generator.cc │ │ │ ├── csharp_generator.h │ │ │ ├── csharp_generator_unittest.cc │ │ │ ├── csharp_helpers.cc │ │ │ ├── csharp_helpers.h │ │ │ ├── csharp_map_field.cc │ │ │ ├── csharp_map_field.h │ │ │ ├── csharp_message.cc │ │ │ ├── csharp_message.h │ │ │ ├── csharp_message_field.cc │ │ │ ├── csharp_message_field.h │ │ │ ├── csharp_names.h │ │ │ ├── csharp_options.h │ │ │ ├── csharp_primitive_field.cc │ │ │ ├── csharp_primitive_field.h │ │ │ ├── csharp_reflection_class.cc │ │ │ ├── csharp_reflection_class.h │ │ │ ├── csharp_repeated_enum_field.cc │ │ │ ├── csharp_repeated_enum_field.h │ │ │ ├── csharp_repeated_message_field.cc │ │ │ ├── csharp_repeated_message_field.h │ │ │ ├── csharp_repeated_primitive_field.cc │ │ │ ├── csharp_repeated_primitive_field.h │ │ │ ├── csharp_source_generator_base.cc │ │ │ ├── csharp_source_generator_base.h │ │ │ ├── csharp_wrapper_field.cc │ │ │ └── csharp_wrapper_field.h │ │ ├── importer.cc │ │ ├── importer.h │ │ ├── importer_unittest.cc │ │ ├── java │ │ │ ├── java_context.cc │ │ │ ├── java_context.h │ │ │ ├── java_doc_comment.cc │ │ │ ├── java_doc_comment.h │ │ │ ├── java_doc_comment_unittest.cc │ │ │ ├── java_enum.cc │ │ │ ├── java_enum.h │ │ │ ├── java_enum_field.cc │ │ │ ├── java_enum_field.h │ │ │ ├── java_enum_field_lite.cc │ │ │ ├── java_enum_field_lite.h │ │ │ ├── java_enum_lite.cc │ │ │ ├── java_enum_lite.h │ │ │ ├── java_extension.cc │ │ │ ├── java_extension.h │ │ │ ├── java_extension_lite.cc │ │ │ ├── java_extension_lite.h │ │ │ ├── java_field.cc │ │ │ ├── java_field.h │ │ │ ├── java_file.cc │ │ │ ├── java_file.h │ │ │ ├── java_generator.cc │ │ │ ├── java_generator.h │ │ │ ├── java_generator_factory.cc │ │ │ ├── java_generator_factory.h │ │ │ ├── java_helpers.cc │ │ │ ├── java_helpers.h │ │ │ ├── java_lazy_message_field.cc │ │ │ ├── java_lazy_message_field.h │ │ │ ├── java_lazy_message_field_lite.cc │ │ │ ├── java_lazy_message_field_lite.h │ │ │ ├── java_map_field.cc │ │ │ ├── java_map_field.h │ │ │ ├── java_map_field_lite.cc │ │ │ ├── java_map_field_lite.h │ │ │ ├── java_message.cc │ │ │ ├── java_message.h │ │ │ ├── java_message_builder.cc │ │ │ ├── java_message_builder.h │ │ │ ├── java_message_builder_lite.cc │ │ │ ├── java_message_builder_lite.h │ │ │ ├── java_message_field.cc │ │ │ ├── java_message_field.h │ │ │ ├── java_message_field_lite.cc │ │ │ ├── java_message_field_lite.h │ │ │ ├── java_message_lite.cc │ │ │ ├── java_message_lite.h │ │ │ ├── java_name_resolver.cc │ │ │ ├── java_name_resolver.h │ │ │ ├── java_names.h │ │ │ ├── java_plugin_unittest.cc │ │ │ ├── java_primitive_field.cc │ │ │ ├── java_primitive_field.h │ │ │ ├── java_primitive_field_lite.cc │ │ │ ├── java_primitive_field_lite.h │ │ │ ├── java_service.cc │ │ │ ├── java_service.h │ │ │ ├── java_shared_code_generator.cc │ │ │ ├── java_shared_code_generator.h │ │ │ ├── java_string_field.cc │ │ │ ├── java_string_field.h │ │ │ ├── java_string_field_lite.cc │ │ │ └── java_string_field_lite.h │ │ ├── javanano │ │ │ ├── javanano_enum.cc │ │ │ ├── javanano_enum.h │ │ │ ├── javanano_enum_field.cc │ │ │ ├── javanano_enum_field.h │ │ │ ├── javanano_extension.cc │ │ │ ├── javanano_extension.h │ │ │ ├── javanano_field.cc │ │ │ ├── javanano_field.h │ │ │ ├── javanano_file.cc │ │ │ ├── javanano_file.h │ │ │ ├── javanano_generator.cc │ │ │ ├── javanano_generator.h │ │ │ ├── javanano_helpers.cc │ │ │ ├── javanano_helpers.h │ │ │ ├── javanano_map_field.cc │ │ │ ├── javanano_map_field.h │ │ │ ├── javanano_message.cc │ │ │ ├── javanano_message.h │ │ │ ├── javanano_message_field.cc │ │ │ ├── javanano_message_field.h │ │ │ ├── javanano_params.h │ │ │ ├── javanano_primitive_field.cc │ │ │ └── javanano_primitive_field.h │ │ ├── js │ │ │ ├── js_generator.cc │ │ │ └── js_generator.h │ │ ├── main.cc │ │ ├── mock_code_generator.cc │ │ ├── mock_code_generator.h │ │ ├── objectivec │ │ │ ├── objectivec_enum.cc │ │ │ ├── objectivec_enum.h │ │ │ ├── objectivec_enum_field.cc │ │ │ ├── objectivec_enum_field.h │ │ │ ├── objectivec_extension.cc │ │ │ ├── objectivec_extension.h │ │ │ ├── objectivec_field.cc │ │ │ ├── objectivec_field.h │ │ │ ├── objectivec_file.cc │ │ │ ├── objectivec_file.h │ │ │ ├── objectivec_generator.cc │ │ │ ├── objectivec_generator.h │ │ │ ├── objectivec_helpers.cc │ │ │ ├── objectivec_helpers.h │ │ │ ├── objectivec_helpers_unittest.cc │ │ │ ├── objectivec_map_field.cc │ │ │ ├── objectivec_map_field.h │ │ │ ├── objectivec_message.cc │ │ │ ├── objectivec_message.h │ │ │ ├── objectivec_message_field.cc │ │ │ ├── objectivec_message_field.h │ │ │ ├── objectivec_oneof.cc │ │ │ ├── objectivec_oneof.h │ │ │ ├── objectivec_primitive_field.cc │ │ │ └── objectivec_primitive_field.h │ │ ├── package_info.h │ │ ├── parser.cc │ │ ├── parser.h │ │ ├── parser_unittest.cc │ │ ├── plugin.cc │ │ ├── plugin.h │ │ ├── plugin.pb.cc │ │ ├── plugin.pb.h │ │ ├── plugin.proto │ │ ├── python │ │ │ ├── python_generator.cc │ │ │ ├── python_generator.h │ │ │ └── python_plugin_unittest.cc │ │ ├── ruby │ │ │ ├── ruby_generated_code.proto │ │ │ ├── ruby_generated_code.rb │ │ │ ├── ruby_generator.cc │ │ │ ├── ruby_generator.h │ │ │ └── ruby_generator_unittest.cc │ │ ├── subprocess.cc │ │ ├── subprocess.h │ │ ├── test_plugin.cc │ │ ├── zip_output_unittest.sh │ │ ├── zip_writer.cc │ │ └── zip_writer.h │ │ ├── descriptor.cc │ │ ├── descriptor.h │ │ ├── descriptor.pb.cc │ │ ├── descriptor.pb.h │ │ ├── descriptor.proto │ │ ├── descriptor_database.cc │ │ ├── descriptor_database.h │ │ ├── descriptor_database_unittest.cc │ │ ├── descriptor_unittest.cc │ │ ├── drop_unknown_fields_test.cc │ │ ├── duration.pb.cc │ │ ├── duration.pb.h │ │ ├── duration.proto │ │ ├── dynamic_message.cc │ │ ├── dynamic_message.h │ │ ├── dynamic_message_unittest.cc │ │ ├── empty.pb.cc │ │ ├── empty.pb.h │ │ ├── empty.proto │ │ ├── extension_set.cc │ │ ├── extension_set.h │ │ ├── extension_set_heavy.cc │ │ ├── extension_set_unittest.cc │ │ ├── field_mask.pb.cc │ │ ├── field_mask.pb.h │ │ ├── field_mask.proto │ │ ├── generated_enum_reflection.h │ │ ├── generated_enum_util.h │ │ ├── generated_message_reflection.cc │ │ ├── generated_message_reflection.h │ │ ├── generated_message_reflection_unittest.cc │ │ ├── generated_message_util.cc │ │ ├── generated_message_util.h │ │ ├── io │ │ ├── coded_stream.cc │ │ ├── coded_stream.h │ │ ├── coded_stream_inl.h │ │ ├── coded_stream_unittest.cc │ │ ├── gzip_stream.cc │ │ ├── gzip_stream.h │ │ ├── gzip_stream_unittest.sh │ │ ├── package_info.h │ │ ├── printer.cc │ │ ├── printer.h │ │ ├── printer_unittest.cc │ │ ├── strtod.cc │ │ ├── strtod.h │ │ ├── tokenizer.cc │ │ ├── tokenizer.h │ │ ├── tokenizer_unittest.cc │ │ ├── zero_copy_stream.cc │ │ ├── zero_copy_stream.h │ │ ├── zero_copy_stream_impl.cc │ │ ├── zero_copy_stream_impl.h │ │ ├── zero_copy_stream_impl_lite.cc │ │ ├── zero_copy_stream_impl_lite.h │ │ └── zero_copy_stream_unittest.cc │ │ ├── lite_arena_unittest.cc │ │ ├── lite_unittest.cc │ │ ├── map.h │ │ ├── map_entry.h │ │ ├── map_entry_lite.h │ │ ├── map_field.cc │ │ ├── map_field.h │ │ ├── map_field_inl.h │ │ ├── map_field_lite.h │ │ ├── map_field_test.cc │ │ ├── map_lite_test_util.cc │ │ ├── map_lite_test_util.h │ │ ├── map_lite_unittest.proto │ │ ├── map_proto2_unittest.proto │ │ ├── map_test.cc │ │ ├── map_test_util.cc │ │ ├── map_test_util.h │ │ ├── map_test_util_impl.h │ │ ├── map_type_handler.h │ │ ├── map_unittest.proto │ │ ├── map_unittest_proto3.proto │ │ ├── message.cc │ │ ├── message.h │ │ ├── message_lite.cc │ │ ├── message_lite.h │ │ ├── message_unittest.cc │ │ ├── metadata.h │ │ ├── no_field_presence_test.cc │ │ ├── package_info.h │ │ ├── preserve_unknown_enum_test.cc │ │ ├── proto3_arena_lite_unittest.cc │ │ ├── proto3_arena_unittest.cc │ │ ├── proto3_lite_unittest.cc │ │ ├── reflection.h │ │ ├── reflection_internal.h │ │ ├── reflection_ops.cc │ │ ├── reflection_ops.h │ │ ├── reflection_ops_unittest.cc │ │ ├── repeated_field.cc │ │ ├── repeated_field.h │ │ ├── repeated_field_reflection.h │ │ ├── repeated_field_reflection_unittest.cc │ │ ├── repeated_field_unittest.cc │ │ ├── service.cc │ │ ├── service.h │ │ ├── source_context.pb.cc │ │ ├── source_context.pb.h │ │ ├── source_context.proto │ │ ├── struct.pb.cc │ │ ├── struct.pb.h │ │ ├── struct.proto │ │ ├── stubs │ │ ├── atomic_sequence_num.h │ │ ├── atomicops.h │ │ ├── atomicops_internals_arm64_gcc.h │ │ ├── atomicops_internals_arm_gcc.h │ │ ├── atomicops_internals_arm_qnx.h │ │ ├── atomicops_internals_atomicword_compat.h │ │ ├── atomicops_internals_generic_gcc.h │ │ ├── atomicops_internals_macosx.h │ │ ├── atomicops_internals_mips_gcc.h │ │ ├── atomicops_internals_pnacl.h │ │ ├── atomicops_internals_power.h │ │ ├── atomicops_internals_ppc_gcc.h │ │ ├── atomicops_internals_solaris.h │ │ ├── atomicops_internals_tsan.h │ │ ├── atomicops_internals_x86_gcc.cc │ │ ├── atomicops_internals_x86_gcc.h │ │ ├── atomicops_internals_x86_msvc.cc │ │ ├── atomicops_internals_x86_msvc.h │ │ ├── bytestream.cc │ │ ├── bytestream.h │ │ ├── bytestream_unittest.cc │ │ ├── callback.h │ │ ├── casts.h │ │ ├── common.cc │ │ ├── common.h │ │ ├── common_unittest.cc │ │ ├── fastmem.h │ │ ├── hash.h │ │ ├── int128.cc │ │ ├── int128.h │ │ ├── int128_unittest.cc │ │ ├── logging.h │ │ ├── macros.h │ │ ├── map_util.h │ │ ├── mathlimits.cc │ │ ├── mathlimits.h │ │ ├── mathutil.h │ │ ├── mutex.h │ │ ├── once.cc │ │ ├── once.h │ │ ├── once_unittest.cc │ │ ├── platform_macros.h │ │ ├── port.h │ │ ├── scoped_ptr.h │ │ ├── shared_ptr.h │ │ ├── singleton.h │ │ ├── status.cc │ │ ├── status.h │ │ ├── status_macros.h │ │ ├── status_test.cc │ │ ├── statusor.cc │ │ ├── statusor.h │ │ ├── statusor_test.cc │ │ ├── stl_util.h │ │ ├── stringpiece.cc │ │ ├── stringpiece.h │ │ ├── stringpiece_unittest.cc │ │ ├── stringprintf.cc │ │ ├── stringprintf.h │ │ ├── stringprintf_unittest.cc │ │ ├── structurally_valid.cc │ │ ├── structurally_valid_unittest.cc │ │ ├── strutil.cc │ │ ├── strutil.h │ │ ├── strutil_unittest.cc │ │ ├── substitute.cc │ │ ├── substitute.h │ │ ├── template_util.h │ │ ├── template_util_unittest.cc │ │ ├── time.cc │ │ ├── time.h │ │ ├── time_test.cc │ │ ├── type_traits.h │ │ └── type_traits_unittest.cc │ │ ├── test_util.cc │ │ ├── test_util.h │ │ ├── test_util_lite.cc │ │ ├── test_util_lite.h │ │ ├── testdata │ │ ├── bad_utf8_string │ │ ├── golden_message │ │ ├── golden_message_oneof_implemented │ │ ├── golden_message_proto3 │ │ ├── golden_packed_fields_message │ │ ├── map_test_data.txt │ │ ├── text_format_unittest_data.txt │ │ ├── text_format_unittest_data_oneof_implemented.txt │ │ ├── text_format_unittest_data_pointy.txt │ │ ├── text_format_unittest_data_pointy_oneof.txt │ │ ├── text_format_unittest_extensions_data.txt │ │ └── text_format_unittest_extensions_data_pointy.txt │ │ ├── testing │ │ ├── file.cc │ │ ├── file.h │ │ ├── googletest.cc │ │ ├── googletest.h │ │ ├── zcgunzip.cc │ │ └── zcgzip.cc │ │ ├── text_format.cc │ │ ├── text_format.h │ │ ├── text_format_unittest.cc │ │ ├── timestamp.pb.cc │ │ ├── timestamp.pb.h │ │ ├── timestamp.proto │ │ ├── type.pb.cc │ │ ├── type.pb.h │ │ ├── type.proto │ │ ├── unittest.proto │ │ ├── unittest_arena.proto │ │ ├── unittest_custom_options.proto │ │ ├── unittest_drop_unknown_fields.proto │ │ ├── unittest_embed_optimize_for.proto │ │ ├── unittest_empty.proto │ │ ├── unittest_enormous_descriptor.proto │ │ ├── unittest_import.proto │ │ ├── unittest_import_lite.proto │ │ ├── unittest_import_proto3.proto │ │ ├── unittest_import_public.proto │ │ ├── unittest_import_public_lite.proto │ │ ├── unittest_import_public_proto3.proto │ │ ├── unittest_lite.proto │ │ ├── unittest_lite_imports_nonlite.proto │ │ ├── unittest_mset.proto │ │ ├── unittest_mset_wire_format.proto │ │ ├── unittest_no_arena.proto │ │ ├── unittest_no_arena_import.proto │ │ ├── unittest_no_arena_lite.proto │ │ ├── unittest_no_field_presence.proto │ │ ├── unittest_no_generic_services.proto │ │ ├── unittest_optimize_for.proto │ │ ├── unittest_preserve_unknown_enum.proto │ │ ├── unittest_preserve_unknown_enum2.proto │ │ ├── unittest_proto3.proto │ │ ├── unittest_proto3_arena.proto │ │ ├── unittest_proto3_arena_lite.proto │ │ ├── unittest_proto3_lite.proto │ │ ├── unittest_well_known_types.proto │ │ ├── unknown_field_set.cc │ │ ├── unknown_field_set.h │ │ ├── unknown_field_set_unittest.cc │ │ ├── util │ │ ├── field_comparator.cc │ │ ├── field_comparator.h │ │ ├── field_comparator_test.cc │ │ ├── field_mask_util.cc │ │ ├── field_mask_util.h │ │ ├── field_mask_util_test.cc │ │ ├── internal │ │ │ ├── constants.h │ │ │ ├── datapiece.cc │ │ │ ├── datapiece.h │ │ │ ├── default_value_objectwriter.cc │ │ │ ├── default_value_objectwriter.h │ │ │ ├── default_value_objectwriter_test.cc │ │ │ ├── error_listener.cc │ │ │ ├── error_listener.h │ │ │ ├── expecting_objectwriter.h │ │ │ ├── field_mask_utility.cc │ │ │ ├── field_mask_utility.h │ │ │ ├── json_escaping.cc │ │ │ ├── json_escaping.h │ │ │ ├── json_objectwriter.cc │ │ │ ├── json_objectwriter.h │ │ │ ├── json_objectwriter_test.cc │ │ │ ├── json_stream_parser.cc │ │ │ ├── json_stream_parser.h │ │ │ ├── json_stream_parser_test.cc │ │ │ ├── location_tracker.h │ │ │ ├── mock_error_listener.h │ │ │ ├── object_location_tracker.h │ │ │ ├── object_source.h │ │ │ ├── object_writer.cc │ │ │ ├── object_writer.h │ │ │ ├── proto_writer.cc │ │ │ ├── proto_writer.h │ │ │ ├── protostream_objectsource.cc │ │ │ ├── protostream_objectsource.h │ │ │ ├── protostream_objectsource_test.cc │ │ │ ├── protostream_objectwriter.cc │ │ │ ├── protostream_objectwriter.h │ │ │ ├── protostream_objectwriter_test.cc │ │ │ ├── structured_objectwriter.h │ │ │ ├── testdata │ │ │ │ ├── anys.proto │ │ │ │ ├── books.proto │ │ │ │ ├── default_value.proto │ │ │ │ ├── default_value_test.proto │ │ │ │ ├── field_mask.proto │ │ │ │ ├── maps.proto │ │ │ │ ├── oneofs.proto │ │ │ │ ├── struct.proto │ │ │ │ ├── timestamp_duration.proto │ │ │ │ └── wrappers.proto │ │ │ ├── type_info.cc │ │ │ ├── type_info.h │ │ │ ├── type_info_test_helper.cc │ │ │ ├── type_info_test_helper.h │ │ │ ├── utility.cc │ │ │ └── utility.h │ │ ├── json_format_proto3.proto │ │ ├── json_util.cc │ │ ├── json_util.h │ │ ├── json_util_test.cc │ │ ├── message_differencer.cc │ │ ├── message_differencer.h │ │ ├── message_differencer_unittest.cc │ │ ├── message_differencer_unittest.proto │ │ ├── time_util.cc │ │ ├── time_util.h │ │ ├── time_util_test.cc │ │ ├── type_resolver.h │ │ ├── type_resolver_util.cc │ │ ├── type_resolver_util.h │ │ └── type_resolver_util_test.cc │ │ ├── well_known_types_unittest.cc │ │ ├── wire_format.cc │ │ ├── wire_format.h │ │ ├── wire_format_lite.cc │ │ ├── wire_format_lite.h │ │ ├── wire_format_lite_inl.h │ │ ├── wire_format_unittest.cc │ │ ├── wrappers.pb.cc │ │ ├── wrappers.pb.h │ │ └── wrappers.proto └── solaris │ └── libstdc++.la ├── tests.sh ├── update_file_lists.sh └── util └── python └── BUILD /LICENSE: -------------------------------------------------------------------------------- 1 | This license applies to all parts of Protocol Buffers except the following: 2 | 3 | - Atomicops support for generic gcc, located in 4 | src/google/protobuf/stubs/atomicops_internals_generic_gcc.h. 5 | This file is copyrighted by Red Hat Inc. 6 | 7 | - Atomicops support for AIX/POWER, located in 8 | src/google/protobuf/stubs/atomicops_internals_power.h. 9 | This file is copyrighted by Bloomberg Finance LP. 10 | 11 | Copyright 2014, Google Inc. All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are 15 | met: 16 | 17 | * Redistributions of source code must retain the above copyright 18 | notice, this list of conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above 20 | copyright notice, this list of conditions and the following disclaimer 21 | in the documentation and/or other materials provided with the 22 | distribution. 23 | * Neither the name of Google Inc. nor the names of its 24 | contributors may be used to endorse or promote products derived from 25 | this software without specific prior written permission. 26 | 27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | 39 | Code generated by the Protocol Buffer compiler is owned by the owner 40 | of the input file used when generating it. This code is not 41 | standalone and requires a support library to be linked with it. This 42 | support library is itself covered by the above license. 43 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | new_http_archive( 2 | name = "gmock_archive", 3 | url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip", 4 | sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b", 5 | build_file = "gmock.BUILD", 6 | ) 7 | 8 | new_http_archive( 9 | name = "six_archive", 10 | url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", 11 | sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", 12 | build_file = "six.BUILD", 13 | ) 14 | 15 | bind( 16 | name = "python_headers", 17 | actual = "//util/python:python_headers", 18 | ) 19 | 20 | bind( 21 | name = "gtest", 22 | actual = "@gmock_archive//:gtest", 23 | ) 24 | 25 | bind( 26 | name = "gtest_main", 27 | actual = "@gmock_archive//:gtest_main", 28 | ) 29 | 30 | bind( 31 | name = "six", 32 | actual = "@six_archive//:six", 33 | ) 34 | 35 | maven_jar( 36 | name = "guava_maven", 37 | artifact = "com.google.guava:guava:18.0", 38 | ) 39 | 40 | bind( 41 | name = "guava", 42 | actual = "@guava_maven//jar", 43 | ) 44 | 45 | maven_jar( 46 | name = "gson_maven", 47 | artifact = "com.google.code.gson:gson:2.3", 48 | ) 49 | 50 | bind( 51 | name = "gson", 52 | actual = "@gson_maven//jar", 53 | ) 54 | -------------------------------------------------------------------------------- /appveyor.bat: -------------------------------------------------------------------------------- 1 | setlocal 2 | 3 | IF %language%==cpp GOTO build_cpp 4 | IF %language%==csharp GOTO build_csharp 5 | 6 | echo Unsupported language %language%. Exiting. 7 | goto :error 8 | 9 | :build_cpp 10 | echo Building C++ 11 | mkdir build_msvc 12 | cd build_msvc 13 | cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% ../cmake 14 | msbuild protobuf.sln /p:Platform=%vcplatform% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error 15 | cd %configuration% 16 | tests.exe || goto error 17 | goto :EOF 18 | 19 | :build_csharp 20 | echo Building C# 21 | cd csharp\src 22 | nuget restore 23 | msbuild Google.Protobuf.sln /p:Platform="Any CPU" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error 24 | nunit-console Google.Protobuf.Test\bin\%configuration%\Google.Protobuf.Test.dll || goto error 25 | goto :EOF 26 | 27 | :error 28 | echo Failed! 29 | EXIT /b %ERRORLEVEL% 30 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # Only test one combination: "Visual Studio 12 + Win64 + Debug + DLL". We can 2 | # test more combinations but AppVeyor just takes too long to finish (each 3 | # combination takes ~15mins). 4 | platform: 5 | - Win64 6 | 7 | configuration: 8 | - Debug 9 | 10 | environment: 11 | matrix: 12 | - language: cpp 13 | BUILD_DLL: ON 14 | 15 | - language: csharp 16 | 17 | install: 18 | - ps: Start-FileDownload https://googlemock.googlecode.com/files/gmock-1.7.0.zip 19 | - 7z x gmock-1.7.0.zip 20 | - rename gmock-1.7.0 gmock 21 | 22 | before_build: 23 | - if %platform%==Win32 set generator=Visual Studio 12 24 | - if %platform%==Win64 set generator=Visual Studio 12 Win64 25 | - if %platform%==Win32 set vcplatform=Win32 26 | - if %platform%==Win64 set vcplatform=x64 27 | 28 | build_script: 29 | - CALL appveyor.bat 30 | 31 | skip_commits: 32 | message: /.*\[skip appveyor\].*/ 33 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script to generate the configure script and other files that will 4 | # be included in the distribution. These files are not checked in because they 5 | # are automatically generated. 6 | 7 | set -e 8 | 9 | if [ ! -z "$@" ]; then 10 | for argument in "$@"; do 11 | case $argument in 12 | # make curl silent 13 | "-s") 14 | curlopts="-s" 15 | ;; 16 | esac 17 | done 18 | fi 19 | 20 | 21 | # Check that we're being run from the right directory. 22 | if test ! -f src/google/protobuf/stubs/common.h; then 23 | cat >&2 << __EOF__ 24 | Could not find source code. Make sure you are running this script from the 25 | root of the distribution tree. 26 | __EOF__ 27 | exit 1 28 | fi 29 | 30 | # Check that gmock is present. Usually it is already there since the 31 | # directory is set up as an SVN external. 32 | if test ! -e gmock; then 33 | echo "Google Mock not present. Fetching gmock-1.7.0 from the web..." 34 | curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip 35 | unzip -q gmock-1.7.0.zip 36 | rm gmock-1.7.0.zip 37 | mv gmock-1.7.0 gmock 38 | fi 39 | 40 | set -ex 41 | 42 | # TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings. 43 | autoreconf -f -i -Wall,no-obsolete 44 | 45 | rm -rf autom4te.cache config.h.in~ 46 | exit 0 47 | -------------------------------------------------------------------------------- /benchmarks/google_message1.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/benchmarks/google_message1.dat -------------------------------------------------------------------------------- /benchmarks/google_message2.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/benchmarks/google_message2.dat -------------------------------------------------------------------------------- /benchmarks/readme.txt: -------------------------------------------------------------------------------- 1 | Contents 2 | -------- 3 | 4 | This folder contains three kinds of file: 5 | 6 | - Code, such as ProtoBench.java, to build the benchmarking framework. 7 | - Protocol buffer definitions (.proto files) 8 | - Sample data files 9 | 10 | If we end up with a lot of different benchmarks it may be worth 11 | separating these out info different directories, but while there are 12 | so few they might as well all be together. 13 | 14 | Running a benchmark (Java) 15 | -------------------------- 16 | 17 | 1) Build protoc and the Java protocol buffer library. The examples 18 | below assume a jar file (protobuf.jar) has been built and copied 19 | into this directory. 20 | 21 | 2) Build ProtoBench: 22 | $ javac -d tmp -cp protobuf.jar ProtoBench.java 23 | 24 | 3) Generate code for the relevant benchmark protocol buffer, e.g. 25 | $ protoc --java_out=tmp google_size.proto google_speed.proto 26 | 27 | 4) Build the generated code, e.g. 28 | $ cd tmp 29 | $ javac -d . -cp ../protobuf.jar benchmarks/*.java 30 | 31 | 5) Run the test. Arguments are given in pairs - the first argument 32 | is the descriptor type; the second is the filename. For example: 33 | $ java -cp .;../protobuf.jar com.google.protocolbuffers.ProtoBench 34 | benchmarks.GoogleSize$SizeMessage1 ../google_message1.dat 35 | benchmarks.GoogleSpeed$SpeedMessage1 ../google_message1.dat 36 | benchmarks.GoogleSize$SizeMessage2 ../google_message2.dat 37 | benchmarks.GoogleSpeed$SpeedMessage2 ../google_message2.dat 38 | 39 | 6) Wait! Each test runs for around 30 seconds, and there are 6 tests 40 | per class/data combination. The above command would therefore take 41 | about 12 minutes to run. 42 | 43 | 44 | Benchmarks available 45 | -------------------- 46 | 47 | From Google: 48 | google_size.proto and google_speed.proto, messages 49 | google_message1.dat and google_message2.dat. The proto files are 50 | equivalent, but optimized differently. 51 | -------------------------------------------------------------------------------- /cmake/libprotobuf-lite.cmake: -------------------------------------------------------------------------------- 1 | set(libprotobuf_lite_files 2 | ${protobuf_source_dir}/src/google/protobuf/arena.cc 3 | ${protobuf_source_dir}/src/google/protobuf/arenastring.cc 4 | ${protobuf_source_dir}/src/google/protobuf/extension_set.cc 5 | ${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc 6 | ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc 7 | ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc 8 | ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc 9 | ${protobuf_source_dir}/src/google/protobuf/message_lite.cc 10 | ${protobuf_source_dir}/src/google/protobuf/repeated_field.cc 11 | ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc 12 | ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc 13 | ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc 14 | ${protobuf_source_dir}/src/google/protobuf/stubs/common.cc 15 | ${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc 16 | ${protobuf_source_dir}/src/google/protobuf/stubs/once.cc 17 | ${protobuf_source_dir}/src/google/protobuf/stubs/status.cc 18 | ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc 19 | ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc 20 | ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.cc 21 | ${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid.cc 22 | ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.cc 23 | ${protobuf_source_dir}/src/google/protobuf/stubs/time.cc 24 | ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc 25 | ) 26 | 27 | add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC} 28 | ${libprotobuf_lite_files}) 29 | target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT}) 30 | target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src) 31 | if(MSVC AND protobuf_BUILD_SHARED_LIBS) 32 | target_compile_definitions(libprotobuf-lite 33 | PUBLIC PROTOBUF_USE_DLLS 34 | PRIVATE LIBPROTOBUF_EXPORTS) 35 | endif() 36 | set_target_properties(libprotobuf-lite PROPERTIES 37 | OUTPUT_NAME ${LIB_PREFIX}protobuf-lite 38 | DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") 39 | -------------------------------------------------------------------------------- /cmake/protobuf-config-version.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION @protobuf_VERSION@) 2 | -------------------------------------------------------------------------------- /cmake/protobuf-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Version info variables 2 | set(PROTOBUF_VERSION "@protobuf_VERSION@") 3 | set(PROTOBUF_VERSION_STRING "@protobuf_VERSION_STRING@") 4 | 5 | # Current dir 6 | get_filename_component(_PROTOBUF_PACKAGE_PREFIX 7 | "${CMAKE_CURRENT_LIST_FILE}" PATH) 8 | 9 | # Imported targets 10 | include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-targets.cmake") 11 | 12 | # Compute the installation prefix relative to this file. 13 | get_filename_component(_PROTOBUF_IMPORT_PREFIX 14 | "${_PROTOBUF_PACKAGE_PREFIX}" PATH) 15 | get_filename_component(_PROTOBUF_IMPORT_PREFIX 16 | "${_PROTOBUF_IMPORT_PREFIX}" PATH) 17 | get_filename_component(_PROTOBUF_IMPORT_PREFIX 18 | "${_PROTOBUF_IMPORT_PREFIX}" PATH) 19 | 20 | # CMake FindProtobuf module compatible file 21 | if(NOT DEFINED PROTOBUF_MODULE_COMPATIBLE OR "${PROTOBUF_MODULE_COMPATIBLE}") 22 | include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-module.cmake") 23 | endif() 24 | 25 | # Cleanup temporary variables. 26 | set(_PROTOBUF_PACKAGE_PREFIX) 27 | set(_PROTOBUF_IMPORT_PREFIX) 28 | -------------------------------------------------------------------------------- /cmake/protoc.cmake: -------------------------------------------------------------------------------- 1 | set(protoc_files 2 | ${protobuf_source_dir}/src/google/protobuf/compiler/main.cc 3 | ) 4 | 5 | add_executable(protoc ${protoc_files}) 6 | target_link_libraries(protoc libprotobuf libprotoc) 7 | -------------------------------------------------------------------------------- /conformance/README.md: -------------------------------------------------------------------------------- 1 | Protocol Buffers - Google's data interchange format 2 | =================================================== 3 | 4 | [![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf) 5 | 6 | Copyright 2008 Google Inc. 7 | 8 | This directory contains conformance tests for testing completeness and 9 | correctness of Protocol Buffers implementations. These tests are designed 10 | to be easy to run against any Protocol Buffers implementation. 11 | 12 | This directory contains the tester process `conformance-test`, which 13 | contains all of the tests themselves. Then separate programs written 14 | in whatever language you want to test communicate with the tester 15 | program over a pipe. 16 | 17 | Before running any of these tests, make sure you run `make` in the base 18 | directory to build `protoc`, since all the tests depend on it. 19 | 20 | $ make 21 | 22 | Then to run the tests against the C++ implementation, run: 23 | 24 | $ cd conformance && make test_cpp 25 | 26 | More tests and languages will be added soon! 27 | 28 | Testing other Protocol Buffer implementations 29 | --------------------------------------------- 30 | 31 | To run these tests against a new Protocol Buffers implementation, write a 32 | program in your language that uses the protobuf implementation you want 33 | to test. This program should implement the testing protocol defined in 34 | [conformance.proto](https://github.com/google/protobuf/blob/master/conformance/conformance.proto). 35 | This is designed to be as easy as possible: the C++ version is only 36 | 150 lines and is a good example for what this program should look like 37 | (see [conformance_cpp.cc](https://github.com/google/protobuf/blob/master/conformance/conformance_cpp.cc)). 38 | The program only needs to be able to read from stdin and write to stdout. 39 | 40 | Portability 41 | ----------- 42 | 43 | Note that the test runner currently does not work on Windows. Patches 44 | to fix this are welcome! (But please get in touch first to settle on 45 | a general implementation strategy). 46 | -------------------------------------------------------------------------------- /conformance/failure_list_csharp.txt: -------------------------------------------------------------------------------- 1 | JsonInput.AnyWithValueForInteger.JsonOutput 2 | JsonInput.AnyWithValueForJsonObject.JsonOutput 3 | JsonInput.FieldNameInLowerCamelCase.Validator 4 | JsonInput.FieldNameInSnakeCase.JsonOutput 5 | JsonInput.FieldNameInSnakeCase.ProtobufOutput 6 | JsonInput.FieldNameWithMixedCases.JsonOutput 7 | JsonInput.FieldNameWithMixedCases.ProtobufOutput 8 | JsonInput.FieldNameWithMixedCases.Validator 9 | JsonInput.Int32FieldMinFloatValue.JsonOutput 10 | JsonInput.Int32FieldMinValue.JsonOutput 11 | JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput 12 | JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput 13 | JsonInput.OriginalProtoFieldName.JsonOutput 14 | JsonInput.StringFieldSurrogatePair.JsonOutput 15 | JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput 16 | JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput 17 | -------------------------------------------------------------------------------- /conformance/failure_list_java.txt: -------------------------------------------------------------------------------- 1 | # This is the list of conformance tests that are known to fail for the Java 2 | # implementation right now. These should be fixed. 3 | # 4 | # By listing them here we can keep tabs on which ones are failing and be sure 5 | # that we don't introduce regressions in other tests. 6 | 7 | FieldMaskNumbersDontRoundTrip.JsonOutput 8 | FieldMaskPathsDontRoundTrip.JsonOutput 9 | FieldMaskTooManyUnderscore.JsonOutput 10 | JsonInput.AnyWithFieldMask.ProtobufOutput 11 | JsonInput.AnyWithValueForInteger.JsonOutput 12 | JsonInput.AnyWithValueForJsonObject.JsonOutput 13 | JsonInput.BoolFieldAllCapitalFalse 14 | JsonInput.BoolFieldAllCapitalTrue 15 | JsonInput.BoolFieldCamelCaseFalse 16 | JsonInput.BoolFieldCamelCaseTrue 17 | JsonInput.BoolFieldDoubleQuotedFalse 18 | JsonInput.BoolFieldDoubleQuotedTrue 19 | JsonInput.BoolMapFieldKeyNotQuoted 20 | JsonInput.DoubleFieldInfinityNotQuoted 21 | JsonInput.DoubleFieldNanNotQuoted 22 | JsonInput.DoubleFieldNegativeInfinityNotQuoted 23 | JsonInput.EnumFieldNotQuoted 24 | JsonInput.FieldMask.ProtobufOutput 25 | JsonInput.FieldMaskInvalidCharacter 26 | JsonInput.FieldNameDuplicate 27 | JsonInput.FieldNameInSnakeCase.JsonOutput 28 | JsonInput.FieldNameNotQuoted 29 | JsonInput.FloatFieldInfinityNotQuoted 30 | JsonInput.FloatFieldNanNotQuoted 31 | JsonInput.FloatFieldNegativeInfinityNotQuoted 32 | JsonInput.Int32FieldLeadingZero 33 | JsonInput.Int32FieldMinFloatValue.JsonOutput 34 | JsonInput.Int32FieldMinValue.JsonOutput 35 | JsonInput.Int32FieldNegativeWithLeadingZero 36 | JsonInput.Int32FieldPlusSign 37 | JsonInput.Int32MapFieldKeyNotQuoted 38 | JsonInput.Int64MapFieldKeyNotQuoted 39 | JsonInput.JsonWithComments 40 | JsonInput.OriginalProtoFieldName.JsonOutput 41 | JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool 42 | JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt 43 | JsonInput.StringFieldNotAString 44 | JsonInput.StringFieldSurrogateInWrongOrder 45 | JsonInput.StringFieldUnpairedHighSurrogate 46 | JsonInput.StringFieldUnpairedLowSurrogate 47 | JsonInput.StringFieldUppercaseEscapeLetter 48 | JsonInput.Uint32MapFieldKeyNotQuoted 49 | JsonInput.Uint64MapFieldKeyNotQuoted 50 | -------------------------------------------------------------------------------- /conformance/failure_list_objc.txt: -------------------------------------------------------------------------------- 1 | # No tests currently failing. 2 | # 3 | # json input or output tests are skipped (in conformance_objc.m) as mobile 4 | # platforms don't support json wire format to avoid code bloat. 5 | -------------------------------------------------------------------------------- /conformance/failure_list_python-post26.txt: -------------------------------------------------------------------------------- 1 | JsonInput.StringFieldSurrogateInWrongOrder 2 | JsonInput.StringFieldUnpairedHighSurrogate 3 | -------------------------------------------------------------------------------- /csharp/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Untracked directories 3 | # 4 | src/AddressBook/bin 5 | src/AddressBook/obj 6 | src/Google.Protobuf/bin/ 7 | src/Google.Protobuf/obj/ 8 | src/Google.Protobuf.Conformance/bin/ 9 | src/Google.Protobuf.Conformance/obj/ 10 | src/Google.Protobuf.Test/bin/ 11 | src/Google.Protobuf.Test/obj/ 12 | src/Google.Protobuf.JsonDump/bin/ 13 | src/Google.Protobuf.JsonDump/obj/ 14 | mono/bin 15 | mono/tmp 16 | mono/protoc 17 | build_output 18 | build_temp 19 | build/msbuild*.log 20 | lib/Microsoft.Silverlight.Testing 21 | lib/NUnit 22 | 23 | # 24 | # Untracked files 25 | # 26 | *.user 27 | *.suo 28 | *.nupkg 29 | _ReSharper.* 30 | *.sln.cache 31 | mono/TestResult.xml 32 | mono/.libs 33 | mono/*.exe 34 | mono/*.dll 35 | lib/protoc.exe 36 | *.ncrunch* 37 | -------------------------------------------------------------------------------- /csharp/build_packages.bat: -------------------------------------------------------------------------------- 1 | @rem Builds Google.Protobuf NuGet packages 2 | 3 | @rem Adjust the location of nuget.exe 4 | set NUGET=C:\nuget\nuget.exe 5 | 6 | @rem Build src/Google.Protobuf.sln solution in Release configuration first. 7 | %NUGET% pack src\Google.Protobuf\Google.Protobuf.nuspec -Symbols || goto :error 8 | 9 | goto :EOF 10 | 11 | :error 12 | echo Failed! 13 | exit /b %errorlevel% 14 | -------------------------------------------------------------------------------- /csharp/buildall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Use mono to build solution and run all tests. 3 | 4 | # Adjust these to reflect the location of nunit-console in your system. 5 | NUNIT_CONSOLE=nunit-console 6 | 7 | # The rest you can leave intact 8 | CONFIG=Release 9 | SRC=$(dirname $0)/src 10 | 11 | set -ex 12 | 13 | echo Building the solution. 14 | xbuild /p:Configuration=$CONFIG $SRC/Google.Protobuf.sln 15 | 16 | echo Running tests. 17 | $NUNIT_CONSOLE $SRC/Google.Protobuf.Test/bin/$CONFIG/Google.Protobuf.Test.dll 18 | -------------------------------------------------------------------------------- /csharp/keys/Google.Protobuf.public.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/csharp/keys/Google.Protobuf.public.snk -------------------------------------------------------------------------------- /csharp/keys/Google.Protobuf.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/csharp/keys/Google.Protobuf.snk -------------------------------------------------------------------------------- /csharp/keys/README.md: -------------------------------------------------------------------------------- 1 | Contents 2 | -------- 3 | 4 | - Google.Protobuf.public.snk: 5 | Public key to verify strong name of Google.Protobuf assemblies. 6 | - Google.Protobuf.snk: 7 | Signing key to provide strong name of Google.Protobuf assemblies. 8 | As per [Microsoft guidance](https://msdn.microsoft.com/en-us/library/wd40t7ad(v=vs.110).aspx) 9 | signing key should be checked into the repository. 10 | -------------------------------------------------------------------------------- /csharp/src/AddressBook/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("AddressBook")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AddressBook")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | [assembly: AssemblyVersion("3.0.0.0")] 18 | [assembly: AssemblyFileVersion("3.0.0.0")] 19 | -------------------------------------------------------------------------------- /csharp/src/AddressBook/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.Conformance/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | 9 | [assembly: AssemblyTitle("ProtoDump")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("ProtoDump")] 14 | [assembly: AssemblyCopyright("Copyright © 2015")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | [assembly: AssemblyVersion("3.0.0.0")] 19 | [assembly: AssemblyFileVersion("3.0.0.0")] 20 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.JsonDump/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | 10 | [assembly: AssemblyTitle("Google.Protobuf.Test")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("Google.Protobuf.Test")] 15 | [assembly: AssemblyCopyright("Copyright © 2015")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | [assembly: AssemblyVersion("3.0.0.0")] 20 | [assembly: AssemblyFileVersion("3.0.0.0")] 21 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.Test/SampleEnum.cs: -------------------------------------------------------------------------------- 1 | #region Copyright notice and license 2 | // Protocol Buffers - Google's data interchange format 3 | // Copyright 2015 Google Inc. All rights reserved. 4 | // https://developers.google.com/protocol-buffers/ 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 16 | // * Neither the name of Google Inc. nor the names of its 17 | // contributors may be used to endorse or promote products derived from 18 | // this software without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | #endregion 32 | 33 | namespace Google.Protobuf 34 | { 35 | // Just a sample enum with positive and negative values to be used in tests. 36 | internal enum SampleEnum 37 | { 38 | NegativeValue = -2, 39 | None = 0, 40 | PositiveValue = 3 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs: -------------------------------------------------------------------------------- 1 | #region Copyright notice and license 2 | // Protocol Buffers - Google's data interchange format 3 | // Copyright 2016 Google Inc. All rights reserved. 4 | // https://developers.google.com/protocol-buffers/ 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 16 | // * Neither the name of Google Inc. nor the names of its 17 | // contributors may be used to endorse or promote products derived from 18 | // this software without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | #endregion 32 | 33 | namespace Google.Protobuf.TestProtos 34 | { 35 | /// 36 | /// A message with custom diagnostics (to test that they work). 37 | /// 38 | public partial class ForeignMessage : ICustomDiagnosticMessage 39 | { 40 | public string ToDiagnosticString() 41 | { 42 | return $"{{ \"c\": {C}, \"@cInHex\": \"{C:x}\" }}"; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs: -------------------------------------------------------------------------------- 1 | #region Copyright notice and license 2 | // Protocol Buffers - Google's data interchange format 3 | // Copyright 2008 Google Inc. All rights reserved. 4 | // https://developers.google.com/protocol-buffers/ 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 16 | // * Neither the name of Google Inc. nor the names of its 17 | // contributors may be used to endorse or promote products derived from 18 | // this software without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | #endregion 32 | 33 | namespace Google.Protobuf.WellKnownTypes 34 | { 35 | public static partial class WrappersReflection 36 | { 37 | /// 38 | /// Field number for the single "value" field in all wrapper types. 39 | /// 40 | internal const int WrapperValueFieldNumber = Int32Value.ValueFieldNumber; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /csharp/src/Google.Protobuf/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /csharp/src/packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /editors/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains syntax highlighting and configuration files for editors 2 | to properly display Protocol Buffer files. 3 | 4 | See each file's header comment for directions on how to use it with the 5 | appropriate editor. 6 | -------------------------------------------------------------------------------- /examples/ListPeople.java: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | import com.example.tutorial.AddressBookProtos.AddressBook; 4 | import com.example.tutorial.AddressBookProtos.Person; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.PrintStream; 8 | 9 | class ListPeople { 10 | // Iterates though all people in the AddressBook and prints info about them. 11 | static void Print(AddressBook addressBook) { 12 | for (Person person: addressBook.getPeopleList()) { 13 | System.out.println("Person ID: " + person.getId()); 14 | System.out.println(" Name: " + person.getName()); 15 | if (!person.getEmail().isEmpty()) { 16 | System.out.println(" E-mail address: " + person.getEmail()); 17 | } 18 | 19 | for (Person.PhoneNumber phoneNumber : person.getPhonesList()) { 20 | switch (phoneNumber.getType()) { 21 | case MOBILE: 22 | System.out.print(" Mobile phone #: "); 23 | break; 24 | case HOME: 25 | System.out.print(" Home phone #: "); 26 | break; 27 | case WORK: 28 | System.out.print(" Work phone #: "); 29 | break; 30 | } 31 | System.out.println(phoneNumber.getNumber()); 32 | } 33 | } 34 | } 35 | 36 | // Main function: Reads the entire address book from a file and prints all 37 | // the information inside. 38 | public static void main(String[] args) throws Exception { 39 | if (args.length != 1) { 40 | System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE"); 41 | System.exit(-1); 42 | } 43 | 44 | // Read the existing address book. 45 | AddressBook addressBook = 46 | AddressBook.parseFrom(new FileInputStream(args[0])); 47 | 48 | Print(addressBook); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /examples/add_person.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # See README.txt for information and build instructions. 4 | 5 | import addressbook_pb2 6 | import sys 7 | 8 | # This function fills in a Person message based on user input. 9 | def PromptForAddress(person): 10 | person.id = int(raw_input("Enter person ID number: ")) 11 | person.name = raw_input("Enter name: ") 12 | 13 | email = raw_input("Enter email address (blank for none): ") 14 | if email != "": 15 | person.email = email 16 | 17 | while True: 18 | number = raw_input("Enter a phone number (or leave blank to finish): ") 19 | if number == "": 20 | break 21 | 22 | phone_number = person.phones.add() 23 | phone_number.number = number 24 | 25 | type = raw_input("Is this a mobile, home, or work phone? ") 26 | if type == "mobile": 27 | phone_number.type = addressbook_pb2.Person.MOBILE 28 | elif type == "home": 29 | phone_number.type = addressbook_pb2.Person.HOME 30 | elif type == "work": 31 | phone_number.type = addressbook_pb2.Person.WORK 32 | else: 33 | print "Unknown phone type; leaving as default value." 34 | 35 | # Main procedure: Reads the entire address book from a file, 36 | # adds one person based on user input, then writes it back out to the same 37 | # file. 38 | if len(sys.argv) != 2: 39 | print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE" 40 | sys.exit(-1) 41 | 42 | address_book = addressbook_pb2.AddressBook() 43 | 44 | # Read the existing address book. 45 | try: 46 | with open(sys.argv[1], "rb") as f: 47 | address_book.ParseFromString(f.read()) 48 | except IOError: 49 | print sys.argv[1] + ": File not found. Creating a new file." 50 | 51 | # Add an address. 52 | PromptForAddress(address_book.people.add()) 53 | 54 | # Write the new address book back to disk. 55 | with open(sys.argv[1], "wb") as f: 56 | f.write(address_book.SerializeToString()) 57 | -------------------------------------------------------------------------------- /examples/add_person_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "strings" 5 | "testing" 6 | 7 | "github.com/golang/protobuf/proto" 8 | pb "github.com/google/protobuf/examples/tutorial" 9 | ) 10 | 11 | func TestPromptForAddressReturnsAddress(t *testing.T) { 12 | in := `12345 13 | Example Name 14 | name@example.com 15 | 123-456-7890 16 | home 17 | 222-222-2222 18 | mobile 19 | 111-111-1111 20 | work 21 | 777-777-7777 22 | unknown 23 | 24 | ` 25 | got, err := promptForAddress(strings.NewReader(in)) 26 | if err != nil { 27 | t.Fatalf("promptForAddress(%q) had unexpected error: %s", in, err.Error()) 28 | } 29 | if got.Id != 12345 { 30 | t.Errorf("promptForAddress(%q) got %d, want ID %d", in, got.Id, 12345) 31 | } 32 | if got.Name != "Example Name" { 33 | t.Errorf("promptForAddress(%q) => want name %q, got %q", "Example Name", got.Name) 34 | } 35 | if got.Email != "name@example.com" { 36 | t.Errorf("promptForAddress(%q) => want email %q, got %q", "name@example.com", got.Email) 37 | } 38 | 39 | want := []*pb.Person_PhoneNumber{ 40 | {Number: "123-456-7890", Type: pb.Person_HOME}, 41 | {Number: "222-222-2222", Type: pb.Person_MOBILE}, 42 | {Number: "111-111-1111", Type: pb.Person_WORK}, 43 | {Number: "777-777-7777", Type: pb.Person_MOBILE}, 44 | } 45 | if len(got.Phones) != len(want) { 46 | t.Errorf("want %d phone numbers, got %d", len(want), len(got.Phones)) 47 | } 48 | phones := len(got.Phones) 49 | if phones > len(want) { 50 | phones = len(want) 51 | } 52 | for i := 0; i < phones; i++ { 53 | if !proto.Equal(got.Phones[i], want[i]) { 54 | t.Errorf("want phone %q, got %q", *want[i], *got.Phones[i]) 55 | } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /examples/addressbook.proto: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | // 3 | // Note: START and END tags are used in comments to define sections used in 4 | // tutorials. They are not part of the syntax for Protocol Buffers. 5 | // 6 | // To get an in-depth walkthrough of this file and the related examples, see: 7 | // https://developers.google.com/protocol-buffers/docs/tutorials 8 | 9 | // [START declaration] 10 | syntax = "proto3"; 11 | package tutorial; 12 | // [END declaration] 13 | 14 | // [START java_declaration] 15 | option java_package = "com.example.tutorial"; 16 | option java_outer_classname = "AddressBookProtos"; 17 | // [END java_declaration] 18 | 19 | // [START csharp_declaration] 20 | option csharp_namespace = "Google.Protobuf.Examples.AddressBook"; 21 | // [END csharp_declaration] 22 | 23 | // [START messages] 24 | message Person { 25 | string name = 1; 26 | int32 id = 2; // Unique ID number for this person. 27 | string email = 3; 28 | 29 | enum PhoneType { 30 | MOBILE = 0; 31 | HOME = 1; 32 | WORK = 2; 33 | } 34 | 35 | message PhoneNumber { 36 | string number = 1; 37 | PhoneType type = 2; 38 | } 39 | 40 | repeated PhoneNumber phones = 4; 41 | } 42 | 43 | // Our address book file is just one of these. 44 | message AddressBook { 45 | repeated Person people = 1; 46 | } 47 | // [END messages] 48 | -------------------------------------------------------------------------------- /examples/list_people.cc: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | #include 4 | #include 5 | #include 6 | #include "addressbook.pb.h" 7 | using namespace std; 8 | 9 | // Iterates though all people in the AddressBook and prints info about them. 10 | void ListPeople(const tutorial::AddressBook& address_book) { 11 | for (int i = 0; i < address_book.people_size(); i++) { 12 | const tutorial::Person& person = address_book.people(i); 13 | 14 | cout << "Person ID: " << person.id() << endl; 15 | cout << " Name: " << person.name() << endl; 16 | if (person.email() != "") { 17 | cout << " E-mail address: " << person.email() << endl; 18 | } 19 | 20 | for (int j = 0; j < person.phones_size(); j++) { 21 | const tutorial::Person::PhoneNumber& phone_number = person.phones(j); 22 | 23 | switch (phone_number.type()) { 24 | case tutorial::Person::MOBILE: 25 | cout << " Mobile phone #: "; 26 | break; 27 | case tutorial::Person::HOME: 28 | cout << " Home phone #: "; 29 | break; 30 | case tutorial::Person::WORK: 31 | cout << " Work phone #: "; 32 | break; 33 | } 34 | cout << phone_number.number() << endl; 35 | } 36 | } 37 | } 38 | 39 | // Main function: Reads the entire address book from a file and prints all 40 | // the information inside. 41 | int main(int argc, char* argv[]) { 42 | // Verify that the version of the library that we linked against is 43 | // compatible with the version of the headers we compiled against. 44 | GOOGLE_PROTOBUF_VERIFY_VERSION; 45 | 46 | if (argc != 2) { 47 | cerr << "Usage: " << argv[0] << " ADDRESS_BOOK_FILE" << endl; 48 | return -1; 49 | } 50 | 51 | tutorial::AddressBook address_book; 52 | 53 | { 54 | // Read the existing address book. 55 | fstream input(argv[1], ios::in | ios::binary); 56 | if (!address_book.ParseFromIstream(&input)) { 57 | cerr << "Failed to parse address book." << endl; 58 | return -1; 59 | } 60 | } 61 | 62 | ListPeople(address_book); 63 | 64 | // Optional: Delete all global objects allocated by libprotobuf. 65 | google::protobuf::ShutdownProtobufLibrary(); 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /examples/list_people.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "io/ioutil" 7 | "log" 8 | "os" 9 | 10 | "github.com/golang/protobuf/proto" 11 | pb "github.com/google/protobuf/examples/tutorial" 12 | ) 13 | 14 | func writePerson(w io.Writer, p *pb.Person) { 15 | fmt.Fprintln(w, "Person ID:", p.Id) 16 | fmt.Fprintln(w, " Name:", p.Name) 17 | if p.Email != "" { 18 | fmt.Fprintln(w, " E-mail address:", p.Email) 19 | } 20 | 21 | for _, pn := range p.Phones { 22 | switch pn.Type { 23 | case pb.Person_MOBILE: 24 | fmt.Fprint(w, " Mobile phone #: ") 25 | case pb.Person_HOME: 26 | fmt.Fprint(w, " Home phone #: ") 27 | case pb.Person_WORK: 28 | fmt.Fprint(w, " Work phone #: ") 29 | } 30 | fmt.Fprintln(w, pn.Number) 31 | } 32 | } 33 | 34 | func listPeople(w io.Writer, book *pb.AddressBook) { 35 | for _, p := range book.People { 36 | writePerson(w, p) 37 | } 38 | } 39 | 40 | // Main reads the entire address book from a file and prints all the 41 | // information inside. 42 | func main() { 43 | if len(os.Args) != 2 { 44 | log.Fatalf("Usage: %s ADDRESS_BOOK_FILE\n", os.Args[0]) 45 | } 46 | fname := os.Args[1] 47 | 48 | // [START unmarshal_proto] 49 | // Read the existing address book. 50 | in, err := ioutil.ReadFile(fname) 51 | if err != nil { 52 | log.Fatalln("Error reading file:", err) 53 | } 54 | book := &pb.AddressBook{} 55 | if err := proto.Unmarshal(in, book); err != nil { 56 | log.Fatalln("Failed to parse address book:", err) 57 | } 58 | // [END unmarshal_proto] 59 | 60 | listPeople(os.Stdout, book) 61 | } 62 | -------------------------------------------------------------------------------- /examples/list_people.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # See README.txt for information and build instructions. 4 | 5 | import addressbook_pb2 6 | import sys 7 | 8 | # Iterates though all people in the AddressBook and prints info about them. 9 | def ListPeople(address_book): 10 | for person in address_book.people: 11 | print "Person ID:", person.id 12 | print " Name:", person.name 13 | if person.email != "": 14 | print " E-mail address:", person.email 15 | 16 | for phone_number in person.phones: 17 | if phone_number.type == addressbook_pb2.Person.MOBILE: 18 | print " Mobile phone #:", 19 | elif phone_number.type == addressbook_pb2.Person.HOME: 20 | print " Home phone #:", 21 | elif phone_number.type == addressbook_pb2.Person.WORK: 22 | print " Work phone #:", 23 | print phone_number.number 24 | 25 | # Main procedure: Reads the entire address book from a file and prints all 26 | # the information inside. 27 | if len(sys.argv) != 2: 28 | print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE" 29 | sys.exit(-1) 30 | 31 | address_book = addressbook_pb2.AddressBook() 32 | 33 | # Read the existing address book. 34 | with open(sys.argv[1], "rb") as f: 35 | address_book.ParseFromString(f.read()) 36 | 37 | ListPeople(address_book) 38 | -------------------------------------------------------------------------------- /gmock.BUILD: -------------------------------------------------------------------------------- 1 | cc_library( 2 | name = "gtest", 3 | srcs = [ 4 | "gmock-1.7.0/gtest/src/gtest-all.cc", 5 | "gmock-1.7.0/src/gmock-all.cc", 6 | ], 7 | hdrs = glob([ 8 | "gmock-1.7.0/**/*.h", 9 | "gmock-1.7.0/gtest/src/*.cc", 10 | "gmock-1.7.0/src/*.cc", 11 | ]), 12 | includes = [ 13 | "gmock-1.7.0", 14 | "gmock-1.7.0/gtest", 15 | "gmock-1.7.0/gtest/include", 16 | "gmock-1.7.0/include", 17 | ], 18 | linkopts = ["-pthread"], 19 | visibility = ["//visibility:public"], 20 | ) 21 | 22 | cc_library( 23 | name = "gtest_main", 24 | srcs = ["gmock-1.7.0/src/gmock_main.cc"], 25 | linkopts = ["-pthread"], 26 | visibility = ["//visibility:public"], 27 | deps = [":gtest"], 28 | ) 29 | -------------------------------------------------------------------------------- /java/core/generate-sources-build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /java/core/src/main/java/com/google/protobuf/MutabilityOracle.java: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package com.google.protobuf; 32 | 33 | /** 34 | * Verifies that an object is mutable, throwing if not. 35 | */ 36 | interface MutabilityOracle { 37 | static final MutabilityOracle IMMUTABLE = new MutabilityOracle() { 38 | @Override 39 | public void ensureMutable() { 40 | throw new UnsupportedOperationException(); 41 | } 42 | }; 43 | 44 | /** 45 | * Throws an {@link UnsupportedOperationException} if not mutable. 46 | */ 47 | void ensureMutable(); 48 | } 49 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/any_test.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package any_test; 34 | 35 | option java_package = "any_test"; 36 | option java_outer_classname = "AnyTestProto"; 37 | 38 | import "google/protobuf/any.proto"; 39 | 40 | message TestAny { 41 | google.protobuf.Any value = 1; 42 | } 43 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: Darick Tong (darick@google.com) 32 | // 33 | // A proto file with extensions. 34 | 35 | syntax = "proto2"; 36 | 37 | package protobuf_unittest; 38 | 39 | 40 | message MessageToBeExtended { 41 | extensions 1 to max; 42 | } 43 | 44 | message MyNonNestedExtension { 45 | } 46 | 47 | extend MessageToBeExtended { 48 | optional MyNonNestedExtension nonNestedExtension = 1; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: Darick Tong (darick@google.com) 32 | // 33 | // A proto file with extensions for a MessageLite messages. 34 | 35 | syntax = "proto2"; 36 | 37 | package protobuf_unittest; 38 | 39 | option optimize_for = LITE_RUNTIME; 40 | 41 | message MessageLiteToBeExtended { 42 | extensions 1 to max; 43 | } 44 | 45 | message MyNonNestedExtensionLite { 46 | } 47 | 48 | extend MessageLiteToBeExtended { 49 | optional MyNonNestedExtensionLite nonNestedExtensionLite = 1; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package protobuf_unittest; 34 | 35 | 36 | // This message's name is the same with the default outer class name of this 37 | // proto file. It's used to test if the compiler can avoid this conflict 38 | // correctly. 39 | message OuterClassNameTest { 40 | } 41 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package protobuf_unittest; 34 | 35 | 36 | message TestMessage2 { 37 | message NestedMessage { 38 | // This message's name is the same with the default outer class name of this 39 | // proto file. It's used to test if the compiler can avoid this conflict 40 | // correctly. 41 | message OuterClassNameTest2 { 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package protobuf_unittest; 34 | 35 | 36 | message TestMessage3 { 37 | message NestedMessage { 38 | // This enum's name is the same with the default outer class name of this 39 | // proto file. It's used to test if the compiler can avoid this conflict 40 | // correctly. 41 | enum OuterClassNameTest3 { 42 | DUMMY_VALUE = 1; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/core/src/test/proto/com/google/protobuf/test_custom_options.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: Feng Xiao (xiaofeng@google.com) 32 | // 33 | // Test that custom options defined in a proto file's dependencies are properly 34 | // initialized. 35 | syntax = "proto2"; 36 | 37 | package protobuf_unittest; 38 | 39 | 40 | import "google/protobuf/unittest_custom_options.proto"; 41 | 42 | message TestMessageWithCustomOptionsContainer { 43 | optional TestMessageWithCustomOptions field = 1; 44 | } 45 | -------------------------------------------------------------------------------- /java/lite/generate-sources-build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_enum_class_nano.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: maxtroy@google.com (Max Cai) 32 | 33 | package protobuf_unittest; 34 | 35 | option java_package = "com.google.protobuf"; 36 | option java_outer_classname = "EnumClassNanos"; 37 | 38 | enum FileScopeEnum { 39 | ONE = 1; 40 | } 41 | 42 | message EnumClassNano { 43 | enum MessageScopeEnum { 44 | TWO = 2; 45 | } 46 | optional FileScopeEnum one = 1 [ default = ONE ]; 47 | optional MessageScopeEnum two = 2 [ default = TWO ]; 48 | } 49 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_enum_validity_nano.proto: -------------------------------------------------------------------------------- 1 | package protobuf_unittest; 2 | 3 | option java_package = "com.google.protobuf"; 4 | option java_outer_classname = "EnumValidity"; 5 | 6 | enum E { 7 | default = 1; // test java keyword renaming 8 | FOO = 2; 9 | BAR = 3; 10 | BAZ = 4; 11 | } 12 | 13 | message M { 14 | optional E optional_e = 1; 15 | optional E default_e = 2 [ default = BAZ ]; 16 | repeated E repeated_e = 3; 17 | repeated E packed_e = 4 [ packed = true ]; 18 | repeated E repeated_e2 = 5; 19 | repeated E packed_e2 = 6 [ packed = true ]; 20 | repeated E repeated_e3 = 7; 21 | repeated E packed_e3 = 8 [ packed = true ]; 22 | } 23 | 24 | message Alt { 25 | optional E repeated_e2_as_optional = 5; 26 | repeated E packed_e2_as_non_packed = 6; 27 | repeated E non_packed_e3_as_packed = 7 [ packed = true ]; 28 | } 29 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_extension_nano.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option java_outer_classname = "Extensions"; 4 | option java_package = "com.google.protobuf.nano.testext"; 5 | 6 | message ExtendableMessage { 7 | optional int32 field = 1; 8 | extensions 10 to max; 9 | } 10 | 11 | enum AnEnum { 12 | FIRST_VALUE = 1; 13 | SECOND_VALUE = 2; 14 | } 15 | 16 | message AnotherMessage { 17 | optional string string = 1; 18 | optional bool value = 2; 19 | repeated int32 integers = 3; 20 | } 21 | 22 | message ContainerMessage { 23 | extend ExtendableMessage { 24 | optional bool another_thing = 100; 25 | // The largest permitted field number, per 26 | // https://developers.google.com/protocol-buffers/docs/proto#simple 27 | optional bool large_field_number = 536870911; 28 | } 29 | } 30 | 31 | // For testNanoOptionalGroupWithUnknownFieldsEnabled; 32 | // not part of the extensions tests. 33 | message MessageWithGroup { 34 | optional group Group = 1 { 35 | optional int32 a = 2; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_extension_packed_nano.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option java_multiple_files = true; 4 | option java_package = "com.google.protobuf"; 5 | 6 | import "google/protobuf/nano/unittest_extension_nano.proto"; 7 | 8 | // Must be compiled separately due to extension number reuse. 9 | // The reuse is deliberate, for testing wire compatibility. 10 | 11 | message PackedExtensions { 12 | extend ExtendableMessage { 13 | repeated int32 packed_int32 = 10 [ packed = true ]; 14 | repeated uint32 packed_uint32 = 11 [ packed = true ]; 15 | repeated sint32 packed_sint32 = 12 [ packed = true ]; 16 | repeated int64 packed_int64 = 13 [ packed = true ]; 17 | repeated uint64 packed_uint64 = 14 [ packed = true ]; 18 | repeated sint64 packed_sint64 = 15 [ packed = true ]; 19 | repeated fixed32 packed_fixed32 = 16 [ packed = true ]; 20 | repeated sfixed32 packed_sfixed32 = 17 [ packed = true ]; 21 | repeated fixed64 packed_fixed64 = 18 [ packed = true ]; 22 | repeated sfixed64 packed_sfixed64 = 19 [ packed = true ]; 23 | repeated bool packed_bool = 20 [ packed = true ]; 24 | repeated float packed_float = 21 [ packed = true ]; 25 | repeated double packed_double = 22 [ packed = true ]; 26 | repeated AnEnum packed_enum = 23 [ packed = true ]; 27 | // Non-packable types omitted. 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_extension_repeated_nano.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option java_multiple_files = true; 4 | option java_package = "com.google.protobuf"; 5 | 6 | import "google/protobuf/nano/unittest_extension_nano.proto"; 7 | 8 | // Must be compiled separately due to extension number reuse. 9 | // The reuse is deliberate, for testing wire compatibility. 10 | 11 | message RepeatedExtensions { 12 | extend ExtendableMessage { 13 | repeated int32 repeated_int32 = 10; 14 | repeated uint32 repeated_uint32 = 11; 15 | repeated sint32 repeated_sint32 = 12; 16 | repeated int64 repeated_int64 = 13; 17 | repeated uint64 repeated_uint64 = 14; 18 | repeated sint64 repeated_sint64 = 15; 19 | repeated fixed32 repeated_fixed32 = 16; 20 | repeated sfixed32 repeated_sfixed32 = 17; 21 | repeated fixed64 repeated_fixed64 = 18; 22 | repeated sfixed64 repeated_sfixed64 = 19; 23 | repeated bool repeated_bool = 20; 24 | repeated float repeated_float = 21; 25 | repeated double repeated_double = 22; 26 | repeated AnEnum repeated_enum = 23; 27 | repeated string repeated_string = 24; 28 | repeated bytes repeated_bytes = 25; 29 | repeated AnotherMessage repeated_message = 26; 30 | repeated group RepeatedGroup = 27 { 31 | optional int32 a = 1; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_extension_singular_nano.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option java_multiple_files = true; 4 | option java_package = "com.google.protobuf"; 5 | 6 | import "google/protobuf/nano/unittest_extension_nano.proto"; 7 | 8 | // Must be compiled separately due to extension number reuse. 9 | // The reuse is deliberate, for testing wire compatibility. 10 | 11 | message SingularExtensions { 12 | extend ExtendableMessage { 13 | optional int32 some_int32 = 10; 14 | optional uint32 some_uint32 = 11; 15 | optional sint32 some_sint32 = 12; 16 | optional int64 some_int64 = 13; 17 | optional uint64 some_uint64 = 14; 18 | optional sint64 some_sint64 = 15; 19 | optional fixed32 some_fixed32 = 16; 20 | optional sfixed32 some_sfixed32 = 17; 21 | optional fixed64 some_fixed64 = 18; 22 | optional sfixed64 some_sfixed64 = 19; 23 | optional bool some_bool = 20; 24 | optional float some_float = 21; 25 | optional double some_double = 22; 26 | optional AnEnum some_enum = 23; 27 | optional string some_string = 24; 28 | optional bytes some_bytes = 25; 29 | optional AnotherMessage some_message = 26; 30 | optional group SomeGroup = 27 { 31 | optional int32 a = 1; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_multiple_nameclash_nano.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: maxtroy@google.com (Max Cai) 32 | 33 | package protobuf_unittest_import; 34 | 35 | option java_package = "com.google.protobuf"; 36 | option java_outer_classname = "MultipleNameClashNano"; 37 | option java_multiple_files = true; 38 | 39 | message MultipleNameClashNano { 40 | optional int32 field = 1; 41 | } 42 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_single_nano.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: maxtroy@google.com (Max Cai) 32 | 33 | package protobuf_unittest_import; 34 | 35 | option java_package = "com.google.protobuf"; 36 | 37 | message SingleMessageNano { 38 | } 39 | -------------------------------------------------------------------------------- /javanano/src/test/java/com/google/protobuf/nano/unittest_stringutf8_nano.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: wink@google.com (Wink Saville) 32 | // 33 | 34 | package protobuf_unittest_import; 35 | 36 | option java_package = "com.google.protobuf"; 37 | // Explicit outer classname to suppress legacy info. 38 | option java_outer_classname = "UnittestStringutf8Nano"; 39 | 40 | message StringUtf8 { 41 | optional string id = 1; 42 | repeated string rs = 2; 43 | } 44 | -------------------------------------------------------------------------------- /jenkins/README.md: -------------------------------------------------------------------------------- 1 | 2 | Jenkins Infrastructure 3 | ---------------------- 4 | 5 | The scripts in this directory serve as plumbing for running the protobuf 6 | tests under Jenkins. 7 | -------------------------------------------------------------------------------- /jenkins/build_and_run_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Builds docker image and runs a command under it. 4 | # This is a generic script that is configured with the following variables: 5 | # 6 | # DOCKERFILE_DIR - Directory in which Dockerfile file is located. 7 | # DOCKER_RUN_SCRIPT - Script to run under docker (relative to protobuf repo root) 8 | # OUTPUT_DIR - Directory that will be copied from inside docker after finishing. 9 | # $@ - Extra args to pass to docker run 10 | 11 | 12 | set -ex 13 | 14 | cd $(dirname $0)/.. 15 | git_root=$(pwd) 16 | cd - 17 | 18 | # Use image name based on Dockerfile location checksum 19 | DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) 20 | 21 | # Make sure docker image has been built. Should be instantaneous if so. 22 | docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR 23 | 24 | # Ensure existence of ccache directory 25 | CCACHE_DIR=/tmp/protobuf-ccache 26 | mkdir -p $CCACHE_DIR 27 | 28 | # Choose random name for docker container 29 | CONTAINER_NAME="build_and_run_docker_$(uuidgen)" 30 | 31 | # Run command inside docker 32 | docker run \ 33 | "$@" \ 34 | -e CCACHE_DIR=$CCACHE_DIR \ 35 | -e EXTERNAL_GIT_ROOT="/var/local/jenkins/protobuf" \ 36 | -e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \ 37 | -v "$git_root:/var/local/jenkins/protobuf:ro" \ 38 | -v $CCACHE_DIR:$CCACHE_DIR \ 39 | -w /var/local/git/protobuf \ 40 | --name=$CONTAINER_NAME \ 41 | $DOCKER_IMAGE_NAME \ 42 | bash -l "/var/local/jenkins/protobuf/$DOCKER_RUN_SCRIPT" || FAILED="true" 43 | 44 | # Copy output artifacts 45 | if [ "$OUTPUT_DIR" != "" ] 46 | then 47 | docker cp "$CONTAINER_NAME:/var/local/git/protobuf/$OUTPUT_DIR" "$git_root" || FAILED="true" 48 | fi 49 | 50 | # remove the container, possibly killing it first 51 | docker rm -f $CONTAINER_NAME || true 52 | 53 | if [ "$FAILED" != "" ] 54 | then 55 | exit 1 56 | fi 57 | -------------------------------------------------------------------------------- /jenkins/buildcmds/README.md: -------------------------------------------------------------------------------- 1 | 2 | Jenkins Build Commands 3 | ---------------------- 4 | 5 | The scripts in this directory are designed to be top-level entry points for 6 | Jenkins projects. 7 | -------------------------------------------------------------------------------- /jenkins/buildcmds/pull_request.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This is the top-level script we give to Jenkins as the entry point for 4 | # running the "pull request" project: 5 | # 6 | # https://grpc-testing.appspot.com/view/Protocol%20Buffers/job/protobuf_pull_request/ 7 | # 8 | # This script selects a specific Dockerfile (for building a Docker image) and 9 | # a script to run inside that image. Then we delegate to the general 10 | # build_and_run_docker.sh script. 11 | 12 | export DOCKERFILE_DIR=jenkins/docker 13 | export DOCKER_RUN_SCRIPT=jenkins/pull_request_in_docker.sh 14 | export OUTPUT_DIR=testoutput 15 | ./jenkins/build_and_run_docker.sh 16 | -------------------------------------------------------------------------------- /js/commonjs/export.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Export symbols needed by generated code in CommonJS style. 3 | * 4 | * This effectively is our canonical list of what we publicly export from 5 | * the google-protobuf.js file that we build at distribution time. 6 | */ 7 | 8 | goog.require('goog.object'); 9 | goog.require('jspb.BinaryReader'); 10 | goog.require('jspb.BinaryWriter'); 11 | goog.require('jspb.ExtensionFieldInfo'); 12 | goog.require('jspb.Message'); 13 | 14 | exports.Message = jspb.Message; 15 | exports.BinaryReader = jspb.BinaryReader; 16 | exports.BinaryWriter = jspb.BinaryWriter; 17 | exports.ExtensionFieldInfo = jspb.ExtensionFieldInfo; 18 | 19 | // These are used by generated code but should not be used directly by clients. 20 | exports.exportSymbol = goog.exportSymbol; 21 | exports.inherits = goog.inherits; 22 | exports.object = {extend: goog.object.extend}; 23 | -------------------------------------------------------------------------------- /js/commonjs/export_asserts.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Exports symbols needed only by tests. 3 | * 4 | * This file exports several Closure Library symbols that are only 5 | * used by tests. It is used to generate a file 6 | * closure_asserts_commonjs.js that is only used at testing time. 7 | */ 8 | 9 | goog.require('goog.testing.asserts'); 10 | 11 | var global = Function('return this')(); 12 | 13 | // All of the closure "assert" functions are exported at the global level. 14 | // 15 | // The Google Closure assert functions start with assert, eg. 16 | // assertThrows 17 | // assertNotThrows 18 | // assertTrue 19 | // ... 20 | // 21 | // The one exception is the "fail" function. 22 | function shouldExport(str) { 23 | return str.lastIndexOf('assert') === 0 || str == 'fail'; 24 | } 25 | 26 | for (var key in global) { 27 | if ((typeof key == "string") && global.hasOwnProperty(key) && 28 | shouldExport(key)) { 29 | exports[key] = global[key]; 30 | } 31 | } 32 | 33 | // The COMPILED variable is set by Closure compiler to "true" when it compiles 34 | // JavaScript, so in practice this is equivalent to "exports.COMPILED = true". 35 | // This will disable some debugging functionality in debug.js. We could 36 | // investigate whether this can/should be enabled in CommonJS builds. 37 | exports.COMPILED = COMPILED 38 | -------------------------------------------------------------------------------- /js/commonjs/export_testdeps.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @fileoverview Export symbols needed by tests in CommonJS style. 3 | * 4 | * This file is like export.js, but for symbols that are only used by tests. 5 | * However we exclude assert functions here, because they are exported into 6 | * the global namespace, so those are handled as a special case in 7 | * export_asserts.js. 8 | */ 9 | 10 | goog.require('goog.crypt.base64'); 11 | goog.require('jspb.arith.Int64'); 12 | goog.require('jspb.arith.UInt64'); 13 | goog.require('jspb.BinaryEncoder'); 14 | goog.require('jspb.BinaryDecoder'); 15 | goog.require('jspb.utils'); 16 | 17 | exports.goog = goog; 18 | exports.jspb = jspb; 19 | -------------------------------------------------------------------------------- /js/commonjs/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "", 3 | "spec_files": [ 4 | "*_test.js", 5 | "binary/proto_test.js" 6 | ], 7 | "helpers": [ 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /js/commonjs/test6/test6.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2016 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | option java_package = "com.google.apps.jspb.proto"; 34 | option java_multiple_files = true; 35 | 36 | package jspb.test.importing; 37 | 38 | message ImportedMessage { 39 | string string_value = 1; 40 | } 41 | -------------------------------------------------------------------------------- /js/commonjs/test7/test7.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2016 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | option java_package = "com.google.apps.jspb.proto"; 34 | option java_multiple_files = true; 35 | 36 | package jspb.test.framing; 37 | 38 | import "test6/test6.proto"; 39 | 40 | message FramingMessage { 41 | jspb.test.importing.ImportedMessage imported_message = 1; 42 | } 43 | -------------------------------------------------------------------------------- /js/data.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: mwr@google.com (Mark Rawling) 32 | 33 | syntax = "proto2"; 34 | 35 | option java_package = "com.google.apps.jspb.proto"; 36 | option java_multiple_files = true; 37 | 38 | package jspb.test; 39 | 40 | // legacy data, must be nested 41 | message data { 42 | message NestedData { 43 | required string str = 1; 44 | } 45 | } 46 | 47 | // new data, does not require nesting 48 | message UnnestedData { 49 | required string str = 1; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /js/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "", 3 | "spec_files": [ 4 | "*_test.js", 5 | "binary/*_test.js" 6 | ], 7 | "helpers": [ 8 | "node_modules/google-closure-library/closure/goog/bootstrap/nodejs.js", 9 | "node_loader.js", 10 | "deps.js" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /js/node_loader.js: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | /** 32 | * @fileoverview Loader that handles goog.require() for Node.JS. 33 | */ 34 | 35 | var oldLoader = goog.global.CLOSURE_IMPORT_SCRIPT; 36 | 37 | goog.global.CLOSURE_IMPORT_SCRIPT = function(src, opt_sourceText) { 38 | if (opt_sourceText === undefined) { 39 | try { 40 | // Load from the current directory. 41 | require("./" + src); 42 | return true; 43 | } catch (e) { 44 | // Fall back to the Closure loader. 45 | } 46 | } 47 | 48 | return oldLoader(src, opt_sourceText); 49 | }; 50 | -------------------------------------------------------------------------------- /js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google-protobuf", 3 | "version": "3.0.0-alpha.5", 4 | "description": "Protocol Buffers for JavaScript", 5 | "main": "google-protobuf.js", 6 | "dependencies": { 7 | "google-closure-library": "~20160125.0.0", 8 | "gulp": "~3.9.0", 9 | "jasmine": "~2.4.1" 10 | }, 11 | "devDependencies": { 12 | "google-closure-compiler": "~20151216.2.0", 13 | "glob": "~6.0.4" 14 | }, 15 | "scripts": { 16 | "test": "node ./node_modules/gulp/bin/gulp.js test" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/google/protobuf/tree/master/js" 21 | }, 22 | "author": "", 23 | "license": "Apache-2.0" 24 | } 25 | -------------------------------------------------------------------------------- /js/test4.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | option java_package = "com.google.apps.jspb.proto"; 34 | option java_multiple_files = true; 35 | 36 | package jspb.exttest; 37 | 38 | import "test3.proto"; 39 | 40 | extend TestExtensionsMessage { 41 | optional ExtensionMessage floating_msg_field_two = 103; 42 | } 43 | -------------------------------------------------------------------------------- /js/test5.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | option java_package = "com.google.apps.jspb.proto"; 34 | option java_multiple_files = true; 35 | 36 | package jspb.exttest.beta; 37 | 38 | message TestBetaExtensionsMessage { 39 | extensions 100 to max; 40 | } 41 | 42 | extend TestBetaExtensionsMessage { 43 | optional string floating_str_field = 101; 44 | } 45 | -------------------------------------------------------------------------------- /js/test_bootstrap.js: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | /** 32 | * @fileoverview Sets flags for uncompiled JSUnit tests. 33 | */ 34 | 35 | /** 36 | * Set uncompiled flags. 37 | */ 38 | var CLOSURE_DEFINES = { 39 | // Enable the fromObject method on the message class. 40 | 'jspb.Message.GENERATE_FROM_OBJECT': true 41 | }; 42 | -------------------------------------------------------------------------------- /js/testempty.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package javatests.com.google.apps.jspb; 34 | 35 | -------------------------------------------------------------------------------- /m4/ac_system_extensions.m4: -------------------------------------------------------------------------------- 1 | dnl Provide AC_USE_SYSTEM_EXTENSIONS for old autoconf machines. 2 | AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],[ 3 | ifdef([AC_USE_SYSTEM_EXTENSIONS],[ 4 | AC_USE_SYSTEM_EXTENSIONS 5 | ],[ 6 | AC_BEFORE([$0], [AC_COMPILE_IFELSE]) 7 | AC_BEFORE([$0], [AC_RUN_IFELSE]) 8 | 9 | AC_REQUIRE([AC_GNU_SOURCE]) 10 | AC_REQUIRE([AC_AIX]) 11 | AC_REQUIRE([AC_MINIX]) 12 | 13 | AH_VERBATIM([__EXTENSIONS__], 14 | [/* Enable extensions on Solaris. */ 15 | #ifndef __EXTENSIONS__ 16 | # undef __EXTENSIONS__ 17 | #endif 18 | #ifndef _POSIX_PTHREAD_SEMANTICS 19 | # undef _POSIX_PTHREAD_SEMANTICS 20 | #endif 21 | #ifndef _TANDEM_SOURCE 22 | # undef _TANDEM_SOURCE 23 | #endif]) 24 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 25 | [ac_cv_safe_to_define___extensions__], 26 | [AC_COMPILE_IFELSE( 27 | [AC_LANG_PROGRAM([ 28 | # define __EXTENSIONS__ 1 29 | AC_INCLUDES_DEFAULT])], 30 | [ac_cv_safe_to_define___extensions__=yes], 31 | [ac_cv_safe_to_define___extensions__=no])]) 32 | test $ac_cv_safe_to_define___extensions__ = yes && 33 | AC_DEFINE([__EXTENSIONS__]) 34 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 35 | AC_DEFINE([_TANDEM_SOURCE]) 36 | ]) 37 | ]) 38 | -------------------------------------------------------------------------------- /more_tests/Makefile: -------------------------------------------------------------------------------- 1 | # Additional tests to run before releasing a package. 2 | # 3 | # Run like: 4 | # make PACKAGE=/path/to/protobuf-VERSION.tar.gz 5 | # 6 | # Some of these tests require tools or make assumptions that may not be 7 | # available on end-user machines, so these cannot be part of "make check". For 8 | # example, we test that the headers compile with strict warning settings, but 9 | # since different compilers produce wildly different warnings we cannot assume 10 | # that this test will pass everywhere. If we ran it as part of "make check", 11 | # it could unnecessarily block users from running the real tests just because 12 | # their compiler produces some extra warnings that probably aren't a big deal. 13 | # So we run it separately. 14 | 15 | all: header_warning_test 16 | 17 | clean: 18 | rm -rf src target header_warning_test.cc header_warning_test.o header_warning_test 19 | 20 | # Unpack the package into src, then install it into target. 21 | PACKAGE=protobuf.tar.gz 22 | 23 | src: $(PACKAGE) 24 | tar zxvf $(PACKAGE) 25 | mv `basename $(PACKAGE) .tar.gz` src 26 | 27 | target: src 28 | (cd src && ./configure --prefix=$$PWD/../target --disable-shared) 29 | (cd src && make -j4 check) 30 | (cd src && make install) 31 | 32 | # Verify that headers produce no warnings even under strict settings. 33 | header_warning_test.cc: target 34 | ( (cd target/include && find google/protobuf -name '*.h') | \ 35 | awk '{print "#include \""$$1"\""} ' > header_warning_test.cc ) 36 | 37 | header_warning_test: header_warning_test.cc 38 | # TODO(kenton): Consider adding -pedantic and -Weffc++. Currently these 39 | # produce tons of extra warnings so we'll need to do some work first. 40 | g++ -Itarget/include -Wall -Werror -Wsign-compare -O2 -c header_warning_test.cc 41 | touch header_warning_test 42 | -------------------------------------------------------------------------------- /objectivec/DevTools/check_version_stamps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script checks that the runtime version number constant in the compiler 4 | # source and in the runtime source is the same. 5 | # 6 | # A distro can be made of the protobuf sources with only a subset of the 7 | # languages, so if the compiler depended on the Objective C runtime, those 8 | # builds would break. At the same time, we don't want the runtime source 9 | # depending on the compiler sources; so two copies of the constant are needed. 10 | 11 | set -eu 12 | 13 | readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") 14 | readonly ProtoRootDir="${ScriptDir}/../.." 15 | 16 | die() { 17 | echo "Error: $1" 18 | exit 1 19 | } 20 | 21 | readonly ConstantName=GOOGLE_PROTOBUF_OBJC_GEN_VERSION 22 | 23 | # Collect version from plugin sources. 24 | 25 | readonly PluginSrc="${ProtoRootDir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc" 26 | readonly PluginVersion=$( \ 27 | cat "${PluginSrc}" \ 28 | | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p" 29 | ) 30 | 31 | if [[ -z "${PluginVersion}" ]] ; then 32 | die "Failed to find ${ConstantName} in the plugin source (${PluginSrc})." 33 | fi 34 | 35 | # Collect version from runtime sources. 36 | 37 | readonly RuntimeSrc="${ProtoRootDir}/objectivec/GPBBootstrap.h" 38 | readonly RuntimeVersion=$( \ 39 | cat "${RuntimeSrc}" \ 40 | | sed -n -e "s:#define ${ConstantName} \([0-9]*\):\1:p" 41 | ) 42 | 43 | if [[ -z "${RuntimeVersion}" ]] ; then 44 | die "Failed to find ${ConstantName} in the runtime source (${RuntimeSrc})." 45 | fi 46 | 47 | # Compare them. 48 | 49 | if [[ "${PluginVersion}" != "${RuntimeVersion}" ]] ; then 50 | die "Versions don't match! 51 | Plugin: ${PluginVersion} from ${PluginSrc} 52 | Runtime: ${RuntimeVersion} from ${RuntimeSrc} 53 | " 54 | fi 55 | 56 | # Success 57 | -------------------------------------------------------------------------------- /objectivec/GPBProtocolBuffers_RuntimeSupport.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // This header is meant to only be used by the generated source, it should not 32 | // be included in code using protocol buffers. 33 | 34 | #import "GPBProtocolBuffers.h" 35 | 36 | #import "GPBDescriptor_PackagePrivate.h" 37 | #import "GPBExtensionInternals.h" 38 | #import "GPBMessage_PackagePrivate.h" 39 | #import "GPBRootObject_PackagePrivate.h" 40 | #import "GPBUtilities_PackagePrivate.h" 41 | -------------------------------------------------------------------------------- /objectivec/GPBRootObject.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | #import 32 | 33 | @class GPBExtensionRegistry; 34 | 35 | NS_ASSUME_NONNULL_BEGIN 36 | 37 | /// Every generated proto file defines a local "Root" class that exposes a 38 | /// @c GPBExtensionRegistry for all the extensions defined by that file and 39 | /// the files it depends on. 40 | @interface GPBRootObject : NSObject 41 | 42 | /// An extension registry for the given file and all the files it depends on. 43 | + (GPBExtensionRegistry *)extensionRegistry; 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | -------------------------------------------------------------------------------- /objectivec/GPBRootObject_PackagePrivate.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | #import 32 | 33 | #import "GPBRootObject.h" 34 | 35 | @class GPBExtensionDescriptor; 36 | 37 | @interface GPBRootObject () 38 | 39 | // Globally register. 40 | + (void)globallyRegisterExtension:(GPBExtensionDescriptor *)field; 41 | 42 | @end 43 | 44 | // Returns YES if the selector was resolved and added to the class, 45 | // NO otherwise. 46 | BOOL GPBResolveExtensionClassMethod(Class self, SEL sel); 47 | -------------------------------------------------------------------------------- /objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/FFE465CA-0E74-40E8-9F09-500B66B7DCB2.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | classNames 6 | 7 | PerfTests 8 | 9 | testExtensionsPerformance 10 | 11 | com.apple.XCTPerformanceMetric_WallClockTime 12 | 13 | baselineAverage 14 | 0.9 15 | baselineIntegrationDisplayName 16 | Feb 5, 2015, 9:42:41 AM 17 | 18 | 19 | testHas 20 | 21 | com.apple.XCTPerformanceMetric_WallClockTime 22 | 23 | baselineAverage 24 | 0.09 25 | baselineIntegrationDisplayName 26 | Feb 5, 2015, 9:42:35 AM 27 | 28 | 29 | testMessagePerformance 30 | 31 | com.apple.XCTPerformanceMetric_WallClockTime 32 | 33 | baselineAverage 34 | 0.57 35 | baselineIntegrationDisplayName 36 | Feb 5, 2015, 9:42:47 AM 37 | 38 | 39 | testPackedExtensionsPerformance 40 | 41 | com.apple.XCTPerformanceMetric_WallClockTime 42 | 43 | baselineAverage 44 | 0.75 45 | baselineIntegrationDisplayName 46 | Feb 5, 2015, 9:42:51 AM 47 | 48 | 49 | testPackedTypesPerformance 50 | 51 | com.apple.XCTPerformanceMetric_WallClockTime 52 | 53 | baselineAverage 54 | 0.26 55 | baselineIntegrationDisplayName 56 | Feb 5, 2015, 9:42:55 AM 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | runDestinationsByUUID 6 | 7 | FFE465CA-0E74-40E8-9F09-500B66B7DCB2 8 | 9 | targetArchitecture 10 | arm64 11 | targetDevice 12 | 13 | modelCode 14 | iPhone7,1 15 | platformIdentifier 16 | com.apple.platform.iphoneos 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /objectivec/Tests/UnitTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "google/protobuf/UnittestRuntimeProto2.pbobjc.h" 6 | #import "google/protobuf/UnittestRuntimeProto3.pbobjc.h" 7 | -------------------------------------------------------------------------------- /objectivec/Tests/UnitTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /objectivec/Tests/golden_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/golden_message -------------------------------------------------------------------------------- /objectivec/Tests/golden_packed_fields_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/golden_packed_fields_message -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AppDelegate : UIResponder 4 | @property (strong, nonatomic) UIWindow *window; 5 | @end 6 | 7 | @implementation AppDelegate 8 | 9 | @synthesize window; 10 | 11 | - (BOOL)application:(UIApplication *)application 12 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 13 | #pragma unused (application, launchOptions) 14 | 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | self.window.backgroundColor = [UIColor whiteColor]; 17 | [self.window makeKeyAndVisible]; 18 | self.window.rootViewController = [[UIViewController alloc] init]; 19 | 20 | UILabel *label = 21 | [[UILabel alloc] initWithFrame:CGRectMake(0, 200, CGRectGetWidth(self.window.frame), 40)]; 22 | label.text = @"Protocol Buffer Test Harness"; 23 | label.textAlignment = NSTextAlignmentCenter; 24 | [self.window addSubview:label]; 25 | 26 | return YES; 27 | } 28 | 29 | @end 30 | 31 | int main(int argc, char * argv[]) { 32 | @autoreleasepool { 33 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | UIInterfaceOrientationPortraitUpsideDown 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /objectivec/Tests/text_format_map_unittest_data.txt: -------------------------------------------------------------------------------- 1 | map_int32_int32 { 2 | key: 100 3 | value: 1 4 | } 5 | map_int64_int64 { 6 | key: 101 7 | value: 1 8 | } 9 | map_uint32_uint32 { 10 | key: 102 11 | value: 1 12 | } 13 | map_uint64_uint64 { 14 | key: 103 15 | value: 1 16 | } 17 | map_sint32_sint32 { 18 | key: 104 19 | value: 1 20 | } 21 | map_sint64_sint64 { 22 | key: 105 23 | value: 1 24 | } 25 | map_fixed32_fixed32 { 26 | key: 106 27 | value: 1 28 | } 29 | map_fixed64_fixed64 { 30 | key: 107 31 | value: 1 32 | } 33 | map_sfixed32_sfixed32 { 34 | key: 108 35 | value: 1 36 | } 37 | map_sfixed64_sfixed64 { 38 | key: 109 39 | value: 1 40 | } 41 | map_int32_float { 42 | key: 110 43 | value: 1 44 | } 45 | map_int32_double { 46 | key: 111 47 | value: 1 48 | } 49 | map_bool_bool { 50 | key: true 51 | value: false 52 | } 53 | map_string_string { 54 | key: "112" 55 | value: "1" 56 | } 57 | map_int32_bytes { 58 | key: 113 59 | value: "\001\000\000\000" 60 | } 61 | map_int32_enum { 62 | key: 114 63 | value: MAP_ENUM_BAZ 64 | } 65 | map_int32_foreign_message { 66 | key: 115 67 | value { 68 | c: 1 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /objectivec/Tests/unittest_objc_startup.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package protobuf_objc_unittest; 34 | 35 | message TestObjCStartupMessage { 36 | extensions 1 to max; 37 | } 38 | 39 | extend TestObjCStartupMessage { 40 | // Singular 41 | optional int32 optional_int32_extension = 1; 42 | repeated int32 repeated_int32_extension = 2; 43 | } 44 | 45 | message TestObjCStartupNested { 46 | extend TestObjCStartupMessage { 47 | optional string nested_string_extension = 3; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /objectivec/google/protobuf/Empty.pbobjc.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/protobuf/empty.proto 3 | 4 | #import "GPBProtocolBuffers.h" 5 | 6 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 7 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. 8 | #endif 9 | 10 | // @@protoc_insertion_point(imports) 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | CF_EXTERN_C_BEGIN 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | #pragma mark - GPBEmptyRoot 20 | 21 | /// Exposes the extension registry for this file. 22 | /// 23 | /// The base class provides: 24 | /// @code 25 | /// + (GPBExtensionRegistry *)extensionRegistry; 26 | /// @endcode 27 | /// which is a @c GPBExtensionRegistry that includes all the extensions defined by 28 | /// this file and all files that it depends on. 29 | @interface GPBEmptyRoot : GPBRootObject 30 | @end 31 | 32 | #pragma mark - GPBEmpty 33 | 34 | /// A generic empty message that you can re-use to avoid defining duplicated 35 | /// empty messages in your APIs. A typical example is to use it as the request 36 | /// or the response type of an API method. For instance: 37 | /// 38 | /// service Foo { 39 | /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 40 | /// } 41 | /// 42 | /// The JSON representation for `Empty` is empty JSON object `{}`. 43 | @interface GPBEmpty : GPBMessage 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | 49 | CF_EXTERN_C_END 50 | 51 | #pragma clang diagnostic pop 52 | 53 | // @@protoc_insertion_point(global_scope) 54 | -------------------------------------------------------------------------------- /objectivec/google/protobuf/Empty.pbobjc.m: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/protobuf/empty.proto 3 | 4 | #import "GPBProtocolBuffers_RuntimeSupport.h" 5 | #import "google/protobuf/Empty.pbobjc.h" 6 | // @@protoc_insertion_point(imports) 7 | 8 | #pragma clang diagnostic push 9 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 10 | 11 | #pragma mark - GPBEmptyRoot 12 | 13 | @implementation GPBEmptyRoot 14 | 15 | @end 16 | 17 | #pragma mark - GPBEmptyRoot_FileDescriptor 18 | 19 | static GPBFileDescriptor *GPBEmptyRoot_FileDescriptor(void) { 20 | // This is called by +initialize so there is no need to worry 21 | // about thread safety of the singleton. 22 | static GPBFileDescriptor *descriptor = NULL; 23 | if (!descriptor) { 24 | GPBDebugCheckRuntimeVersion(); 25 | descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf" 26 | syntax:GPBFileSyntaxProto3]; 27 | } 28 | return descriptor; 29 | } 30 | 31 | #pragma mark - GPBEmpty 32 | 33 | @implementation GPBEmpty 34 | 35 | 36 | typedef struct GPBEmpty__storage_ { 37 | uint32_t _has_storage_[1]; 38 | } GPBEmpty__storage_; 39 | 40 | // This method is threadsafe because it is initially called 41 | // in +initialize for each subclass. 42 | + (GPBDescriptor *)descriptor { 43 | static GPBDescriptor *descriptor = nil; 44 | if (!descriptor) { 45 | GPBDescriptor *localDescriptor = 46 | [GPBDescriptor allocDescriptorForClass:[GPBEmpty class] 47 | rootClass:[GPBEmptyRoot class] 48 | file:GPBEmptyRoot_FileDescriptor() 49 | fields:NULL 50 | fieldCount:0 51 | storageSize:sizeof(GPBEmpty__storage_) 52 | flags:0]; 53 | NSAssert(descriptor == nil, @"Startup recursed!"); 54 | descriptor = localDescriptor; 55 | } 56 | return descriptor; 57 | } 58 | 59 | @end 60 | 61 | 62 | #pragma clang diagnostic pop 63 | 64 | // @@protoc_insertion_point(global_scope) 65 | -------------------------------------------------------------------------------- /objectivec/google/protobuf/SourceContext.pbobjc.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: google/protobuf/source_context.proto 3 | 4 | #import "GPBProtocolBuffers.h" 5 | 6 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001 7 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. 8 | #endif 9 | 10 | // @@protoc_insertion_point(imports) 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | CF_EXTERN_C_BEGIN 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | #pragma mark - GPBSourceContextRoot 20 | 21 | /// Exposes the extension registry for this file. 22 | /// 23 | /// The base class provides: 24 | /// @code 25 | /// + (GPBExtensionRegistry *)extensionRegistry; 26 | /// @endcode 27 | /// which is a @c GPBExtensionRegistry that includes all the extensions defined by 28 | /// this file and all files that it depends on. 29 | @interface GPBSourceContextRoot : GPBRootObject 30 | @end 31 | 32 | #pragma mark - GPBSourceContext 33 | 34 | typedef GPB_ENUM(GPBSourceContext_FieldNumber) { 35 | GPBSourceContext_FieldNumber_FileName = 1, 36 | }; 37 | 38 | /// `SourceContext` represents information about the source of a 39 | /// protobuf element, like the file in which it is defined. 40 | @interface GPBSourceContext : GPBMessage 41 | 42 | /// The path-qualified name of the .proto file that contained the associated 43 | /// protobuf element. For example: `"google/protobuf/source.proto"`. 44 | @property(nonatomic, readwrite, copy, null_resettable) NSString *fileName; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | 50 | CF_EXTERN_C_END 51 | 52 | #pragma clang diagnostic pop 53 | 54 | // @@protoc_insertion_point(global_scope) 55 | -------------------------------------------------------------------------------- /php/ext/google/protobuf/config.m4: -------------------------------------------------------------------------------- 1 | dnl lines starting with "dnl" are comments 2 | 3 | PHP_ARG_ENABLE(protobuf, whether to enable Protobuf extension, [ --enable-protobuf Enable Protobuf extension]) 4 | 5 | if test "$PHP_PROTOBUF" != "no"; then 6 | 7 | dnl this defines the extension 8 | PHP_NEW_EXTENSION(protobuf, upb.c protobuf.c def.c message.c storage.c, $ext_shared) 9 | 10 | fi 11 | -------------------------------------------------------------------------------- /php/ext/google/protobuf/test.php: -------------------------------------------------------------------------------- 1 | addMessage("TestMessage") 8 | ->optional("optional_int32_a", "int32", 1) 9 | ->optional("optional_int32_b", "int32", 2) 10 | ->finalizeToPool() 11 | ->finalize(); 12 | 13 | $test_message = new \TestMessage(); 14 | 15 | ?> 16 | -------------------------------------------------------------------------------- /php/tests/autoload.php: -------------------------------------------------------------------------------- 1 | &2 20 | exit 1 21 | fi 22 | 23 | if [ ! -e $1 ]; then 24 | echo $1": File not found." >&2 25 | exit 1 26 | fi 27 | 28 | set -ex 29 | 30 | LANGUAGES="cpp csharp java javanano js objectivec python ruby" 31 | BASENAME=`basename $1 .tar.gz` 32 | VERSION=${BASENAME:9} 33 | 34 | # Create a directory called "dist", copy the tarball there and unpack it. 35 | mkdir dist 36 | cp $1 dist 37 | cd dist 38 | tar zxvf $BASENAME.tar.gz 39 | rm $BASENAME.tar.gz 40 | 41 | # Set the entire contents to be user-writable. 42 | chmod -R u+w $BASENAME 43 | cd $BASENAME 44 | 45 | for LANG in $LANGUAGES; do 46 | # Build the dist again in .tar.gz 47 | ./configure DIST_LANG=$LANG 48 | make dist-gzip 49 | mv $BASENAME.tar.gz ../protobuf-$LANG-$VERSION.tar.gz 50 | done 51 | 52 | # Convert all text files to use DOS-style line endings, then build a .zip 53 | # distribution. 54 | todos *.txt */*.txt 55 | 56 | for LANG in $LANGUAGES; do 57 | # Build the dist again in .zip 58 | ./configure DIST_LANG=$LANG 59 | make dist-zip 60 | mv $BASENAME.zip ../protobuf-$LANG-$VERSION.zip 61 | done 62 | 63 | cd .. 64 | rm -rf $BASENAME 65 | -------------------------------------------------------------------------------- /protobuf-lite.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lprotobuf-lite @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 10 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 11 | Conflicts: protobuf 12 | -------------------------------------------------------------------------------- /protobuf.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lprotobuf @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 10 | Libs.private: @LIBS@ 11 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 12 | Conflicts: protobuf-lite 13 | -------------------------------------------------------------------------------- /protoc-artifacts/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:6.6 2 | 3 | RUN yum install -y git \ 4 | tar \ 5 | wget \ 6 | make \ 7 | autoconf \ 8 | curl-devel \ 9 | unzip \ 10 | automake \ 11 | libtool \ 12 | glibc-static.i686 \ 13 | glibc-devel \ 14 | glibc-devel.i686 15 | 16 | # Install Java 8 17 | RUN wget -q --no-cookies --no-check-certificate \ 18 | --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz" \ 19 | -O - | tar xz -C /var/local 20 | ENV JAVA_HOME /var/local/jdk1.8.0_45 21 | ENV PATH $JAVA_HOME/bin:$PATH 22 | 23 | # Install Maven 24 | RUN wget -q http://apache.cs.utah.edu/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz -O - | \ 25 | tar xz -C /var/local 26 | ENV PATH /var/local/apache-maven-3.3.3/bin:$PATH 27 | 28 | # Install GCC 4.7 to support -static-libstdc++ 29 | RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d 30 | RUN bash -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo' 31 | RUN bash -c "sed -e 's/\$basearch/i386/g' /etc/yum.repos.d/devtools-1.1.repo > /etc/yum.repos.d/devtools-i386-1.1.repo" 32 | RUN sed -e 's/testing-/testing-i386-/g' -i /etc/yum.repos.d/devtools-i386-1.1.repo 33 | RUN yum install -y devtoolset-1.1 \ 34 | devtoolset-1.1-libstdc++-devel \ 35 | devtoolset-1.1-libstdc++-devel.i686 36 | 37 | RUN git clone --depth 1 https://github.com/google/protobuf.git 38 | 39 | # Start in devtoolset environment that uses GCC 4.7 40 | CMD ["scl", "enable", "devtoolset-1.1", "bash"] 41 | -------------------------------------------------------------------------------- /python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | prune google/protobuf/internal/import_test_package 2 | exclude google/protobuf/internal/*_pb2.py 3 | exclude google/protobuf/internal/*_test.py 4 | exclude google/protobuf/internal/*.proto 5 | exclude google/protobuf/internal/test_util.py 6 | 7 | recursive-exclude google *_test.py 8 | recursive-exclude google *_test.proto 9 | recursive-exclude google unittest*_pb2.py 10 | 11 | global-exclude *.dll 12 | global-exclude *.pyc 13 | global-exclude *.pyo 14 | global-exclude *.so 15 | -------------------------------------------------------------------------------- /python/google/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | __import__('pkg_resources').declare_namespace(__name__) 3 | except ImportError: 4 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 5 | -------------------------------------------------------------------------------- /python/google/protobuf/__init__.py: -------------------------------------------------------------------------------- 1 | # Protocol Buffers - Google's data interchange format 2 | # Copyright 2008 Google Inc. All rights reserved. 3 | # https://developers.google.com/protocol-buffers/ 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are 7 | # met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above 12 | # copyright notice, this list of conditions and the following disclaimer 13 | # in the documentation and/or other materials provided with the 14 | # distribution. 15 | # * Neither the name of Google Inc. nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | # Copyright 2007 Google Inc. All Rights Reserved. 32 | 33 | __version__ = '3.0.0b2.post2' 34 | 35 | if __name__ != '__main__': 36 | try: 37 | __import__('pkg_resources').declare_namespace(__name__) 38 | except ImportError: 39 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 40 | -------------------------------------------------------------------------------- /python/google/protobuf/internal/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/python/google/protobuf/internal/__init__.py -------------------------------------------------------------------------------- /python/google/protobuf/internal/any_test.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: jieluo@google.com (Jie Luo) 32 | 33 | syntax = "proto3"; 34 | 35 | package google.protobuf.internal; 36 | 37 | import "google/protobuf/any.proto"; 38 | 39 | message TestAny { 40 | google.protobuf.Any value = 1; 41 | int32 int_value = 2; 42 | } 43 | -------------------------------------------------------------------------------- /python/google/protobuf/internal/import_test_package/__init__.py: -------------------------------------------------------------------------------- 1 | # Protocol Buffers - Google's data interchange format 2 | # Copyright 2008 Google Inc. All rights reserved. 3 | # https://developers.google.com/protocol-buffers/ 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are 7 | # met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above 12 | # copyright notice, this list of conditions and the following disclaimer 13 | # in the documentation and/or other materials provided with the 14 | # distribution. 15 | # * Neither the name of Google Inc. nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | """Sample module importing a nested proto from itself.""" 32 | 33 | from google.protobuf.internal.import_test_package import outer_pb2 as myproto 34 | -------------------------------------------------------------------------------- /python/google/protobuf/internal/import_test_package/inner.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package google.protobuf.python.internal.import_test_package; 34 | 35 | message Inner { 36 | optional int32 value = 1 [default = 57]; 37 | } 38 | -------------------------------------------------------------------------------- /python/google/protobuf/internal/import_test_package/outer.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package google.protobuf.python.internal.import_test_package; 34 | 35 | import "google/protobuf/internal/import_test_package/inner.proto"; 36 | 37 | message Outer { 38 | optional Inner inner = 1; 39 | } 40 | -------------------------------------------------------------------------------- /python/google/protobuf/pyext/README: -------------------------------------------------------------------------------- 1 | This is the 'v2' C++ implementation for python proto2. 2 | 3 | It is active when: 4 | 5 | PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp 6 | PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 7 | -------------------------------------------------------------------------------- /python/google/protobuf/pyext/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | __import__('pkg_resources').declare_namespace(__name__) 3 | except ImportError: 4 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 5 | -------------------------------------------------------------------------------- /python/google/protobuf/pyext/proto2_api_test.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | import "google/protobuf/internal/cpp/proto1_api_test.proto"; 34 | 35 | package google.protobuf.python.internal; 36 | 37 | message TestNestedProto1APIMessage { 38 | optional int32 a = 1; 39 | optional TestMessage.NestedMessage b = 2; 40 | } 41 | -------------------------------------------------------------------------------- /python/tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = 3 | py{26,27,33,34}-{cpp,python} 4 | 5 | [testenv] 6 | usedevelop=true 7 | passenv = CC 8 | setenv = 9 | cpp: LD_LIBRARY_PATH={toxinidir}/../src/.libs 10 | cpp: DYLD_LIBRARY_PATH={toxinidir}/../src/.libs 11 | cpp: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp 12 | commands = 13 | python setup.py -q build_py 14 | python: python setup.py -q build 15 | cpp: python setup.py -q build --cpp_implementation --warnings_as_errors 16 | python: python setup.py -q test -q 17 | cpp: python setup.py -q test -q --cpp_implementation 18 | python: python setup.py -q test_conformance 19 | cpp: python setup.py -q test_conformance --cpp_implementation 20 | deps = 21 | # Keep this list of dependencies in sync with setup.py. 22 | six>=1.9 23 | py26: ordereddict 24 | py26: unittest2 25 | -------------------------------------------------------------------------------- /ruby/.gitignore: -------------------------------------------------------------------------------- 1 | *.bundle 2 | tags 3 | .idea/ 4 | lib/google/protobuf_java.jar 5 | protobuf-jruby.iml 6 | target/ 7 | pkg/ 8 | tmp/ 9 | -------------------------------------------------------------------------------- /ruby/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /ruby/Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | google-protobuf (3.0.0.alpha.5.0) 5 | 6 | GEM 7 | remote: https://rubygems.org/ 8 | specs: 9 | power_assert (0.2.2) 10 | rake (10.4.2) 11 | rake-compiler (0.9.5) 12 | rake 13 | rake-compiler-dock (0.5.1) 14 | rubygems-tasks (0.2.4) 15 | test-unit (3.0.9) 16 | power_assert 17 | 18 | PLATFORMS 19 | java 20 | ruby 21 | 22 | DEPENDENCIES 23 | google-protobuf! 24 | rake-compiler 25 | rake-compiler-dock 26 | rubygems-tasks 27 | test-unit 28 | 29 | BUNDLED WITH 30 | 1.11.2 31 | -------------------------------------------------------------------------------- /ruby/ext/google/protobuf_c/extconf.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require 'mkmf' 4 | 5 | $CFLAGS += " -std=c99 -O3 -DNDEBUG" 6 | 7 | $objs = ["protobuf.o", "defs.o", "storage.o", "message.o", 8 | "repeated_field.o", "map.o", "encode_decode.o", "upb.o"] 9 | 10 | create_makefile("google/protobuf_c") 11 | -------------------------------------------------------------------------------- /ruby/google-protobuf.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = "google-protobuf" 3 | s.version = "3.0.0.alpha.5.0" 4 | s.licenses = ["BSD"] 5 | s.summary = "Protocol Buffers" 6 | s.description = "Protocol Buffers are Google's data interchange format." 7 | s.homepage = "https://developers.google.com/protocol-buffers" 8 | s.authors = ["Protobuf Authors"] 9 | s.email = "protobuf@googlegroups.com" 10 | s.require_paths = ["lib"] 11 | s.files = Dir.glob('lib/**/*.rb') 12 | if RUBY_PLATFORM == "java" 13 | s.files += ["lib/google/protobuf_java.jar"] 14 | else 15 | s.files += Dir.glob('ext/**/*') 16 | s.extensions= ["ext/google/protobuf_c/extconf.rb"] 17 | s.add_development_dependency "rake-compiler-dock" 18 | end 19 | s.test_files = ["tests/basic.rb", 20 | "tests/stress.rb", 21 | "tests/generated_code_test.rb"] 22 | s.add_development_dependency "rake-compiler" 23 | s.add_development_dependency "test-unit" 24 | s.add_development_dependency "rubygems-tasks" 25 | end 26 | -------------------------------------------------------------------------------- /ruby/lib/google/protobuf/message_exts.rb: -------------------------------------------------------------------------------- 1 | # Protocol Buffers - Google's data interchange format 2 | # Copyright 2008 Google Inc. All rights reserved. 3 | # https://developers.google.com/protocol-buffers/ 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are 7 | # met: 8 | # 9 | # * Redistributions of source code must retain the above copyright 10 | # notice, this list of conditions and the following disclaimer. 11 | # * Redistributions in binary form must reproduce the above 12 | # copyright notice, this list of conditions and the following disclaimer 13 | # in the documentation and/or other materials provided with the 14 | # distribution. 15 | # * Neither the name of Google Inc. nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | module Google 32 | module Protobuf 33 | module MessageExts 34 | 35 | #this is only called in jruby; mri loades the ClassMethods differently 36 | def self.included(klass) 37 | klass.extend(ClassMethods) 38 | end 39 | 40 | module ClassMethods 41 | end 42 | 43 | def to_json 44 | self.class.encode_json(self) 45 | end 46 | 47 | def to_proto 48 | self.class.encode(self) 49 | end 50 | 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /ruby/src/main/sentinel.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package com.google.protobuf.jruby; 3 | option optimize_for = CODE_SIZE; 4 | 5 | message Sentinel { 6 | int32 default_int32 = 1; 7 | int64 default_int64 = 2; 8 | uint32 default_unit32 = 3; 9 | uint64 default_uint64 = 4; 10 | string default_string = 5; 11 | bool default_bool = 6; 12 | float default_float = 7; 13 | double default_double = 8; 14 | bytes default_bytes = 9; 15 | } 16 | -------------------------------------------------------------------------------- /ruby/tests/generated_code.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package A.B.C; 4 | 5 | message TestMessage { 6 | int32 optional_int32 = 1; 7 | int64 optional_int64 = 2; 8 | uint32 optional_uint32 = 3; 9 | uint64 optional_uint64 = 4; 10 | bool optional_bool = 5; 11 | double optional_double = 6; 12 | float optional_float = 7; 13 | string optional_string = 8; 14 | bytes optional_bytes = 9; 15 | TestEnum optional_enum = 10; 16 | TestMessage optional_msg = 11; 17 | 18 | repeated int32 repeated_int32 = 21; 19 | repeated int64 repeated_int64 = 22; 20 | repeated uint32 repeated_uint32 = 23; 21 | repeated uint64 repeated_uint64 = 24; 22 | repeated bool repeated_bool = 25; 23 | repeated double repeated_double = 26; 24 | repeated float repeated_float = 27; 25 | repeated string repeated_string = 28; 26 | repeated bytes repeated_bytes = 29; 27 | repeated TestEnum repeated_enum = 30; 28 | repeated TestMessage repeated_msg = 31; 29 | 30 | oneof my_oneof { 31 | int32 oneof_int32 = 41; 32 | int64 oneof_int64 = 42; 33 | uint32 oneof_uint32 = 43; 34 | uint64 oneof_uint64 = 44; 35 | bool oneof_bool = 45; 36 | double oneof_double = 46; 37 | float oneof_float = 47; 38 | string oneof_string = 48; 39 | bytes oneof_bytes = 49; 40 | TestEnum oneof_enum = 50; 41 | TestMessage oneof_msg = 51; 42 | } 43 | 44 | map map_int32_string = 61; 45 | map map_int64_string = 62; 46 | map map_uint32_string = 63; 47 | map map_uint64_string = 64; 48 | map map_bool_string = 65; 49 | map map_string_string = 66; 50 | map map_string_msg = 67; 51 | map map_string_enum = 68; 52 | map map_string_int32 = 69; 53 | map map_string_bool = 70; 54 | 55 | message NestedMessage { 56 | int32 foo = 1; 57 | } 58 | 59 | NestedMessage nested_message = 80; 60 | } 61 | 62 | enum TestEnum { 63 | Default = 0; 64 | A = 1; 65 | B = 2; 66 | C = 3; 67 | } 68 | -------------------------------------------------------------------------------- /ruby/tests/generated_code_test.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | # generated_code.rb is in the same directory as this test. 4 | $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) 5 | 6 | require 'generated_code' 7 | require 'test/unit' 8 | 9 | class GeneratedCodeTest < Test::Unit::TestCase 10 | def test_generated_msg 11 | # just test that we can instantiate the message. The purpose of this test 12 | # is to ensure that the output of the code generator is valid Ruby and 13 | # successfully creates message definitions and classes, not to test every 14 | # aspect of the extension (basic.rb is for that). 15 | m = A::B::C::TestMessage.new() 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /ruby/tests/stress.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require 'google/protobuf' 4 | require 'test/unit' 5 | 6 | module StressTest 7 | pool = Google::Protobuf::DescriptorPool.new 8 | pool.build do 9 | add_message "TestMessage" do 10 | optional :a, :int32, 1 11 | repeated :b, :message, 2, "M" 12 | end 13 | add_message "M" do 14 | optional :foo, :string, 1 15 | end 16 | end 17 | 18 | TestMessage = pool.lookup("TestMessage").msgclass 19 | M = pool.lookup("M").msgclass 20 | 21 | class StressTest < Test::Unit::TestCase 22 | def get_msg 23 | TestMessage.new(:a => 1000, 24 | :b => [M.new(:foo => "hello"), 25 | M.new(:foo => "world")]) 26 | end 27 | def test_stress 28 | m = get_msg 29 | data = TestMessage.encode(m) 30 | 100_000.times do 31 | mnew = TestMessage.decode(data) 32 | mnew = mnew.dup 33 | assert_equal mnew.inspect, m.inspect 34 | assert TestMessage.encode(mnew) == data 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /ruby/travis-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit on any error. 4 | set -e 5 | 6 | test_version() { 7 | version=$1 8 | if [ "$version" == "jruby" ] ; then 9 | # No conformance tests yet -- JRuby is too broken to run them. 10 | bash --login -c \ 11 | "rvm install $version && rvm use $version && \ 12 | which ruby && \ 13 | gem install bundler && bundle && \ 14 | rake test" 15 | else 16 | bash --login -c \ 17 | "rvm install $version && rvm use $version && \ 18 | which ruby && \ 19 | gem install bundler && bundle && \ 20 | rake test && 21 | cd ../conformance && make test_ruby" 22 | fi 23 | } 24 | 25 | test_version $1 26 | -------------------------------------------------------------------------------- /six.BUILD: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "copy_six", 3 | srcs = ["six-1.10.0/six.py"], 4 | outs = ["six.py"], 5 | cmd = "cp $< $(@)", 6 | ) 7 | 8 | py_library( 9 | name = "six", 10 | srcs = ["six.py"], 11 | srcs_version = "PY2AND3", 12 | visibility = ["//visibility:public"], 13 | ) 14 | -------------------------------------------------------------------------------- /src/google/protobuf/any_test.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto3"; 32 | 33 | package protobuf_unittest; 34 | 35 | import "google/protobuf/any.proto"; 36 | 37 | message TestAny { 38 | int32 int32_value = 1; 39 | google.protobuf.Any any_value = 2; 40 | repeated google.protobuf.Any repeated_any_value = 3; 41 | } 42 | -------------------------------------------------------------------------------- /src/google/protobuf/arena_nc.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Negative compilation test for arena usage. 32 | 33 | #include 34 | #include 35 | 36 | #ifdef TEST_ARENA_PRIVATE_CONSTRUCTOR 37 | 38 | namespace google { 39 | void ArenaPrivateConstructor() { 40 | google::protobuf::Arena arena; 41 | protobuf_unittest::TestAllTypes message(&arena); 42 | } 43 | 44 | #endif 45 | } // namespace google 46 | -------------------------------------------------------------------------------- /src/google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Test that proto2 compiler can generate valid code when the enum value 32 | // is INT_MAX. Note that this is a compile-only test and this proto is not 33 | // referenced in any C++ code. 34 | syntax = "proto2"; 35 | 36 | package protobuf_unittest; 37 | 38 | message TestLargeEnumValue { 39 | enum EnumWithLargeValue { 40 | VALUE_1 = 1; 41 | VALUE_MAX = 0x7fffffff; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/google/protobuf/compiler/ruby/ruby_generated_code.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package A.B.C; 4 | 5 | message TestMessage { 6 | int32 optional_int32 = 1; 7 | int64 optional_int64 = 2; 8 | uint32 optional_uint32 = 3; 9 | uint64 optional_uint64 = 4; 10 | bool optional_bool = 5; 11 | double optional_double = 6; 12 | float optional_float = 7; 13 | string optional_string = 8; 14 | bytes optional_bytes = 9; 15 | TestEnum optional_enum = 10; 16 | TestMessage optional_msg = 11; 17 | 18 | repeated int32 repeated_int32 = 21; 19 | repeated int64 repeated_int64 = 22; 20 | repeated uint32 repeated_uint32 = 23; 21 | repeated uint64 repeated_uint64 = 24; 22 | repeated bool repeated_bool = 25; 23 | repeated double repeated_double = 26; 24 | repeated float repeated_float = 27; 25 | repeated string repeated_string = 28; 26 | repeated bytes repeated_bytes = 29; 27 | repeated TestEnum repeated_enum = 30; 28 | repeated TestMessage repeated_msg = 31; 29 | 30 | oneof my_oneof { 31 | int32 oneof_int32 = 41; 32 | int64 oneof_int64 = 42; 33 | uint32 oneof_uint32 = 43; 34 | uint64 oneof_uint64 = 44; 35 | bool oneof_bool = 45; 36 | double oneof_double = 46; 37 | float oneof_float = 47; 38 | string oneof_string = 48; 39 | bytes oneof_bytes = 49; 40 | TestEnum oneof_enum = 50; 41 | TestMessage oneof_msg = 51; 42 | } 43 | 44 | map map_int32_string = 61; 45 | map map_int64_string = 62; 46 | map map_uint32_string = 63; 47 | map map_uint64_string = 64; 48 | map map_bool_string = 65; 49 | map map_string_string = 66; 50 | map map_string_msg = 67; 51 | map map_string_enum = 68; 52 | map map_string_int32 = 69; 53 | map map_string_bool = 70; 54 | 55 | message NestedMessage { 56 | int32 foo = 1; 57 | } 58 | 59 | NestedMessage nested_message = 80; 60 | } 61 | 62 | enum TestEnum { 63 | Default = 0; 64 | A = 1; 65 | B = 2; 66 | C = 3; 67 | } 68 | -------------------------------------------------------------------------------- /src/google/protobuf/io/gzip_stream_unittest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | # 3 | # Protocol Buffers - Google's data interchange format 4 | # Copyright 2009 Google Inc. All rights reserved. 5 | # https://developers.google.com/protocol-buffers/ 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above 14 | # copyright notice, this list of conditions and the following disclaimer 15 | # in the documentation and/or other materials provided with the 16 | # distribution. 17 | # * Neither the name of Google Inc. nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | # Author: brianolson@google.com (Brian Olson) 34 | # 35 | # Test compatibility between command line gzip/gunzip binaries and 36 | # ZeroCopyStream versions. 37 | 38 | TESTFILE=Makefile 39 | 40 | (./zcgzip < ${TESTFILE} | gunzip | cmp - ${TESTFILE}) && \ 41 | (gzip < ${TESTFILE} | ./zcgunzip | cmp - ${TESTFILE}) 42 | 43 | # Result of "(cmd) && (cmd)" implicitly becomes result of this script 44 | # and thus the test. 45 | -------------------------------------------------------------------------------- /src/google/protobuf/service.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | 35 | #include 36 | 37 | namespace google { 38 | namespace protobuf { 39 | 40 | Service::~Service() {} 41 | RpcChannel::~RpcChannel() {} 42 | RpcController::~RpcController() {} 43 | 44 | } // namespace protobuf 45 | 46 | } // namespace google 47 | -------------------------------------------------------------------------------- /src/google/protobuf/stubs/statusor.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | #include 32 | 33 | namespace google { 34 | namespace protobuf { 35 | namespace util { 36 | namespace internal { 37 | 38 | void StatusOrHelper::Crash(const Status& status) { 39 | GOOGLE_LOG(FATAL) << "Attempting to fetch value instead of handling error " 40 | << status.ToString(); 41 | } 42 | 43 | } // namespace internal 44 | } // namespace util 45 | } // namespace protobuf 46 | } // namespace google 47 | -------------------------------------------------------------------------------- /src/google/protobuf/stubs/structurally_valid_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. All Rights Reserved. 2 | // Author: xpeng@google.com (Peter Peng) 3 | 4 | #include 5 | #include 6 | 7 | namespace google { 8 | namespace protobuf { 9 | namespace internal { 10 | namespace { 11 | 12 | TEST(StructurallyValidTest, ValidUTF8String) { 13 | // On GCC, this string can be written as: 14 | // "abcd 1234 - \u2014\u2013\u2212" 15 | // MSVC seems to interpret \u differently. 16 | string valid_str("abcd 1234 - \342\200\224\342\200\223\342\210\222 - xyz789"); 17 | EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(), 18 | valid_str.size())); 19 | // Additional check for pointer alignment 20 | for (int i = 1; i < 8; ++i) { 21 | EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data() + i, 22 | valid_str.size() - i)); 23 | } 24 | } 25 | 26 | TEST(StructurallyValidTest, InvalidUTF8String) { 27 | const string invalid_str("abcd\xA0\xB0\xA0\xB0\xA0\xB0 - xyz789"); 28 | EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(), 29 | invalid_str.size())); 30 | // Additional check for pointer alignment 31 | for (int i = 1; i < 8; ++i) { 32 | EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data() + i, 33 | invalid_str.size() - i)); 34 | } 35 | } 36 | 37 | } // namespace 38 | } // namespace internal 39 | } // namespace protobuf 40 | } // namespace google 41 | -------------------------------------------------------------------------------- /src/google/protobuf/testdata/bad_utf8_string: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/src/google/protobuf/testdata/bad_utf8_string -------------------------------------------------------------------------------- /src/google/protobuf/testdata/golden_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/src/google/protobuf/testdata/golden_message -------------------------------------------------------------------------------- /src/google/protobuf/testdata/golden_message_oneof_implemented: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/src/google/protobuf/testdata/golden_message_oneof_implemented -------------------------------------------------------------------------------- /src/google/protobuf/testdata/golden_message_proto3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/src/google/protobuf/testdata/golden_message_proto3 -------------------------------------------------------------------------------- /src/google/protobuf/testdata/golden_packed_fields_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/52im/protobuf/09f1757cf55236f14ab5cc23cf36ec802860744f/src/google/protobuf/testdata/golden_packed_fields_message -------------------------------------------------------------------------------- /src/google/protobuf/unittest_arena.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | import "google/protobuf/unittest_no_arena_import.proto"; 34 | 35 | package proto2_arena_unittest; 36 | 37 | option cc_enable_arenas = true; 38 | 39 | message NestedMessage { 40 | optional int32 d = 1; 41 | } 42 | 43 | message ArenaMessage { 44 | repeated NestedMessage repeated_nested_message = 1; 45 | repeated ImportNoArenaNestedMessage repeated_import_no_arena_message = 2; 46 | }; 47 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_empty.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // This file intentionally left blank. (At one point this wouldn't compile 36 | // correctly.) 37 | 38 | syntax = "proto2"; 39 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_import_public.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: liujisi@google.com (Pherl Liu) 32 | 33 | syntax = "proto2"; 34 | 35 | package protobuf_unittest_import; 36 | 37 | option java_package = "com.google.protobuf.test"; 38 | 39 | message PublicImportMessage { 40 | optional int32 e = 1; 41 | } 42 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_import_public_lite.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: liujisi@google.com (Pherl Liu) 32 | 33 | syntax = "proto2"; 34 | 35 | package protobuf_unittest_import; 36 | 37 | option optimize_for = LITE_RUNTIME; 38 | 39 | option java_package = "com.google.protobuf"; 40 | 41 | message PublicImportMessageLite { 42 | optional int32 e = 1; 43 | } 44 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_import_public_proto3.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: liujisi@google.com (Pherl Liu) 32 | 33 | syntax = "proto3"; 34 | 35 | package protobuf_unittest_import; 36 | 37 | option java_package = "com.google.protobuf.test"; 38 | option csharp_namespace = "Google.Protobuf.TestProtos"; 39 | 40 | message PublicImportMessage { 41 | int32 e = 1; 42 | } 43 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_lite_imports_nonlite.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // 33 | // Tests that a "lite" message can import a regular message. 34 | 35 | syntax = "proto2"; 36 | package protobuf_unittest; 37 | 38 | import "google/protobuf/unittest.proto"; 39 | 40 | option optimize_for = LITE_RUNTIME; 41 | 42 | message TestLiteImportsNonlite { 43 | optional TestAllTypes message = 1; 44 | } 45 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_no_arena_import.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package proto2_arena_unittest; 34 | 35 | message ImportNoArenaNestedMessage { 36 | optional int32 d = 1; 37 | }; 38 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_no_arena_lite.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | option optimize_for = LITE_RUNTIME; 34 | 35 | // We don't put this in a package within proto2 because we need to make sure 36 | // that the generated code doesn't depend on being in the proto2 namespace. 37 | // In test_util.h we do "using namespace unittest = protobuf_unittest". 38 | package protobuf_unittest_no_arena; 39 | 40 | message ForeignMessageLite { 41 | optional int32 c = 1; 42 | } 43 | -------------------------------------------------------------------------------- /src/google/protobuf/unittest_preserve_unknown_enum2.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | syntax = "proto2"; 32 | 33 | package proto2_preserve_unknown_enum_unittest; 34 | 35 | enum MyEnum { 36 | FOO = 0; 37 | BAR = 1; 38 | BAZ = 2; 39 | } 40 | 41 | message MyMessage { 42 | optional MyEnum e = 1; 43 | repeated MyEnum repeated_e = 2; 44 | repeated MyEnum repeated_packed_e = 3 [packed=true]; 45 | repeated MyEnum repeated_packed_unexpected_e = 4; // not packed 46 | oneof o { 47 | MyEnum oneof_e_1 = 5; 48 | MyEnum oneof_e_2 = 6; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/google/protobuf/util/internal/error_listener.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | #include 32 | 33 | namespace google { 34 | namespace protobuf { 35 | namespace util { 36 | namespace converter { 37 | 38 | 39 | } // namespace converter 40 | } // namespace util 41 | } // namespace protobuf 42 | } // namespace google 43 | -------------------------------------------------------------------------------- /src/google/protobuf/util/internal/testdata/anys.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Proto to test Proto3 Any serialization. 32 | syntax = "proto3"; 33 | 34 | package google.protobuf.testing.anys; 35 | option java_package = "com.google.protobuf.testing.anys"; 36 | 37 | import "google/protobuf/any.proto"; 38 | 39 | message AnyIn { 40 | string something = 1; 41 | } 42 | 43 | message AnyOut { 44 | google.protobuf.Any any = 1; 45 | } 46 | 47 | message AnyM { 48 | string foo = 1; 49 | } 50 | 51 | service TestService { 52 | rpc Call(AnyIn) returns (AnyOut); 53 | } 54 | -------------------------------------------------------------------------------- /src/google/protobuf/util/internal/testdata/struct.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // https://developers.google.com/protocol-buffers/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Proto to test proto3 struct. 32 | syntax = "proto3"; 33 | 34 | package google.protobuf.testing.structs; 35 | option java_package = "com.google.protobuf.testing.structs"; 36 | 37 | import "google/protobuf/struct.proto"; 38 | 39 | message StructType { 40 | google.protobuf.Struct object = 1; 41 | } 42 | 43 | service TestService { 44 | rpc Call(StructType) returns (StructType); 45 | } 46 | -------------------------------------------------------------------------------- /src/solaris/libstdc++.la: -------------------------------------------------------------------------------- 1 | # libstdc++.la - a libtool library file 2 | # Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes) 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # --- 8 | # NOTE: This file lives in /usr/sfw/lib on Solaris 10. Unfortunately, 9 | # due to an apparent bug in the Solaris 10 6/06 release, 10 | # /usr/sfw/lib/libstdc++.la is empty. Below is the correct content, 11 | # according to 12 | # http://forum.java.sun.com/thread.jspa?threadID=5073150 13 | # By passing LDFLAGS='-Lsrc/solaris' to configure, make will pick up 14 | # this copy of the file rather than the empty copy in /usr/sfw/lib. 15 | # 16 | # Also see 17 | # http://www.technicalarticles.org/index.php/Compiling_MySQL_5.0_on_Solaris_10 18 | # 19 | # Note: this is for 32-bit systems. If you have a 64-bit system, 20 | # uncomment the appropriate dependency_libs line below. 21 | # ---- 22 | 23 | # The name that we can dlopen(3). 24 | dlname='libstdc++.so.6' 25 | 26 | # Names of this library. 27 | library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so' 28 | 29 | # The name of the static archive. 30 | old_library='libstdc++.a' 31 | 32 | # Libraries that this one depends upon. 33 | # 32-bit version: 34 | dependency_libs='-lc -lm -L/usr/sfw/lib -lgcc_s' 35 | # 64-bit version: 36 | #dependency_libs='-L/lib/64 -lc -lm -L/usr/sfw/lib/64 -lgcc_s' 37 | 38 | # Version information for libstdc++. 39 | current=6 40 | age=0 41 | revision=3 42 | 43 | # Is this an already installed library? 44 | installed=yes 45 | 46 | # Files to dlopen/dlpreopen 47 | dlopen='' 48 | dlpreopen='' 49 | 50 | # Directory that this library needs to be installed in: 51 | libdir='/usr/sfw/lib' 52 | -------------------------------------------------------------------------------- /util/python/BUILD: -------------------------------------------------------------------------------- 1 | # This is a placeholder for python headers. Projects needing to use 2 | # fast cpp protos in protobuf's python interface should build with 3 | # --define=use_fast_cpp_protos=true, and in addition, provide 4 | # //external:python_headers dependency that in turn provides Python.h. 5 | # 6 | # Projects that include protobuf using a Bazel external repository will need to 7 | # add a workspace rule to their WORKSPACE files to add an external workspace 8 | # that includes the Python headers. For example, the protobuf WORKSPACE file 9 | # includes the following local_repository rule that points to this directory: 10 | # 11 | # new_local_repository( 12 | # name = "python", 13 | # path = __workspace_dir__ + "/util/python", 14 | # ) 15 | cc_library( 16 | name = "python_headers", 17 | visibility = ["//visibility:public"], 18 | ) 19 | --------------------------------------------------------------------------------