|
| 1 | +require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") |
| 2 | +require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") |
| 3 | +require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules") |
| 4 | + |
| 5 | +require 'json' |
| 6 | +podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} |
| 7 | + |
| 8 | +ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' |
| 9 | + |
| 10 | +platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0' |
| 11 | +install! 'cocoapods', |
| 12 | + :deterministic_uuids => false |
| 13 | + |
| 14 | +prepare_react_native_project! |
| 15 | + |
| 16 | +# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. |
| 17 | +# because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this, |
| 18 | +# you can also exclude `react-native-flipper` in `react-native.config.js` |
| 19 | +# |
| 20 | +# ```js |
| 21 | +# module.exports = { |
| 22 | +# dependencies: { |
| 23 | +# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), |
| 24 | +# } |
| 25 | +# } |
| 26 | +# ``` |
| 27 | +flipper_config = FlipperConfiguration.disabled |
| 28 | +if ENV['NO_FLIPPER'] == '1' then |
| 29 | + # Explicitly disabled through environment variables |
| 30 | + flipper_config = FlipperConfiguration.disabled |
| 31 | +elsif podfile_properties.key?('ios.flipper') then |
| 32 | + # Configure Flipper in Podfile.properties.json |
| 33 | + if podfile_properties['ios.flipper'] == 'true' then |
| 34 | + flipper_config = FlipperConfiguration.enabled(["Debug", "Release"]) |
| 35 | + elsif podfile_properties['ios.flipper'] != 'false' then |
| 36 | + flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] }) |
| 37 | + end |
| 38 | +end |
| 39 | + |
| 40 | +target 'imggenrn' do |
| 41 | + use_expo_modules! |
| 42 | + config = use_native_modules! |
| 43 | + |
| 44 | + use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] |
| 45 | + use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] |
| 46 | + |
| 47 | + # Flags change depending on the env values. |
| 48 | + flags = get_default_flags() |
| 49 | + |
| 50 | + use_react_native!( |
| 51 | + :path => config[:reactNativePath], |
| 52 | + :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', |
| 53 | + :fabric_enabled => flags[:fabric_enabled], |
| 54 | + # An absolute path to your application root. |
| 55 | + :app_path => "#{Pod::Config.instance.installation_root}/..", |
| 56 | + # Note that if you have use_frameworks! enabled, Flipper will not work if enabled |
| 57 | + :flipper_configuration => flipper_config |
| 58 | + ) |
| 59 | + |
| 60 | + post_install do |installer| |
| 61 | + react_native_post_install( |
| 62 | + installer, |
| 63 | + config[:reactNativePath], |
| 64 | + # Set `mac_catalyst_enabled` to `true` in order to apply patches |
| 65 | + # necessary for Mac Catalyst builds |
| 66 | + :mac_catalyst_enabled => false |
| 67 | + ) |
| 68 | + __apply_Xcode_12_5_M1_post_install_workaround(installer) |
| 69 | + |
| 70 | + # This is necessary for Xcode 14, because it signs resource bundles by default |
| 71 | + # when building for devices. |
| 72 | + installer.target_installation_results.pod_target_installation_results |
| 73 | + .each do |pod_name, target_installation_result| |
| 74 | + target_installation_result.resource_bundle_targets.each do |resource_bundle_target| |
| 75 | + resource_bundle_target.build_configurations.each do |config| |
| 76 | + config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' |
| 77 | + end |
| 78 | + end |
| 79 | + end |
| 80 | + end |
| 81 | + |
| 82 | + post_integrate do |installer| |
| 83 | + begin |
| 84 | + expo_patch_react_imports!(installer) |
| 85 | + rescue => e |
| 86 | + Pod::UI.warn e |
| 87 | + end |
| 88 | + end |
| 89 | +end |
0 commit comments