|
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
|
platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1' |
|
11
|
install! 'cocoapods', |
|
12
|
:deterministic_uuids => false |
|
13
|
|
|
14
|
prepare_react_native_project! |
|
15
|
|
|
16
|
target 'OndeExample' do |
|
17
|
use_expo_modules! |
|
18
|
|
|
19
|
if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1' |
|
20
|
config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"]; |
|
21
|
else |
|
22
|
config_command = [ |
|
23
|
'node', |
|
24
|
'--no-warnings', |
|
25
|
'--eval', |
|
26
|
'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))', |
|
27
|
'react-native-config', |
|
28
|
'--json', |
|
29
|
'--platform', |
|
30
|
'ios' |
|
31
|
] |
|
32
|
end |
|
33
|
|
|
34
|
config = use_native_modules!(config_command) |
|
35
|
|
|
36
|
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] |
|
37
|
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] |
|
38
|
|
|
39
|
use_react_native!( |
|
40
|
:path => config[:reactNativePath], |
|
41
|
:hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', |
|
42
|
# An absolute path to your application root. |
|
43
|
:app_path => "#{Pod::Config.instance.installation_root}/..", |
|
44
|
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false', |
|
45
|
) |
|
46
|
|
|
47
|
post_install do |installer| |
|
48
|
react_native_post_install( |
|
49
|
installer, |
|
50
|
config[:reactNativePath], |
|
51
|
:mac_catalyst_enabled => false, |
|
52
|
:ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true', |
|
53
|
) |
|
54
|
|
|
55
|
# This is necessary for Xcode 14, because it signs resource bundles by default |
|
56
|
# when building for devices. |
|
57
|
installer.target_installation_results.pod_target_installation_results |
|
58
|
.each do |pod_name, target_installation_result| |
|
59
|
target_installation_result.resource_bundle_targets.each do |resource_bundle_target| |
|
60
|
resource_bundle_target.build_configurations.each do |config| |
|
61
|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' |
|
62
|
end |
|
63
|
end |
|
64
|
end |
|
65
|
|
|
66
|
# Xcode 26 with the optional Metal Toolchain can point TOOLCHAIN_DIR at |
|
67
|
# Metal.xctoolchain, which does not ship the Swift compatibility libraries |
|
68
|
# CocoaPods expects in LIBRARY_SEARCH_PATHS. That leads to noisy linker |
|
69
|
# warnings and, on some projects, missing swiftCompatibility* symbols. |
|
70
|
# |
|
71
|
# Force CocoaPods-generated xcconfigs to reference the default Xcode |
|
72
|
# toolchain instead of TOOLCHAIN_DIR for Swift runtime search paths. |
|
73
|
Dir.glob(File.join(installer.sandbox.root.to_s, 'Target Support Files', '**', '*.xcconfig')).each do |path| |
|
74
|
contents = File.read(path) |
|
75
|
updated = contents.gsub( |
|
76
|
'${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}', |
|
77
|
'$(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME)" "$(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/$(PLATFORM_NAME)' |
|
78
|
) |
|
79
|
|
|
80
|
File.write(path, updated) if updated != contents |
|
81
|
end |
|
82
|
end |
|
83
|
end |