@@ -358,15 +358,19 @@ def self.create_header_search_path_for_frameworks(base_folder, pod_name, framewo
358358 def self . create_header_search_paths_for_stable_umbrellas ( base_folder )
359359 return [ ] unless ReactNativeCoreUtils . build_rncore_from_source ( )
360360
361+ self . stable_umbrella_frameworks . flat_map { |pod_name , framework_name |
362+ self . create_header_search_path_for_frameworks ( base_folder , pod_name , framework_name , [ ] )
363+ }
364+ end
365+
366+ def self . stable_umbrella_frameworks
361367 [
362368 [ "React-Fabric" , "React_Fabric" ] ,
363369 [ "React-debug" , "React_debug" ] ,
364370 [ "React-rendererdebug" , "React_rendererdebug" ] ,
365371 [ "React-timing" , "React_timing" ] ,
366372 [ "React-utils" , "React_utils" ] ,
367- ] . flat_map { |pod_name , framework_name |
368- self . create_header_search_path_for_frameworks ( base_folder , pod_name , framework_name , [ ] )
369- }
373+ ]
370374 end
371375
372376 # Add a new dependency to an existing spec, configuring also the headers search paths
@@ -399,6 +403,9 @@ def self.update_search_paths(installer)
399403 projects = self . extract_projects ( installer )
400404
401405 projects . each do |project |
406+ stable_umbrella_search_paths = project == installer . pods_project ?
407+ [ ] : ReactNativePodsUtils . create_header_search_paths_for_stable_umbrellas ( "PODS_CONFIGURATION_BUILD_DIR" )
408+
402409 project . build_configurations . each do |config |
403410
404411 header_search_paths = config . build_settings [ "HEADER_SEARCH_PATHS" ] ||= "$(inherited)"
@@ -411,7 +418,7 @@ def self.update_search_paths(installer)
411418 "react/renderer/components/scrollview/platform/cxx" ,
412419 "react/renderer/components/scrollview/platform/ios" ,
413420 ] , false ) )
414- . concat ( ReactNativePodsUtils . create_header_search_paths_for_stable_umbrellas ( "PODS_CONFIGURATION_BUILD_DIR" ) )
421+ . concat ( stable_umbrella_search_paths )
415422 . concat ( ReactNativePodsUtils . create_header_search_path_for_frameworks ( "PODS_CONFIGURATION_BUILD_DIR" , "React-FabricComponents" , "React_FabricComponents" , [
416423 "react/renderer/textlayoutmanager/platform/ios" ,
417424 "react/renderer/components/text/platform/cxx" ,
@@ -435,6 +442,8 @@ def self.update_search_paths(installer)
435442 end
436443
437444 installer . target_installation_results . pod_target_installation_results . each do |pod_name , target_installation_result |
445+ self . set_stable_umbrella_search_paths ( target_installation_result )
446+
438447 if self . react_native_pods . include? ( pod_name ) || pod_name . include? ( "Pod" ) || pod_name . include? ( "Tests" )
439448 next
440449 end
@@ -648,7 +657,9 @@ def self.add_search_path_if_not_included(current_search_paths, new_search_path)
648657
649658 if current_search_paths . is_a? ( String )
650659 current_search_paths = current_search_paths . strip
651- return "#{ current_search_paths } #{ new_search_path } " unless current_search_paths . include? ( new_search_path )
660+ current_paths = Shellwords . shellsplit ( current_search_paths )
661+ normalized_new_path = Shellwords . shellsplit ( new_search_path ) . first
662+ return "#{ current_search_paths } #{ new_search_path } " unless current_paths . include? ( normalized_new_path )
652663 end
653664
654665 if current_search_paths . is_a? ( Array )
@@ -659,17 +670,55 @@ def self.add_search_path_if_not_included(current_search_paths, new_search_path)
659670 current_search_paths
660671 end
661672
662- def self . update_header_paths_if_depends_on ( target_installation_result , dependency_name , header_paths )
663- depends_on_framework = target_installation_result . native_target . dependencies . any? { |d | d . name == dependency_name }
673+ def self . target_depends_on? ( target , dependency_name , visited_targets = { } )
674+ return false if target == nil
675+
676+ target_identifier = target . respond_to? ( :uuid ) ? target . uuid : target . object_id
677+ target_identifier ||= target . object_id
678+ return false if visited_targets [ target_identifier ]
679+
680+ visited_targets [ target_identifier ] = true
681+ target . dependencies . any? do |dependency |
682+ dependency . name == dependency_name ||
683+ ( dependency . respond_to? ( :target ) && self . target_depends_on? ( dependency . target , dependency_name , visited_targets ) )
684+ end
685+ end
686+
687+ def self . update_header_paths_if_depends_on ( target_installation_result , dependency_name , header_paths , include_transitive_dependencies : false )
688+ native_target = target_installation_result . native_target
689+ depends_on_framework = if include_transitive_dependencies
690+ self . target_depends_on? ( native_target , dependency_name )
691+ else
692+ native_target . dependencies . any? { |d | d . name == dependency_name }
693+ end
664694 if depends_on_framework
665- target_installation_result . native_target . build_configurations . each do |config |
695+ native_target . build_configurations . each do |config |
666696 header_search_path = config . build_settings [ "HEADER_SEARCH_PATHS" ] != nil ? config . build_settings [ "HEADER_SEARCH_PATHS" ] : "$(inherited)"
667697 header_paths . each { |header | header_search_path = ReactNativePodsUtils . add_search_path_if_not_included ( header_search_path , header ) }
668698 config . build_settings [ "HEADER_SEARCH_PATHS" ] = header_search_path
669699 end
670700 end
671701 end
672702
703+ def self . set_stable_umbrella_search_paths ( target_installation_result )
704+ return unless ReactNativeCoreUtils . build_rncore_from_source ( )
705+
706+ ReactNativePodsUtils . stable_umbrella_frameworks . each do |pod_name , framework_name |
707+ header_search_paths = ReactNativePodsUtils . create_header_search_path_for_frameworks (
708+ "PODS_CONFIGURATION_BUILD_DIR" ,
709+ pod_name ,
710+ framework_name ,
711+ [ ]
712+ ) . map { |search_path | "\" #{ search_path } \" " }
713+ ReactNativePodsUtils . update_header_paths_if_depends_on (
714+ target_installation_result ,
715+ pod_name ,
716+ header_search_paths ,
717+ include_transitive_dependencies : true
718+ )
719+ end
720+ end
721+
673722 def self . set_rctfolly_search_paths ( target_installation_result )
674723 ReactNativePodsUtils . update_header_paths_if_depends_on ( target_installation_result , "RCT-Folly" , [
675724 "\" $(PODS_ROOT)/RCT-Folly\" " ,
0 commit comments