react-native-macos 0.78.3 → 0.78.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/Libraries/Blob/RCTBlobManager.h +0 -0
  2. package/Libraries/Blob/RCTBlobManager.mm +0 -0
  3. package/Libraries/Components/TextInput/TextInputState.js +5 -1
  4. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
  5. package/Libraries/Core/ReactNativeVersion.js +1 -1
  6. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  7. package/Libraries/Lists/FillRateHelper.js +3 -3
  8. package/Libraries/Lists/FlatList.d.ts +1 -1
  9. package/Libraries/Lists/FlatList.js +2 -2
  10. package/Libraries/Lists/SectionList.d.ts +1 -1
  11. package/Libraries/Lists/SectionList.js +2 -2
  12. package/Libraries/Lists/SectionListModern.js +2 -2
  13. package/Libraries/Lists/ViewabilityHelper.js +3 -3
  14. package/Libraries/Lists/VirtualizeUtils.js +2 -2
  15. package/Libraries/Lists/VirtualizedList.js +3 -3
  16. package/Libraries/Lists/VirtualizedListContext.js +2 -2
  17. package/Libraries/Lists/VirtualizedSectionList.js +3 -3
  18. package/Libraries/Modal/Modal.js +1 -1
  19. package/Libraries/StyleSheet/normalizeColor.js +0 -0
  20. package/Libraries/Text/Text.d.ts +1 -0
  21. package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
  22. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  23. package/React/Base/RCTJavaScriptLoader.h +0 -0
  24. package/React/Base/RCTJavaScriptLoader.mm +0 -0
  25. package/React/Base/RCTVersion.m +1 -1
  26. package/React/CoreModules/RCTDevLoadingView.mm +1 -1
  27. package/React/CoreModules/RCTLogBoxView.mm +4 -1
  28. package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +82 -14
  29. package/React/Views/RCTViewKeyboardEvent.m +24 -0
  30. package/ReactAndroid/gradle.properties +1 -1
  31. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  32. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  33. package/local-cli/cli.js +0 -0
  34. package/package.json +5 -4
  35. package/scripts/compose-source-maps.js +0 -0
  36. package/scripts/featureflags/README.md +156 -0
  37. package/scripts/featureflags/index.js +39 -0
  38. package/scripts/ios-configure-glog.sh +0 -0
  39. package/scripts/node-binary.sh +0 -0
  40. package/scripts/packager.sh +0 -0
  41. package/scripts/react-native-xcode.sh +0 -0
  42. package/scripts/react_native_pods_utils/script_phases.sh +0 -0
  43. package/scripts/xcode/ccache-clang++.sh +0 -0
  44. package/scripts/xcode/ccache-clang.sh +0 -0
  45. package/scripts/xcode/with-environment.sh +0 -0
  46. package/types/index.d.ts +1 -1
  47. package/scripts/cocoapods/autolinking.rb +0 -206
  48. package/scripts/cocoapods/autolinking_utils.rb +0 -25
  49. package/scripts/cocoapods/codegen.rb +0 -59
  50. package/scripts/cocoapods/codegen_script_phase_extractor.rb +0 -13
  51. package/scripts/cocoapods/codegen_utils.rb +0 -389
  52. package/scripts/cocoapods/fabric.rb +0 -18
  53. package/scripts/cocoapods/helpers.rb +0 -150
  54. package/scripts/cocoapods/jsengine.rb +0 -33
  55. package/scripts/cocoapods/local_podspec_patch.rb +0 -51
  56. package/scripts/cocoapods/new_architecture.rb +0 -194
  57. package/scripts/cocoapods/privacy_manifest_utils.rb +0 -194
  58. package/scripts/cocoapods/runtime.rb +0 -18
  59. package/scripts/cocoapods/spm.rb +0 -94
  60. package/scripts/cocoapods/utils.rb +0 -724
  61. package/scripts/codegen/codegen-utils.js +0 -51
  62. package/scripts/codegen/generate-artifacts-executor.js +0 -982
  63. package/scripts/codegen/generate-specs-cli-executor.js +0 -128
  64. package/scripts/codegen/templates/RCTAppDependencyProviderH.template +0 -25
  65. package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +0 -55
  66. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +0 -18
  67. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +0 -33
  68. package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +0 -16
  69. package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +0 -23
  70. package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +0 -34
  71. package/sdks/hermes-engine/hermes-engine.podspec +0 -169
  72. package/sdks/hermes-engine/hermes-utils.rb +0 -289
  73. package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -225
  74. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +0 -100
  75. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +0 -18
  76. package/sdks/hermes-engine/utils/build-ios-framework.sh +0 -90
  77. package/sdks/hermes-engine/utils/build-mac-framework.sh +0 -22
  78. package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +0 -7
  79. package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -32
  80. package/sdks/hermes-engine/utils/replace_hermes_version.js +0 -106
@@ -1,724 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory of this source tree.
5
-
6
- require 'shellwords'
7
-
8
- require_relative "./helpers.rb"
9
-
10
- # Utilities class for React Native Cocoapods
11
- class ReactNativePodsUtils
12
- def self.warn_if_not_on_arm64
13
- if SysctlChecker.new().call_sysctl_arm64() == 1 && !Environment.new().ruby_platform().include?('arm64')
14
- Pod::UI.warn 'Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).'
15
- Pod::UI.warn ' - Emulated x86_64 is slower than native arm64'
16
- Pod::UI.warn ' - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)'
17
- Pod::UI.warn 'Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.'
18
- end
19
- end
20
-
21
- # deprecated. These checks are duplicated in the react_native_pods function
22
- # and we don't really need them. Removing this function will make it easy to
23
- # move forward.
24
- def self.get_default_flags
25
- flags = {
26
- :fabric_enabled => false,
27
- :hermes_enabled => true,
28
- }
29
-
30
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
31
- flags[:fabric_enabled] = true
32
- flags[:hermes_enabled] = true
33
- end
34
-
35
- if ENV['USE_HERMES'] == '0'
36
- flags[:hermes_enabled] = false
37
- end
38
-
39
- return flags
40
- end
41
-
42
- def self.has_pod(installer, name)
43
- installer.pods_project.pod_group(name) != nil
44
- end
45
-
46
- def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
47
- self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
48
- self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-jsinspector", :debug)
49
- self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
50
- self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
51
- end
52
-
53
- def self.turn_off_resource_bundle_react_core(installer)
54
- # this is needed for Xcode 14, see more details here https://github.com/facebook/react-native/issues/34673
55
- # we should be able to remove this once CocoaPods catches up to it, see more details here https://github.com/CocoaPods/CocoaPods/issues/11402
56
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
57
- if pod_name.to_s == 'React-Core'
58
- target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
59
- resource_bundle_target.build_configurations.each do |config|
60
- config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
61
- end
62
- end
63
- end
64
- end
65
- end
66
-
67
- def self.set_build_setting(installer, build_setting:, value:, config_name: nil)
68
- Pod::UI.puts("Setting #{build_setting} build settings")
69
- projects = self.extract_projects(installer)
70
-
71
- projects.each do |project|
72
- project.build_configurations.each do |config|
73
- if config_name == nil || config.name == config_name
74
- config.build_settings[build_setting] = value
75
- end
76
- end
77
-
78
- project.save()
79
- end
80
- end
81
-
82
- def self.set_ccache_compiler_and_linker_build_settings(installer, react_native_path, ccache_enabled)
83
- projects = self.extract_projects(installer)
84
-
85
- ccache_path = `command -v ccache`.strip
86
- ccache_available = !ccache_path.empty?
87
-
88
- message_prefix = "[Ccache]"
89
-
90
- if ccache_available
91
- Pod::UI.puts("#{message_prefix}: Ccache found at #{ccache_path}")
92
- end
93
-
94
- # Using scripts wrapping the ccache executable, to allow injection of configurations
95
- ccache_clang_sh = File.join("$(REACT_NATIVE_PATH)", 'scripts', 'xcode', 'ccache-clang.sh')
96
- ccache_clangpp_sh = File.join("$(REACT_NATIVE_PATH)", 'scripts', 'xcode', 'ccache-clang++.sh')
97
-
98
- if ccache_available and ccache_enabled
99
- Pod::UI.puts("#{message_prefix}: Setting CC, LD, CXX & LDPLUSPLUS build settings")
100
-
101
- projects.each do |project|
102
- project.build_configurations.each do |config|
103
- # Using the un-qualified names means you can swap in different implementations, for example ccache
104
- config.build_settings["CC"] = ccache_clang_sh
105
- config.build_settings["LD"] = ccache_clang_sh
106
- config.build_settings["CXX"] = ccache_clangpp_sh
107
- config.build_settings["LDPLUSPLUS"] = ccache_clangpp_sh
108
- config.build_settings["CCACHE_BINARY"] = ccache_path
109
- end
110
-
111
- project.save()
112
- end
113
- elsif ccache_available and !ccache_enabled
114
- Pod::UI.puts("#{message_prefix}: Pass ':ccache_enabled => true' to 'react_native_post_install' in your Podfile or set environment variable 'USE_CCACHE=1' to increase the speed of subsequent builds")
115
- elsif !ccache_available and ccache_enabled
116
- Pod::UI.warn("#{message_prefix}: Install ccache or ensure your neither passing ':ccache_enabled => true' nor setting environment variable 'USE_CCACHE=1'")
117
- else
118
- Pod::UI.puts("#{message_prefix}: Removing Ccache from CC, LD, CXX & LDPLUSPLUS build settings")
119
-
120
- projects.each do |project|
121
- project.build_configurations.each do |config|
122
- # Using the un-qualified names means you can swap in different implementations, for example ccache
123
- config.build_settings["CC"] = config.build_settings["CC"].gsub(/#{Regexp.escape(ccache_clang_sh)}/, '') if config.build_settings["CC"]
124
- config.build_settings["LD"] = config.build_settings["LD"].gsub(/#{Regexp.escape(ccache_clang_sh)}/, "") if config.build_settings["LD"]
125
- config.build_settings["CXX"] = config.build_settings["CXX"].gsub(/#{Regexp.escape(ccache_clangpp_sh)}/, "") if config.build_settings["CXX"]
126
- config.build_settings["LDPLUSPLUS"] = config.build_settings["LDPLUSPLUS"].gsub(/#{Regexp.escape(ccache_clangpp_sh)}/, "") if config.build_settings["LDPLUSPLUS"]
127
- end
128
-
129
- project.save()
130
- end
131
- end
132
- end
133
-
134
- def self.fix_library_search_paths(installer)
135
- projects = self.extract_projects(installer)
136
-
137
- projects.each do |project|
138
- project.build_configurations.each do |config|
139
- self.fix_library_search_path(config)
140
- end
141
- project.native_targets.each do |target|
142
- target.build_configurations.each do |config|
143
- self.fix_library_search_path(config)
144
- end
145
- end
146
- project.save()
147
- end
148
- end
149
-
150
- def self.apply_mac_catalyst_patches(installer)
151
- # Fix bundle signing issues
152
- installer.pods_project.targets.each do |target|
153
- if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
154
- target.build_configurations.each do |config|
155
- config.build_settings['CODE_SIGN_IDENTITY[sdk=macosx*]'] = '-'
156
- end
157
- end
158
- end
159
-
160
- installer.aggregate_targets.each do |aggregate_target|
161
- aggregate_target.user_project.native_targets.each do |target|
162
- target.build_configurations.each do |config|
163
- # Explicitly set dead code stripping flags
164
- config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
165
- config.build_settings['PRESERVE_DEAD_CODE_INITS_AND_TERMS'] = 'YES'
166
- # Modify library search paths
167
- config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(SDKROOT)/System/iOSSupport/usr/lib/swift', '$(inherited)']
168
- end
169
- end
170
- aggregate_target.user_project.save()
171
- end
172
- end
173
-
174
- def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
175
- projects = self.extract_projects(installer)
176
-
177
- other_ld_flags_key = 'OTHER_LDFLAGS'
178
- xcode15_compatibility_flags = '-Wl -ld_classic '
179
-
180
- projects.each do |project|
181
- project.build_configurations.each do |config|
182
- # fix for weak linking
183
- self.safe_init(config, other_ld_flags_key)
184
- if self.is_using_xcode15_0(:xcodebuild_manager => xcodebuild_manager)
185
- self.add_value_to_setting_if_missing(config, other_ld_flags_key, xcode15_compatibility_flags)
186
- else
187
- self.remove_value_from_setting_if_present(config, other_ld_flags_key, xcode15_compatibility_flags)
188
- end
189
- end
190
- project.save()
191
- end
192
-
193
- end
194
-
195
- private
196
-
197
- def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration_type)
198
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
199
- if pod_name.to_s == target_pod_name
200
- target_installation_result.native_target.build_configurations.each do |config|
201
- if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
202
- config.build_settings[settings_name] ||= '$(inherited) '
203
- config.build_settings[settings_name] << settings_value
204
- end
205
- end
206
- end
207
- end
208
- end
209
-
210
- def self.fix_library_search_path(config)
211
- lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
212
-
213
- if lib_search_paths == nil
214
- # No search paths defined, return immediately
215
- return
216
- end
217
-
218
- if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
219
- # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple Silicon)
220
- # since the libraries there are only built for x86_64 and i386.
221
- lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
222
- lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
223
- end
224
-
225
- if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
226
- # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
227
- lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
228
- end
229
- end
230
-
231
- def self.create_xcode_env_if_missing(file_manager: File)
232
- relative_path = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
233
- file_path = file_manager.join(relative_path, '.xcode.env')
234
-
235
- if !file_manager.exist?(file_path)
236
- system("echo 'export NODE_BINARY=$(command -v node)' > #{file_path}")
237
- end
238
-
239
- if !file_manager.exist?("#{file_path}.local")
240
- # When installing pods with a yarn alias, yarn creates a fake yarn and node executables
241
- # in a temporary folder.
242
- # Using `node --print "process.argv[0]";` we are able to retrieve the actual path from which node is running.
243
- # see https://github.com/facebook/react-native/issues/43285 for more info. We've tweaked this slightly.
244
- node_binary = Shellwords.escape(`node --print "process.argv[0]"`.strip)
245
- system("echo 'export NODE_BINARY=#{node_binary}' > #{file_path}.local")
246
- end
247
- end
248
-
249
- # It examines the target_definition property and sets the appropriate value for
250
- # ENV['USE_FRAMEWORKS'] variable.
251
- #
252
- # - parameter target_definition: The current target definition
253
- def self.detect_use_frameworks(target_definition)
254
- if ENV['USE_FRAMEWORKS'] != nil
255
- return
256
- end
257
-
258
- framework_build_type = target_definition.build_type.to_s
259
-
260
- Pod::UI.puts("Framework build type is #{framework_build_type}")
261
-
262
- if framework_build_type === "static framework"
263
- ENV['USE_FRAMEWORKS'] = 'static'
264
- elsif framework_build_type === "dynamic framework"
265
- ENV['USE_FRAMEWORKS'] = 'dynamic'
266
- else
267
- ENV['USE_FRAMEWORKS'] = nil
268
- end
269
- end
270
-
271
- def self.create_header_search_path_for_frameworks(base_folder, pod_name, framework_name, additional_paths, include_base_path = true)
272
- platforms = $RN_PLATFORMS != nil ? $RN_PLATFORMS : []
273
- search_paths = []
274
-
275
- if platforms.empty?() || platforms.length() == 1
276
- base_path = File.join("${#{base_folder}}", pod_name, "#{framework_name}.framework", "Headers")
277
- self.add_search_path_to_result(search_paths, base_path, additional_paths, include_base_path)
278
- else
279
- platforms.each { |platform|
280
- base_path = File.join("${#{base_folder}}", "#{pod_name}-#{platform}", "#{framework_name}.framework", "Headers")
281
- self.add_search_path_to_result(search_paths, base_path, additional_paths, include_base_path)
282
- }
283
- end
284
- return search_paths
285
- end
286
-
287
- # Add a new dependency to an existing spec, configuring also the headers search paths
288
- def self.add_dependency(spec, dependency_name, base_folder_for_frameworks, framework_name, additional_paths: [], version: nil, subspec_dependency: nil)
289
- # Update Search Path
290
- optional_current_search_path = spec.to_hash["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"]
291
- current_search_paths = (optional_current_search_path != nil ? optional_current_search_path : "")
292
- .split(" ")
293
- create_header_search_path_for_frameworks(base_folder_for_frameworks, dependency_name, framework_name, additional_paths)
294
- .each { |path|
295
- wrapped_path = "\"#{path}\""
296
- current_search_paths << wrapped_path
297
- }
298
- current_pod_target_xcconfig = spec.to_hash["pod_target_xcconfig"]
299
- current_pod_target_xcconfig["HEADER_SEARCH_PATHS"] = current_search_paths.join(" ")
300
- spec.pod_target_xcconfig = current_pod_target_xcconfig
301
-
302
- actual_dependency = subspec_dependency != nil ? "#{dependency_name}/#{subspec_dependency}" : dependency_name
303
- # Set Dependency
304
- if !version
305
- spec.dependency actual_dependency
306
- else
307
- spec.dependency actual_dependency, version
308
- end
309
- end
310
-
311
- def self.update_search_paths(installer)
312
- return if ENV['USE_FRAMEWORKS'] == nil
313
-
314
- projects = self.extract_projects(installer)
315
-
316
- projects.each do |project|
317
- project.build_configurations.each do |config|
318
-
319
- header_search_paths = config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited)"
320
-
321
- ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"])
322
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon-Samples", "ReactCommon_Samples", ["platform/ios"]))
323
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"], false))
324
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", []))
325
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"]))
326
- .each{ |search_path|
327
- header_search_paths = self.add_search_path_if_not_included(header_search_paths, search_path)
328
- }
329
-
330
- config.build_settings["HEADER_SEARCH_PATHS"] = header_search_paths
331
- end
332
-
333
- project.save()
334
- end
335
-
336
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
337
- if self.react_native_pods.include?(pod_name) || pod_name.include?("Pod") || pod_name.include?("Tests")
338
- next
339
- end
340
-
341
- self.set_rctfolly_search_paths(target_installation_result)
342
- self.set_codegen_search_paths(target_installation_result)
343
- self.set_reactcommon_searchpaths(target_installation_result)
344
- self.set_rctfabric_search_paths(target_installation_result)
345
- self.set_imagemanager_search_path(target_installation_result)
346
- end
347
- end
348
-
349
- def self.updateOSDeploymentTarget(installer)
350
- installer.target_installation_results.pod_target_installation_results
351
- .each do |pod_name, target_installation_result|
352
- target_installation_result.native_target.build_configurations.each do |config|
353
- old_iphone_deploy_target = config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] ?
354
- config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] :
355
- Helpers::Constants.min_ios_version_supported
356
- config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = [Helpers::Constants.min_ios_version_supported.to_f, old_iphone_deploy_target.to_f].max.to_s
357
- # [macOS
358
- old_macos_deploy_target = config.build_settings["MACOSX_DEPLOYMENT_TARGET"] ?
359
- config.build_settings["MACOSX_DEPLOYMENT_TARGET"] :
360
- Helpers::Constants.min_macos_version_supported
361
- config.build_settings["MACOSX_DEPLOYMENT_TARGET"] = [Helpers::Constants.min_macos_version_supported.to_f, old_macos_deploy_target.to_f].max.to_s
362
- # macOS]
363
- # [visionOS
364
- old_visionos_deploy_target = config.build_settings["XROS_DEPLOYMENT_TARGET"] ?
365
- config.build_settings["XROS_DEPLOYMENT_TARGET"] :
366
- Helpers::Constants.min_visionos_version_supported
367
- config.build_settings["XROS_DEPLOYMENT_TARGET"] = [Helpers::Constants.min_visionos_version_supported.to_f, old_visionos_deploy_target.to_f].max.to_s
368
- # visionOS]
369
- end
370
- end
371
- end
372
-
373
- def self.set_dynamic_frameworks_flags(installer)
374
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
375
-
376
- # Set "RCT_DYNAMIC_FRAMEWORKS=1" if pod are installed with USE_FRAMEWORKS=dynamic
377
- # This helps with backward compatibility.
378
- if pod_name == 'React-RCTFabric' && ENV['USE_FRAMEWORKS'] == 'dynamic'
379
- Pod::UI.puts "Setting -DRCT_DYNAMIC_FRAMEWORKS=1 to React-RCTFabric".green
380
- rct_dynamic_framework_flag = " -DRCT_DYNAMIC_FRAMEWORKS=1"
381
- target_installation_result.native_target.build_configurations.each do |config|
382
- prev_build_settings = config.build_settings['OTHER_CPLUSPLUSFLAGS'] != nil ? config.build_settings['OTHER_CPLUSPLUSFLAGS'] : "$(inherited)"
383
- config.build_settings['OTHER_CPLUSPLUSFLAGS'] = prev_build_settings + rct_dynamic_framework_flag
384
- end
385
- end
386
- end
387
- end
388
-
389
- # ========= #
390
- # Utilities #
391
- # ========= #
392
-
393
- def self.extract_projects(installer)
394
- return installer.aggregate_targets
395
- .map{ |t| t.user_project }
396
- .uniq{ |p| p.path }
397
- .push(installer.pods_project)
398
- end
399
-
400
- def self.safe_init(config, setting_name)
401
- old_config = config.build_settings[setting_name]
402
- if old_config == nil
403
- config.build_settings[setting_name] ||= '$(inherited) '
404
- end
405
- end
406
-
407
- def self.add_value_to_setting_if_missing(config, setting_name, value)
408
- old_config = config.build_settings[setting_name]
409
- if old_config.is_a?(Array)
410
- old_config = old_config.join(" ")
411
- end
412
-
413
- trimmed_value = value.strip()
414
- if !old_config.include?(trimmed_value)
415
- config.build_settings[setting_name] = "#{old_config.strip()} #{trimmed_value}".strip()
416
- end
417
- end
418
-
419
- def self.remove_value_from_setting_if_present(config, setting_name, value)
420
- old_config = config.build_settings[setting_name]
421
- if old_config.is_a?(Array)
422
- old_config = old_config.join(" ")
423
- end
424
-
425
- trimmed_value = value.strip()
426
- if old_config.include?(trimmed_value)
427
- new_config = old_config.gsub(trimmed_value, "")
428
- config.build_settings[setting_name] = new_config.strip()
429
- end
430
- end
431
-
432
- def self.is_using_xcode15_0(xcodebuild_manager: Xcodebuild)
433
- xcodebuild_version = xcodebuild_manager.version
434
-
435
- if version = self.parse_xcode_version(xcodebuild_version)
436
- return version["major"] == 15 && version["minor"] == 0
437
- end
438
-
439
- return false
440
- end
441
-
442
- def self.parse_xcode_version(version_string)
443
- # The output of xcodebuild -version is something like
444
- # Xcode 15.0
445
- # or
446
- # Xcode 14.3.1
447
- # We want to capture the version digits
448
- match = version_string.match(/(\d+)\.(\d+)(?:\.(\d+))?/)
449
- return nil if match.nil?
450
-
451
- return {"str" => match[0], "major" => match[1].to_i, "minor" => match[2].to_i};
452
- end
453
-
454
- def self.check_minimum_required_xcode(xcodebuild_manager: Xcodebuild)
455
- version = self.parse_xcode_version(xcodebuild_manager.version)
456
- if (version.nil? || !Gem::Version::correct?(version["str"]))
457
- Pod::UI.warn "Unexpected XCode version string '#{xcodebuild_manager.version}'"
458
- return
459
- end
460
-
461
- current = version["str"]
462
- min_required = Helpers::Constants.min_xcode_version_supported
463
-
464
- if Gem::Version::new(current) < Gem::Version::new(min_required)
465
- Pod::UI.puts "React Native requires XCode >= #{min_required}. Found #{current}.".red
466
- raise "Please upgrade XCode"
467
- end
468
- end
469
-
470
- def self.add_compiler_flag_to_project(installer, flag, configuration: nil)
471
- projects = self.extract_projects(installer)
472
-
473
- projects.each do |project|
474
- project.build_configurations.each do |config|
475
- self.set_flag_in_config(config, flag, configuration: configuration)
476
- end
477
- project.save()
478
- end
479
- end
480
-
481
- def self.remove_compiler_flag_from_project(installer, flag, configuration: nil)
482
- projects = self.extract_projects(installer)
483
-
484
- projects.each do |project|
485
- project.build_configurations.each do |config|
486
- self.remove_flag_in_config(config, flag, configuration: configuration)
487
- end
488
- project.save()
489
- end
490
- end
491
-
492
- def self.add_compiler_flag_to_pods(installer, flag, configuration: nil)
493
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
494
- target_installation_result.native_target.build_configurations.each do |config|
495
- self.set_flag_in_config(config, flag, configuration: configuration)
496
- end
497
- end
498
- end
499
-
500
- def self.set_flag_in_config(config, flag, configuration: nil)
501
- if configuration == nil || config.name == configuration
502
- self.add_flag_for_key(config, flag, "OTHER_CFLAGS")
503
- self.add_flag_for_key(config, flag, "OTHER_CPLUSPLUSFLAGS")
504
- end
505
- end
506
-
507
- def self.remove_flag_in_config(config, flag, configuration: nil)
508
- if configuration == nil || config.name == configuration
509
- self.remove_flag_for_key(config, flag, "OTHER_CFLAGS")
510
- self.remove_flag_for_key(config, flag, "OTHER_CPLUSPLUSFLAGS")
511
- end
512
- end
513
-
514
-
515
- def self.add_flag_for_key(config, flag, key)
516
- current_setting = config.build_settings[key] ? config.build_settings[key] : "$(inherited)"
517
-
518
- if current_setting.kind_of?(Array)
519
- current_setting = current_setting
520
- .map { |s| s.gsub('"', '') }
521
- .map { |s| s.gsub('\"', '') }
522
- .join(" ")
523
- end
524
-
525
- if !current_setting.include?(flag)
526
- current_setting = "#{current_setting} #{flag}"
527
- end
528
-
529
- config.build_settings[key] = current_setting
530
- end
531
-
532
- def self.remove_flag_for_key(config, flag, key)
533
- current_setting = config.build_settings[key] ? config.build_settings[key] : "$(inherited)"
534
-
535
- if current_setting.kind_of?(Array)
536
- current_setting = current_setting
537
- .map { |s| s.gsub('"', '') }
538
- .map { |s| s.gsub('\"', '') }
539
- .join(" ")
540
- end
541
-
542
- if current_setting.include?(flag)
543
- current_setting.slice! flag
544
- end
545
-
546
- config.build_settings[key] = current_setting
547
- end
548
-
549
- def self.add_search_path_if_not_included(current_search_paths, new_search_path)
550
- new_search_path = new_search_path.strip
551
-
552
- if current_search_paths.is_a?(String)
553
- current_search_paths = current_search_paths.strip
554
- return "#{current_search_paths} #{new_search_path}" unless current_search_paths.include?(new_search_path)
555
- end
556
-
557
- if current_search_paths.is_a?(Array)
558
- current_search_paths = current_search_paths.map(&:strip)
559
- return current_search_paths << new_search_path unless current_search_paths.include?(new_search_path)
560
- end
561
-
562
- current_search_paths
563
- end
564
-
565
- def self.update_header_paths_if_depends_on(target_installation_result, dependency_name, header_paths)
566
- depends_on_framework = target_installation_result.native_target.dependencies.any? { |d| d.name == dependency_name }
567
- if depends_on_framework
568
- target_installation_result.native_target.build_configurations.each do |config|
569
- header_search_path = config.build_settings["HEADER_SEARCH_PATHS"] != nil ? config.build_settings["HEADER_SEARCH_PATHS"] : "$(inherited)"
570
- header_paths.each { |header| header_search_path = ReactNativePodsUtils.add_search_path_if_not_included(header_search_path, header) }
571
- config.build_settings["HEADER_SEARCH_PATHS"] = header_search_path
572
- end
573
- end
574
- end
575
-
576
- def self.set_rctfolly_search_paths(target_installation_result)
577
- ReactNativePodsUtils.update_header_paths_if_depends_on(target_installation_result, "RCT-Folly", [
578
- "\"$(PODS_ROOT)/RCT-Folly\"",
579
- "\"$(PODS_ROOT)/DoubleConversion\"",
580
- "\"$(PODS_ROOT)/fast_float/include\"",
581
- "\"$(PODS_ROOT)/fmt/include\"",
582
- "\"$(PODS_ROOT)/boost\""
583
- ])
584
- end
585
-
586
- def self.set_codegen_search_paths(target_installation_result)
587
- header_search_paths = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCodegen", "ReactCodegen", [])
588
- .map { |search_path| "\"#{search_path}\"" }
589
- ReactNativePodsUtils.update_header_paths_if_depends_on(target_installation_result, "ReactCodegen", header_search_paths)
590
- end
591
-
592
- def self.set_reactcommon_searchpaths(target_installation_result)
593
- header_search_paths = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"])
594
- .map { |search_path| "\"#{search_path}\"" }
595
- ReactNativePodsUtils.update_header_paths_if_depends_on(target_installation_result, "ReactCommon", header_search_paths)
596
- end
597
-
598
- def self.set_rctfabric_search_paths(target_installation_result)
599
- header_search_paths = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", [])
600
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"]))
601
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", []))
602
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Graphics", "React_graphics", ["react/renderer/graphics/platform/ios"]))
603
- .map { |search_path| "\"#{search_path}\"" }
604
-
605
- ReactNativePodsUtils.update_header_paths_if_depends_on(target_installation_result, "React-RCTFabric", header_search_paths)
606
- end
607
-
608
- def self.set_imagemanager_search_path(target_installation_result)
609
- header_search_paths = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/imagemanager/platform/ios"])
610
- .map { |search_path| "\"#{search_path}\"" }
611
- ReactNativePodsUtils.update_header_paths_if_depends_on(target_installation_result, "React-ImageManager", header_search_paths)
612
- end
613
-
614
- def self.react_native_pods
615
- return [
616
- "DoubleConversion",
617
- "FBLazyVector",
618
- "RCT-Folly",
619
- "RCTRequired",
620
- "RCTTypeSafety",
621
- "React",
622
- "ReactCodegen",
623
- "React-Core",
624
- "React-CoreModules",
625
- "React-Fabric",
626
- "React-FabricImage",
627
- "React-ImageManager",
628
- "React-RCTActionSheet",
629
- "React-RCTAnimation",
630
- "React-RCTAppDelegate",
631
- "React-RCTBlob",
632
- "React-RCTFabric",
633
- "React-RCTImage",
634
- "React-RCTLinking",
635
- "React-RCTNetwork",
636
- "React-RCTPushNotification",
637
- "React-RCTSettings",
638
- "React-RCTText",
639
- "React-RCTTest",
640
- "React-RCTVibration",
641
- "React-callinvoker",
642
- "React-cxxreact",
643
- "React-graphics",
644
- "React-jsc",
645
- "React-jsi",
646
- "React-jsiexecutor",
647
- "React-jsinspector",
648
- "React-logger",
649
- "React-perflogger",
650
- "React-rncore",
651
- "React-runtimeexecutor",
652
- "React-timing",
653
- "ReactCommon",
654
- "Yoga",
655
- "boost",
656
- "fast_float",
657
- "fmt",
658
- "glog",
659
- "hermes-engine",
660
- "React-hermes",
661
- ]
662
- end
663
-
664
- def self.add_search_path_to_result(result, base_path, additional_paths, include_base_path)
665
- if (include_base_path)
666
- result << base_path
667
- end
668
-
669
- additional_paths.each { |extra_path|
670
- result << File.join(base_path, extra_path)
671
- }
672
- return result
673
- end
674
-
675
- def self.add_ndebug_flag_to_pods_in_release(installer)
676
- ndebug_flag = " -DNDEBUG"
677
-
678
- installer.aggregate_targets.each do |aggregate_target|
679
- aggregate_target.xcconfigs.each do |config_name, config_file|
680
- is_release = aggregate_target.user_build_configurations[config_name] == :release
681
- unless is_release
682
- next
683
- end
684
- self.add_flag_to_map_with_inheritance(config_file.attributes, 'OTHER_CPLUSPLUSFLAGS', ndebug_flag);
685
- self.add_flag_to_map_with_inheritance(config_file.attributes, 'OTHER_CFLAGS', ndebug_flag);
686
-
687
- xcconfig_path = aggregate_target.xcconfig_path(config_name)
688
- config_file.save_as(xcconfig_path)
689
- end
690
- end
691
-
692
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
693
- target_installation_result.native_target.build_configurations.each do |config|
694
- is_release = config.type == :release
695
- unless is_release
696
- next
697
- end
698
- self.add_flag_to_map_with_inheritance(config.build_settings, 'OTHER_CPLUSPLUSFLAGS', ndebug_flag);
699
- self.add_flag_to_map_with_inheritance(config.build_settings, 'OTHER_CFLAGS', ndebug_flag);
700
- end
701
- end
702
- end
703
-
704
- def self.add_flag_to_map_with_inheritance(map, field, flag)
705
- if map[field] == nil
706
- map[field] = "$(inherited)" + flag
707
- else
708
- unless map[field].include?(flag)
709
- if map[field].instance_of? String
710
- map[field] = map[field] + flag
711
- elsif map[field].instance_of? Array
712
- map[field].push(flag)
713
- end
714
- end
715
- unless map[field].include?("$(inherited)")
716
- if map[field].instance_of? String
717
- map[field] = "$(inherited) " + map[field]
718
- elsif map[field].instance_of? Array
719
- map[field].unshift("$(inherited)")
720
- end
721
- end
722
- end
723
- end
724
- end