xref: /expo/apps/fabric-tester/ios/Podfile (revision adae5ee7)
1require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
2require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
3
4require 'json'
5podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
6
7ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
8ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']
9
10platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0'
11install! 'cocoapods',
12  :deterministic_uuids => false
13
14prepare_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# ```
27flipper_config = FlipperConfiguration.disabled
28if ENV['NO_FLIPPER'] == '1' then
29  # Explicitly disabled through environment variables
30  flipper_config = FlipperConfiguration.disabled
31elsif 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
38end
39
40target 'fabrictester' 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      :mac_catalyst_enabled => false
65    )
66    __apply_Xcode_12_5_M1_post_install_workaround(installer)
67
68    # This is necessary for Xcode 14, because it signs resource bundles by default
69    # when building for devices.
70    installer.target_installation_results.pod_target_installation_results
71      .each do |pod_name, target_installation_result|
72      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
73        resource_bundle_target.build_configurations.each do |config|
74          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
75        end
76      end
77    end
78  end
79
80  post_integrate do |installer|
81    begin
82      expo_patch_react_imports!(installer)
83    rescue => e
84      Pod::UI.warn e
85    end
86  end
87end
88