@@ -60,7 +60,7 @@ def self.exclude_i386_architecture_while_using_hermes(installer)
60
60
. push ( installer . pods_project )
61
61
62
62
63
- # Hermes does not support ` i386` architecture
63
+ # Hermes does not support ' i386' architecture
64
64
excluded_archs_default = ReactNativePodsUtils . has_pod ( installer , 'hermes-engine' ) ? "i386" : ""
65
65
66
66
projects . each do |project |
@@ -150,7 +150,7 @@ def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
150
150
if self . is_using_xcode15_or_greter ( :xcodebuild_manager => xcodebuild_manager )
151
151
self . add_value_to_setting_if_missing ( config , other_ld_flags_key , xcode15_compatibility_flags )
152
152
else
153
- self . remove_value_to_setting_if_present ( config , other_ld_flags_key , xcode15_compatibility_flags )
153
+ self . remove_value_from_setting_if_present ( config , other_ld_flags_key , xcode15_compatibility_flags )
154
154
end
155
155
end
156
156
project . save ( )
@@ -263,20 +263,26 @@ def self.safe_init(config, setting_name)
263
263
264
264
def self . add_value_to_setting_if_missing ( config , setting_name , value )
265
265
old_config = config . build_settings [ setting_name ]
266
- if !old_config . include? ( value )
267
- config . build_settings [ setting_name ] << value
266
+ if old_config . is_a? ( Array )
267
+ old_config = old_config . join ( " " )
268
+ end
269
+
270
+ trimmed_value = value . strip ( )
271
+ if !old_config . include? ( trimmed_value )
272
+ config . build_settings [ setting_name ] = "#{ old_config . strip ( ) } #{ trimmed_value } " . strip ( )
268
273
end
269
274
end
270
275
271
- def self . remove_value_to_setting_if_present ( config , setting_name , value )
276
+ def self . remove_value_from_setting_if_present ( config , setting_name , value )
272
277
old_config = config . build_settings [ setting_name ]
273
- if old_config . include? ( value )
274
- # Old config can be either an Array or a String
275
- if old_config . is_a? ( Array )
276
- old_config = old_config . join ( " " )
277
- end
278
- new_config = old_config . gsub ( value , "" )
279
- config . build_settings [ setting_name ] = new_config
278
+ if old_config . is_a? ( Array )
279
+ old_config = old_config . join ( " " )
280
+ end
281
+
282
+ trimmed_value = value . strip ( )
283
+ if old_config . include? ( trimmed_value )
284
+ new_config = old_config . gsub ( trimmed_value , "" )
285
+ config . build_settings [ setting_name ] = new_config . strip ( )
280
286
end
281
287
end
282
288
0 commit comments