@@ -524,21 +524,38 @@ def self.configure_aggregate_xcconfig(installer)
524524 # Add flags to aggregate target xcconfigs (these are used by the main app target)
525525 installer . aggregate_targets . each do |aggregate_target |
526526 aggregate_target . xcconfigs . each do |config_name , config_file |
527- # Add VFS overlay to compiler flags (C/C++ and Swift)
528- ReactNativePodsUtils . add_flag_to_map_with_inheritance ( config_file . attributes , "OTHER_CFLAGS" , vfs_overlay_flag )
529- ReactNativePodsUtils . add_flag_to_map_with_inheritance ( config_file . attributes , "OTHER_CPLUSPLUSFLAGS" , vfs_overlay_flag )
527+ add_vfs_overlay_flags ( config_file . attributes , vfs_overlay_flag , swift_vfs_overlay_flag )
528+ xcconfig_path = aggregate_target . xcconfig_path ( config_name )
529+ config_file . save_as ( xcconfig_path )
530+ end
531+ end
530532
531- # For Swift, we need to use -Xcc to pass the flag to the underlying Clang compiler
532- ReactNativePodsUtils . add_flag_to_map_with_inheritance ( config_file . attributes , "OTHER_SWIFT_FLAGS" , swift_vfs_overlay_flag )
533+ # Add flags to ALL pod targets (for third-party pods that don't call add_rncore_dependency)
534+ installer . pod_targets . each do |pod_target |
535+ pod_target . build_settings . each do |config_name , build_settings |
536+ xcconfig_path = pod_target . xcconfig_path ( config_name )
537+ next unless File . exist? ( xcconfig_path )
533538
534- # Suppress incomplete umbrella warnings for the prebuilt frameworks (it is expected, as our umbrella headers do not include all headers)
535- ReactNativePodsUtils . add_flag_to_map_with_inheritance ( config_file . attributes , "OTHER_SWIFT_FLAGS" , " -Xcc -Wno-incomplete-umbrella" )
539+ xcconfig = Xcodeproj ::Config . new ( xcconfig_path )
536540
537- xcconfig_path = aggregate_target . xcconfig_path ( config_name )
538- config_file . save_as ( xcconfig_path )
541+ # Check if VFS overlay is already present
542+ other_cflags = xcconfig . attributes [ "OTHER_CFLAGS" ] || ""
543+ next if other_cflags . include? ( "ivfsoverlay" )
544+
545+ add_vfs_overlay_flags ( xcconfig . attributes , vfs_overlay_flag , swift_vfs_overlay_flag )
546+ xcconfig . save_as ( xcconfig_path )
539547 end
540548 end
541549
542550 rncore_log ( "Prebuilt xcconfig configuration complete" )
543551 end
552+
553+ # Helper method to add VFS overlay flags to an xcconfig attributes map
554+ def self . add_vfs_overlay_flags ( attributes , vfs_overlay_flag , swift_vfs_overlay_flag )
555+ ReactNativePodsUtils . add_flag_to_map_with_inheritance ( attributes , "OTHER_CFLAGS" , vfs_overlay_flag )
556+ ReactNativePodsUtils . add_flag_to_map_with_inheritance ( attributes , "OTHER_CPLUSPLUSFLAGS" , vfs_overlay_flag )
557+ ReactNativePodsUtils . add_flag_to_map_with_inheritance ( attributes , "OTHER_SWIFT_FLAGS" , swift_vfs_overlay_flag )
558+ # Suppress incomplete umbrella warnings for the prebuilt frameworks (it is expected, as our umbrella headers do not include all headers)
559+ ReactNativePodsUtils . add_flag_to_map_with_inheritance ( attributes , "OTHER_SWIFT_FLAGS" , " -Xcc -Wno-incomplete-umbrella" )
560+ end
544561end
0 commit comments