From e3def00d7a9567f5879a6cd0dfed161bc1aaa176 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 27 Jan 2025 06:52:35 -0800 Subject: [PATCH] Warn users when calling pod install (#48960) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48960 We are moving away from Cocoapods toward alternative solution. We are adding this deprecation message to help inform our users that this change is happening. Part of the Cocoapods tasks will be moved to an alternative script that will be invoked by Expo and by the Community CLI. The warning message tells the users what to do as an alternative to `pod install`. ## Changelog: [iOS][Deprecated] - deprecate calling `pod install` directly Reviewed By: cortinico Differential Revision: D68704127 fbshipit-source-id: df93008afc055254d0c0da09566c84af99248310 --- .../react-native/scripts/react_native_pods.rb | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 5227eaa4e07..201396d90d0 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -363,6 +363,25 @@ def rct_cxx_language_standard() return Helpers::Constants.cxx_language_standard end +def print_cocoapods_deprecation_message() + if ENV["RCT_IGNORE_PODS_DEPRECATION"] == "1" + return + end + + puts '' + puts '==================== DEPRECATION NOTICE ====================='.yellow + puts 'Calling `pod install` directly is deprecated in React Native'.yellow + puts 'because we are moving away from Cocoapods toward alternative'.yellow + puts 'solutions to build the project.'.yellow + puts '* If you are using Expo, please run:'.yellow + puts '`npx expo run:ios`'.yellow + puts '* If you are using the Community CLI, please run:'.yellow + puts '`yarn ios`'.yellow + puts '============================================================='.yellow + puts '' + +end + # Function that executes after React Native has been installed to configure some flags and build settings. # # Parameters @@ -412,6 +431,6 @@ def react_native_post_install( NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer) NewArchitectureHelper.modify_flags_for_new_architecture(installer, NewArchitectureHelper.new_arch_enabled) - + print_cocoapods_deprecation_message Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green end