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.
- package/Libraries/Blob/RCTBlobManager.h +0 -0
- package/Libraries/Blob/RCTBlobManager.mm +0 -0
- package/Libraries/Components/TextInput/TextInputState.js +5 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Lists/FillRateHelper.js +3 -3
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/Lists/SectionList.d.ts +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +2 -2
- package/Libraries/Lists/ViewabilityHelper.js +3 -3
- package/Libraries/Lists/VirtualizeUtils.js +2 -2
- package/Libraries/Lists/VirtualizedList.js +3 -3
- package/Libraries/Lists/VirtualizedListContext.js +2 -2
- package/Libraries/Lists/VirtualizedSectionList.js +3 -3
- package/Libraries/Modal/Modal.js +1 -1
- package/Libraries/StyleSheet/normalizeColor.js +0 -0
- package/Libraries/Text/Text.d.ts +1 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/React/Base/RCTJavaScriptLoader.h +0 -0
- package/React/Base/RCTJavaScriptLoader.mm +0 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/CoreModules/RCTLogBoxView.mm +4 -1
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +82 -14
- package/React/Views/RCTViewKeyboardEvent.m +24 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/local-cli/cli.js +0 -0
- package/package.json +5 -4
- package/scripts/compose-source-maps.js +0 -0
- package/scripts/featureflags/README.md +156 -0
- package/scripts/featureflags/index.js +39 -0
- package/scripts/ios-configure-glog.sh +0 -0
- package/scripts/node-binary.sh +0 -0
- package/scripts/packager.sh +0 -0
- package/scripts/react-native-xcode.sh +0 -0
- package/scripts/react_native_pods_utils/script_phases.sh +0 -0
- package/scripts/xcode/ccache-clang++.sh +0 -0
- package/scripts/xcode/ccache-clang.sh +0 -0
- package/scripts/xcode/with-environment.sh +0 -0
- package/types/index.d.ts +1 -1
- package/scripts/cocoapods/autolinking.rb +0 -206
- package/scripts/cocoapods/autolinking_utils.rb +0 -25
- package/scripts/cocoapods/codegen.rb +0 -59
- package/scripts/cocoapods/codegen_script_phase_extractor.rb +0 -13
- package/scripts/cocoapods/codegen_utils.rb +0 -389
- package/scripts/cocoapods/fabric.rb +0 -18
- package/scripts/cocoapods/helpers.rb +0 -150
- package/scripts/cocoapods/jsengine.rb +0 -33
- package/scripts/cocoapods/local_podspec_patch.rb +0 -51
- package/scripts/cocoapods/new_architecture.rb +0 -194
- package/scripts/cocoapods/privacy_manifest_utils.rb +0 -194
- package/scripts/cocoapods/runtime.rb +0 -18
- package/scripts/cocoapods/spm.rb +0 -94
- package/scripts/cocoapods/utils.rb +0 -724
- package/scripts/codegen/codegen-utils.js +0 -51
- package/scripts/codegen/generate-artifacts-executor.js +0 -982
- package/scripts/codegen/generate-specs-cli-executor.js +0 -128
- package/scripts/codegen/templates/RCTAppDependencyProviderH.template +0 -25
- package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +0 -55
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +0 -18
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +0 -33
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +0 -16
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +0 -23
- package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +0 -34
- package/sdks/hermes-engine/hermes-engine.podspec +0 -169
- package/sdks/hermes-engine/hermes-utils.rb +0 -289
- package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -225
- package/sdks/hermes-engine/utils/build-hermes-xcode.sh +0 -100
- package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +0 -18
- package/sdks/hermes-engine/utils/build-ios-framework.sh +0 -90
- package/sdks/hermes-engine/utils/build-mac-framework.sh +0 -22
- package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +0 -7
- package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -32
- package/sdks/hermes-engine/utils/replace_hermes_version.js +0 -106
|
@@ -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
|
-
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 = Helpers::Constants.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 = Helpers::Constants.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
|
-
ReactNativePodsUtils.add_flag_to_map_with_inheritance(current_config, "OTHER_SWIFT_FLAGS", new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED" : "")
|
|
118
|
-
|
|
119
|
-
spec.dependency "React-RCTFabric" # This is for Fabric Component
|
|
120
|
-
spec.dependency "ReactCodegen"
|
|
121
|
-
|
|
122
|
-
spec.dependency "RCTRequired"
|
|
123
|
-
spec.dependency "RCTTypeSafety"
|
|
124
|
-
spec.dependency "ReactCommon/turbomodule/bridging"
|
|
125
|
-
spec.dependency "ReactCommon/turbomodule/core"
|
|
126
|
-
spec.dependency "React-NativeModulesApple"
|
|
127
|
-
spec.dependency "Yoga"
|
|
128
|
-
spec.dependency "React-Fabric"
|
|
129
|
-
spec.dependency "React-graphics"
|
|
130
|
-
spec.dependency "React-utils"
|
|
131
|
-
spec.dependency "React-featureflags"
|
|
132
|
-
spec.dependency "React-debug"
|
|
133
|
-
spec.dependency "React-ImageManager"
|
|
134
|
-
spec.dependency "React-rendererdebug"
|
|
135
|
-
# This dependency is required for the cases when the pod includes generated sources, specifically Props.cpp.
|
|
136
|
-
spec.dependency "DoubleConversion"
|
|
137
|
-
|
|
138
|
-
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
|
|
139
|
-
spec.dependency "hermes-engine"
|
|
140
|
-
else
|
|
141
|
-
spec.dependency "React-jsi"
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
spec.pod_target_xcconfig = current_config
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def self.folly_compiler_flags
|
|
148
|
-
folly_config = Helpers::Constants.folly_config
|
|
149
|
-
return folly_config[:compiler_flags]
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def self.extract_react_native_version(react_native_path, file_manager: File, json_parser: JSON)
|
|
153
|
-
package_json_file = File.join(react_native_path, "package.json")
|
|
154
|
-
if !file_manager.exist?(package_json_file)
|
|
155
|
-
raise "Couldn't find the React Native package.json file at #{package_json_file}"
|
|
156
|
-
end
|
|
157
|
-
package = json_parser.parse(file_manager.read(package_json_file))
|
|
158
|
-
return package["version"]
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def self.compute_new_arch_enabled(new_arch_enabled, react_native_version)
|
|
162
|
-
# Regex that identify a version with the syntax `<major>.<minor>.<patch>[-<prerelease>[.-]k]
|
|
163
|
-
# where
|
|
164
|
-
# - major is a number
|
|
165
|
-
# - minor is a number
|
|
166
|
-
# - patch is a number
|
|
167
|
-
# - prerelease is a string (can include numbers)
|
|
168
|
-
# - k is a number
|
|
169
|
-
version_regex = /^(\d+)\.(\d+)\.(\d+)(?:-(\w+(?:[-.]\d+)?))?$/
|
|
170
|
-
|
|
171
|
-
if match_data = react_native_version.match(version_regex)
|
|
172
|
-
|
|
173
|
-
prerelease = match_data[4].to_s
|
|
174
|
-
|
|
175
|
-
# We want to enforce the new architecture for 1.0.0 and greater,
|
|
176
|
-
# but not for 1000 as version 1000 is currently main.
|
|
177
|
-
if prerelease.include?("prealpha")
|
|
178
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] != nil && !@@NewArchWarningEmitted
|
|
179
|
-
warning_message = "[New Architecture] Starting from version 1.0.0-prealpha the value of the " \
|
|
180
|
-
"RCT_NEW_ARCH_ENABLED flag is ignored and the New Architecture is enabled by default."
|
|
181
|
-
Pod::UI.warn warning_message
|
|
182
|
-
@@NewArchWarningEmitted = true
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
return "1"
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
return new_arch_enabled ? "1" : "0"
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def self.new_arch_enabled
|
|
192
|
-
return ENV["RCT_NEW_ARCH_ENABLED"] == "1" # [macOS] Disable Fabric by default till macOS supports it
|
|
193
|
-
end
|
|
194
|
-
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
|
package/scripts/cocoapods/spm.rb
DELETED
|
@@ -1,94 +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
|
-
class SPMManager
|
|
7
|
-
def initialize()
|
|
8
|
-
@dependencies_by_pod = {}
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def dependency(pod_spec, url:, requirement:, products:)
|
|
12
|
-
@dependencies_by_pod[pod_spec.name] ||= []
|
|
13
|
-
@dependencies_by_pod[pod_spec.name] << { url: url, requirement: requirement, products: products}
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def apply_on_post_install(installer)
|
|
17
|
-
project = installer.pods_project
|
|
18
|
-
|
|
19
|
-
log 'Cleaning old SPM dependencies from Pods project'
|
|
20
|
-
clean_spm_dependencies_from_target(project, @dependencies_by_pod)
|
|
21
|
-
log 'Adding SPM dependencies to Pods project'
|
|
22
|
-
@dependencies_by_pod.each do |pod_name, dependencies|
|
|
23
|
-
dependencies.each do |spm_spec|
|
|
24
|
-
log "Adding SPM dependency on product #{spm_spec[:products]}"
|
|
25
|
-
add_spm_to_target(
|
|
26
|
-
project,
|
|
27
|
-
project.targets.find { |t| t.name == pod_name},
|
|
28
|
-
spm_spec[:url],
|
|
29
|
-
spm_spec[:requirement],
|
|
30
|
-
spm_spec[:products]
|
|
31
|
-
)
|
|
32
|
-
log " Adding workaround for Swift package not found issue"
|
|
33
|
-
target = project.targets.find { |t| t.name == pod_name}
|
|
34
|
-
target.build_configurations.each do |config|
|
|
35
|
-
target.build_settings(config.name)['SWIFT_INCLUDE_PATHS'] ||= ['$(inherited)']
|
|
36
|
-
search_path = '${SYMROOT}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/'
|
|
37
|
-
unless target.build_settings(config.name)['SWIFT_INCLUDE_PATHS'].include?(search_path)
|
|
38
|
-
target.build_settings(config.name)['SWIFT_INCLUDE_PATHS'].push(search_path)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
unless @dependencies_by_pod.empty?
|
|
45
|
-
log_warning "If you're using Xcode 15 or earlier you might need to close and reopen the Xcode workspace"
|
|
46
|
-
unless ENV["USE_FRAMEWORKS"] == "dynamic"
|
|
47
|
-
@dependencies_by_pod.each do |pod_name, dependencies|
|
|
48
|
-
log_warning "Pod #{pod_name} is using swift package(s) #{dependencies.map{|i| i[:products]}.flatten.uniq.join(", ")} with static linking, this might cause linker errors. Consider using USE_FRAMEWORKS=dynamic, see https://github.com/facebook/react-native/pull/44627#issuecomment-2123119711 for more information"
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
def log(msg)
|
|
57
|
-
::Pod::UI.puts "[SPM] #{msg}"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def log_warning(msg)
|
|
61
|
-
::Pod::UI.puts "\n\n[SPM] WARNING!!! #{msg}\n\n"
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def clean_spm_dependencies_from_target(project, new_targets)
|
|
65
|
-
project.root_object.package_references.delete_if { |pkg| (pkg.class == Xcodeproj::Project::Object::XCRemoteSwiftPackageReference) }
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def add_spm_to_target(project, target, url, requirement, products)
|
|
69
|
-
pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
|
|
70
|
-
ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
|
|
71
|
-
pkg = project.root_object.package_references.find { |p| p.class == pkg_class && p.repositoryURL == url }
|
|
72
|
-
if !pkg
|
|
73
|
-
pkg = project.new(pkg_class)
|
|
74
|
-
pkg.repositoryURL = url
|
|
75
|
-
pkg.requirement = requirement
|
|
76
|
-
log(" Adding package to workspace: #{pkg.inspect}")
|
|
77
|
-
project.root_object.package_references << pkg
|
|
78
|
-
end
|
|
79
|
-
products.each do |product_name|
|
|
80
|
-
ref = target.package_product_dependencies.find do |r|
|
|
81
|
-
r.class == ref_class && r.package == pkg && r.product_name == product_name
|
|
82
|
-
end
|
|
83
|
-
next if ref
|
|
84
|
-
|
|
85
|
-
log(" Adding product dependency #{product_name} to #{target.name}")
|
|
86
|
-
ref = project.new(ref_class)
|
|
87
|
-
ref.package = pkg
|
|
88
|
-
ref.product_name = product_name
|
|
89
|
-
target.package_product_dependencies << ref
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
SPM = SPMManager.new
|