From 5aa9a7e7b7b70fdedb02d153d1bef4a1d07f2a72 Mon Sep 17 00:00:00 2001
From: Muxi Yan <mxyan@google.com>
Date: Tue, 8 Oct 2019 10:39:12 -0700
Subject: [PATCH] Move internal_testing to a separate subspec

---
 gRPC.podspec                    | 18 ++++++++++++++----
 src/objective-c/tests/Podfile   |  8 ++++----
 templates/gRPC.podspec.template | 18 ++++++++++++++----
 3 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/gRPC.podspec b/gRPC.podspec
index e104f2f513..38dc708ec0 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -117,11 +117,9 @@ Pod::Spec.new do |s|
                              'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
                              'src/objective-c/GRPCClient/GRPCCall+OAuth2.h',
                              'src/objective-c/GRPCClient/GRPCCall+Tests.h',
-                             'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h',
-                             'src/objective-c/GRPCClient/internal_testing/*.h'
+                             'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h'
     ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h'
-    ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}',
-                      'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}',
+    ss.source_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}',
                       'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h',
                       'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m',
                       'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h',
@@ -170,4 +168,16 @@ Pod::Spec.new do |s|
     ss.tvos.deployment_target = '10.0'
     ss.watchos.deployment_target = '4.0'
   end
+
+  s.subspec 'InternalTesting' do |ss|
+    ss.dependency "#{s.name}/GRPCCore", version
+    ss.public_header_files = 'src/objective-c/GRPCClient/internal_testing/*.h'
+    ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}'
+    ss.header_mappings_dir = 'src/objective-c/GRPCClient'
+
+    ss.ios.deployment_target = '7.0'
+    ss.osx.deployment_target = '10.9'
+    ss.tvos.deployment_target = '10.0'
+    ss.watchos.deployment_target = '4.0'
+  end
 end
diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile
index f75b36dc99..664ff94526 100644
--- a/src/objective-c/tests/Podfile
+++ b/src/objective-c/tests/Podfile
@@ -13,10 +13,10 @@ def grpc_deps
   
   pod 'BoringSSL-GRPC',       :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
   
-  pod 'gRPC',           :path => GRPC_LOCAL_SRC
-  pod 'gRPC-Core',      :path => GRPC_LOCAL_SRC
-  pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC
-  pod 'gRPC-ProtoRPC',  :path => GRPC_LOCAL_SRC, :inhibit_warnings => true
+  pod 'gRPC/InternalTesting',           :path => GRPC_LOCAL_SRC
+  pod 'gRPC-Core',                      :path => GRPC_LOCAL_SRC
+  pod 'gRPC-RxLibrary',                 :path => GRPC_LOCAL_SRC
+  pod 'gRPC-ProtoRPC',                  :path => GRPC_LOCAL_SRC, :inhibit_warnings => true
   pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true
 end
 
diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template
index e8afdb1406..6420045b10 100644
--- a/templates/gRPC.podspec.template
+++ b/templates/gRPC.podspec.template
@@ -119,11 +119,9 @@
                                'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
                                'src/objective-c/GRPCClient/GRPCCall+OAuth2.h',
                                'src/objective-c/GRPCClient/GRPCCall+Tests.h',
-                               'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h',
-                               'src/objective-c/GRPCClient/internal_testing/*.h'
+                               'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h'
       ss.private_header_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.h'
-      ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}',
-                        'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}',
+      ss.source_files = 'src/objective-c/GRPCClient/private/GRPCCore/*.{h,m}',
                         'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h',
                         'src/objective-c/GRPCClient/GRPCCall+ChannelArg.m',
                         'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h',
@@ -172,4 +170,16 @@
       ss.tvos.deployment_target = '10.0'
       ss.watchos.deployment_target = '4.0'
     end
+
+    s.subspec 'InternalTesting' do |ss|
+      ss.dependency "#{s.name}/GRPCCore", version
+      ss.public_header_files = 'src/objective-c/GRPCClient/internal_testing/*.h'
+      ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,m}'
+      ss.header_mappings_dir = 'src/objective-c/GRPCClient'
+
+      ss.ios.deployment_target = '7.0'
+      ss.osx.deployment_target = '10.9'
+      ss.tvos.deployment_target = '10.0'
+      ss.watchos.deployment_target = '4.0'
+    end
   end
-- 
GitLab