From 8212c73884bad4cf7d2081670100bab1ac4bfd0b Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Wed, 6 Mar 2024 13:53:48 +0000 Subject: [PATCH] [RN][iOS][0.72] Fix flipper for Xcode 15.3 --- .../react-native/scripts/cocoapods/utils.rb | 22 +++++++++++++++++++ .../react-native/scripts/react_native_pods.rb | 1 + 2 files changed, 23 insertions(+) diff --git a/packages/react-native/scripts/cocoapods/utils.rb b/packages/react-native/scripts/cocoapods/utils.rb index 7221e81bf40529..bf15a4f295ea7e 100644 --- a/packages/react-native/scripts/cocoapods/utils.rb +++ b/packages/react-native/scripts/cocoapods/utils.rb @@ -78,6 +78,28 @@ def self.exclude_i386_architecture_while_using_hermes(installer) end end + def self.fix_flipper_for_xcode_15_3(installer) + + installer.pods_project.targets.each do |target| + if target.name == 'Flipper' + file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h' + if !File.exist(file_path) + return + end + + contents = File.read(file_path) + if contents.include?('#include ') + return + end + mod_content = contents.gsub("#pragma once", "#pragma once\n#include ") + File.chmod(0755, file_path) + File.open(file_path, 'w') do |file| + file.puts(mod_content) + end + end + end + end + def self.set_node_modules_user_settings(installer, react_native_path) Pod::UI.puts("Setting REACT_NATIVE build settings") projects = self.extract_projects(installer) diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 0c28e6818f9834..b95bd4f7ebf60e 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -248,6 +248,7 @@ def react_native_post_install( ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled) ReactNativePodsUtils.apply_xcode_15_patch(installer) ReactNativePodsUtils.updateIphoneOSDeploymentTarget(installer) + ReactNativePodsUtils.fix_flipper_for_xcode_15_3(installer) NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer) is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"