@@ -18,10 +18,14 @@ def initialize(pods_project, aggregate_targets = [])
1818 super
1919 end
2020 end
21- PodTargetStub = Struct . new ( :name )
22- AggregateTargetStub = Struct . new ( :name , :pod_targets , :embed_frameworks_script_path ) do
23- def xcconfigs
24- { }
21+ PodTargetStub = Struct . new ( :name , :product_module_name )
22+ AggregateTargetStub = Struct . new ( :name , :pod_targets , :embed_frameworks_script_path , :xcconfigs ) do
23+ def initialize ( name , pod_targets , embed_frameworks_script_path , xcconfigs = { } )
24+ super
25+ end
26+
27+ def xcconfig_path ( config_name )
28+ Pathname ( TMP_DIR ) + "#{ name } .#{ config_name . downcase } .xcconfig"
2529 end
2630 end
2731
@@ -202,4 +206,32 @@ def test_signature_cleanup_is_added_only_to_pods_not_built_into_the_shared_produ
202206 assert_empty ( phase_names . call ( POD_NAME ) )
203207 assert_loadable_project ( project . path )
204208 end
209+
210+ def test_module_map_references_use_the_module_name_of_pods_built_into_the_shared_products_dir
211+ project = build_project ( 0 )
212+ project . new_target ( :static_library , "rnmapbox-maps" , :ios )
213+ project . save
214+ manager = SPMManager . new
215+ [ POD_NAME , "rnmapbox-maps" ] . each do |pod_name |
216+ manager . dependency (
217+ PodSpecStub . new ( pod_name ) ,
218+ url : "https://github.com/rive-app/rive-ios.git" ,
219+ requirement : { kind : "exactVersion" , version : "6.26.0" } ,
220+ products : [ "RiveRuntime" ]
221+ )
222+ end
223+ flags = '$(inherited) -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/%s" -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/%s"'
224+ config = Xcodeproj ::Config . new (
225+ "OTHER_CFLAGS" => flags % [ "#{ POD_NAME } /#{ POD_NAME } .modulemap" , "rnmapbox-maps/rnmapbox_maps.modulemap" ] ,
226+ "OTHER_SWIFT_FLAGS" => flags % [ "#{ POD_NAME } /#{ POD_NAME } .modulemap" , "rnmapbox-maps/rnmapbox_maps.modulemap" ]
227+ )
228+ pod_targets = [ PodTargetStub . new ( POD_NAME , POD_NAME ) , PodTargetStub . new ( "rnmapbox-maps" , "rnmapbox_maps" ) ]
229+ aggregate_target = AggregateTargetStub . new ( "Pods-App" , pod_targets , File . join ( TMP_DIR , "none.sh" ) , { "Debug" => config } )
230+
231+ manager . apply_on_post_install ( InstallerStub . new ( project , [ aggregate_target ] ) )
232+
233+ expected = flags % [ "#{ POD_NAME } .modulemap" , "rnmapbox_maps.modulemap" ]
234+ assert_equal ( expected , config . attributes [ "OTHER_CFLAGS" ] )
235+ assert_equal ( expected , config . attributes [ "OTHER_SWIFT_FLAGS" ] )
236+ end
205237end
0 commit comments