From 30650d81d9baa446dbc8deb784ba53794cafda5b Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Fri, 1 May 2015 08:57:16 -0400 Subject: Alpha 1 drop of Google's Objective C plugin and runtime support for protobufs. --- .gitignore | 6 + Makefile.am | 124 +- objectivec/DevTools/check_version_stamps.sh | 56 + objectivec/DevTools/generate_descriptors_proto.sh | 36 + objectivec/DevTools/pddm.py | 687 + objectivec/DevTools/pddm_tests.py | 515 + objectivec/GPBArray.h | 535 + objectivec/GPBArray.m | 2499 ++++ objectivec/GPBArray_PackagePrivate.h | 130 + objectivec/GPBBootstrap.h | 84 + objectivec/GPBCodedInputStream.h | 81 + objectivec/GPBCodedInputStream.m | 801 ++ objectivec/GPBCodedInputStream_PackagePrivate.h | 131 + objectivec/GPBCodedOutputStream.h | 340 + objectivec/GPBCodedOutputStream.m | 1229 ++ objectivec/GPBDescriptor.h | 143 + objectivec/GPBDescriptor.m | 888 ++ objectivec/GPBDescriptor_PackagePrivate.h | 293 + objectivec/GPBDictionary.h | 2233 ++++ objectivec/GPBDictionary.m | 12627 +++++++++++++++++++ objectivec/GPBDictionary_PackagePrivate.h | 577 + objectivec/GPBExtensionField.h | 51 + objectivec/GPBExtensionField.m | 525 + objectivec/GPBExtensionField_PackagePrivate.h | 51 + objectivec/GPBExtensionRegistry.h | 46 + objectivec/GPBExtensionRegistry.m | 98 + objectivec/GPBExtensionRegistry_PackagePrivate.h | 40 + objectivec/GPBField.h | 56 + objectivec/GPBField.m | 328 + objectivec/GPBField_PackagePrivate.h | 49 + objectivec/GPBMessage.h | 151 + objectivec/GPBMessage.m | 4735 +++++++ objectivec/GPBMessage_PackagePrivate.h | 124 + objectivec/GPBProtocolBuffers.h | 45 + objectivec/GPBProtocolBuffers.m | 49 + objectivec/GPBProtocolBuffers_RuntimeSupport.h | 41 + objectivec/GPBRootObject.h | 42 + objectivec/GPBRootObject.m | 177 + objectivec/GPBRootObject_PackagePrivate.h | 42 + objectivec/GPBTypes.h | 102 + objectivec/GPBUnknownFieldSet.h | 46 + objectivec/GPBUnknownFieldSet.m | 422 + objectivec/GPBUnknownFieldSet_PackagePrivate.h | 61 + objectivec/GPBUtilities.h | 181 + objectivec/GPBUtilities.m | 1645 +++ objectivec/GPBUtilities_PackagePrivate.h | 426 + objectivec/GPBWellKnownTypes.h | 48 + objectivec/GPBWellKnownTypes.m | 117 + objectivec/GPBWireFormat.h | 68 + objectivec/GPBWireFormat.m | 78 + .../ProtocolBuffers_OSX.xcodeproj/project.pbxproj | 919 ++ .../project.xcworkspace/contents.xcworkspacedata | 7 + .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../xcschemes/PerformanceTests.xcscheme | 125 + .../xcschemes/ProtocolBuffers.xcscheme | 115 + .../ProtocolBuffers_iOS.xcodeproj/project.pbxproj | 1093 ++ .../project.xcworkspace/contents.xcworkspacedata | 7 + .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../FFE465CA-0E74-40E8-9F09-500B66B7DCB2.plist | 62 + .../8BBEA4A5147C727100C4ADB7.xcbaseline/Info.plist | 21 + .../xcschemes/PerformanceTests.xcscheme | 134 + .../xcschemes/ProtocolBuffers.xcscheme | 116 + objectivec/Tests/Filter1.txt | 40 + objectivec/Tests/Filter2.txt | 35 + objectivec/Tests/GPBARCUnittestProtos.m | 57 + objectivec/Tests/GPBArrayTests.m | 3365 +++++ objectivec/Tests/GPBCodedInputStreamTests.m | 290 + objectivec/Tests/GPBCodedOuputStreamTests.m | 321 + objectivec/Tests/GPBConcurrencyTests.m | 157 + objectivec/Tests/GPBDescriptorTests.m | 232 + objectivec/Tests/GPBDictionaryTests+Bool.m | 2421 ++++ objectivec/Tests/GPBDictionaryTests+Int32.m | 3650 ++++++ objectivec/Tests/GPBDictionaryTests+Int64.m | 3650 ++++++ objectivec/Tests/GPBDictionaryTests+String.m | 3362 +++++ objectivec/Tests/GPBDictionaryTests+UInt32.m | 3650 ++++++ objectivec/Tests/GPBDictionaryTests+UInt64.m | 3649 ++++++ objectivec/Tests/GPBDictionaryTests.pddm | 1044 ++ objectivec/Tests/GPBFilteredMessageTests.m | 98 + objectivec/Tests/GPBMessageTests+Merge.m | 700 + objectivec/Tests/GPBMessageTests+Runtime.m | 1978 +++ objectivec/Tests/GPBMessageTests+Serialization.m | 838 ++ objectivec/Tests/GPBMessageTests.m | 1728 +++ objectivec/Tests/GPBPerfTests.m | 306 + objectivec/Tests/GPBStringTests.m | 516 + objectivec/Tests/GPBSwiftTests.swift | 405 + objectivec/Tests/GPBTestUtilities.h | 87 + objectivec/Tests/GPBTestUtilities.m | 2350 ++++ objectivec/Tests/GPBUnittestProtos.m | 56 + objectivec/Tests/GPBUnknownFieldSetTest.m | 255 + objectivec/Tests/GPBUtilitiesTests.m | 363 + objectivec/Tests/GPBWellKnownTypesTest.m | 102 + objectivec/Tests/GPBWireFormatTests.m | 246 + objectivec/Tests/UnitTests-Bridging-Header.h | 6 + objectivec/Tests/UnitTests-Info.plist | 20 + objectivec/Tests/golden_message | Bin 0 -> 493 bytes objectivec/Tests/golden_packed_fields_message | Bin 0 -> 493 bytes objectivec/Tests/iOSTestHarness/AppDelegate.m | 35 + .../AppIcon.appiconset/Contents.json | 116 + .../Images.xcassets/AppIcon.appiconset/iPad6.png | Bin 0 -> 8583 bytes .../AppIcon.appiconset/iPad6@2x.png | Bin 0 -> 17744 bytes .../Images.xcassets/AppIcon.appiconset/iPad7.png | Bin 0 -> 8969 bytes .../AppIcon.appiconset/iPad7@2x.png | Bin 0 -> 18788 bytes .../Images.xcassets/AppIcon.appiconset/iPhone6.png | Bin 0 -> 7021 bytes .../AppIcon.appiconset/iPhone6@2x.png | Bin 0 -> 13348 bytes .../AppIcon.appiconset/iPhone7@2x.png | Bin 0 -> 11128 bytes .../AppIcon.appiconset/iPhone7@3x.png | Bin 0 -> 21792 bytes .../LaunchImage.launchimage/Contents.json | 49 + objectivec/Tests/iOSTestHarness/Info.plist | 43 + objectivec/Tests/iOSTestHarness/LaunchScreen.xib | 33 + .../iOSTestHarness/en.lproj/InfoPlist.strings | 2 + objectivec/Tests/text_format_map_unittest_data.txt | 70 + objectivec/Tests/text_format_unittest_data.txt | 116 + objectivec/Tests/unittest_cycle.proto | 58 + objectivec/Tests/unittest_filter.proto | 71 + objectivec/Tests/unittest_name_mangling.proto | 37 + objectivec/Tests/unittest_objc.proto | 389 + objectivec/Tests/unittest_runtime_proto2.proto | 108 + objectivec/Tests/unittest_runtime_proto3.proto | 101 + objectivec/google/protobuf/Descriptor.pbobjc.h | 1046 ++ objectivec/google/protobuf/Descriptor.pbobjc.m | 2205 ++++ objectivec/google/protobuf/Duration.pbobjc.h | 83 + objectivec/google/protobuf/Duration.pbobjc.m | 85 + objectivec/google/protobuf/Timestamp.pbobjc.h | 94 + objectivec/google/protobuf/Timestamp.pbobjc.m | 85 + src/Makefile.am | 25 + src/google/protobuf/any.proto | 1 + src/google/protobuf/api.proto | 1 + src/google/protobuf/compiler/main.cc | 6 + .../compiler/objectivec/objectivec_enum.cc | 199 + .../protobuf/compiler/objectivec/objectivec_enum.h | 73 + .../compiler/objectivec/objectivec_enum_field.cc | 129 + .../compiler/objectivec/objectivec_enum_field.h | 77 + .../compiler/objectivec/objectivec_extension.cc | 166 + .../compiler/objectivec/objectivec_extension.h | 73 + .../compiler/objectivec/objectivec_field.cc | 474 + .../compiler/objectivec/objectivec_field.h | 166 + .../compiler/objectivec/objectivec_file.cc | 392 + .../protobuf/compiler/objectivec/objectivec_file.h | 94 + .../compiler/objectivec/objectivec_generator.cc | 95 + .../compiler/objectivec/objectivec_generator.h | 60 + .../compiler/objectivec/objectivec_helpers.cc | 1131 ++ .../compiler/objectivec/objectivec_helpers.h | 176 + .../objectivec/objectivec_helpers_unittest.cc | 242 + .../compiler/objectivec/objectivec_map_field.cc | 161 + .../compiler/objectivec/objectivec_map_field.h | 64 + .../compiler/objectivec/objectivec_message.cc | 642 + .../compiler/objectivec/objectivec_message.h | 103 + .../objectivec/objectivec_message_field.cc | 90 + .../compiler/objectivec/objectivec_message_field.h | 71 + .../compiler/objectivec/objectivec_oneof.cc | 139 + .../compiler/objectivec/objectivec_oneof.h | 77 + .../objectivec/objectivec_primitive_field.cc | 162 + .../objectivec/objectivec_primitive_field.h | 82 + src/google/protobuf/descriptor.pb.cc | 4 +- src/google/protobuf/descriptor.proto | 1 + src/google/protobuf/duration.proto | 1 + src/google/protobuf/empty.proto | 1 + src/google/protobuf/field_mask.proto | 1 + src/google/protobuf/source_context.proto | 1 + src/google/protobuf/struct.proto | 1 + src/google/protobuf/timestamp.proto | 1 + src/google/protobuf/type.proto | 1 + .../protobuf/unittest_drop_unknown_fields.proto | 1 + .../protobuf/unittest_preserve_unknown_enum.proto | 1 + src/google/protobuf/wrappers.proto | 1 + 165 files changed, 82460 insertions(+), 3 deletions(-) create mode 100755 objectivec/DevTools/check_version_stamps.sh create mode 100755 objectivec/DevTools/generate_descriptors_proto.sh create mode 100755 objectivec/DevTools/pddm.py create mode 100755 objectivec/DevTools/pddm_tests.py create mode 100644 objectivec/GPBArray.h create mode 100644 objectivec/GPBArray.m create mode 100644 objectivec/GPBArray_PackagePrivate.h create mode 100644 objectivec/GPBBootstrap.h create mode 100644 objectivec/GPBCodedInputStream.h create mode 100644 objectivec/GPBCodedInputStream.m create mode 100644 objectivec/GPBCodedInputStream_PackagePrivate.h create mode 100644 objectivec/GPBCodedOutputStream.h create mode 100644 objectivec/GPBCodedOutputStream.m create mode 100644 objectivec/GPBDescriptor.h create mode 100644 objectivec/GPBDescriptor.m create mode 100644 objectivec/GPBDescriptor_PackagePrivate.h create mode 100644 objectivec/GPBDictionary.h create mode 100644 objectivec/GPBDictionary.m create mode 100644 objectivec/GPBDictionary_PackagePrivate.h create mode 100644 objectivec/GPBExtensionField.h create mode 100644 objectivec/GPBExtensionField.m create mode 100644 objectivec/GPBExtensionField_PackagePrivate.h create mode 100644 objectivec/GPBExtensionRegistry.h create mode 100644 objectivec/GPBExtensionRegistry.m create mode 100644 objectivec/GPBExtensionRegistry_PackagePrivate.h create mode 100644 objectivec/GPBField.h create mode 100644 objectivec/GPBField.m create mode 100644 objectivec/GPBField_PackagePrivate.h create mode 100644 objectivec/GPBMessage.h create mode 100644 objectivec/GPBMessage.m create mode 100644 objectivec/GPBMessage_PackagePrivate.h create mode 100644 objectivec/GPBProtocolBuffers.h create mode 100644 objectivec/GPBProtocolBuffers.m create mode 100644 objectivec/GPBProtocolBuffers_RuntimeSupport.h create mode 100644 objectivec/GPBRootObject.h create mode 100644 objectivec/GPBRootObject.m create mode 100644 objectivec/GPBRootObject_PackagePrivate.h create mode 100644 objectivec/GPBTypes.h create mode 100644 objectivec/GPBUnknownFieldSet.h create mode 100644 objectivec/GPBUnknownFieldSet.m create mode 100644 objectivec/GPBUnknownFieldSet_PackagePrivate.h create mode 100644 objectivec/GPBUtilities.h create mode 100644 objectivec/GPBUtilities.m create mode 100644 objectivec/GPBUtilities_PackagePrivate.h create mode 100644 objectivec/GPBWellKnownTypes.h create mode 100644 objectivec/GPBWellKnownTypes.m create mode 100644 objectivec/GPBWireFormat.h create mode 100644 objectivec/GPBWireFormat.m create mode 100644 objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj create mode 100644 objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme create mode 100644 objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/FFE465CA-0E74-40E8-9F09-500B66B7DCB2.plist create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/Info.plist create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme create mode 100644 objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme create mode 100644 objectivec/Tests/Filter1.txt create mode 100644 objectivec/Tests/Filter2.txt create mode 100644 objectivec/Tests/GPBARCUnittestProtos.m create mode 100644 objectivec/Tests/GPBArrayTests.m create mode 100644 objectivec/Tests/GPBCodedInputStreamTests.m create mode 100644 objectivec/Tests/GPBCodedOuputStreamTests.m create mode 100644 objectivec/Tests/GPBConcurrencyTests.m create mode 100644 objectivec/Tests/GPBDescriptorTests.m create mode 100644 objectivec/Tests/GPBDictionaryTests+Bool.m create mode 100644 objectivec/Tests/GPBDictionaryTests+Int32.m create mode 100644 objectivec/Tests/GPBDictionaryTests+Int64.m create mode 100644 objectivec/Tests/GPBDictionaryTests+String.m create mode 100644 objectivec/Tests/GPBDictionaryTests+UInt32.m create mode 100644 objectivec/Tests/GPBDictionaryTests+UInt64.m create mode 100644 objectivec/Tests/GPBDictionaryTests.pddm create mode 100644 objectivec/Tests/GPBFilteredMessageTests.m create mode 100644 objectivec/Tests/GPBMessageTests+Merge.m create mode 100644 objectivec/Tests/GPBMessageTests+Runtime.m create mode 100644 objectivec/Tests/GPBMessageTests+Serialization.m create mode 100644 objectivec/Tests/GPBMessageTests.m create mode 100644 objectivec/Tests/GPBPerfTests.m create mode 100644 objectivec/Tests/GPBStringTests.m create mode 100644 objectivec/Tests/GPBSwiftTests.swift create mode 100644 objectivec/Tests/GPBTestUtilities.h create mode 100644 objectivec/Tests/GPBTestUtilities.m create mode 100644 objectivec/Tests/GPBUnittestProtos.m create mode 100644 objectivec/Tests/GPBUnknownFieldSetTest.m create mode 100644 objectivec/Tests/GPBUtilitiesTests.m create mode 100644 objectivec/Tests/GPBWellKnownTypesTest.m create mode 100644 objectivec/Tests/GPBWireFormatTests.m create mode 100644 objectivec/Tests/UnitTests-Bridging-Header.h create mode 100644 objectivec/Tests/UnitTests-Info.plist create mode 100644 objectivec/Tests/golden_message create mode 100644 objectivec/Tests/golden_packed_fields_message create mode 100644 objectivec/Tests/iOSTestHarness/AppDelegate.m create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6@2x.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7@2x.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6@2x.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7@2x.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7@3x.png create mode 100644 objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json create mode 100644 objectivec/Tests/iOSTestHarness/Info.plist create mode 100644 objectivec/Tests/iOSTestHarness/LaunchScreen.xib create mode 100644 objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings create mode 100644 objectivec/Tests/text_format_map_unittest_data.txt create mode 100644 objectivec/Tests/text_format_unittest_data.txt create mode 100644 objectivec/Tests/unittest_cycle.proto create mode 100644 objectivec/Tests/unittest_filter.proto create mode 100644 objectivec/Tests/unittest_name_mangling.proto create mode 100644 objectivec/Tests/unittest_objc.proto create mode 100644 objectivec/Tests/unittest_runtime_proto2.proto create mode 100644 objectivec/Tests/unittest_runtime_proto3.proto create mode 100644 objectivec/google/protobuf/Descriptor.pbobjc.h create mode 100644 objectivec/google/protobuf/Descriptor.pbobjc.m create mode 100644 objectivec/google/protobuf/Duration.pbobjc.h create mode 100644 objectivec/google/protobuf/Duration.pbobjc.m create mode 100644 objectivec/google/protobuf/Timestamp.pbobjc.h create mode 100644 objectivec/google/protobuf/Timestamp.pbobjc.m create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_enum_field.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_extension.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_extension.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_field.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_file.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_file.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_generator.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_generator.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_helpers.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_helpers.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_map_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_map_field.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_message_field.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_oneof.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_oneof.h create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc create mode 100644 src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h diff --git a/.gitignore b/.gitignore index b8ba4892..9a5508de 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,9 @@ src/**/*.trs # JavaBuild output. java/target javanano/target + +# Directories created by opening the Objective C Xcode projects. +objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcuserdata/ +objectivec/ProtocolBuffers_OSX.xcodeproj/xcuserdata/ +objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcuserdata/ +objectivec/ProtocolBuffers_iOS.xcodeproj/xcuserdata/ diff --git a/Makefile.am b/Makefile.am index 4fd93f26..eecffa1f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -197,6 +197,128 @@ javanano_EXTRA_DIST= javanano/README.md \ javanano/pom.xml +objectivec_EXTRA_DIST= \ + objectivec/DevTools/generate_descriptors_proto.sh \ + objectivec/DevTools/pddm.py \ + objectivec/DevTools/pddm_tests.py \ + objectivec/google/protobuf/Descriptor.pbobjc.h \ + objectivec/google/protobuf/Descriptor.pbobjc.m \ + objectivec/google/protobuf/Duration.pbobjc.h \ + objectivec/google/protobuf/Duration.pbobjc.m \ + objectivec/google/protobuf/Timestamp.pbobjc.h \ + objectivec/google/protobuf/Timestamp.pbobjc.m \ + objectivec/GPBArray.h \ + objectivec/GPBArray.m \ + objectivec/GPBArray_PackagePrivate.h \ + objectivec/GPBBootstrap.h \ + objectivec/GPBCodedInputStream.h \ + objectivec/GPBCodedInputStream.m \ + objectivec/GPBCodedInputStream_PackagePrivate.h \ + objectivec/GPBCodedOutputStream.h \ + objectivec/GPBCodedOutputStream.m \ + objectivec/GPBDescriptor.h \ + objectivec/GPBDescriptor.m \ + objectivec/GPBDescriptor_PackagePrivate.h \ + objectivec/GPBDictionary.h \ + objectivec/GPBDictionary.m \ + objectivec/GPBDictionary_PackagePrivate.h \ + objectivec/GPBExtensionField.h \ + objectivec/GPBExtensionField.m \ + objectivec/GPBExtensionField_PackagePrivate.h \ + objectivec/GPBExtensionRegistry.h \ + objectivec/GPBExtensionRegistry.m \ + objectivec/GPBExtensionRegistry_PackagePrivate.h \ + objectivec/GPBField.h \ + objectivec/GPBField.m \ + objectivec/GPBField_PackagePrivate.h \ + objectivec/GPBMessage.h \ + objectivec/GPBMessage.m \ + objectivec/GPBMessage_PackagePrivate.h \ + objectivec/GPBProtocolBuffers.h \ + objectivec/GPBProtocolBuffers.m \ + objectivec/GPBProtocolBuffers_RuntimeSupport.h \ + objectivec/GPBRootObject.h \ + objectivec/GPBRootObject.m \ + objectivec/GPBRootObject_PackagePrivate.h \ + objectivec/GPBTypes.h \ + objectivec/GPBUnknownFieldSet.h \ + objectivec/GPBUnknownFieldSet.m \ + objectivec/GPBUnknownFieldSet_PackagePrivate.h \ + objectivec/GPBUtilities.h \ + objectivec/GPBUtilities.m \ + objectivec/GPBUtilities_PackagePrivate.h \ + objectivec/GPBWellKnownTypes.h \ + objectivec/GPBWellKnownTypes.m \ + objectivec/GPBWireFormat.h \ + objectivec/GPBWireFormat.m \ + objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj \ + objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ + objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \ + objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/FFE465CA-0E74-40E8-9F09-500B66B7DCB2.plist \ + objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/Info.plist \ + objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ + objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ + objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj \ + objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ + objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \ + objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ + objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ + objectivec/Tests/Filter1.txt \ + objectivec/Tests/Filter2.txt \ + objectivec/Tests/golden_message \ + objectivec/Tests/golden_packed_fields_message \ + objectivec/Tests/GPBARCUnittestProtos.m \ + objectivec/Tests/GPBArrayTests.m \ + objectivec/Tests/GPBCodedInputStreamTests.m \ + objectivec/Tests/GPBCodedOuputStreamTests.m \ + objectivec/Tests/GPBConcurrencyTests.m \ + objectivec/Tests/GPBDescriptorTests.m \ + objectivec/Tests/GPBDictionaryTests+Bool.m \ + objectivec/Tests/GPBDictionaryTests+Int32.m \ + objectivec/Tests/GPBDictionaryTests+Int64.m \ + objectivec/Tests/GPBDictionaryTests+String.m \ + objectivec/Tests/GPBDictionaryTests+UInt32.m \ + objectivec/Tests/GPBDictionaryTests+UInt64.m \ + objectivec/Tests/GPBDictionaryTests.pddm \ + objectivec/Tests/GPBFilteredMessageTests.m \ + objectivec/Tests/GPBMessageTests+Merge.m \ + objectivec/Tests/GPBMessageTests+Runtime.m \ + objectivec/Tests/GPBMessageTests+Serialization.m \ + objectivec/Tests/GPBMessageTests.m \ + objectivec/Tests/GPBPerfTests.m \ + objectivec/Tests/GPBStringTests.m \ + objectivec/Tests/GPBSwiftTests.swift \ + objectivec/Tests/GPBTestUtilities.h \ + objectivec/Tests/GPBTestUtilities.m \ + objectivec/Tests/GPBUnittestProtos.m \ + objectivec/Tests/GPBUnknownFieldSetTest.m \ + objectivec/Tests/GPBUtilitiesTests.m \ + objectivec/Tests/GPBWellKnownTypesTest.m \ + objectivec/Tests/GPBWireFormatTests.m \ + objectivec/Tests/iOSTestHarness/AppDelegate.m \ + objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6@2x.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7@2x.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6@2x.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7@2x.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7@3x.png \ + objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json \ + objectivec/Tests/iOSTestHarness/Info.plist \ + objectivec/Tests/iOSTestHarness/LaunchScreen.xib \ + objectivec/Tests/text_format_map_unittest_data.txt \ + objectivec/Tests/text_format_unittest_data.txt \ + objectivec/Tests/unittest_cycle.proto \ + objectivec/Tests/unittest_filter.proto \ + objectivec/Tests/unittest_name_mangling.proto \ + objectivec/Tests/unittest_objc.proto \ + objectivec/Tests/unittest_runtime_proto2.proto \ + objectivec/Tests/unittest_runtime_proto3.proto \ + objectivec/Tests/UnitTests-Bridging-Header.h \ + objectivec/Tests/UnitTests-Info.plist python_EXTRA_DIST= \ python/google/protobuf/internal/api_implementation.cc \ @@ -301,7 +423,7 @@ ruby_EXTRA_DIST= \ ruby/tests/generated_code.rb \ ruby/tests/generated_code_test.rb -all_EXTRA_DIST=$(java_EXTRA_DIST) $(javanano_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) +all_EXTRA_DIST=$(java_EXTRA_DIST) $(javanano_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ autogen.sh \ diff --git a/objectivec/DevTools/check_version_stamps.sh b/objectivec/DevTools/check_version_stamps.sh new file mode 100755 index 00000000..5de9ef14 --- /dev/null +++ b/objectivec/DevTools/check_version_stamps.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# This script checks that the runtime version number constant in the compiler +# source and in the runtime source is the same. +# +# A distro can be made of the protobuf sources with only a subset of the +# languages, so if the compiler depended on the Objective C runtime, those +# builds would break. At the same time, we don't want the runtime source +# depending on the compiler sources; so two copies of the constant are needed. + +set -eu + +readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") +readonly ProtoRootDir="${ScriptDir}/../.." + +die() { + echo "Error: $1" + exit 1 +} + +readonly ConstantName=GOOGLE_PROTOBUF_OBJC_GEN_VERSION + +# Collect version from plugin sources. + +readonly PluginSrc="${ProtoRootDir}/src/google/protobuf/compiler/objectivec/objectivec_file.cc" +readonly PluginVersion=$( \ + cat "${PluginSrc}" \ + | sed -n -e "s:const int32_t ${ConstantName} = \([0-9]*\);:\1:p" +) + +if [[ -z "${PluginVersion}" ]] ; then + die "Failed to fine ${ConstantName} in the plugin source (${PluginSrc})." +fi + +# Collect version from runtime sources. + +readonly RuntimeSrc="${ProtoRootDir}/objectivec/GPBBootstrap.h" +readonly RuntimeVersion=$( \ + cat "${RuntimeSrc}" \ + | sed -n -e "s:#define ${ConstantName} \([0-9]*\):\1:p" +) + +if [[ -z "${RuntimeVersion}" ]] ; then + die "Failed to fine ${ConstantName} in the runtime source (${RuntimeSrc})." +fi + +# Compare them. + +if [[ "${PluginVersion}" != "${RuntimeVersion}" ]] ; then + die "Versions don't match! + Plugin: ${PluginVersion} from ${PluginSrc} + Runtime: ${RuntimeVersion} from ${RuntimeSrc} +" +fi + +# Success diff --git a/objectivec/DevTools/generate_descriptors_proto.sh b/objectivec/DevTools/generate_descriptors_proto.sh new file mode 100755 index 00000000..42502bfe --- /dev/null +++ b/objectivec/DevTools/generate_descriptors_proto.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# This script will generate the common descriptors needed by the Objective C +# runtime. + +# HINT: Flags passed to generate_descriptor_proto.sh will be passed directly +# to make when building protoc. This is particularly useful for passing +# -j4 to run 4 jobs simultaneously. + +set -eu + +readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") +readonly ProtoRootDir="${ScriptDir}/../.." +readonly ProtoC="${ProtoRootDir}/src/protoc" + +pushd "${ProtoRootDir}" > /dev/null + +# Compiler build fails if config.h hasn't been made yet (even if configure/etc. +# have been run, so get that made first). +make $@ config.h + +# Make sure the compiler is current. +cd src +make $@ protoc + +# These really should only be run when the inputs or compiler are newer than +# the outputs. + +# Needed by the runtime. +./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/descriptor.proto + +# Well known types that the library provides helpers for. +./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/timestamp.proto +./protoc --objc_out="${ProtoRootDir}/objectivec" google/protobuf/duration.proto + +popd > /dev/null diff --git a/objectivec/DevTools/pddm.py b/objectivec/DevTools/pddm.py new file mode 100755 index 00000000..d1b53f5a --- /dev/null +++ b/objectivec/DevTools/pddm.py @@ -0,0 +1,687 @@ +#! /usr/bin/python +# +# Protocol Buffers - Google's data interchange format +# Copyright 2015 Google Inc. All rights reserved. +# https://developers.google.com/protocol-buffers/ +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""PDDM - Poor Developers' Debug-able Macros + +A simple markup that can be added in comments of source so they can then be +expanded out into code. Most of this could be done with CPP macros, but then +developers can't really step through them in the debugger, this way they are +expanded to the same code, but you can debug them. + +Any file can be processed, but the syntax is designed around a C based compiler. +Processed lines start with "//%". There are three types of sections you can +create: Text (left alone), Macro Definitions, and Macro Expansions. There is +no order required between definitions and expansions, all definitions are read +before any expansions are processed (thus, if desired, definitions can be put +at the end of the file to keep them out of the way of the code). + +Macro Definitions are started with "//%PDDM-DEFINE Name(args)" and all lines +afterwards that start with "//%" are included in the definition. Multiple +macros can be defined in one block by just using a another "//%PDDM-DEFINE" +line to start the next macro. Optionally, a macro can be ended with +"//%PDDM-DEFINE-END", this can be useful when you want to make it clear that +trailing blank lines are included in the macro. You can also end a definition +with an expansion. + +Macro Expansions are started by single lines containing +"//%PDDM-EXPAND Name(args)" and then with "//%PDDM-EXPAND-END" or another +expansions. All lines in-between are replaced by the result of the expansion. +The first line of the expansion is always a blank like just for readability. + +Expansion itself is pretty simple, one macro can invoke another macro, but +you cannot nest the invoke of a macro in another macro (i.e. - can't do +"foo(bar(a))", but you can define foo(a) and bar(b) where bar invokes foo() +within its expansion. + +When macros are expanded, the arg references can also add "$O" suffix to the +name (i.e. - "NAME$O") to specify an option to be applied. The options are: + + $S - Replace each character in the value with a space. + $l - Lowercase the first letter of the value. + $L - Lowercase the whole value. + $u - Uppercase the first letter of the value. + $U - Uppercase the whole value. + +Within a macro you can use ## to cause things to get joined together after +expansion (i.e. - "a##b" within a macro will become "ab"). + +Example: + + int foo(MyEnum x) { + switch (x) { + //%PDDM-EXPAND case(Enum_Left, 1) + //%PDDM-EXPAND case(Enum_Center, 2) + //%PDDM-EXPAND case(Enum_Right, 3) + //%PDDM-EXPAND-END + } + + //%PDDM-DEFINE case(_A, _B) + //% case _A: + //% return _B; + + A macro ends at the start of the next one, or an optional %PDDM-DEFINE-END + can be used to avoid adding extra blank lines/returns (or make it clear when + it is desired). + + One macro can invoke another by simply using its name NAME(ARGS). You cannot + nest an invoke inside another (i.e. - NAME1(NAME2(ARGS)) isn't supported). + + Within a macro you can use ## to cause things to get joined together after + processing (i.e. - "a##b" within a macro will become "ab"). + + +""" + +import optparse +import os +import re +import sys + + +# Regex for macro definition. +_MACRO_RE = re.compile(r'(?P\w+)\((?P.*?)\)') +# Regex for macro's argument definition. +_MACRO_ARG_NAME_RE = re.compile(r'^\w+$') + +# Line inserted after each EXPAND. +_GENERATED_CODE_LINE = ( + '// This block of code is generated, do not edit it directly.' +) + + +def _MacroRefRe(macro_names): + # Takes in a list of macro names and makes a regex that will match invokes + # of those macros. + return re.compile(r'\b(?P(?P(%s))\((?P.*?)\))' % + '|'.join(macro_names)) + +def _MacroArgRefRe(macro_arg_names): + # Takes in a list of macro arg names and makes a regex that will match + # uses of those args. + return re.compile(r'\b(?P(%s))(\$(?P