From 309ee06ead4e23904418449ec33bc98a6ea2e825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Fri, 6 Aug 2021 10:41:32 -0700 Subject: [PATCH] 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 --- scripts/react_native_pods.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index f2b8d8d4fe5..0e8b1c9bc99 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -194,7 +194,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',