react-native-macos 0.76.10 → 0.76.11

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 (57) hide show
  1. package/Libraries/Blob/RCTBlobManager.h +0 -0
  2. package/Libraries/Blob/RCTBlobManager.mm +0 -0
  3. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/Libraries/StyleSheet/normalizeColor.js +0 -0
  6. package/React/Base/RCTJavaScriptLoader.h +0 -0
  7. package/React/Base/RCTJavaScriptLoader.mm +0 -0
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/React/CoreModules/RCTLogBoxView.mm +4 -1
  10. package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +82 -14
  11. package/ReactAndroid/gradle.properties +1 -1
  12. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  13. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  14. package/local-cli/cli.js +0 -0
  15. package/package.json +3 -3
  16. package/scripts/compose-source-maps.js +0 -0
  17. package/scripts/featureflags/README.md +156 -0
  18. package/scripts/featureflags/index.js +14 -0
  19. package/scripts/ios-configure-glog.sh +0 -0
  20. package/scripts/node-binary.sh +0 -0
  21. package/scripts/packager.sh +0 -0
  22. package/scripts/react-native-xcode.sh +0 -0
  23. package/scripts/react_native_pods_utils/script_phases.sh +0 -0
  24. package/scripts/xcode/ccache-clang++.sh +0 -0
  25. package/scripts/xcode/ccache-clang.sh +0 -0
  26. package/scripts/xcode/with-environment.sh +0 -0
  27. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +0 -2354
  28. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +0 -2820
  29. package/scripts/cocoapods/autolinking.rb +0 -206
  30. package/scripts/cocoapods/autolinking_utils.rb +0 -25
  31. package/scripts/cocoapods/codegen.rb +0 -59
  32. package/scripts/cocoapods/codegen_script_phase_extractor.rb +0 -13
  33. package/scripts/cocoapods/codegen_utils.rb +0 -363
  34. package/scripts/cocoapods/fabric.rb +0 -18
  35. package/scripts/cocoapods/helpers.rb +0 -148
  36. package/scripts/cocoapods/jsengine.rb +0 -33
  37. package/scripts/cocoapods/local_podspec_patch.rb +0 -51
  38. package/scripts/cocoapods/new_architecture.rb +0 -193
  39. package/scripts/cocoapods/privacy_manifest_utils.rb +0 -194
  40. package/scripts/cocoapods/runtime.rb +0 -18
  41. package/scripts/cocoapods/spm.rb +0 -94
  42. package/scripts/cocoapods/utils.rb +0 -729
  43. package/scripts/codegen/codegen-utils.js +0 -51
  44. package/scripts/codegen/generate-artifacts-executor.js +0 -815
  45. package/scripts/codegen/generate-specs-cli-executor.js +0 -128
  46. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +0 -18
  47. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +0 -33
  48. package/sdks/hermes-engine/hermes-engine.podspec +0 -160
  49. package/sdks/hermes-engine/hermes-utils.rb +0 -337
  50. package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -225
  51. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +0 -100
  52. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +0 -18
  53. package/sdks/hermes-engine/utils/build-ios-framework.sh +0 -85
  54. package/sdks/hermes-engine/utils/build-mac-framework.sh +0 -22
  55. package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +0 -7
  56. package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -32
  57. package/sdks/hermes-engine/utils/replace_hermes_version.js +0 -106
@@ -1,18 +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
-
7
- # It sets up the Fabric dependencies.
8
- #
9
- # @parameter react_native_path: relative path to react-native
10
- def setup_fabric!(react_native_path: "../node_modules/react-native")
11
- pod 'React-Fabric', :path => "#{react_native_path}/ReactCommon"
12
- pod 'React-FabricComponents', :path => "#{react_native_path}/ReactCommon"
13
- pod 'React-graphics', :path => "#{react_native_path}/ReactCommon/react/renderer/graphics"
14
- pod 'React-RCTFabric', :path => "#{react_native_path}/React", :modular_headers => true
15
- pod 'React-ImageManager', :path => "#{react_native_path}/ReactCommon/react/renderer/imagemanager/platform/ios"
16
- pod 'RCT-Folly/Fabric', :podspec => "#{react_native_path}/third-party-podspecs/RCT-Folly.podspec"
17
- pod 'React-FabricImage', :path => "#{react_native_path}/ReactCommon"
18
- end
@@ -1,148 +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
- # Helper object to wrap the invocation of sysctl
7
- # This makes it easier to mock the behaviour in tests
8
- class SysctlChecker
9
- def call_sysctl_arm64
10
- return `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i
11
- end
12
- end
13
-
14
- # Helper class that is used to easily send commands to Xcodebuild
15
- # And that can be subclassed for testing purposes.
16
- class Xcodebuild
17
- def self.version
18
- `xcodebuild -version`
19
- end
20
- end
21
-
22
- # Helper object to wrap system properties like RUBY_PLATFORM
23
- # This makes it easier to mock the behaviour in tests
24
- class Environment
25
- def ruby_platform
26
- return RUBY_PLATFORM
27
- end
28
- end
29
-
30
- class Finder
31
- def self.find_codegen_file(path)
32
- js_files = '-name "Native*.js" -or -name "*NativeComponent.js"'
33
- ts_files = '-name "Native*.ts" -or -name "*NativeComponent.ts"'
34
- return `find #{path} -type f \\( #{js_files} -or #{ts_files} \\)`.split("\n").sort()
35
- end
36
- end
37
-
38
- module Helpers
39
- class Constants
40
- @@boost_config = {
41
- :git => "https://github.com/react-native-community/boost-for-react-native",
42
- }
43
-
44
- @@socket_rocket_config = {
45
- :version => '0.7.1'
46
- }
47
-
48
- @@folly_config = {
49
- :version => '2024.10.14.00',
50
- :git => 'https://github.com/facebook/folly.git',
51
- :compiler_flags => '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32'
52
- }
53
-
54
- @@fast_float_config = {
55
- :git => "https://github.com/fastfloat/fast_float.git",
56
- }
57
-
58
- @@fmt_config = {
59
- :git => "https://github.com/fmtlib/fmt.git",
60
- }
61
-
62
- @@glog_config = {
63
- :git => "https://github.com/google/glog.git",
64
- }
65
-
66
- @@double_conversion_config = {
67
- :git => "https://github.com/google/double-conversion.git",
68
- }
69
-
70
- def self.min_ios_version_supported
71
- return '15.1'
72
- end
73
- # [macOS
74
- def self.min_macos_version_supported
75
- return '11.0'
76
- end
77
- # macOS]
78
- # [visionOS
79
- def self.min_visionos_version_supported
80
- return '1.0'
81
- end
82
- # visionOS]
83
-
84
- def self.min_xcode_version_supported
85
- return '15.1'
86
- end
87
-
88
- def self.folly_config
89
- return @@folly_config
90
- end
91
-
92
- def self.set_folly_config(new_folly_config)
93
- @@folly_config.update(new_folly_config)
94
- end
95
-
96
- def self.fast_float_config
97
- return @@fast_float_config
98
- end
99
-
100
- def self.set_fast_float_config(new_fast_float_config)
101
- @@fast_float_config.update(new_fast_float_config)
102
- end
103
-
104
- def self.boost_config
105
- return @@boost_config
106
- end
107
-
108
- def self.set_boost_config(new_boost_config)
109
- @@boost_config.update(new_boost_config)
110
- end
111
-
112
- def self.socket_rocket_config
113
- return @@socket_rocket_config
114
- end
115
-
116
- def self.set_socket_rocket_config(new_socket_rocket_config)
117
- @@socket_rocket_config.update(new_socket_rocket_config)
118
- end
119
-
120
- def self.fmt_config
121
- return @@fmt_config
122
- end
123
-
124
- def self.set_fmt_config(new_fmt_config)
125
- @@fmt_config.update(new_fmt_config)
126
- end
127
-
128
- def self.glog_config
129
- return @@glog_config
130
- end
131
-
132
- def self.set_glog_config(new_glog_config)
133
- @@glog_config.update(new_glog_config)
134
- end
135
-
136
- def self.double_conversion_config
137
- return @@double_conversion_config
138
- end
139
-
140
- def self.set_double_conversion_config(new_double_conversion_config)
141
- @@double_conversion_config.update(new_double_conversion_config)
142
- end
143
-
144
- def self.cxx_language_standard
145
- return "c++20"
146
- end
147
- end
148
- end
@@ -1,33 +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_relative './utils.rb'
7
-
8
- # It sets up the JavaScriptCore and JSI pods.
9
- #
10
- # @parameter react_native_path: relative path to react-native
11
- # @parameter fabric_enabled: whether Fabirc is enabled
12
- def setup_jsc!(react_native_path: "../node_modules/react-native", fabric_enabled: false)
13
- pod 'React-jsi', :path => "#{react_native_path}/ReactCommon/jsi"
14
- pod 'React-jsc', :path => "#{react_native_path}/ReactCommon/jsc"
15
- if fabric_enabled
16
- pod 'React-jsc/Fabric', :path => "#{react_native_path}/ReactCommon/jsc"
17
- end
18
- end
19
-
20
- # It sets up the Hermes and JSI pods.
21
- #
22
- # @parameter react_native_path: relative path to react-native
23
- # @parameter fabric_enabled: whether Fabirc is enabled
24
- def setup_hermes!(react_native_path: "../node_modules/react-native")
25
- react_native_dir = Pod::Config.instance.installation_root.join(react_native_path)
26
- pod 'React-jsi', :path => "#{react_native_path}/ReactCommon/jsi"
27
- # This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
28
- # We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
29
- hermestag_file = File.join(react_native_dir, "sdks", ".hermesversion")
30
- hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : ''
31
- pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag
32
- pod 'React-hermes', :path => "#{react_native_path}/ReactCommon/hermes"
33
- end
@@ -1,51 +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
- # Monkeypatch of `Pod::Lockfile` to ensure automatic update of dependencies integrated with a local podspec when their version changed.
7
- # This is necessary because local podspec dependencies must be otherwise manually updated.
8
- module LocalPodspecPatch
9
- # Returns local podspecs whose versions differ from the one in the `react-native` package.
10
- def self.pods_to_update(react_native_path: "../node_modules/react-native", dir_manager: Dir, file_manager: File)
11
- @@local_podspecs = dir_manager.glob("#{react_native_path}/third-party-podspecs/*").map { |file| file_manager.basename(file, ".podspec") }
12
- @@local_podspecs = @@local_podspecs.select do |podspec_name|
13
-
14
- # Read local podspec to determine the cached version
15
- local_podspec_path = file_manager.join(
16
- dir_manager.pwd, "Pods/Local Podspecs/#{podspec_name}.podspec.json"
17
- )
18
-
19
- # Local podspec cannot be outdated if it does not exist, yet
20
- next unless file_manager.exist?(local_podspec_path)
21
-
22
- local_podspec = file_manager.read(local_podspec_path)
23
- local_podspec_json = JSON.parse(local_podspec)
24
- local_version = local_podspec_json["version"]
25
-
26
- # Read the version from a podspec from the `react-native` package
27
- podspec_path = "#{react_native_path}/third-party-podspecs/#{podspec_name}.podspec"
28
- current_podspec = Pod::Specification.from_file(podspec_path)
29
- current_version = current_podspec.version.to_s
30
- current_version != local_version
31
- end
32
- @@local_podspecs
33
- end
34
-
35
- # Patched `detect_changes_with_podfile` method
36
- def detect_changes_with_podfile(podfile)
37
- Pod::UI.puts "Invoke detect_changes_with_podfile patched method".red
38
- changes = super(podfile)
39
- return patch_detect_changes_with_podfile(changes)
40
- end
41
-
42
- def patch_detect_changes_with_podfile(changes)
43
- @@local_podspecs.each do |local_podspec|
44
- next unless changes[:unchanged].include?(local_podspec)
45
-
46
- changes[:unchanged].delete(local_podspec)
47
- changes[:changed] << local_podspec
48
- end
49
- changes
50
- end
51
- end
@@ -1,193 +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 'json'
7
-
8
- require_relative "./utils.rb"
9
- require_relative "./helpers.rb"
10
-
11
- class NewArchitectureHelper
12
- @@NewArchWarningEmitted = false # Used not to spam warnings to the user.
13
-
14
- def self.set_clang_cxx_language_standard_if_needed(installer)
15
- cxxBuildsettingsName = "CLANG_CXX_LANGUAGE_STANDARD"
16
- projects = installer.aggregate_targets
17
- .map{ |t| t.user_project }
18
- .uniq{ |p| p.path }
19
-
20
- projects.each do |project|
21
- Pod::UI.puts("Setting #{cxxBuildsettingsName} to #{ Helpers::Constants::cxx_language_standard } on #{ project.path }")
22
-
23
- project.build_configurations.each do |config|
24
- config.build_settings[cxxBuildsettingsName] = Helpers::Constants::cxx_language_standard
25
- end
26
-
27
- project.save()
28
- end
29
-
30
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
31
- target_installation_result.native_target.build_configurations.each do |config|
32
- config.build_settings[cxxBuildsettingsName] = Helpers::Constants::cxx_language_standard
33
- end
34
- end
35
-
36
- # Override targets that would set spec.xcconfig to define c++ version
37
- installer.aggregate_targets.each do |aggregate_target|
38
- aggregate_target.xcconfigs.each do |config_name, config_file|
39
- config_file.attributes[cxxBuildsettingsName] = Helpers::Constants::cxx_language_standard
40
- end
41
- end
42
- end
43
-
44
- def self.computeFlags(is_new_arch_enabled)
45
- new_arch_flag = is_new_arch_enabled ? "-DRCT_NEW_ARCH_ENABLED=1 " : ""
46
- return " #{new_arch_flag}#{Helpers::Constants.folly_config()[:compiler_flags]}"
47
- end
48
-
49
- def self.modify_flags_for_new_architecture(installer, is_new_arch_enabled)
50
- # Add flags to Target pods xcconfig
51
- installer.aggregate_targets.each do |aggregate_target|
52
- aggregate_target.xcconfigs.each do |config_name, config_file|
53
- ReactNativePodsUtils.add_flag_to_map_with_inheritance(config_file.attributes, "OTHER_CPLUSPLUSFLAGS", self.computeFlags(is_new_arch_enabled))
54
-
55
- xcconfig_path = aggregate_target.xcconfig_path(config_name)
56
- config_file.save_as(xcconfig_path)
57
- end
58
- end
59
-
60
- # Add flags to Target pods xcconfig
61
- installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
62
- # The React-Core pod may have a suffix added by Cocoapods, so we test whether 'React-Core' is a substring, and do not require exact match
63
- if pod_name.include? 'React-Core'
64
- target_installation_result.native_target.build_configurations.each do |config|
65
- ReactNativePodsUtils.add_flag_to_map_with_inheritance(config.build_settings, "OTHER_CPLUSPLUSFLAGS", self.computeFlags(is_new_arch_enabled))
66
- end
67
- end
68
- end
69
- end
70
-
71
- def self.install_modules_dependencies(spec, new_arch_enabled, folly_version = get_folly_config()[:version])
72
- # Pod::Specification does not have getters so, we have to read
73
- # the existing values from a hash representation of the object.
74
- folly_config = get_folly_config()
75
- folly_compiler_flags = folly_config[:compiler_flags]
76
-
77
- hash = spec.to_hash
78
-
79
- compiler_flags = hash["compiler_flags"] ? hash["compiler_flags"] : ""
80
- current_config = hash["pod_target_xcconfig"] != nil ? hash["pod_target_xcconfig"] : {}
81
- current_headers = current_config["HEADER_SEARCH_PATHS"] != nil ? current_config["HEADER_SEARCH_PATHS"] : ""
82
-
83
- header_search_paths = ["\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\""]
84
- if ENV['USE_FRAMEWORKS']
85
- header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\""
86
- header_search_paths << "\"$(PODS_ROOT)/fast_float/include\""
87
- header_search_paths << "\"$(PODS_ROOT)/fmt/include\""
88
- ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"])
89
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"]))
90
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", []))
91
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"]))
92
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", []))
93
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", []))
94
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", []))
95
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", []))
96
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", []))
97
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-ImageManager", "React_ImageManager", []))
98
- .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", []))
99
- .each { |search_path|
100
- header_search_paths << "\"#{search_path}\""
101
- }
102
- end
103
- header_search_paths_string = header_search_paths.join(" ")
104
- spec.compiler_flags = compiler_flags.empty? ? self.computeFlags(new_arch_enabled).strip! : "#{compiler_flags} #{self.computeFlags(new_arch_enabled)}"
105
- current_config["HEADER_SEARCH_PATHS"] = current_headers.empty? ?
106
- header_search_paths_string :
107
- "#{current_headers} #{header_search_paths_string}"
108
- current_config["CLANG_CXX_LANGUAGE_STANDARD"] = Helpers::Constants::cxx_language_standard
109
-
110
-
111
- spec.dependency "React-Core"
112
- spec.dependency "RCT-Folly", folly_version
113
- spec.dependency "glog"
114
-
115
-
116
- ReactNativePodsUtils.add_flag_to_map_with_inheritance(current_config, "OTHER_CPLUSPLUSFLAGS", self.computeFlags(new_arch_enabled))
117
-
118
- spec.dependency "React-RCTFabric" # This is for Fabric Component
119
- spec.dependency "ReactCodegen"
120
-
121
- spec.dependency "RCTRequired"
122
- spec.dependency "RCTTypeSafety"
123
- spec.dependency "ReactCommon/turbomodule/bridging"
124
- spec.dependency "ReactCommon/turbomodule/core"
125
- spec.dependency "React-NativeModulesApple"
126
- spec.dependency "Yoga"
127
- spec.dependency "React-Fabric"
128
- spec.dependency "React-graphics"
129
- spec.dependency "React-utils"
130
- spec.dependency "React-featureflags"
131
- spec.dependency "React-debug"
132
- spec.dependency "React-ImageManager"
133
- spec.dependency "React-rendererdebug"
134
- # This dependency is required for the cases when the pod includes generated sources, specifically Props.cpp.
135
- spec.dependency "DoubleConversion"
136
-
137
- if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
138
- spec.dependency "hermes-engine"
139
- else
140
- spec.dependency "React-jsi"
141
- end
142
-
143
- spec.pod_target_xcconfig = current_config
144
- end
145
-
146
- def self.folly_compiler_flags
147
- folly_config = get_folly_config()
148
- return folly_config[:compiler_flags]
149
- end
150
-
151
- def self.extract_react_native_version(react_native_path, file_manager: File, json_parser: JSON)
152
- package_json_file = File.join(react_native_path, "package.json")
153
- if !file_manager.exist?(package_json_file)
154
- raise "Couldn't find the React Native package.json file at #{package_json_file}"
155
- end
156
- package = json_parser.parse(file_manager.read(package_json_file))
157
- return package["version"]
158
- end
159
-
160
- def self.compute_new_arch_enabled(new_arch_enabled, react_native_version)
161
- # Regex that identify a version with the syntax `<major>.<minor>.<patch>[-<prerelease>[.-]k]
162
- # where
163
- # - major is a number
164
- # - minor is a number
165
- # - patch is a number
166
- # - prerelease is a string (can include numbers)
167
- # - k is a number
168
- version_regex = /^(\d+)\.(\d+)\.(\d+)(?:-(\w+(?:[-.]\d+)?))?$/
169
-
170
- if match_data = react_native_version.match(version_regex)
171
-
172
- prerelease = match_data[4].to_s
173
-
174
- # We want to enforce the new architecture for 1.0.0 and greater,
175
- # but not for 1000 as version 1000 is currently main.
176
- if prerelease.include?("prealpha")
177
- if ENV['RCT_NEW_ARCH_ENABLED'] != nil && !@@NewArchWarningEmitted
178
- warning_message = "[New Architecture] Starting from version 1.0.0-prealpha the value of the " \
179
- "RCT_NEW_ARCH_ENABLED flag is ignored and the New Architecture is enabled by default."
180
- Pod::UI.warn warning_message
181
- @@NewArchWarningEmitted = true
182
- end
183
-
184
- return "1"
185
- end
186
- end
187
- return new_arch_enabled ? "1" : "0"
188
- end
189
-
190
- def self.new_arch_enabled
191
- return ENV["RCT_NEW_ARCH_ENABLED"] == "1" # [macOS] Disable Fabric by default till macOS supports it
192
- end
193
- end
@@ -1,194 +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
- module PrivacyManifestUtils
7
- def self.add_aggregated_privacy_manifest(installer)
8
- user_project = get_user_project_from(installer)
9
- targets = get_application_targets(user_project)
10
- file_path = get_privacyinfo_file_path(user_project, targets)
11
-
12
- privacy_info = read_privacyinfo_file(file_path) || {
13
- "NSPrivacyCollectedDataTypes" => [],
14
- "NSPrivacyTracking" => false
15
- }
16
-
17
- # Get all required reason APIs defined in current pods
18
- required_reason_apis = get_used_required_reason_apis(installer)
19
-
20
- # Add the Required Reason APIs from React Native core
21
- get_core_accessed_apis.each do |accessed_api|
22
- api_type = accessed_api["NSPrivacyAccessedAPIType"]
23
- reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
24
- required_reason_apis[api_type] ||= []
25
- required_reason_apis[api_type] += reasons
26
- end
27
-
28
- # Merge the Required Reason APIs from pods with the ones from the existing PrivacyInfo file
29
- (privacy_info["NSPrivacyAccessedAPITypes"] || []).each do |accessed_api|
30
- api_type = accessed_api["NSPrivacyAccessedAPIType"]
31
- reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
32
- # Add reasons from existing PrivacyInfo file to the ones from pods
33
- required_reason_apis[api_type] ||= []
34
- required_reason_apis[api_type] += reasons
35
- end
36
-
37
- # Update the existing PrivacyInfo file with the new aggregated data
38
- privacy_info["NSPrivacyAccessedAPITypes"] = required_reason_apis.map { |api_type, reasons|
39
- {
40
- "NSPrivacyAccessedAPIType" => api_type,
41
- "NSPrivacyAccessedAPITypeReasons" => reasons.uniq
42
- }
43
- }
44
-
45
- Xcodeproj::Plist.write_to_path(privacy_info, file_path)
46
-
47
- targets.each do |target|
48
- ensure_reference(file_path, user_project, target)
49
- end
50
- end
51
-
52
- def self.get_application_targets(user_project)
53
- return user_project.targets.filter { |t| t.respond_to?(:symbol_type) && t.symbol_type == :application }
54
- end
55
-
56
- def self.read_privacyinfo_file(file_path)
57
- # Maybe add missing default NSPrivacyTracking, NSPrivacyTrackingDomains, NSPrivacyCollectedDataTypes, but this works without those keys
58
- source_data = nil
59
- # Try to read an existing PrivacyInfo.xcprivacy file
60
- begin
61
- source_data = Xcodeproj::Plist.read_from_path(file_path)
62
- Pod::UI.puts "[Privacy Manifest Aggregation] Appending aggregated reasons to existing PrivacyInfo.xcprivacy file."
63
- rescue => e
64
- Pod::UI.puts "[Privacy Manifest Aggregation] No existing PrivacyInfo.xcprivacy file found, creating a new one."
65
- end
66
- return source_data
67
- end
68
-
69
- def self.ensure_reference(file_path, user_project, target)
70
- privacy_info_filename = File.basename(file_path)
71
-
72
- # Check if the file is already in the PBXBuildFile section
73
- build_phase_reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref&.path&.end_with?(privacy_info_filename) }
74
-
75
- unless build_phase_reference_exists
76
- # Check if the file is already in the PBXFileReference section
77
- existing_file_reference = user_project.files.find { |file| file.path&.end_with?(privacy_info_filename) }
78
-
79
- if existing_file_reference
80
- # If the file reference exists, add it to the build phase
81
- target.resources_build_phase.add_file_reference(existing_file_reference, true)
82
- else
83
- # If the file reference doesn't exist, add it to the project and the build phase
84
- # We try to find the main group, but if it doesn't exist, we default to adding the file to the project root - both work
85
- file_root = user_project.root_object.main_group.children.find { |group|
86
- group.class == Xcodeproj::Project::Object::PBXGroup && (group.name == target.name || group.path == target.name)
87
- } || user_project
88
- puts "file_root: #{file_root}"
89
-
90
- file_ref = file_root.new_file(file_path)
91
- target.resources_build_phase.add_file_reference(file_ref, true)
92
- end
93
- end
94
- end
95
-
96
- def self.get_privacyinfo_file_path(user_project, targets)
97
-
98
- file_refs = targets.flat_map { |target| target.resources_build_phase.files_references }
99
- existing_file = file_refs.find { |file_ref| file_ref&.path&.end_with?("PrivacyInfo.xcprivacy") }
100
-
101
-
102
- if existing_file
103
- return existing_file.real_path
104
- end
105
-
106
- # We try to find a file we know exists in the project to get the path to the main group directory
107
- info_plist_path = user_project.files.find { |file_ref| file_ref.name == "Info.plist" }
108
- if info_plist_path.nil?
109
- # return path that is sibling to .xcodeproj
110
-
111
- path = user_project.path
112
-
113
- return File.join(File.dirname(path), "PrivacyInfo.xcprivacy")
114
- end
115
- return File.join(File.dirname(info_plist_path.real_path),"PrivacyInfo.xcprivacy")
116
- end
117
-
118
- def self.get_used_required_reason_apis(installer)
119
- # A dictionary with keys of type string (NSPrivacyAccessedAPIType) and values of type string[] (NSPrivacyAccessedAPITypeReasons[])
120
- used_apis = {}
121
- Pod::UI.puts "[Privacy Manifest Aggregation] Reading .xcprivacy files to aggregate all used Required Reason APIs."
122
- installer.pod_targets.each do |pod_target|
123
- # puts pod_target
124
- pod_target.file_accessors.each do |file_accessor|
125
- file_accessor.resource_bundles.each do |bundle_name, bundle_files|
126
- bundle_files.each do |file_path|
127
- # This needs to be named like that due to apple requirements
128
- if File.basename(file_path) == 'PrivacyInfo.xcprivacy'
129
- content = Xcodeproj::Plist.read_from_path(file_path)
130
- accessed_api_types = content["NSPrivacyAccessedAPITypes"]
131
- accessed_api_types&.each do |accessed_api|
132
- api_type = accessed_api["NSPrivacyAccessedAPIType"]
133
- reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
134
- next unless api_type
135
- used_apis[api_type] ||= []
136
- used_apis[api_type] += reasons
137
- end
138
- end
139
- end
140
- end
141
- end
142
- end
143
-
144
- return used_apis
145
- end
146
-
147
- def self.get_privacy_manifest_paths_from(user_project)
148
- privacy_manifests = user_project
149
- .files
150
- .select { |p|
151
- p&.path&.end_with?('PrivacyInfo.xcprivacy')
152
- }
153
- return privacy_manifests
154
- end
155
-
156
- def self.get_core_accessed_apis()
157
- file_timestamp_accessed_api = {
158
- "NSPrivacyAccessedAPIType" => "NSPrivacyAccessedAPICategoryFileTimestamp",
159
- "NSPrivacyAccessedAPITypeReasons" => ["C617.1"],
160
- }
161
- user_defaults_accessed_api = {
162
- "NSPrivacyAccessedAPIType" => "NSPrivacyAccessedAPICategoryUserDefaults",
163
- "NSPrivacyAccessedAPITypeReasons" => ["CA92.1"],
164
- }
165
- boot_time_accessed_api = {
166
- "NSPrivacyAccessedAPIType" => "NSPrivacyAccessedAPICategorySystemBootTime",
167
- "NSPrivacyAccessedAPITypeReasons" => ["35F9.1"],
168
- }
169
- return [file_timestamp_accessed_api, user_defaults_accessed_api, boot_time_accessed_api]
170
- end
171
-
172
-
173
- def self.get_user_project_from(installer)
174
- user_project = installer.aggregate_targets
175
- .map{ |t| t.user_project }
176
- .first
177
- return user_project
178
- end
179
-
180
- def self.add_privacy_manifest_if_needed(installer)
181
- user_project = get_user_project_from(installer)
182
- privacy_manifest = self.get_privacy_manifest_paths_from(user_project).first
183
- if privacy_manifest.nil?
184
- privacy_manifest = {
185
- "NSPrivacyCollectedDataTypes" => [],
186
- "NSPrivacyTracking" => false,
187
- "NSPrivacyAccessedAPITypes" => get_core_accessed_apis
188
- }
189
- path = File.join(user_project&.path.parent, "PrivacyInfo.xcprivacy")
190
- Xcodeproj::Plist.write_to_path(privacy_manifest, path)
191
- Pod::UI.puts "Your app does not have a privacy manifest! A template has been generated containing Required Reasons API usage in the core React Native library. Please add the PrivacyInfo.xcprivacy file to your project and complete data use, tracking and any additional required reasons your app is using according to Apple's guidance: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files. Then, you will need to manually add this file to your project in Xcode.".red
192
- end
193
- end
194
- end
@@ -1,18 +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
-
7
- # Set up Bridgeless dependencies
8
- #
9
- # @parameter react_native_path: relative path to react-native
10
- def setup_bridgeless!(react_native_path: "../node_modules/react-native", use_hermes: true)
11
- pod "React-jsitracing", :path => "#{react_native_path}/ReactCommon/hermes/executor/"
12
- pod "React-runtimescheduler", :path => "#{react_native_path}/ReactCommon/react/renderer/runtimescheduler"
13
- pod 'React-RuntimeCore', :path => "#{react_native_path}/ReactCommon/react/runtime"
14
- pod 'React-RuntimeApple', :path => "#{react_native_path}/ReactCommon/react/runtime/platform/ios"
15
- if use_hermes
16
- pod 'React-RuntimeHermes', :path => "#{react_native_path}/ReactCommon/react/runtime"
17
- end
18
- end