Repository navigation
Expand file tree
/
Copy pathPodfile
More file actions
97 lines (82 loc) · 3.99 KB
/
Copy pathPodfile
File metadata and controls
97 lines (82 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
source 'https://github.com/CocoaPods/Specs.git'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'ddSdkReactnativeExample' do
pod 'DatadogSDKReactNative', :path => '../../packages/core/DatadogSDKReactNative.podspec', :testspecs => ['Tests']
pod 'DatadogSDKReactNativeSessionReplay', :path => '../../packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec', :testspecs => ['Tests']
pod 'DatadogSDKReactNativeWebView', :path => '../../packages/react-native-webview/DatadogSDKReactNativeWebView.podspec', :testspecs => ['Tests']
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
# pod 'DatadogSDKReactNative', :path => '../../packages/core/DatadogSDKReactNative.podspec', :testspecs => ['Tests']
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
)
# `DD_SDK_COMPILED_FOR_TESTING` is no longer injected. There is no pod target to set it on now
# that the SDK comes from SPM, and the native tests never needed it: none of them touch the
# three declarations it guards (`Datadog.flushAndDeinitialize` and its ObjC counterpart, and
# `DatadogContextProvider.replace(context:)`).
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
end
end
# Modify RCT-Folly Portability.h to disable coroutines
Dir.glob(installer.sandbox.root + "RCT-Folly/folly/Portability.h") do |file|
begin
# First try to make the file writable
system "chmod +w #{file}"
contents = File.read(file)
modified_contents = contents.gsub(/#define FOLLY_HAS_COROUTINES 1/, '#define FOLLY_HAS_COROUTINES 0')
# Try writing with elevated privileges if needed
if !File.writable?(file)
system "sudo chmod +w #{file}"
end
File.write(file, modified_contents)
# Optionally restore original permissions
system "chmod -w #{file}"
rescue => e
Pod::UI.warn "Failed to modify Portability.h: #{e.message}"
end
end
# Workaround for fmt consteval errors with Xcode 26+ Clang:
# The fmt library's consteval usage is incompatible with newer Apple Clang.
# Patch base.h to disable consteval by adding a guard for the current Xcode.
fmt_base_header = File.join(installer.sandbox.pod_dir('fmt'), 'include', 'fmt', 'base.h')
if File.exist?(fmt_base_header)
content = File.read(fmt_base_header)
unless content.include?('Patched for Xcode 26')
if content.gsub!(
/^(#elif defined\(__cpp_consteval\)\n#\s*define FMT_USE_CONSTEVAL 1)$/,
"#elif defined(__apple_build_version__) && __apple_build_version__ >= 17000000L\n# define FMT_USE_CONSTEVAL 0 // Patched for Xcode 26+ consteval compat\n\\1"
)
original_mode = File.stat(fmt_base_header).mode
File.chmod(original_mode | 0200, fmt_base_header)
File.write(fmt_base_header, content)
File.chmod(original_mode, fmt_base_header)
else
Pod::UI.warn "fmt consteval patch: expected pattern not found in #{fmt_base_header}. " \
"The fmt library may have changed — Xcode 26+ builds may fail."
end
end
end
end
end