From 43b872145787f08e1110b49003daa21150397152 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Tue, 23 Aug 2022 10:45:23 -0400 Subject: [PATCH] [ObjC] Remove the need for descriptor.proto in tests. Add a test message to one of the objc test proto files for the one case that was using what was in descriptor.proto. --- objectivec/DevTools/compile_testing_protos.sh | 4 -- .../project.pbxproj | 4 -- .../project.pbxproj | 4 -- .../project.pbxproj | 4 -- objectivec/Tests/GPBARCUnittestProtos.m | 6 +-- objectivec/Tests/GPBCompileTest24.m | 42 ------------------- objectivec/Tests/GPBDescriptorTests.m | 10 ++--- objectivec/Tests/GPBUnittestProtos.m | 6 +-- objectivec/Tests/unittest_objc_options.proto | 7 ++++ 9 files changed, 14 insertions(+), 73 deletions(-) delete mode 100644 objectivec/Tests/GPBCompileTest24.m diff --git a/objectivec/DevTools/compile_testing_protos.sh b/objectivec/DevTools/compile_testing_protos.sh index 8bc6643bc7..35c5a3a546 100755 --- a/objectivec/DevTools/compile_testing_protos.sh +++ b/objectivec/DevTools/compile_testing_protos.sh @@ -41,10 +41,6 @@ CORE_PROTO_FILES=( src/google/protobuf/unittest_preserve_unknown_enum.proto src/google/protobuf/map_proto2_unittest.proto src/google/protobuf/map_unittest.proto - # The unittest_custom_options.proto extends the messages in descriptor.proto - # so we build it in to test extending in general. The library doesn't provide - # a descriptor as it doesn't use the classes/enums. - src/google/protobuf/descriptor.proto ) # ----------------------------------------------------------------------------- diff --git a/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj index 839c15854d..4e80cb1fe1 100644 --- a/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj +++ b/objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj @@ -61,7 +61,6 @@ F40EE4BF206BF8B90071091A /* GPBCompileTest21.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE486206BF8AF0071091A /* GPBCompileTest21.m */; }; F40EE4C0206BF8B90071091A /* GPBCompileTest22.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE48A206BF8B00071091A /* GPBCompileTest22.m */; }; F40EE4C1206BF8B90071091A /* GPBCompileTest23.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE487206BF8B00071091A /* GPBCompileTest23.m */; }; - F40EE50B206C06640071091A /* GPBCompileTest24.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE508206C06440071091A /* GPBCompileTest24.m */; }; F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F41C175C1833D3310064ED4D /* GPBPerfTests.m */; }; F4353D1D1AB8822D005A6198 /* GPBDescriptorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D1C1AB8822D005A6198 /* GPBDescriptorTests.m */; }; F4353D231ABB1537005A6198 /* GPBDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D211ABB1537005A6198 /* GPBDictionary.m */; }; @@ -204,7 +203,6 @@ F40EE491206BF8B10071091A /* GPBCompileTest03.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest03.m; sourceTree = ""; }; F40EE492206BF8B10071091A /* GPBCompileTest06.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest06.m; sourceTree = ""; }; F40EE493206BF8B20071091A /* GPBCompileTest11.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest11.m; sourceTree = ""; }; - F40EE508206C06440071091A /* GPBCompileTest24.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest24.m; sourceTree = ""; }; F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = ""; }; F4353D1C1AB8822D005A6198 /* GPBDescriptorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBDescriptorTests.m; sourceTree = ""; }; F4353D201ABB1537005A6198 /* GPBDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBDictionary.h; sourceTree = ""; }; @@ -469,7 +467,6 @@ F40EE486206BF8AF0071091A /* GPBCompileTest21.m */, F40EE48A206BF8B00071091A /* GPBCompileTest22.m */, F40EE487206BF8B00071091A /* GPBCompileTest23.m */, - F40EE508206C06440071091A /* GPBCompileTest24.m */, 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */, F4353D1C1AB8822D005A6198 /* GPBDescriptorTests.m */, F4C4B9E21E1D974F00D3B61D /* GPBDictionaryTests.m */, @@ -741,7 +738,6 @@ buildActionMask = 2147483647; files = ( 8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */, - F40EE50B206C06640071091A /* GPBCompileTest24.m in Sources */, F40EE4BE206BF8B90071091A /* GPBCompileTest20.m in Sources */, F401DC331A8E5C0200FCC765 /* GPBArrayTests.m in Sources */, F40EE4B4206BF8B90071091A /* GPBCompileTest10.m in Sources */, diff --git a/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj index e0c24d1044..553e8d0b6b 100644 --- a/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj +++ b/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj @@ -61,7 +61,6 @@ F40EE504206BF91E0071091A /* GPBCompileTest21.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CB206BF9170071091A /* GPBCompileTest21.m */; }; F40EE505206BF91E0071091A /* GPBCompileTest22.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CF206BF9170071091A /* GPBCompileTest22.m */; }; F40EE506206BF91E0071091A /* GPBCompileTest23.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CC206BF9170071091A /* GPBCompileTest23.m */; }; - F40EE511206C068D0071091A /* GPBCompileTest24.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE50E206C06880071091A /* GPBCompileTest24.m */; }; F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F41C175C1833D3310064ED4D /* GPBPerfTests.m */; }; F4353D1F1AB88243005A6198 /* GPBDescriptorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */; }; F4353D271ABB156F005A6198 /* GPBDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D251ABB156F005A6198 /* GPBDictionary.m */; }; @@ -205,7 +204,6 @@ F40EE4D6206BF9190071091A /* GPBCompileTest03.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest03.m; sourceTree = ""; }; F40EE4D7206BF9190071091A /* GPBCompileTest06.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest06.m; sourceTree = ""; }; F40EE4D8206BF9190071091A /* GPBCompileTest11.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest11.m; sourceTree = ""; }; - F40EE50E206C06880071091A /* GPBCompileTest24.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest24.m; sourceTree = ""; }; F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = ""; }; F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBDescriptorTests.m; sourceTree = ""; }; F4353D241ABB156F005A6198 /* GPBDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBDictionary.h; sourceTree = ""; }; @@ -475,7 +473,6 @@ F40EE4CB206BF9170071091A /* GPBCompileTest21.m */, F40EE4CF206BF9170071091A /* GPBCompileTest22.m */, F40EE4CC206BF9170071091A /* GPBCompileTest23.m */, - F40EE50E206C06880071091A /* GPBCompileTest24.m */, 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */, F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */, F4C4B9E51E1D97BB00D3B61D /* GPBDictionaryTests.m */, @@ -748,7 +745,6 @@ buildActionMask = 2147483647; files = ( 8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */, - F40EE511206C068D0071091A /* GPBCompileTest24.m in Sources */, F40EE503206BF91E0071091A /* GPBCompileTest20.m in Sources */, F401DC351A8E5C6F00FCC765 /* GPBArrayTests.m in Sources */, F40EE4F9206BF91E0071091A /* GPBCompileTest10.m in Sources */, diff --git a/objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj index 73bac6358d..51339194e8 100644 --- a/objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj +++ b/objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj @@ -61,7 +61,6 @@ F40EE504206BF91E0071091A /* GPBCompileTest21.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CB206BF9170071091A /* GPBCompileTest21.m */; }; F40EE505206BF91E0071091A /* GPBCompileTest22.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CF206BF9170071091A /* GPBCompileTest22.m */; }; F40EE506206BF91E0071091A /* GPBCompileTest23.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE4CC206BF9170071091A /* GPBCompileTest23.m */; }; - F40EE511206C068D0071091A /* GPBCompileTest24.m in Sources */ = {isa = PBXBuildFile; fileRef = F40EE50E206C06880071091A /* GPBCompileTest24.m */; }; F41C175D1833D3310064ED4D /* GPBPerfTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F41C175C1833D3310064ED4D /* GPBPerfTests.m */; }; F4353D1F1AB88243005A6198 /* GPBDescriptorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */; }; F4353D271ABB156F005A6198 /* GPBDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = F4353D251ABB156F005A6198 /* GPBDictionary.m */; }; @@ -205,7 +204,6 @@ F40EE4D6206BF9190071091A /* GPBCompileTest03.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest03.m; sourceTree = ""; }; F40EE4D7206BF9190071091A /* GPBCompileTest06.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest06.m; sourceTree = ""; }; F40EE4D8206BF9190071091A /* GPBCompileTest11.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest11.m; sourceTree = ""; }; - F40EE50E206C06880071091A /* GPBCompileTest24.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBCompileTest24.m; sourceTree = ""; }; F41C175C1833D3310064ED4D /* GPBPerfTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBPerfTests.m; sourceTree = ""; }; F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GPBDescriptorTests.m; sourceTree = ""; }; F4353D241ABB156F005A6198 /* GPBDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBDictionary.h; sourceTree = ""; }; @@ -475,7 +473,6 @@ F40EE4CB206BF9170071091A /* GPBCompileTest21.m */, F40EE4CF206BF9170071091A /* GPBCompileTest22.m */, F40EE4CC206BF9170071091A /* GPBCompileTest23.m */, - F40EE50E206C06880071091A /* GPBCompileTest24.m */, 5102DABB1891A052002037B6 /* GPBConcurrencyTests.m */, F4353D1E1AB88243005A6198 /* GPBDescriptorTests.m */, F4C4B9E51E1D97BB00D3B61D /* GPBDictionaryTests.m */, @@ -748,7 +745,6 @@ buildActionMask = 2147483647; files = ( 8BBEA4A9147C727D00C4ADB7 /* GPBCodedInputStreamTests.m in Sources */, - F40EE511206C068D0071091A /* GPBCompileTest24.m in Sources */, F40EE503206BF91E0071091A /* GPBCompileTest20.m in Sources */, F401DC351A8E5C6F00FCC765 /* GPBArrayTests.m in Sources */, F40EE4F9206BF91E0071091A /* GPBCompileTest10.m in Sources */, diff --git a/objectivec/Tests/GPBARCUnittestProtos.m b/objectivec/Tests/GPBARCUnittestProtos.m index bd5f261850..e9a7019ee3 100644 --- a/objectivec/Tests/GPBARCUnittestProtos.m +++ b/objectivec/Tests/GPBARCUnittestProtos.m @@ -34,11 +34,6 @@ // Makes sure all the generated headers compile with ARC on. -// The unittest_custom_options.proto extends the messages in descriptor.proto -// so we build it in to test extending in general. The library doesn't provide -// a descriptor as it doesn't use the classes/enums. -#import "google/protobuf/Descriptor.pbobjc.h" - #import "google/protobuf/Unittest.pbobjc.h" #import "google/protobuf/UnittestCycle.pbobjc.h" #import "google/protobuf/UnittestDeprecated.pbobjc.h" @@ -48,6 +43,7 @@ #import "google/protobuf/UnittestImportPublicLite.pbobjc.h" #import "google/protobuf/UnittestMset.pbobjc.h" #import "google/protobuf/UnittestObjc.pbobjc.h" +#import "google/protobuf/UnittestObjcOptions.pbobjc.h" #import "google/protobuf/UnittestObjcStartup.pbobjc.h" #import "google/protobuf/UnittestPreserveUnknownEnum.pbobjc.h" #import "google/protobuf/UnittestRuntimeProto2.pbobjc.h" diff --git a/objectivec/Tests/GPBCompileTest24.m b/objectivec/Tests/GPBCompileTest24.m deleted file mode 100644 index c81ea73255..0000000000 --- a/objectivec/Tests/GPBCompileTest24.m +++ /dev/null @@ -1,42 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 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. - - -// This is a test including a single header to ensure things build. This -// is NOT a public header of the library, but uses a file that defines -// proto2 syntax messages that are extendable, so it can need more things -// that the proto3 syntax WKTs bundled with the library. - -#import "google/protobuf/Descriptor.pbobjc.h" - - -// Something in the body of this file so the compiler/linker won't complain -// about an empty .o file. -__attribute__((visibility("default"))) char dummy_symbol_24 = 0; diff --git a/objectivec/Tests/GPBDescriptorTests.m b/objectivec/Tests/GPBDescriptorTests.m index b1ff544189..a33b0a6ba7 100644 --- a/objectivec/Tests/GPBDescriptorTests.m +++ b/objectivec/Tests/GPBDescriptorTests.m @@ -35,7 +35,7 @@ #import "GPBDescriptor_PackagePrivate.h" #import "google/protobuf/Unittest.pbobjc.h" #import "google/protobuf/UnittestObjc.pbobjc.h" -#import "google/protobuf/Descriptor.pbobjc.h" +#import "google/protobuf/UnittestObjcOptions.pbobjc.h" @interface DescriptorTests : GPBTestCase @end @@ -57,10 +57,10 @@ XCTAssertEqualObjects(nestedMessageDesc.fullName, @"protobuf_unittest.TestAllTypes.NestedMessage"); // Prefixes removed. - GPBDescriptor *descDesc = [GPBDescriptorProto descriptor]; - XCTAssertEqualObjects(descDesc.fullName, @"google.protobuf.DescriptorProto"); - GPBDescriptor *descExtRngDesc = [GPBDescriptorProto_ExtensionRange descriptor]; - XCTAssertEqualObjects(descExtRngDesc.fullName, @"google.protobuf.DescriptorProto.ExtensionRange"); + GPBDescriptor *descDesc = [GPBTESTPrefixedParentMessage descriptor]; + XCTAssertEqualObjects(descDesc.fullName, @"protobuf_objc_unittest.PrefixedParentMessage"); + GPBDescriptor *descExtRngDesc = [GPBTESTPrefixedParentMessage_Child descriptor]; + XCTAssertEqualObjects(descExtRngDesc.fullName, @"protobuf_objc_unittest.PrefixedParentMessage.Child"); // Things that get "_Class" added. GPBDescriptor *pointDesc = [Point_Class descriptor]; diff --git a/objectivec/Tests/GPBUnittestProtos.m b/objectivec/Tests/GPBUnittestProtos.m index 37e4773980..2d745b26f8 100644 --- a/objectivec/Tests/GPBUnittestProtos.m +++ b/objectivec/Tests/GPBUnittestProtos.m @@ -31,11 +31,6 @@ // Collects all the compiled protos into one file and compiles them to make sure // the compiler is generating valid code. -// The unittest_custom_options.proto extends the messages in descriptor.proto -// so we build it in to test extending in general. The library doesn't provide -// a descriptor as it doesn't use the classes/enums. -#import "google/protobuf/Descriptor.pbobjc.m" - #import "google/protobuf/AnyTest.pbobjc.m" #import "google/protobuf/MapProto2Unittest.pbobjc.m" #import "google/protobuf/MapUnittest.pbobjc.m" @@ -49,6 +44,7 @@ #import "google/protobuf/UnittestMset.pbobjc.m" #import "google/protobuf/UnittestMsetWireFormat.pbobjc.m" #import "google/protobuf/UnittestObjc.pbobjc.m" +#import "google/protobuf/UnittestObjcOptions.pbobjc.m" #import "google/protobuf/UnittestObjcStartup.pbobjc.m" #import "google/protobuf/UnittestPreserveUnknownEnum.pbobjc.m" #import "google/protobuf/UnittestRuntimeProto2.pbobjc.m" diff --git a/objectivec/Tests/unittest_objc_options.proto b/objectivec/Tests/unittest_objc_options.proto index 6129b854e0..177697ea7a 100644 --- a/objectivec/Tests/unittest_objc_options.proto +++ b/objectivec/Tests/unittest_objc_options.proto @@ -59,3 +59,10 @@ message GPBTESTshouldGetAPrefixMessage { // Verify that classes named the same as prefixes are prefixed. message GPBTEST { } + +// Gets that lookup deals with prefix. + +message PrefixedParentMessage { + message Child { + } +}