diff --git a/packages/react-native/scripts/cocoapods/codegen.rb b/packages/react-native/scripts/cocoapods/codegen.rb index cd76a0a7540..a19d151e17b 100644 --- a/packages/react-native/scripts/cocoapods/codegen.rb +++ b/packages/react-native/scripts/cocoapods/codegen.rb @@ -21,6 +21,10 @@ def run_codegen!( codegen_utils: CodegenUtils.new() ) + if ENV["RCT_SKIP_CODEGEN"] == "1" + return + end + codegen_utils.use_react_native_codegen_discovery!( disable_codegen, app_path, diff --git a/packages/react-native/scripts/cocoapods/codegen_utils.rb b/packages/react-native/scripts/cocoapods/codegen_utils.rb index 6f62e8c75ae..3ce12e28ebc 100644 --- a/packages/react-native/scripts/cocoapods/codegen_utils.rb +++ b/packages/react-native/scripts/cocoapods/codegen_utils.rb @@ -76,6 +76,10 @@ class CodegenUtils end def self.clean_up_build_folder(rn_path, codegen_dir, dir_manager: Dir, file_manager: File) + if ENV["RCT_SKIP_CODEGEN"] == "1" + return + end + return if CodegenUtils.cleanup_done() CodegenUtils.set_cleanup_done(true) diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 201396d90d0..4f1c53b0289 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -73,6 +73,10 @@ def use_react_native! ( ENV['APP_PATH'] = app_path ENV['REACT_NATIVE_PATH'] = path + # We set RCT_SKIP_CODEGEN to true, if the user wants to skip the running Codegen step from Cocoapods. + # This is needed as part of our migration away from cocoapods + ENV['RCT_SKIP_CODEGEN'] = ENV['RCT_SKIP_CODEGEN'] == '1' || ENV['RCT_IGNORE_PODS_DEPRECATION'] == '1' ? '1' : '0' + ReactNativePodsUtils.check_minimum_required_xcode() # Current target definition is provided by Cocoapods and it refers to the target