react-native-macos 0.77.4 → 0.77.6

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