react-native-macos 0.78.3 → 0.78.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/Libraries/Blob/RCTBlobManager.h +0 -0
  2. package/Libraries/Blob/RCTBlobManager.mm +0 -0
  3. package/Libraries/Components/TextInput/TextInputState.js +5 -1
  4. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
  5. package/Libraries/Core/ReactNativeVersion.js +1 -1
  6. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  7. package/Libraries/Lists/FillRateHelper.js +3 -3
  8. package/Libraries/Lists/FlatList.d.ts +1 -1
  9. package/Libraries/Lists/FlatList.js +2 -2
  10. package/Libraries/Lists/SectionList.d.ts +1 -1
  11. package/Libraries/Lists/SectionList.js +2 -2
  12. package/Libraries/Lists/SectionListModern.js +2 -2
  13. package/Libraries/Lists/ViewabilityHelper.js +3 -3
  14. package/Libraries/Lists/VirtualizeUtils.js +2 -2
  15. package/Libraries/Lists/VirtualizedList.js +3 -3
  16. package/Libraries/Lists/VirtualizedListContext.js +2 -2
  17. package/Libraries/Lists/VirtualizedSectionList.js +3 -3
  18. package/Libraries/Modal/Modal.js +1 -1
  19. package/Libraries/StyleSheet/normalizeColor.js +0 -0
  20. package/Libraries/Text/Text.d.ts +1 -0
  21. package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
  22. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  23. package/React/Base/RCTJavaScriptLoader.h +0 -0
  24. package/React/Base/RCTJavaScriptLoader.mm +0 -0
  25. package/React/Base/RCTVersion.m +1 -1
  26. package/React/CoreModules/RCTDevLoadingView.mm +1 -1
  27. package/React/CoreModules/RCTLogBoxView.mm +4 -1
  28. package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +82 -14
  29. package/React/Views/RCTViewKeyboardEvent.m +24 -0
  30. package/ReactAndroid/gradle.properties +1 -1
  31. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  32. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  33. package/local-cli/cli.js +0 -0
  34. package/package.json +5 -4
  35. package/scripts/compose-source-maps.js +0 -0
  36. package/scripts/featureflags/README.md +156 -0
  37. package/scripts/featureflags/index.js +39 -0
  38. package/scripts/ios-configure-glog.sh +0 -0
  39. package/scripts/node-binary.sh +0 -0
  40. package/scripts/packager.sh +0 -0
  41. package/scripts/react-native-xcode.sh +0 -0
  42. package/scripts/react_native_pods_utils/script_phases.sh +0 -0
  43. package/scripts/xcode/ccache-clang++.sh +0 -0
  44. package/scripts/xcode/ccache-clang.sh +0 -0
  45. package/scripts/xcode/with-environment.sh +0 -0
  46. package/types/index.d.ts +1 -1
  47. package/scripts/cocoapods/autolinking.rb +0 -206
  48. package/scripts/cocoapods/autolinking_utils.rb +0 -25
  49. package/scripts/cocoapods/codegen.rb +0 -59
  50. package/scripts/cocoapods/codegen_script_phase_extractor.rb +0 -13
  51. package/scripts/cocoapods/codegen_utils.rb +0 -389
  52. package/scripts/cocoapods/fabric.rb +0 -18
  53. package/scripts/cocoapods/helpers.rb +0 -150
  54. package/scripts/cocoapods/jsengine.rb +0 -33
  55. package/scripts/cocoapods/local_podspec_patch.rb +0 -51
  56. package/scripts/cocoapods/new_architecture.rb +0 -194
  57. package/scripts/cocoapods/privacy_manifest_utils.rb +0 -194
  58. package/scripts/cocoapods/runtime.rb +0 -18
  59. package/scripts/cocoapods/spm.rb +0 -94
  60. package/scripts/cocoapods/utils.rb +0 -724
  61. package/scripts/codegen/codegen-utils.js +0 -51
  62. package/scripts/codegen/generate-artifacts-executor.js +0 -982
  63. package/scripts/codegen/generate-specs-cli-executor.js +0 -128
  64. package/scripts/codegen/templates/RCTAppDependencyProviderH.template +0 -25
  65. package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +0 -55
  66. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +0 -18
  67. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +0 -33
  68. package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +0 -16
  69. package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +0 -23
  70. package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +0 -34
  71. package/sdks/hermes-engine/hermes-engine.podspec +0 -169
  72. package/sdks/hermes-engine/hermes-utils.rb +0 -289
  73. package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -225
  74. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +0 -100
  75. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +0 -18
  76. package/sdks/hermes-engine/utils/build-ios-framework.sh +0 -90
  77. package/sdks/hermes-engine/utils/build-mac-framework.sh +0 -22
  78. package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +0 -7
  79. package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -32
  80. package/sdks/hermes-engine/utils/replace_hermes_version.js +0 -106
@@ -1,289 +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 'net/http'
7
- require 'rexml/document'
8
- require 'open3' # [macOS]
9
-
10
- HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
11
- ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
12
-
13
- module HermesEngineSourceType
14
- LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
15
- DOWNLOAD_PREBUILD_RELEASE_TARBALL = :download_prebuild_release_tarball
16
- DOWNLOAD_PREBUILT_NIGHTLY_TARBALL = :download_prebuilt_nightly_tarball
17
- BUILD_FROM_GITHUB_COMMIT = :build_from_github_commit
18
- BUILD_FROM_GITHUB_TAG = :build_from_github_tag
19
- BUILD_FROM_GITHUB_MAIN = :build_from_github_main
20
- BUILD_FROM_LOCAL_SOURCE_DIR = :build_from_local_source_dir
21
-
22
- def HermesEngineSourceType.isPrebuilt(source_type)
23
- return source_type == LOCAL_PREBUILT_TARBALL || source_type == DOWNLOAD_PREBUILD_RELEASE_TARBALL || source_type == DOWNLOAD_PREBUILT_NIGHTLY_TARBALL
24
- end
25
-
26
- def HermesEngineSourceType.isFromSource(source_type)
27
- return source_type == BUILD_FROM_GITHUB_COMMIT || source_type == BUILD_FROM_GITHUB_TAG || source_type == BUILD_FROM_GITHUB_MAIN || source_type == BUILD_FROM_LOCAL_SOURCE_DIR
28
- end
29
- end
30
-
31
- # Computes the hermes-engine.podspec's source type.
32
- # - To use a specific tarball, install the dependencies with:
33
- # `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
34
- # - To force a build from source, install the dependencies with:
35
- # `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
36
- # If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
37
- # (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
38
- #
39
- # Parameters:
40
- # - version: current version of the pod
41
- # - react_native_path: path to react native
42
- #
43
-
44
- # Returns: hermes-engine source type
45
- def hermes_source_type(version, react_native_path)
46
- if override_hermes_dir_envvar_defined()
47
- return HermesEngineSourceType::BUILD_FROM_LOCAL_SOURCE_DIR
48
- end
49
-
50
- if hermes_engine_tarball_envvar_defined()
51
- return HermesEngineSourceType::LOCAL_PREBUILT_TARBALL
52
- end
53
-
54
- if hermes_commit_envvar_defined()
55
- return HermesEngineSourceType::BUILD_FROM_GITHUB_COMMIT
56
- end
57
-
58
- if force_build_from_tag(react_native_path)
59
- return HermesEngineSourceType::BUILD_FROM_GITHUB_TAG
60
- end
61
-
62
- if force_build_from_main(react_native_path)
63
- return HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN
64
- end
65
-
66
- if release_artifact_exists(version)
67
- return HermesEngineSourceType::DOWNLOAD_PREBUILD_RELEASE_TARBALL
68
- end
69
-
70
- if nightly_artifact_exists(version)
71
- return HermesEngineSourceType::DOWNLOAD_PREBUILT_NIGHTLY_TARBALL
72
- end
73
-
74
- return HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN
75
- end
76
-
77
- def override_hermes_dir_envvar_defined()
78
- return ENV.has_key?('REACT_NATIVE_OVERRIDE_HERMES_DIR')
79
- end
80
-
81
- def hermes_engine_tarball_envvar_defined()
82
- return ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
83
- end
84
-
85
- def hermes_commit_envvar_defined()
86
- return ENV.has_key?('HERMES_COMMIT')
87
- end
88
-
89
- def force_build_from_tag(react_native_path)
90
- return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
91
- end
92
-
93
- def force_build_from_main(react_native_path)
94
- return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
95
- end
96
-
97
- def release_artifact_exists(version)
98
- return hermes_artifact_exists(release_tarball_url(version, :debug))
99
- end
100
-
101
- def nightly_artifact_exists(version)
102
- return hermes_artifact_exists(nightly_tarball_url(version).gsub("\\", ""))
103
- end
104
-
105
- def podspec_source(source_type, version, react_native_path)
106
- case source_type
107
- when HermesEngineSourceType::BUILD_FROM_LOCAL_SOURCE_DIR
108
- return podspec_source_build_from_local_source_dir(react_native_path)
109
- when HermesEngineSourceType::LOCAL_PREBUILT_TARBALL
110
- return podspec_source_local_prebuilt_tarball()
111
- when HermesEngineSourceType::BUILD_FROM_GITHUB_COMMIT
112
- return podspec_source_build_from_github_commit()
113
- when HermesEngineSourceType::BUILD_FROM_GITHUB_TAG
114
- return podspec_source_build_from_github_tag(react_native_path)
115
- when HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN
116
- return podspec_source_build_from_github_main()
117
- when HermesEngineSourceType::DOWNLOAD_PREBUILD_RELEASE_TARBALL
118
- return podspec_source_download_prebuild_release_tarball(react_native_path, version)
119
- when HermesEngineSourceType::DOWNLOAD_PREBUILT_NIGHTLY_TARBALL
120
- return podspec_source_download_prebuilt_nightly_tarball(version)
121
- else
122
- abort "[Hermes] Unsupported or invalid source type provided: #{source_type}"
123
- end
124
- end
125
-
126
- def podspec_source_build_from_local_source_dir(react_native_path)
127
- source_dir_path = ENV['REACT_NATIVE_OVERRIDE_HERMES_DIR']
128
- if Dir.exist?(source_dir_path)
129
- hermes_log("Using source code from local path: #{source_dir_path}")
130
- tarball_dir_path = artifacts_dir()
131
- FileUtils.mkdir_p(tarball_dir_path) unless Dir.exist?(tarball_dir_path)
132
- tarball_path = File.join(tarball_dir_path, "hermes-engine-from-local-source-dir.tar.gz")
133
- exclude_paths = [
134
- "__tests__",
135
- "./external/flowtest",
136
- "./external/esprima/test_fixtures"
137
- ]
138
- .map {|path| "--exclude=#{path}"}
139
- .join(' ')
140
- tar_command = "tar #{exclude_paths} -czvf #{tarball_path} -C #{source_dir_path} . 2> /dev/null"
141
- success = system(tar_command)
142
- if !success
143
- abort "Failed to create a tarball with the contents of \"#{source_dir_path}\""
144
- end
145
- return {:http => "file://#{tarball_path}"}
146
- else
147
- abort <<-EOS
148
- [Hermes] REACT_NATIVE_OVERRIDE_HERMES_DIR is set, but points to a non-existing directory: \"#{source_dir_path}\"
149
- If you don't want to use local source, run `unset REACT_NATIVE_OVERRIDE_HERMES_DIR`
150
- EOS
151
- end
152
- end
153
-
154
- def podspec_source_local_prebuilt_tarball()
155
- tarball_path = ENV['HERMES_ENGINE_TARBALL_PATH']
156
- if File.exist?(tarball_path)
157
- hermes_log("Using pre-built binary from local path defined by HERMES_ENGINE_TARBALL_PATH envvar: #{tarball_path}")
158
- return {:http => "file://#{tarball_path}"}
159
- end
160
- abort <<-EOS
161
- [Hermes] HERMES_ENGINE_TARBALL_PATH is set, but points to a non-existing file: \"#{tarball_path}\"
162
- If you don't want to use tarball, run `unset HERMES_ENGINE_TARBALL_PATH`
163
- EOS
164
- end
165
-
166
- def podspec_source_build_from_github_commit()
167
- commit = ENV['HERMES_COMMIT']
168
- hermes_log("Using commit defined by HERMES_COMMIT envvar: #{commit}")
169
- return {:git => HERMES_GITHUB_URL, :commit => commit}
170
- end
171
-
172
- def podspec_source_build_from_github_tag(react_native_path)
173
- tag = File.read(hermestag_file(react_native_path)).strip
174
- hermes_log("Using tag difined in sdks/.hermesversion: #{tag}")
175
- return {:git => HERMES_GITHUB_URL, :tag => tag}
176
- end
177
-
178
- def podspec_source_build_from_github_main()
179
- hermes_log("Using the latest commit from main.")
180
- return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} main | cut -f 1`.strip}
181
- end
182
-
183
- def podspec_source_download_prebuild_release_tarball(react_native_path, version)
184
- url = release_tarball_url(version, :debug)
185
- hermes_log("Using release tarball from URL: #{url}")
186
- download_stable_hermes(react_native_path, version, :debug)
187
- download_stable_hermes(react_native_path, version, :release)
188
- return {:http => url}
189
- end
190
-
191
- def podspec_source_download_prebuilt_nightly_tarball(version)
192
- url = nightly_tarball_url(version)
193
- hermes_log("Using nightly tarball from URL: #{url}")
194
- return {:http => url}
195
- end
196
-
197
- # HELPERS
198
-
199
- def artifacts_dir()
200
- return File.join(Pod::Config.instance.project_pods_root, "hermes-engine-artifacts")
201
- end
202
-
203
- def hermestag_file(react_native_path)
204
- return File.join(react_native_path, "sdks", ".hermesversion")
205
- end
206
-
207
- def release_tarball_url(version, build_type)
208
- maven_repo_url = "https://repo1.maven.org/maven2"
209
- namespace = "com/facebook/react"
210
- # Sample url from Maven:
211
- # https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz
212
- return "#{maven_repo_url}/#{namespace}/react-native-artifacts/#{version}/react-native-artifacts-#{version}-hermes-ios-#{build_type.to_s}.tar.gz"
213
- end
214
-
215
- def download_stable_hermes(react_native_path, version, configuration)
216
- tarball_url = release_tarball_url(version, configuration)
217
- download_hermes_tarball(react_native_path, tarball_url, version, configuration)
218
- end
219
-
220
- def download_hermes_tarball(react_native_path, tarball_url, version, configuration)
221
- destination_path = configuration == nil ?
222
- "#{artifacts_dir()}/hermes-ios-#{version}.tar.gz" :
223
- "#{artifacts_dir()}/hermes-ios-#{version}-#{configuration}.tar.gz"
224
-
225
- unless File.exist?(destination_path)
226
- # Download to a temporary file first so we don't cache incomplete downloads.
227
- tmp_file = "#{artifacts_dir()}/hermes-ios.download"
228
- `mkdir -p "#{artifacts_dir()}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"`
229
- end
230
- return destination_path
231
- end
232
-
233
- def nightly_tarball_url(version)
234
- params = "r=snapshots\&g=com.facebook.react\&a=react-native-artifacts\&c=hermes-ios-debug\&e=tar.gz\&v=#{version}-SNAPSHOT"
235
- return resolve_url_redirects("http://oss.sonatype.org/service/local/artifact/maven/redirect\?#{params}")
236
- end
237
-
238
- def resolve_url_redirects(url)
239
- return (`curl -Ls -o /dev/null -w %{url_effective} \"#{url}\"`)
240
- end
241
-
242
- # [macOS react-native-macos does not publish macos specific hermes artifacts
243
- # so we attempt to find the latest patch version of the iOS artifacts and use that
244
- def findLastestVersionWithArtifact(version)
245
- versionWithoutPatch = version.match(/^(\d+\.\d+)/)
246
- xml_data, = Open3.capture3("curl -s https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/maven-metadata.xml")
247
-
248
- metadata = REXML::Document.new(xml_data)
249
- versions = metadata.elements.to_a('//metadata/versioning/versions/version')
250
-
251
- # Extract version numbers and sort them
252
- filtered_versions = versions.select { |version| version.text.match?(/^#{versionWithoutPatch}\.\d+$/) }
253
- if filtered_versions.empty?
254
- return
255
- end
256
-
257
- version_numbers = filtered_versions.map { |version| version.text }
258
- sorted_versions = version_numbers.sort_by { |v| Gem::Version.new(v) }
259
-
260
- return sorted_versions.last
261
- end
262
- # macOS]
263
-
264
- # This function checks that Hermes artifact exists.
265
- # As of now it should check it on the Maven repo.
266
- #
267
- # Parameters
268
- # - version: the version of React Native
269
- # - build_type: debug or release
270
- def hermes_artifact_exists(tarball_url)
271
- # -L is used to follow redirects, useful for the nightlies
272
- # I also needed to wrap the url in quotes to avoid escaping & and ?.
273
- return (`curl -o /dev/null --silent -Iw '%{http_code}' -L "#{tarball_url}"` == "200")
274
- end
275
-
276
- def hermes_log(message, level = :warning)
277
- if !Object.const_defined?("Pod::UI")
278
- return
279
- end
280
- hermes_log_messgae = '[Hermes] ' + message
281
- case level
282
- when :info
283
- Pod::UI.puts hermes_log_messgae.green
284
- when :error
285
- Pod::UI.puts hermes_log_messgae.red
286
- else
287
- Pod::UI.puts hermes_log_messgae.yellow
288
- end
289
- end
@@ -1,225 +0,0 @@
1
- #!/bin/bash
2
- # Copyright (c) Meta Platforms, Inc. and affiliates.
3
- #
4
- # This source code is licensed under the MIT license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- # Defines functions for building various Hermes frameworks.
8
- # See build-ios-framework.sh and build-mac-framework.sh for usage examples.
9
-
10
- CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
11
-
12
- IMPORT_HERMESC_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHermesc.cmake}
13
- BUILD_TYPE=${BUILD_TYPE:-Debug}
14
-
15
- HERMES_PATH="$CURR_SCRIPT_DIR/.."
16
- REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$CURR_SCRIPT_DIR/../../..}
17
-
18
- NUM_CORES=$(sysctl -n hw.ncpu)
19
-
20
- PLATFORMS=("macosx" "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator")
21
-
22
- if [[ -z "$JSI_PATH" ]]; then
23
- JSI_PATH="$REACT_NATIVE_PATH/ReactCommon/jsi"
24
- fi
25
-
26
- function use_env_var_or_ruby_prop {
27
- if [[ -n "$1" ]]; then
28
- echo "$1"
29
- else
30
- ruby -rcocoapods-core -rjson -e "puts Pod::Specification.from_file('hermes-engine.podspec').$2"
31
- fi
32
- }
33
-
34
- function use_env_var {
35
- if [[ -n "$1" ]]; then
36
- echo "$1"
37
- else
38
- echo "error: Missing $2 environment variable"
39
- exit 1
40
- fi
41
- }
42
-
43
- function get_release_version {
44
- use_env_var_or_ruby_prop "${RELEASE_VERSION}" "version"
45
- }
46
-
47
- function get_ios_deployment_target {
48
- use_env_var "${IOS_DEPLOYMENT_TARGET}" "IOS_DEPLOYMENT_TARGET"
49
- }
50
-
51
- function get_visionos_deployment_target {
52
- use_env_var "${XROS_DEPLOYMENT_TARGET}" "XROS_DEPLOYMENT_TARGET"
53
- }
54
-
55
- function get_mac_deployment_target {
56
- use_env_var "${MAC_DEPLOYMENT_TARGET}" "MAC_DEPLOYMENT_TARGET"
57
- }
58
-
59
- # Build host hermes compiler for internal bytecode
60
- function build_host_hermesc {
61
- echo "Building hermesc"
62
- pushd "$HERMES_PATH" > /dev/null || exit 1
63
- cmake -S . -B build_host_hermesc -DJSI_DIR="$JSI_PATH"
64
- cmake --build ./build_host_hermesc --target hermesc -j "${NUM_CORES}"
65
- popd > /dev/null || exit 1
66
- }
67
-
68
- # Utility function to configure an Apple framework
69
- function configure_apple_framework {
70
- local enable_debugger cmake_build_type xcode_15_flags xcode_major_version
71
-
72
- if [[ $BUILD_TYPE == "Debug" ]]; then
73
- enable_debugger="true"
74
- else
75
- enable_debugger="false"
76
- fi
77
- if [[ $BUILD_TYPE == "Debug" ]]; then
78
- # JS developers aren't VM developers.
79
- # Therefore we're passing as build type Release, to provide a faster build.
80
- cmake_build_type="Release"
81
- else
82
- cmake_build_type="MinSizeRel"
83
- fi
84
-
85
- xcode_15_flags=""
86
- xcode_major_version=$(xcodebuild -version | grep -oE '[0-9]*' | head -n 1)
87
- if [[ $xcode_major_version -ge 15 ]]; then
88
- xcode_15_flags="LINKER:-ld_classic"
89
- fi
90
-
91
- pushd "$HERMES_PATH" > /dev/null || exit 1
92
- cmake -S . -B "build_$1" \
93
- -DHERMES_EXTRA_LINKER_FLAGS="$xcode_15_flags" \
94
- -DHERMES_APPLE_TARGET_PLATFORM:STRING="$1" \
95
- -DCMAKE_OSX_ARCHITECTURES:STRING="$2" \
96
- -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$3" \
97
- -DHERMES_ENABLE_DEBUGGER:BOOLEAN="$enable_debugger" \
98
- -DHERMES_ENABLE_INTL:BOOLEAN=true \
99
- -DHERMES_ENABLE_LIBFUZZER:BOOLEAN=false \
100
- -DHERMES_ENABLE_FUZZILLI:BOOLEAN=false \
101
- -DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false \
102
- -DHERMES_ENABLE_BITCODE:BOOLEAN=false \
103
- -DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true \
104
- -DHERMES_BUILD_SHARED_JSI:BOOLEAN=false \
105
- -DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true \
106
- -DIMPORT_HERMESC:PATH="$IMPORT_HERMESC_PATH" \
107
- -DJSI_DIR="$JSI_PATH" \
108
- -DHERMES_RELEASE_VERSION="for RN $(get_release_version)" \
109
- -DCMAKE_BUILD_TYPE="$cmake_build_type"
110
- popd > /dev/null || exit 1
111
- }
112
-
113
- function build_host_hermesc_if_needed {
114
- if [[ ! -f "$IMPORT_HERMESC_PATH" ]]; then
115
- build_host_hermesc
116
- else
117
- echo "[HermesC] Skipping! Found an existent hermesc already at: $IMPORT_HERMESC_PATH"
118
- fi
119
- }
120
-
121
- # Utility function to build an Apple framework
122
- function build_apple_framework {
123
- # Only build host HermesC if no file found at $IMPORT_HERMESC_PATH
124
- build_host_hermesc_if_needed
125
-
126
- # Confirm ImportHermesc.cmake is now available.
127
- [ ! -f "$IMPORT_HERMESC_PATH" ] &&
128
- echo "Host hermesc is required to build apple frameworks!"
129
-
130
- # $1: platform, $2: architectures, $3: deployment target
131
- echo "Building $BUILD_TYPE framework for $1 with architectures: $2"
132
- configure_apple_framework "$1" "$2" "$3"
133
-
134
- pushd "$HERMES_PATH" > /dev/null || exit 1
135
- mkdir -p "destroot/Library/Frameworks/$1"
136
- cmake --build "./build_$1" --target libhermes -j "${NUM_CORES}"
137
- cp -R "./build_$1"/API/hermes/hermes.framework* "destroot/Library/Frameworks/$1"
138
-
139
- # In a MacOS build, also produce the hermes and hermesc CLI tools.
140
- if [[ $1 == macosx ]]; then
141
- cmake --build "./build_$1" --target hermesc hermes -j "${NUM_CORES}"
142
- mkdir -p destroot/bin
143
- cp "./build_$1/bin"/* "destroot/bin"
144
- fi
145
-
146
- # Copy over Hermes and JSI API headers.
147
- mkdir -p destroot/include/hermes/Public
148
- cp public/hermes/Public/*.h destroot/include/hermes/Public
149
-
150
- mkdir -p destroot/include/hermes
151
- cp API/hermes/*.h destroot/include/hermes
152
-
153
- mkdir -p destroot/include/hermes/cdp
154
- cp API/hermes/cdp/*.h destroot/include/hermes/cdp
155
-
156
- mkdir -p destroot/include/hermes/inspector
157
- cp API/hermes/inspector/*.h destroot/include/hermes/inspector
158
-
159
- mkdir -p destroot/include/hermes/inspector/chrome
160
- cp API/hermes/inspector/chrome/*.h destroot/include/hermes/inspector/chrome
161
-
162
- mkdir -p destroot/include/jsi
163
- cp "$JSI_PATH"/jsi/*.h destroot/include/jsi
164
- popd > /dev/null || exit 1
165
- }
166
-
167
- function prepare_dest_root_for_ci {
168
- mkdir -p "destroot/bin"
169
- for platform in "${PLATFORMS[@]}"; do
170
- mkdir -p "destroot/Library/Frameworks/$platform"
171
- cp -R "./build_$platform/API/hermes/hermes.framework"* "destroot/Library/Frameworks/$platform"
172
- done
173
-
174
- cp "./build_macosx/bin/"* "destroot/bin"
175
-
176
- # Copy over Hermes and JSI API headers.
177
- mkdir -p destroot/include/hermes/Public
178
- cp public/hermes/Public/*.h destroot/include/hermes/Public
179
-
180
- mkdir -p destroot/include/hermes
181
- cp API/hermes/*.h destroot/include/hermes
182
-
183
- mkdir -p destroot/include/hermes/cdp
184
- cp API/hermes/cdp/*.h destroot/include/hermes/cdp
185
-
186
- mkdir -p destroot/include/hermes/inspector
187
- cp API/hermes/inspector/*.h destroot/include/hermes/inspector
188
-
189
- mkdir -p destroot/include/hermes/inspector/chrome
190
- cp API/hermes/inspector/chrome/*.h destroot/include/hermes/inspector/chrome
191
-
192
- mkdir -p destroot/include/jsi
193
- cp "$JSI_PATH"/jsi/*.h destroot/include/jsi
194
- }
195
-
196
- # Accepts an array of frameworks and will place all of
197
- # the architectures into an universal folder and then remove
198
- # the merged frameworks from destroot
199
- function create_universal_framework {
200
- pushd "$HERMES_PATH/destroot/Library/Frameworks" > /dev/null || exit 1
201
-
202
- local platforms=("$@")
203
- local args=""
204
-
205
- echo "Creating universal framework for platforms: ${platforms[*]}"
206
-
207
- for i in "${!platforms[@]}"; do
208
- local platform="${platforms[$i]}"
209
- local hermes_framework_path="${platform}/hermes.framework"
210
- args+="-framework $hermes_framework_path "
211
- done
212
-
213
- mkdir -p universal
214
- # shellcheck disable=SC2086
215
- if xcodebuild -create-xcframework $args -output "universal/hermes.xcframework"
216
- then
217
- # # Remove the thin iOS hermes.frameworks that are now part of the universal
218
- # XCFramework
219
- for platform in "${platforms[@]}"; do
220
- rm -r "$platform"
221
- done
222
- fi
223
-
224
- popd > /dev/null || exit 1
225
- }
@@ -1,100 +0,0 @@
1
- #!/bin/bash
2
- # Copyright (c) Meta Platforms, Inc. and affiliates.
3
- #
4
- # This source code is licensed under the MIT license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- set -x -e
8
-
9
- release_version="$1"; shift
10
- hermesc_path="$1"; shift
11
- jsi_path="$1"; shift
12
-
13
- # Based on platform name returns the framework copy destination. Used later by `vendored_frameworks` in Podspec.
14
- # Fallbacks to "ios" if platform is not recognized.
15
- function get_platform_copy_destination {
16
- if [[ $1 == "macosx" ]]; then
17
- echo "macosx"
18
- return
19
- elif [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
20
- echo "xros"
21
- return
22
- fi
23
-
24
- echo "ios"
25
- }
26
-
27
- function get_deployment_target {
28
- if [[ $1 == "macosx" ]]; then
29
- echo "${MACOSX_DEPLOYMENT_TARGET}"
30
- return
31
- elif [[ $1 == "xrsimulator" || $1 == "xros" ]]; then
32
- echo "${XROS_DEPLOYMENT_TARGET}"
33
- return
34
- fi
35
-
36
- echo "${IPHONEOS_DEPLOYMENT_TARGET}"
37
- }
38
-
39
- enable_debugger="false"
40
- if [[ "$CONFIGURATION" == "Debug" ]]; then
41
- enable_debugger="true"
42
- fi
43
-
44
- cmake_build_type=""
45
- if [[ $CONFIGURATION == "Debug" ]]; then
46
- # JS developers aren't VM developers.
47
- # Therefore we're passing as build type Release, to provide a faster build.
48
- cmake_build_type="Release"
49
- else
50
- cmake_build_type="MinSizeRel"
51
- fi
52
-
53
- deployment_target=$(get_deployment_target $PLATFORM_NAME)
54
-
55
- xcode_15_flags=""
56
- xcode_major_version=$(xcodebuild -version | grep -oE '[0-9]*' | head -n 1)
57
- if [[ $xcode_major_version -ge 15 ]]; then
58
- echo "########### Using LINKER:-ld_classic ###########"
59
- xcode_15_flags="LINKER:-ld_classic"
60
- fi
61
-
62
- architectures=$( echo "$ARCHS" | tr " " ";" )
63
-
64
- echo "Configure Apple framework"
65
-
66
- "$CMAKE_BINARY" \
67
- -S "${PODS_ROOT}/hermes-engine" \
68
- -B "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}" \
69
- -DHERMES_EXTRA_LINKER_FLAGS="$xcode_15_flags" \
70
- -DHERMES_APPLE_TARGET_PLATFORM:STRING="$PLATFORM_NAME" \
71
- -DCMAKE_OSX_ARCHITECTURES:STRING="$architectures" \
72
- -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$deployment_target" \
73
- -DHERMES_ENABLE_DEBUGGER:BOOLEAN="$enable_debugger" \
74
- -DHERMES_ENABLE_INTL:BOOLEAN=true \
75
- -DHERMES_ENABLE_LIBFUZZER:BOOLEAN=false \
76
- -DHERMES_ENABLE_FUZZILLI:BOOLEAN=false \
77
- -DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false \
78
- -DHERMES_ENABLE_BITCODE:BOOLEAN=false \
79
- -DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true \
80
- -DHERMES_BUILD_SHARED_JSI:BOOLEAN=false \
81
- -DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true \
82
- -DIMPORT_HERMESC:PATH="${hermesc_path}" \
83
- -DJSI_DIR="$jsi_path" \
84
- -DHERMES_RELEASE_VERSION="for RN $release_version" \
85
- -DCMAKE_BUILD_TYPE="$cmake_build_type"
86
-
87
- echo "Build Apple framework"
88
-
89
- "$CMAKE_BINARY" \
90
- --build "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}" \
91
- --target libhermes \
92
- -j "$(sysctl -n hw.ncpu)"
93
-
94
- echo "Copy Apple framework to destroot/Library/Frameworks"
95
-
96
- platform_copy_destination=$(get_platform_copy_destination $PLATFORM_NAME)
97
-
98
- cp -pfR \
99
- "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}/API/hermes/hermes.framework" \
100
- "${PODS_ROOT}/hermes-engine/destroot/Library/Frameworks/${platform_copy_destination}"
@@ -1,18 +0,0 @@
1
- #!/bin/bash
2
- # Copyright (c) Meta Platforms, Inc. and affiliates.
3
- #
4
- # This source code is licensed under the MIT license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- set -x -e
8
-
9
- hermesc_dir_path="$1"; shift
10
- jsi_path="$1"
11
-
12
- # This script is supposed to be executed from Xcode "run script" phase.
13
- # Xcode sets up its build environment based on the build target (iphone, iphonesimulator, macodsx).
14
- # We want to make sure that hermesc is built for mac.
15
- # So we clean the environment with env -i, and explicitly set SDKROOT to macosx
16
- SDKROOT=$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
17
- env -i SDKROOT="$SDKROOT" "$CMAKE_BINARY" -S "${PODS_ROOT}/hermes-engine" -B "$hermesc_dir_path" -DJSI_DIR="$jsi_path"
18
- env -i SDKROOT="$SDKROOT" "$CMAKE_BINARY" --build "$hermesc_dir_path" --target hermesc -j "$(sysctl -n hw.ncpu)"