From a5e110adcf21e67eeaff0d838ed18aef9a1f224d Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 18 Sep 2023 02:45:12 -0700 Subject: [PATCH] Bump IPHONEOS_DEPLOYMENT_TARGET to 13.4 for 3rd party pods (#39478) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39478 When testing Xcode 15, we realized that a few pods we do not control directly have the IPHONEOS_DEPLOYMENT_TARGET set to old versions of iOS. We can update that setting to silence the warning with Cocoapods and this is what this script does. Notice that bumping that setting generated other warning as some APIs have been deprecated. [Internal] - Bump min IPHONEOS_DEPLOYMENT_TARGET for 3rd party pods Reviewed By: dmytrorykun Differential Revision: D49274837 fbshipit-source-id: 584d105c76d654daa2ecf5eb2f1b9381e70f567a --- .../react-native/scripts/cocoapods/helpers.rb | 8 +++++ .../react-native/scripts/cocoapods/utils.rb | 31 +++++++++++++++++++ .../react-native/scripts/react_native_pods.rb | 8 +++-- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/helpers.rb b/packages/react-native/scripts/cocoapods/helpers.rb index 03e3a5cbeac..eeffd9ec40e 100644 --- a/packages/react-native/scripts/cocoapods/helpers.rb +++ b/packages/react-native/scripts/cocoapods/helpers.rb @@ -26,3 +26,11 @@ class Finder return `find #{path} -type f \\( #{js_files} -or #{ts_files} \\)`.split("\n").sort() end end + +module Helpers + class Constants + def self.min_ios_version_supported + return '12.4' + end + end +end diff --git a/packages/react-native/scripts/cocoapods/utils.rb b/packages/react-native/scripts/cocoapods/utils.rb index 44b2579e49a..a96be89fac1 100644 --- a/packages/react-native/scripts/cocoapods/utils.rb +++ b/packages/react-native/scripts/cocoapods/utils.rb @@ -232,6 +232,37 @@ class ReactNativePodsUtils end end + def self.updateIphoneOSDeploymentTarget(installer) + pod_to_update = Set.new([ + "boost", + "CocoaAsyncSocket", + "Flipper", + "Flipper-DoubleConversion", + "Flipper-Fmt", + "Flipper-Boost-iOSX", + "Flipper-Folly", + "Flipper-Glog", + "Flipper-PeerTalk", + "FlipperKit", + "fmt", + "libevent", + "OpenSSL-Universal", + "RCT-Folly", + "SocketRocket", + "YogaKit" + ]) + + installer.target_installation_results.pod_target_installation_results + .each do |pod_name, target_installation_result| + unless pod_to_update.include?(pod_name) + next + end + target_installation_result.native_target.build_configurations.each do |config| + config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = Helpers::Constants.min_ios_version_supported + end + end + end + # ========= # # Utilities # # ========= # diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 653385ed12e..0c28e6818f9 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -15,6 +15,7 @@ require_relative './cocoapods/codegen_utils.rb' require_relative './cocoapods/utils.rb' require_relative './cocoapods/new_architecture.rb' require_relative './cocoapods/local_podspec_patch.rb' +require_relative './cocoapods/helpers.rb' $CODEGEN_OUTPUT_DIR = 'build/generated/ios' $CODEGEN_COMPONENT_DIR = 'react/renderer/components' @@ -34,11 +35,12 @@ require Pod::Executable.execute_command('node', ['-p', {paths: [process.argv[1]]}, )', __dir__]).strip -# This function returns the min iOS version supported by React Native + +# This function returns the min supported OS versions supported by React Native # By using this function, you won't have to manually change your Podfile # when we change the minimum version supported by the framework. def min_ios_version_supported - return '12.4' + return Helpers::Constants.min_ios_version_supported end # This function prepares the project for React Native, before processing @@ -245,11 +247,13 @@ def react_native_post_install( ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path) ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled) ReactNativePodsUtils.apply_xcode_15_patch(installer) + ReactNativePodsUtils.updateIphoneOSDeploymentTarget(installer) NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer) is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1" NewArchitectureHelper.modify_flags_for_new_architecture(installer, is_new_arch_enabled) + Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green end