@@ -71,7 +71,7 @@ def use_react_native! (options={})
71
71
def use_flipper! ( versions = { } , configurations : [ 'Debug' ] )
72
72
versions [ 'Flipper' ] ||= '~> 0.75.1'
73
73
versions [ 'Flipper-DoubleConversion' ] ||= '1.1.7'
74
- versions [ 'Flipper-Folly' ] ||= '~> 2.5'
74
+ versions [ 'Flipper-Folly' ] ||= '~> 2.5.3 '
75
75
versions [ 'Flipper-Glog' ] ||= '0.3.6'
76
76
versions [ 'Flipper-PeerTalk' ] ||= '~> 0.0.4'
77
77
versions [ 'Flipper-RSocket' ] ||= '~> 1.3'
@@ -138,10 +138,26 @@ def exclude_architectures(installer)
138
138
end
139
139
140
140
def react_native_post_install ( installer )
141
+ pods_prefix = File . dirname ( installer . pods_project . path )
142
+
141
143
if has_pod ( installer , 'Flipper' )
142
144
flipper_post_install ( installer )
143
145
end
144
146
147
+ ## Fix for RTC-Folly on iOS 14.5 - makes Hermes work again
148
+ find_and_replace (
149
+ "#{ pods_prefix } /RCT-Folly/folly/synchronization/DistributedMutex-inl.h" ,
150
+ 'atomic_notify_one(state)' ,
151
+ 'folly::atomic_notify_one(state)'
152
+ )
153
+
154
+ find_and_replace (
155
+ "#{ pods_prefix } Pods/RCT-Folly/folly/synchronization/DistributedMutex-inl.h" ,
156
+ 'atomic_wait_until(&state, previous | data, deadline)' ,
157
+ 'folly::atomic_wait_until(&state, previous | data, deadline)'
158
+ )
159
+
160
+ ## Exclude `i386` from valid architectures when building with Hermes on iOS
145
161
exclude_architectures ( installer )
146
162
end
147
163
@@ -199,3 +215,18 @@ def use_react_native_codegen!(spec, options={})
199
215
200
216
spec . prepare_command = "#{ mkdir_command } && touch #{ generated_files . reduce ( ) { |str , file | str + " " + file } } "
201
217
end
218
+
219
+ # Local method for the Xcode 12.5 fix
220
+ def find_and_replace ( dir , findstr , replacestr )
221
+ Dir [ dir ] . each do |name |
222
+ text = File . read ( name )
223
+ replace = text . gsub ( findstr , replacestr )
224
+ replaced = text . index ( replacestr )
225
+ next if !replaced . nil? || text == replace
226
+
227
+ puts "Patching #{ name } "
228
+ File . open ( name , 'w' ) { |file | file . puts replace }
229
+ $stdout. flush
230
+ end
231
+ Dir [ "#{ dir } */" ] . each ( &method ( :find_and_replace ) )
232
+ end
0 commit comments