Skip to content

Commit

Permalink
Codegen: Always prepare filesystem
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hramos authored and kelset committed Aug 11, 2021
1 parent dfd324e commit 5efad92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/react_native_pods.rb
Expand Up @@ -193,7 +193,9 @@ def use_react_native_codegen!(spec, options={})
end

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

spec.script_phase = {
:name => 'Generate Specs',
Expand Down

0 comments on commit 5efad92

Please sign in to comment.