Skip to content

Commit

Permalink
[RN][iOS] Fix flipper for Xcode 15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cipolleschi committed Mar 6, 2024
1 parent 02f163e commit 9d22a7f
Show file tree
Hide file tree
Showing 3 changed files with 251 additions and 27 deletions.
21 changes: 21 additions & 0 deletions packages/react-native/scripts/cocoapods/utils.rb
Expand Up @@ -86,6 +86,27 @@ 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)

This comment has been minimized.

Copy link
@oleksandr-dziuban

oleksandr-dziuban Mar 11, 2024

Hi guys

Shouldn't be a

if !File.exist?(file_path)

just exist without ? will throw an error

CC: @cipolleschi

This comment has been minimized.

Copy link
@paulschreiber

paulschreiber Mar 19, 2024

Contributor

unless File.exist?(file_path) is more idiomatic Ruby.

return
end

contents = File.read(file_path)
if contents.include?('#include <functional>')
return
end
mod_content = contents.gsub("#pragma once", "#pragma once\n#include <functional>")
File.chmod(0755, file_path)
File.open(file_path, 'w') do |file|
file.puts(mod_content)
end
end
end
end

def self.set_use_hermes_build_setting(installer, hermes_enabled)
Pod::UI.puts("Setting USE_HERMES build settings")
projects = self.extract_projects(installer)
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/scripts/react_native_pods.rb
Expand Up @@ -308,6 +308,7 @@ def react_native_post_install(
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
ReactNativePodsUtils.apply_xcode_15_patch(installer)
ReactNativePodsUtils.updateOSDeploymentTarget(installer)
ReactNativePodsUtils.fix_flipper_for_xcode_15_3(installer)

NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
NewArchitectureHelper.modify_flags_for_new_architecture(installer, NewArchitectureHelper.new_arch_enabled)
Expand Down

0 comments on commit 9d22a7f

Please sign in to comment.