Skip to content

Commit 5efad92

Browse files
hramoskelset
authored andcommittedAug 11, 2021
Codegen: Always prepare filesystem
Summary: For any Pod that uses the codegen, create references to code-gen'd files in local filesystem regardless of Pod install status by invoking the same command used by `prepare_command` whenever `pod install` is run. This works around the issue where CocoaPods may decide to skip running `prepare_command`. While this is expected CocoaPods behavior, external factors may result in the deletion of the original code-gen'd files in which case we need to make sure that running `pod install` will bring these files back. See Test Plan for more details on how to reproduce the issue being fixed. Fixes T97404254. Changelog: [Internal] Codegen invoked with every `pod install` regardless of pod install status Differential Revision: D30116640 fbshipit-source-id: 81db5dff1d4c4f8ae22b5dbe822609c770789ac8
1 parent dfd324e commit 5efad92

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎scripts/react_native_pods.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def use_react_native_codegen!(spec, options={})
193193
end
194194

195195
# Prepare filesystem by creating empty files that will be picked up as references by CocoaPods.
196-
spec.prepare_command = "mkdir -p #{generated_dirs.join(" ")} && touch #{generated_files.join(" ")}"
196+
prepare_command = "mkdir -p #{generated_dirs.join(" ")} && touch -a #{generated_files.join(" ")}"
197+
system(prepare_command) # Always run prepare_command when a podspec uses the codegen, as CocoaPods may skip invoking this command in certain scenarios
198+
spec.prepare_command = prepare_command
197199

198200
spec.script_phase = {
199201
:name => 'Generate Specs',

0 commit comments

Comments
 (0)
Please sign in to comment.