@@ -661,6 +661,7 @@ def self.add_search_path_to_result(result, base_path, additional_paths, include_
661661
662662 def self . add_ndebug_flag_to_pods_in_release ( installer )
663663 ndebug_flag = " -DNDEBUG"
664+ react_native_debug_flag = " -DREACT_NATIVE_DEBUG=0"
664665
665666 installer . aggregate_targets . each do |aggregate_target |
666667 aggregate_target . xcconfigs . each do |config_name , config_file |
@@ -670,6 +671,9 @@ def self.add_ndebug_flag_to_pods_in_release(installer)
670671 end
671672 self . add_flag_to_map_with_inheritance ( config_file . attributes , 'OTHER_CPLUSPLUSFLAGS' , ndebug_flag ) ;
672673 self . add_flag_to_map_with_inheritance ( config_file . attributes , 'OTHER_CFLAGS' , ndebug_flag ) ;
674+ # explicitly set REACT_NATIVE_DEBUG to 0 for Release builds to ensure consistent compilation
675+ self . add_flag_to_map_with_inheritance ( config_file . attributes , 'OTHER_CPLUSPLUSFLAGS' , react_native_debug_flag ) ;
676+ self . add_flag_to_map_with_inheritance ( config_file . attributes , 'OTHER_CFLAGS' , react_native_debug_flag ) ;
673677
674678 xcconfig_path = aggregate_target . xcconfig_path ( config_name )
675679 config_file . save_as ( xcconfig_path )
@@ -684,6 +688,38 @@ def self.add_ndebug_flag_to_pods_in_release(installer)
684688 end
685689 self . add_flag_to_map_with_inheritance ( config . build_settings , 'OTHER_CPLUSPLUSFLAGS' , ndebug_flag ) ;
686690 self . add_flag_to_map_with_inheritance ( config . build_settings , 'OTHER_CFLAGS' , ndebug_flag ) ;
691+ # explicitly set REACT_NATIVE_DEBUG to 0 for Release builds to ensure consistent compilation
692+ self . add_flag_to_map_with_inheritance ( config . build_settings , 'OTHER_CPLUSPLUSFLAGS' , react_native_debug_flag ) ;
693+ self . add_flag_to_map_with_inheritance ( config . build_settings , 'OTHER_CFLAGS' , react_native_debug_flag ) ;
694+ end
695+ end
696+ end
697+
698+ def self . add_react_native_debug_flag_to_pods_in_debug ( installer )
699+ react_native_debug_flag = " -DREACT_NATIVE_DEBUG=1"
700+
701+ installer . aggregate_targets . each do |aggregate_target |
702+ aggregate_target . xcconfigs . each do |config_name , config_file |
703+ is_debug = aggregate_target . user_build_configurations [ config_name ] == :debug
704+ unless is_debug
705+ next
706+ end
707+ self . add_flag_to_map_with_inheritance ( config_file . attributes , 'OTHER_CPLUSPLUSFLAGS' , react_native_debug_flag ) ;
708+ self . add_flag_to_map_with_inheritance ( config_file . attributes , 'OTHER_CFLAGS' , react_native_debug_flag ) ;
709+
710+ xcconfig_path = aggregate_target . xcconfig_path ( config_name )
711+ config_file . save_as ( xcconfig_path )
712+ end
713+ end
714+
715+ installer . target_installation_results . pod_target_installation_results . each do |pod_name , target_installation_result |
716+ target_installation_result . native_target . build_configurations . each do |config |
717+ is_debug = config . type == :debug
718+ unless is_debug
719+ next
720+ end
721+ self . add_flag_to_map_with_inheritance ( config . build_settings , 'OTHER_CPLUSPLUSFLAGS' , react_native_debug_flag ) ;
722+ self . add_flag_to_map_with_inheritance ( config . build_settings , 'OTHER_CFLAGS' , react_native_debug_flag ) ;
687723 end
688724 end
689725 end
0 commit comments