|
| 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 | + |
| 4 | +require 'json' |
| 5 | +podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} |
| 6 | + |
| 7 | +ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' |
| 8 | +ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] |
| 9 | + |
| 10 | +use_autolinking_method_symbol = ('use' + '_native' + '_modules!').to_sym |
| 11 | +origin_autolinking_method = self.method(use_autolinking_method_symbol) |
| 12 | +self.define_singleton_method(use_autolinking_method_symbol) do |*args| |
| 13 | + if ENV['EXPO_UNSTABLE_CORE_AUTOLINKING'] == '1' |
| 14 | + Pod::UI.puts('Using expo-modules-autolinking as core autolinking source'.green) |
| 15 | + config_command = [ |
| 16 | + 'node', |
| 17 | + '--no-warnings', |
| 18 | + '--eval', |
| 19 | + 'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))', |
| 20 | + 'react-native-config', |
| 21 | + '--json', |
| 22 | + '--platform', |
| 23 | + 'ios' |
| 24 | + ] |
| 25 | + origin_autolinking_method.call(config_command) |
| 26 | + else |
| 27 | + origin_autolinking_method.call() |
| 28 | + end |
| 29 | +end |
| 30 | + |
| 31 | +platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4' |
| 32 | +install! 'cocoapods', |
| 33 | + :deterministic_uuids => false |
| 34 | + |
| 35 | +prepare_react_native_project! |
| 36 | + |
| 37 | +target 'example' do |
| 38 | + use_expo_modules! |
| 39 | + config = use_native_modules! |
| 40 | + |
| 41 | + use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] |
| 42 | + use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] |
| 43 | + |
| 44 | + use_react_native!( |
| 45 | + :path => config[:reactNativePath], |
| 46 | + :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', |
| 47 | + # An absolute path to your application root. |
| 48 | + :app_path => "#{Pod::Config.instance.installation_root}/..", |
| 49 | + :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false', |
| 50 | + ) |
| 51 | + |
| 52 | + post_install do |installer| |
| 53 | + react_native_post_install( |
| 54 | + installer, |
| 55 | + config[:reactNativePath], |
| 56 | + :mac_catalyst_enabled => false, |
| 57 | + :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true', |
| 58 | + ) |
| 59 | + |
| 60 | + # This is necessary for Xcode 14, because it signs resource bundles by default |
| 61 | + # when building for devices. |
| 62 | + installer.target_installation_results.pod_target_installation_results |
| 63 | + .each do |pod_name, target_installation_result| |
| 64 | + target_installation_result.resource_bundle_targets.each do |resource_bundle_target| |
| 65 | + resource_bundle_target.build_configurations.each do |config| |
| 66 | + config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' |
| 67 | + end |
| 68 | + end |
| 69 | + end |
| 70 | + end |
| 71 | + |
| 72 | + post_integrate do |installer| |
| 73 | + begin |
| 74 | + expo_patch_react_imports!(installer) |
| 75 | + rescue => e |
| 76 | + Pod::UI.warn e |
| 77 | + end |
| 78 | + end |
| 79 | +end |
0 commit comments