react-native-macos 0.77.6 → 0.77.7
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/Touchable/TouchableWithoutFeedback.js +0 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Network/RCTDataRequestHandler.mm +17 -3
- package/Libraries/Network/RCTFileRequestHandler.mm +17 -3
- package/Libraries/StyleSheet/normalizeColor.js +0 -0
- package/React/Base/RCTJavaScriptLoader.h +0 -0
- package/React/Base/RCTJavaScriptLoader.mm +0 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +3 -5
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +18 -4
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +1 -4
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +22 -3
- package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +1 -1
- package/React/Fabric/Surface/RCTFabricSurface.mm +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +13 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +3 -16
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +13 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +0 -3
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +39 -0
- package/ReactCommon/React-FabricComponents.podspec +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/components/modal/CMakeLists.txt +4 -1
- package/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h +3 -2
- package/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +4 -12
- package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h +2 -2
- package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.mm +1 -1
- package/ReactCommon/react/renderer/components/modal/platform/android/JReactModalHostView.h +38 -0
- package/ReactCommon/react/renderer/components/modal/platform/android/ModalHostViewUtils.cpp +18 -0
- package/ReactCommon/react/renderer/components/modal/platform/cxx/ModalHostViewUtils.cpp +17 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollEvent.cpp +33 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollEvent.h +17 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp +3 -2
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h +2 -1
- package/ReactCommon/react/runtime/TimerManager.cpp +6 -4
- package/ReactCommon/react/runtime/TimerManager.h +3 -1
- package/ReactCommon/react/runtime/tests/cxx/ReactInstanceTest.cpp +9 -5
- package/local-cli/cli.js +0 -0
- package/package.json +12 -12
- package/scripts/cocoapods/autolinking.rb +206 -0
- package/scripts/cocoapods/autolinking_utils.rb +25 -0
- package/scripts/cocoapods/codegen.rb +59 -0
- package/scripts/cocoapods/codegen_script_phase_extractor.rb +13 -0
- package/scripts/cocoapods/codegen_utils.rb +389 -0
- package/scripts/cocoapods/fabric.rb +18 -0
- package/scripts/cocoapods/helpers.rb +150 -0
- package/scripts/cocoapods/jsengine.rb +33 -0
- package/scripts/cocoapods/local_podspec_patch.rb +51 -0
- package/scripts/cocoapods/new_architecture.rb +194 -0
- package/scripts/cocoapods/privacy_manifest_utils.rb +194 -0
- package/scripts/cocoapods/runtime.rb +18 -0
- package/scripts/cocoapods/spm.rb +94 -0
- package/scripts/cocoapods/utils.rb +729 -0
- package/scripts/codegen/codegen-utils.js +51 -0
- package/scripts/codegen/generate-artifacts-executor.js +982 -0
- package/scripts/codegen/generate-specs-cli-executor.js +128 -0
- package/scripts/codegen/templates/RCTAppDependencyProviderH.template +25 -0
- package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +55 -0
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +18 -0
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +33 -0
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +16 -0
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +23 -0
- package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +34 -0
- package/scripts/compose-source-maps.js +0 -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/sdks/hermes-engine/hermes-engine.podspec +168 -0
- package/sdks/hermes-engine/hermes-utils.rb +341 -0
- package/sdks/hermes-engine/utils/build-apple-framework.sh +225 -0
- package/sdks/hermes-engine/utils/build-hermes-xcode.sh +100 -0
- package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +18 -0
- package/sdks/hermes-engine/utils/build-ios-framework.sh +90 -0
- package/sdks/hermes-engine/utils/build-mac-framework.sh +22 -0
- package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +7 -0
- package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +32 -0
- package/sdks/hermes-engine/utils/replace_hermes_version.js +106 -0
- package/scripts/featureflags/README.md +0 -156
- package/scripts/featureflags/index.js +0 -39
|
@@ -0,0 +1,389 @@
|
|
|
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
|
+
require_relative './utils.rb'
|
|
8
|
+
require_relative './helpers.rb'
|
|
9
|
+
require_relative './codegen_script_phase_extractor.rb'
|
|
10
|
+
|
|
11
|
+
class CodegenUtils
|
|
12
|
+
|
|
13
|
+
def initialize()
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@@REACT_CODEGEN_PODSPEC_GENERATED = false
|
|
17
|
+
|
|
18
|
+
def self.set_react_codegen_podspec_generated(value)
|
|
19
|
+
@@REACT_CODEGEN_PODSPEC_GENERATED = value
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.react_codegen_podspec_generated
|
|
23
|
+
@@REACT_CODEGEN_PODSPEC_GENERATED
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
@@REACT_CODEGEN_DISCOVERY_DONE = false
|
|
27
|
+
|
|
28
|
+
def self.set_react_codegen_discovery_done(value)
|
|
29
|
+
@@REACT_CODEGEN_DISCOVERY_DONE = value
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.react_codegen_discovery_done
|
|
33
|
+
@@REACT_CODEGEN_DISCOVERY_DONE
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# It takes some cocoapods specs and writes them into a file
|
|
37
|
+
#
|
|
38
|
+
# Parameters
|
|
39
|
+
# - spec: the cocoapod specs
|
|
40
|
+
# - codegen_output_dir: the output directory for the codegen
|
|
41
|
+
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
|
42
|
+
def generate_react_codegen_podspec!(spec, codegen_output_dir, file_manager: File, logger: CodegenUtils::UI)
|
|
43
|
+
# This podspec file should only be create once in the session/pod install.
|
|
44
|
+
# This happens when multiple targets are calling use_react_native!.
|
|
45
|
+
if @@REACT_CODEGEN_PODSPEC_GENERATED
|
|
46
|
+
logger.puts("Skipping ReactCodegen podspec generation.")
|
|
47
|
+
return
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
|
51
|
+
output_dir = "#{relative_installation_root}/#{codegen_output_dir}"
|
|
52
|
+
Pod::Executable.execute_command("mkdir", ["-p", output_dir]);
|
|
53
|
+
|
|
54
|
+
podspec_path = file_manager.join(output_dir, 'ReactCodegen.podspec.json')
|
|
55
|
+
logger.puts("Generating #{podspec_path}")
|
|
56
|
+
|
|
57
|
+
file_manager.open(podspec_path, 'w') do |f|
|
|
58
|
+
f.write(spec.to_json)
|
|
59
|
+
f.fsync
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
@@REACT_CODEGEN_PODSPEC_GENERATED = true
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# It generates the podspec object that represents the `ReactCodegen.podspec` file
|
|
66
|
+
#
|
|
67
|
+
# Parameters
|
|
68
|
+
# - package_json_file: the path to the `package.json`, required to extract the proper React Native version
|
|
69
|
+
# - hermes_enabled: whether hermes is enabled or not.
|
|
70
|
+
# - script_phases: whether we want to add some build script phases or not.
|
|
71
|
+
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
|
72
|
+
def get_react_codegen_spec(package_json_file, folly_version: get_folly_config()[:version], hermes_enabled: true, script_phases: nil, file_manager: File, logger: CodegenUtils::UI)
|
|
73
|
+
package = JSON.parse(file_manager.read(package_json_file))
|
|
74
|
+
version = package['version']
|
|
75
|
+
use_frameworks = ENV['USE_FRAMEWORKS'] != nil
|
|
76
|
+
|
|
77
|
+
folly_compiler_flags = get_folly_config()[:compiler_flags]
|
|
78
|
+
boost_compiler_flags = get_boost_config()[:compiler_flags]
|
|
79
|
+
|
|
80
|
+
header_search_paths = [
|
|
81
|
+
"\"$(PODS_ROOT)/boost\"",
|
|
82
|
+
"\"$(PODS_ROOT)/RCT-Folly\"",
|
|
83
|
+
"\"$(PODS_ROOT)/DoubleConversion\"",
|
|
84
|
+
"\"$(PODS_ROOT)/fast_float/include\"",
|
|
85
|
+
"\"$(PODS_ROOT)/fmt/include\"",
|
|
86
|
+
"\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
|
|
87
|
+
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
|
|
88
|
+
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
|
|
89
|
+
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
|
|
90
|
+
"\"$(PODS_TARGET_SRCROOT)\"",
|
|
91
|
+
]
|
|
92
|
+
framework_search_paths = []
|
|
93
|
+
|
|
94
|
+
if use_frameworks
|
|
95
|
+
ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"])
|
|
96
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", []))
|
|
97
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"]))
|
|
98
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"]))
|
|
99
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", []))
|
|
100
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", []))
|
|
101
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", []))
|
|
102
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", []))
|
|
103
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", []))
|
|
104
|
+
.concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", []))
|
|
105
|
+
.each { |search_path|
|
|
106
|
+
header_search_paths << "\"#{search_path}\""
|
|
107
|
+
}
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
spec = {
|
|
111
|
+
'name' => "ReactCodegen",
|
|
112
|
+
'version' => version,
|
|
113
|
+
'summary' => 'Temp pod for generated files for React Native',
|
|
114
|
+
'homepage' => 'https://facebook.com/',
|
|
115
|
+
'license' => 'Unlicense',
|
|
116
|
+
'authors' => 'Facebook',
|
|
117
|
+
'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++20",
|
|
118
|
+
'source' => { :git => '' },
|
|
119
|
+
'header_mappings_dir' => './',
|
|
120
|
+
'platforms' => min_supported_versions,
|
|
121
|
+
'source_files' => "**/*.{h,mm,cpp}",
|
|
122
|
+
'exclude_files' => "RCTAppDependencyProvider.{h,mm}", # these files are generated in the same codegen path but needs to belong to a different pod
|
|
123
|
+
'pod_target_xcconfig' => {
|
|
124
|
+
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
|
|
125
|
+
"FRAMEWORK_SEARCH_PATHS" => framework_search_paths,
|
|
126
|
+
"OTHER_CPLUSPLUSFLAGS" => "$(inherited) #{folly_compiler_flags} #{boost_compiler_flags}",
|
|
127
|
+
},
|
|
128
|
+
'dependencies': {
|
|
129
|
+
"React-jsiexecutor": [],
|
|
130
|
+
"RCT-Folly": [],
|
|
131
|
+
"RCTRequired": [],
|
|
132
|
+
"RCTTypeSafety": [],
|
|
133
|
+
"React-Core": [],
|
|
134
|
+
"React-jsi": [],
|
|
135
|
+
"ReactCommon/turbomodule/bridging": [],
|
|
136
|
+
"ReactCommon/turbomodule/core": [],
|
|
137
|
+
"React-NativeModulesApple": [],
|
|
138
|
+
"glog": [],
|
|
139
|
+
"DoubleConversion": [],
|
|
140
|
+
'React-graphics': [],
|
|
141
|
+
'React-rendererdebug': [],
|
|
142
|
+
'React-Fabric': [],
|
|
143
|
+
'React-FabricImage': [],
|
|
144
|
+
'React-debug': [],
|
|
145
|
+
'React-utils': [],
|
|
146
|
+
'React-featureflags': [],
|
|
147
|
+
'React-RCTAppDelegate': [],
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if hermes_enabled
|
|
152
|
+
spec[:'dependencies'].merge!({
|
|
153
|
+
'hermes-engine': [],
|
|
154
|
+
});
|
|
155
|
+
else
|
|
156
|
+
spec[:'dependencies'].merge!({
|
|
157
|
+
'React-jsc': [],
|
|
158
|
+
});
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if script_phases
|
|
162
|
+
logger.puts("Adding script_phases to ReactCodegen.")
|
|
163
|
+
spec[:'script_phases'] = script_phases
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
return spec
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# It extracts the codegen config from the configuration file
|
|
170
|
+
#
|
|
171
|
+
# Parameters
|
|
172
|
+
# - config_path: a path to the configuration file
|
|
173
|
+
# - config_key: the codegen configuration key
|
|
174
|
+
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
|
175
|
+
#
|
|
176
|
+
# Returns: the list of dependencies as extracted from the package.json
|
|
177
|
+
def get_codegen_config_from_file(config_path, config_key, file_manager: File)
|
|
178
|
+
empty = {}
|
|
179
|
+
if !file_manager.exist?(config_path)
|
|
180
|
+
return empty
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
config = JSON.parse(file_manager.read(config_path))
|
|
184
|
+
return config[config_key] ? config[config_key] : empty
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# It creates a list of JS files that contains the JS specifications that Codegen needs to use to generate the code
|
|
188
|
+
#
|
|
189
|
+
# Parameters
|
|
190
|
+
# - app_codegen_config: an object that contains the configurations
|
|
191
|
+
# - app_path: path to the app
|
|
192
|
+
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
|
193
|
+
#
|
|
194
|
+
# Returns: the list of files that needs to be used by Codegen
|
|
195
|
+
def get_list_of_js_specs(app_codegen_config, app_path, file_manager: File)
|
|
196
|
+
file_list = []
|
|
197
|
+
|
|
198
|
+
if app_codegen_config['libraries'] then
|
|
199
|
+
Pod::UI.warn '[Deprecated] You are using the old `libraries` array to list all your codegen.\nThis method will be removed in the future.\nUpdate your `package.json` with a single object.'
|
|
200
|
+
app_codegen_config['libraries'].each do |library|
|
|
201
|
+
library_dir = file_manager.join(app_path, library['jsSrcsDir'])
|
|
202
|
+
file_list.concat(Finder.find_codegen_file(library_dir))
|
|
203
|
+
end
|
|
204
|
+
elsif app_codegen_config['jsSrcsDir'] then
|
|
205
|
+
codegen_dir = file_manager.join(app_path, app_codegen_config['jsSrcsDir'])
|
|
206
|
+
file_list.concat (Finder.find_codegen_file(codegen_dir))
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
input_files = file_list.map { |filename| "${PODS_ROOT}/../#{Pathname.new(filename).realpath().relative_path_from(Pod::Config.instance.installation_root)}" }
|
|
210
|
+
|
|
211
|
+
return input_files
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# It generates the build script phase for the codegen
|
|
215
|
+
#
|
|
216
|
+
# Parameters
|
|
217
|
+
# - app_path: the path to the app
|
|
218
|
+
# - fabric_enabled: whether fabric is enabled or not
|
|
219
|
+
# - config_file_dir: the directory of the config file
|
|
220
|
+
# - react_native_path: the path to React Native
|
|
221
|
+
# - config_key: the configuration key to use in the package.json for the Codegen
|
|
222
|
+
# - codegen_utils: an object which exposes utilities functions for the codegen
|
|
223
|
+
# - script_phase_extractor: an object that is able to extract the Xcode Script Phases for React Native
|
|
224
|
+
# - file_manager: a class that implements the `File` interface. Defaults to `File`, the Dependency can be injected for testing purposes.
|
|
225
|
+
#
|
|
226
|
+
# Return: an object containing the script phase
|
|
227
|
+
def get_react_codegen_script_phases(
|
|
228
|
+
app_path,
|
|
229
|
+
fabric_enabled: false,
|
|
230
|
+
hermes_enabled: false,
|
|
231
|
+
config_file_dir: '',
|
|
232
|
+
react_native_path: "../node_modules/react-native",
|
|
233
|
+
config_key: 'codegenConfig',
|
|
234
|
+
codegen_utils: CodegenUtils.new(),
|
|
235
|
+
script_phase_extractor: CodegenScriptPhaseExtractor.new(),
|
|
236
|
+
file_manager: File,
|
|
237
|
+
logger: CodegenUtils::UI
|
|
238
|
+
)
|
|
239
|
+
if !app_path
|
|
240
|
+
logger.warn("error: app_path is required to use codegen discovery.")
|
|
241
|
+
abort
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# We need to convert paths to relative path from installation_root for the script phase for CI.
|
|
245
|
+
relative_app_root = Pathname.new(app_path).realpath().relative_path_from(Pod::Config.instance.installation_root)
|
|
246
|
+
|
|
247
|
+
relative_config_file_dir = ''
|
|
248
|
+
if config_file_dir != ''
|
|
249
|
+
relative_config_file_dir = Pathname.new(config_file_dir).relative_path_from(Pod::Config.instance.installation_root)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Generate input files for in-app libaraies which will be used to check if the script needs to be run.
|
|
253
|
+
# TODO: Ideally, we generate the input_files list from generate-codegen-artifacts.js and read the result here.
|
|
254
|
+
# Or, generate this podspec in generate-codegen-artifacts.js as well.
|
|
255
|
+
app_package_path = file_manager.join(app_path, 'package.json')
|
|
256
|
+
app_codegen_config = codegen_utils.get_codegen_config_from_file(app_package_path, config_key)
|
|
257
|
+
input_files = codegen_utils.get_list_of_js_specs(app_codegen_config, app_path)
|
|
258
|
+
|
|
259
|
+
# Add a script phase to trigger generate artifact.
|
|
260
|
+
# Some code is duplicated so that it's easier to delete the old way and switch over to this once it's stabilized.
|
|
261
|
+
return {
|
|
262
|
+
'name': 'Generate Specs',
|
|
263
|
+
'execution_position': :before_compile,
|
|
264
|
+
'input_files' => input_files,
|
|
265
|
+
'show_env_vars_in_log': true,
|
|
266
|
+
'output_files': ["${DERIVED_FILE_DIR}/react-codegen.log"],
|
|
267
|
+
'script': script_phase_extractor.extract_script_phase(
|
|
268
|
+
react_native_path: react_native_path,
|
|
269
|
+
relative_app_root: relative_app_root,
|
|
270
|
+
relative_config_file_dir: relative_config_file_dir,
|
|
271
|
+
fabric_enabled: fabric_enabled
|
|
272
|
+
),
|
|
273
|
+
}
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def use_react_native_codegen_discovery!(
|
|
277
|
+
codegen_disabled,
|
|
278
|
+
app_path,
|
|
279
|
+
react_native_path: "../node_modules/react-native",
|
|
280
|
+
fabric_enabled: false,
|
|
281
|
+
hermes_enabled: true,
|
|
282
|
+
config_file_dir: '',
|
|
283
|
+
codegen_output_dir: 'build/generated/ios',
|
|
284
|
+
config_key: 'codegenConfig',
|
|
285
|
+
folly_version: get_folly_config()[:version],
|
|
286
|
+
codegen_utils: CodegenUtils.new(),
|
|
287
|
+
file_manager: File,
|
|
288
|
+
logger: CodegenUtils::UI
|
|
289
|
+
)
|
|
290
|
+
return if codegen_disabled
|
|
291
|
+
|
|
292
|
+
if CodegenUtils.react_codegen_discovery_done()
|
|
293
|
+
logger.puts("Skipping use_react_native_codegen_discovery.")
|
|
294
|
+
return
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
if !app_path
|
|
298
|
+
logger.warn("Error: app_path is required for use_react_native_codegen_discovery.")
|
|
299
|
+
logger.warn("If you are calling use_react_native_codegen_discovery! in your Podfile, please remove the call and pass `app_path` and/or `config_file_dir` to `use_react_native!`.")
|
|
300
|
+
abort
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
logger.warn("warn: using experimental new codegen integration")
|
|
304
|
+
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
|
305
|
+
|
|
306
|
+
# Generate ReactCodegen podspec here to add the script phases.
|
|
307
|
+
script_phases = codegen_utils.get_react_codegen_script_phases(
|
|
308
|
+
app_path,
|
|
309
|
+
:fabric_enabled => fabric_enabled,
|
|
310
|
+
:config_file_dir => config_file_dir,
|
|
311
|
+
:react_native_path => react_native_path,
|
|
312
|
+
:config_key => config_key
|
|
313
|
+
)
|
|
314
|
+
react_codegen_spec = codegen_utils.get_react_codegen_spec(
|
|
315
|
+
file_manager.join(relative_installation_root, react_native_path, "package.json"),
|
|
316
|
+
:folly_version => folly_version,
|
|
317
|
+
:hermes_enabled => hermes_enabled,
|
|
318
|
+
:script_phases => script_phases
|
|
319
|
+
)
|
|
320
|
+
codegen_utils.generate_react_codegen_podspec!(react_codegen_spec, codegen_output_dir)
|
|
321
|
+
|
|
322
|
+
out = Pod::Executable.execute_command(
|
|
323
|
+
'node',
|
|
324
|
+
[
|
|
325
|
+
"#{relative_installation_root}/#{react_native_path}/scripts/generate-codegen-artifacts.js",
|
|
326
|
+
"-p", "#{app_path}",
|
|
327
|
+
"-o", Pod::Config.instance.installation_root,
|
|
328
|
+
"-t", "ios",
|
|
329
|
+
])
|
|
330
|
+
Pod::UI.puts out;
|
|
331
|
+
|
|
332
|
+
CodegenUtils.set_react_codegen_discovery_done(true)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
@@CLEANUP_DONE = false
|
|
336
|
+
|
|
337
|
+
def self.set_cleanup_done(newValue)
|
|
338
|
+
@@CLEANUP_DONE = newValue
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def self.cleanup_done
|
|
342
|
+
return @@CLEANUP_DONE
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def self.clean_up_build_folder(rn_path, codegen_dir, dir_manager: Dir, file_manager: File)
|
|
346
|
+
return if CodegenUtils.cleanup_done()
|
|
347
|
+
CodegenUtils.set_cleanup_done(true)
|
|
348
|
+
|
|
349
|
+
ios_folder = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
|
|
350
|
+
codegen_path = file_manager.join(ios_folder, codegen_dir)
|
|
351
|
+
return if !dir_manager.exist?(codegen_path)
|
|
352
|
+
|
|
353
|
+
FileUtils.rm_rf(dir_manager.glob("#{codegen_path}/*"))
|
|
354
|
+
base_provider_path = file_manager.join(rn_path, 'React', 'Fabric', 'RCTThirdPartyFabricComponentsProvider')
|
|
355
|
+
FileUtils.rm_rf("#{base_provider_path}.h")
|
|
356
|
+
FileUtils.rm_rf("#{base_provider_path}.mm")
|
|
357
|
+
CodegenUtils.assert_codegen_folder_is_empty(codegen_path, dir_manager: dir_manager)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Need to split this function from the previous one to be able to test it properly.
|
|
361
|
+
def self.assert_codegen_folder_is_empty(codegen_path, dir_manager: Dir)
|
|
362
|
+
# double check that the files have actually been deleted.
|
|
363
|
+
# Emit an error message if not.
|
|
364
|
+
if dir_manager.exist?(codegen_path) && dir_manager.glob("#{codegen_path}/*").length() != 0
|
|
365
|
+
Pod::UI.warn "Unable to remove the content of #{codegen_path} folder. Please run rm -rf #{codegen_path} and try again."
|
|
366
|
+
abort
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
class UI
|
|
371
|
+
# ANSI escape codes for colors and formatting
|
|
372
|
+
CYAN = "\e[36m"
|
|
373
|
+
YELLOW = "\e[33m"
|
|
374
|
+
BOLD = "\e[1m"
|
|
375
|
+
RESET = "\e[0m"
|
|
376
|
+
|
|
377
|
+
class << self
|
|
378
|
+
def puts(text, info: false)
|
|
379
|
+
prefix = "#{CYAN}#{BOLD}[Codegen]#{RESET}"
|
|
380
|
+
message = info ? "#{YELLOW}#{text}#{RESET}" : text
|
|
381
|
+
Pod::UI.puts "#{prefix} #{message}"
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def warn(text)
|
|
385
|
+
puts(text, info: true)
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
:compiler_flags => '-Wno-documentation'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@@socket_rocket_config = {
|
|
46
|
+
:version => '0.7.1'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@@folly_config = {
|
|
50
|
+
:version => '2024.11.18.00',
|
|
51
|
+
:git => 'https://github.com/facebook/folly.git',
|
|
52
|
+
: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',
|
|
53
|
+
:dep_name => 'RCT-Folly/Fabric'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@@fast_float_config = {
|
|
57
|
+
:git => "https://github.com/fastfloat/fast_float.git",
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@@fmt_config = {
|
|
61
|
+
:git => "https://github.com/fmtlib/fmt.git",
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@@glog_config = {
|
|
65
|
+
:git => "https://github.com/google/glog.git",
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@@double_conversion_config = {
|
|
69
|
+
:git => "https://github.com/google/double-conversion.git",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def self.min_ios_version_supported
|
|
73
|
+
return '15.1'
|
|
74
|
+
end
|
|
75
|
+
# [macOS
|
|
76
|
+
def self.min_macos_version_supported
|
|
77
|
+
return '11.0'
|
|
78
|
+
end
|
|
79
|
+
# macOS]
|
|
80
|
+
# [visionOS
|
|
81
|
+
def self.min_visionos_version_supported
|
|
82
|
+
return '1.0'
|
|
83
|
+
end
|
|
84
|
+
# visionOS]
|
|
85
|
+
|
|
86
|
+
def self.min_xcode_version_supported
|
|
87
|
+
return '15.1'
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.folly_config
|
|
91
|
+
return @@folly_config
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.set_folly_config(new_folly_config)
|
|
95
|
+
@@folly_config.update(new_folly_config)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.boost_config
|
|
99
|
+
return @@boost_config
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.set_boost_config(new_boost_config)
|
|
103
|
+
@@boost_config.update(new_boost_config)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.socket_rocket_config
|
|
107
|
+
return @@socket_rocket_config
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.set_socket_rocket_config(new_socket_rocket_config)
|
|
111
|
+
@@socket_rocket_config.update(new_socket_rocket_config)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.fast_float_config
|
|
115
|
+
return @@fast_float_config
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self.set_fast_float_config(new_fast_float_config)
|
|
119
|
+
@@fast_float_config.update(new_fast_float_config)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.fmt_config
|
|
123
|
+
return @@fmt_config
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def self.set_fmt_config(new_fmt_config)
|
|
127
|
+
@@fmt_config.update(new_fmt_config)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.glog_config
|
|
131
|
+
return @@glog_config
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def self.set_glog_config(new_glog_config)
|
|
135
|
+
@@glog_config.update(new_glog_config)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.double_conversion_config
|
|
139
|
+
return @@double_conversion_config
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def self.set_double_conversion_config(new_double_conversion_config)
|
|
143
|
+
@@double_conversion_config.update(new_double_conversion_config)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def self.cxx_language_standard
|
|
147
|
+
return "c++20"
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|