react-native-macos 0.77.4 → 0.77.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/Libraries/Blob/RCTBlobManager.h +0 -0
  2. package/Libraries/Blob/RCTBlobManager.mm +0 -0
  3. package/Libraries/Components/TextInput/TextInputState.js +5 -1
  4. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
  5. package/Libraries/Core/ReactNativeVersion.js +1 -1
  6. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  7. package/Libraries/Lists/FillRateHelper.js +3 -3
  8. package/Libraries/Lists/FlatList.d.ts +1 -1
  9. package/Libraries/Lists/FlatList.js +2 -2
  10. package/Libraries/Lists/SectionList.d.ts +1 -1
  11. package/Libraries/Lists/SectionList.js +2 -2
  12. package/Libraries/Lists/SectionListModern.js +2 -2
  13. package/Libraries/Lists/ViewabilityHelper.js +3 -3
  14. package/Libraries/Lists/VirtualizeUtils.js +2 -2
  15. package/Libraries/Lists/VirtualizedList.js +3 -3
  16. package/Libraries/Lists/VirtualizedListContext.js +2 -2
  17. package/Libraries/Lists/VirtualizedSectionList.js +3 -3
  18. package/Libraries/Modal/Modal.js +1 -1
  19. package/Libraries/StyleSheet/normalizeColor.js +0 -0
  20. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  21. package/React/Base/RCTJavaScriptLoader.h +0 -0
  22. package/React/Base/RCTJavaScriptLoader.mm +0 -0
  23. package/React/Base/RCTVersion.m +1 -1
  24. package/React/CoreModules/RCTDevLoadingView.mm +1 -1
  25. package/React/CoreModules/RCTLogBoxView.mm +4 -1
  26. package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +82 -14
  27. package/React/Views/RCTViewKeyboardEvent.m +24 -0
  28. package/ReactAndroid/gradle.properties +1 -1
  29. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  30. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  31. package/local-cli/cli.js +0 -0
  32. package/package.json +5 -4
  33. package/scripts/compose-source-maps.js +0 -0
  34. package/scripts/featureflags/README.md +156 -0
  35. package/scripts/featureflags/index.js +39 -0
  36. package/scripts/ios-configure-glog.sh +0 -0
  37. package/scripts/node-binary.sh +0 -0
  38. package/scripts/packager.sh +0 -0
  39. package/scripts/react-native-xcode.sh +0 -0
  40. package/scripts/react_native_pods_utils/script_phases.sh +0 -0
  41. package/scripts/xcode/ccache-clang++.sh +0 -0
  42. package/scripts/xcode/ccache-clang.sh +0 -0
  43. package/scripts/xcode/with-environment.sh +0 -0
  44. package/types/index.d.ts +1 -1
  45. package/scripts/cocoapods/autolinking.rb +0 -206
  46. package/scripts/cocoapods/autolinking_utils.rb +0 -25
  47. package/scripts/cocoapods/codegen.rb +0 -59
  48. package/scripts/cocoapods/codegen_script_phase_extractor.rb +0 -13
  49. package/scripts/cocoapods/codegen_utils.rb +0 -389
  50. package/scripts/cocoapods/fabric.rb +0 -18
  51. package/scripts/cocoapods/helpers.rb +0 -150
  52. package/scripts/cocoapods/jsengine.rb +0 -33
  53. package/scripts/cocoapods/local_podspec_patch.rb +0 -51
  54. package/scripts/cocoapods/new_architecture.rb +0 -194
  55. package/scripts/cocoapods/privacy_manifest_utils.rb +0 -194
  56. package/scripts/cocoapods/runtime.rb +0 -18
  57. package/scripts/cocoapods/spm.rb +0 -94
  58. package/scripts/cocoapods/utils.rb +0 -723
  59. package/scripts/codegen/codegen-utils.js +0 -51
  60. package/scripts/codegen/generate-artifacts-executor.js +0 -982
  61. package/scripts/codegen/generate-specs-cli-executor.js +0 -128
  62. package/scripts/codegen/templates/RCTAppDependencyProviderH.template +0 -25
  63. package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +0 -55
  64. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +0 -18
  65. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +0 -33
  66. package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +0 -16
  67. package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +0 -23
  68. package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +0 -34
  69. package/sdks/hermes-engine/hermes-engine.podspec +0 -169
  70. package/sdks/hermes-engine/hermes-utils.rb +0 -280
  71. package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -225
  72. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +0 -100
  73. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +0 -18
  74. package/sdks/hermes-engine/utils/build-ios-framework.sh +0 -90
  75. package/sdks/hermes-engine/utils/build-mac-framework.sh +0 -22
  76. package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +0 -7
  77. package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +0 -32
  78. package/sdks/hermes-engine/utils/replace_hermes_version.js +0 -106
@@ -1,280 +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
- require 'json' # [macOS]
10
-
11
- HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
12
- ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
13
-
14
- module HermesEngineSourceType
15
- LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
16
- DOWNLOAD_PREBUILD_RELEASE_TARBALL = :download_prebuild_release_tarball
17
- DOWNLOAD_PREBUILT_NIGHTLY_TARBALL = :download_prebuilt_nightly_tarball
18
- BUILD_FROM_GITHUB_COMMIT = :build_from_github_commit
19
- BUILD_FROM_GITHUB_TAG = :build_from_github_tag
20
- BUILD_FROM_GITHUB_MAIN = :build_from_github_main
21
- BUILD_FROM_LOCAL_SOURCE_DIR = :build_from_local_source_dir
22
-
23
- def HermesEngineSourceType.isPrebuilt(source_type)
24
- return source_type == LOCAL_PREBUILT_TARBALL || source_type == DOWNLOAD_PREBUILD_RELEASE_TARBALL || source_type == DOWNLOAD_PREBUILT_NIGHTLY_TARBALL
25
- end
26
-
27
- def HermesEngineSourceType.isFromSource(source_type)
28
- 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
29
- end
30
- end
31
-
32
- # Computes the hermes-engine.podspec's source type.
33
- # - To use a specific tarball, install the dependencies with:
34
- # `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
35
- # - To force a build from source, install the dependencies with:
36
- # `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
37
- # If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
38
- # (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
39
- #
40
- # Parameters:
41
- # - version: current version of the pod
42
- # - react_native_path: path to react native
43
- #
44
-
45
- # Returns: hermes-engine source type
46
- def hermes_source_type(version, react_native_path)
47
- if override_hermes_dir_envvar_defined()
48
- return HermesEngineSourceType::BUILD_FROM_LOCAL_SOURCE_DIR
49
- end
50
-
51
- if hermes_engine_tarball_envvar_defined()
52
- return HermesEngineSourceType::LOCAL_PREBUILT_TARBALL
53
- end
54
-
55
- if hermes_commit_envvar_defined()
56
- return HermesEngineSourceType::BUILD_FROM_GITHUB_COMMIT
57
- end
58
-
59
- if force_build_from_tag(react_native_path)
60
- return HermesEngineSourceType::BUILD_FROM_GITHUB_TAG
61
- end
62
-
63
- if force_build_from_main(react_native_path)
64
- return HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN
65
- end
66
-
67
- if release_artifact_exists(version)
68
- return HermesEngineSourceType::DOWNLOAD_PREBUILD_RELEASE_TARBALL
69
- end
70
-
71
- if nightly_artifact_exists(version)
72
- return HermesEngineSourceType::DOWNLOAD_PREBUILT_NIGHTLY_TARBALL
73
- end
74
-
75
- return HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN
76
- end
77
-
78
- def override_hermes_dir_envvar_defined()
79
- return ENV.has_key?('REACT_NATIVE_OVERRIDE_HERMES_DIR')
80
- end
81
-
82
- def hermes_engine_tarball_envvar_defined()
83
- return ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
84
- end
85
-
86
- def hermes_commit_envvar_defined()
87
- return ENV.has_key?('HERMES_COMMIT')
88
- end
89
-
90
- def force_build_from_tag(react_native_path)
91
- return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
92
- end
93
-
94
- def force_build_from_main(react_native_path)
95
- return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
96
- end
97
-
98
- def release_artifact_exists(version)
99
- return hermes_artifact_exists(release_tarball_url(version, :debug))
100
- end
101
-
102
- def nightly_artifact_exists(version)
103
- return hermes_artifact_exists(nightly_tarball_url(version).gsub("\\", ""))
104
- end
105
-
106
- def podspec_source(source_type, version, react_native_path)
107
- case source_type
108
- when HermesEngineSourceType::BUILD_FROM_LOCAL_SOURCE_DIR
109
- return podspec_source_build_from_local_source_dir(react_native_path)
110
- when HermesEngineSourceType::LOCAL_PREBUILT_TARBALL
111
- return podspec_source_local_prebuilt_tarball()
112
- when HermesEngineSourceType::BUILD_FROM_GITHUB_COMMIT
113
- return podspec_source_build_from_github_commit()
114
- when HermesEngineSourceType::BUILD_FROM_GITHUB_TAG
115
- return podspec_source_build_from_github_tag(react_native_path)
116
- when HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN
117
- return podspec_source_build_from_github_main()
118
- when HermesEngineSourceType::DOWNLOAD_PREBUILD_RELEASE_TARBALL
119
- return podspec_source_download_prebuild_release_tarball(react_native_path, version)
120
- when HermesEngineSourceType::DOWNLOAD_PREBUILT_NIGHTLY_TARBALL
121
- return podspec_source_download_prebuilt_nightly_tarball(version)
122
- else
123
- abort "[Hermes] Unsupported or invalid source type provided: #{source_type}"
124
- end
125
- end
126
-
127
- def podspec_source_build_from_local_source_dir(react_native_path)
128
- source_dir_path = ENV['REACT_NATIVE_OVERRIDE_HERMES_DIR']
129
- if Dir.exist?(source_dir_path)
130
- hermes_log("Using source code from local path: #{source_dir_path}")
131
- tarball_dir_path = artifacts_dir()
132
- FileUtils.mkdir_p(tarball_dir_path) unless Dir.exist?(tarball_dir_path)
133
- tarball_path = File.join(tarball_dir_path, "hermes-engine-from-local-source-dir.tar.gz")
134
- exclude_paths = [
135
- "__tests__",
136
- "./external/flowtest",
137
- "./external/esprima/test_fixtures"
138
- ]
139
- .map {|path| "--exclude=#{path}"}
140
- .join(' ')
141
- tar_command = "tar #{exclude_paths} -czvf #{tarball_path} -C #{source_dir_path} . 2> /dev/null"
142
- success = system(tar_command)
143
- if !success
144
- abort "Failed to create a tarball with the contents of \"#{source_dir_path}\""
145
- end
146
- return {:http => "file://#{tarball_path}"}
147
- else
148
- abort <<-EOS
149
- [Hermes] REACT_NATIVE_OVERRIDE_HERMES_DIR is set, but points to a non-existing directory: \"#{source_dir_path}\"
150
- If you don't want to use local source, run `unset REACT_NATIVE_OVERRIDE_HERMES_DIR`
151
- EOS
152
- end
153
- end
154
-
155
- def podspec_source_local_prebuilt_tarball()
156
- tarball_path = ENV['HERMES_ENGINE_TARBALL_PATH']
157
- if File.exist?(tarball_path)
158
- hermes_log("Using pre-built binary from local path defined by HERMES_ENGINE_TARBALL_PATH envvar: #{tarball_path}")
159
- return {:http => "file://#{tarball_path}"}
160
- end
161
- abort <<-EOS
162
- [Hermes] HERMES_ENGINE_TARBALL_PATH is set, but points to a non-existing file: \"#{tarball_path}\"
163
- If you don't want to use tarball, run `unset HERMES_ENGINE_TARBALL_PATH`
164
- EOS
165
- end
166
-
167
- def podspec_source_build_from_github_commit()
168
- commit = ENV['HERMES_COMMIT']
169
- hermes_log("Using commit defined by HERMES_COMMIT envvar: #{commit}")
170
- return {:git => HERMES_GITHUB_URL, :commit => commit}
171
- end
172
-
173
- def podspec_source_build_from_github_tag(react_native_path)
174
- tag = File.read(hermestag_file(react_native_path)).strip
175
- hermes_log("Using tag difined in sdks/.hermesversion: #{tag}")
176
- return {:git => HERMES_GITHUB_URL, :tag => tag}
177
- end
178
-
179
- def podspec_source_build_from_github_main()
180
- hermes_log("Using the latest commit from main.")
181
- return {:git => HERMES_GITHUB_URL, :commit => `git ls-remote #{HERMES_GITHUB_URL} main | cut -f 1`.strip}
182
- end
183
-
184
- def podspec_source_download_prebuild_release_tarball(react_native_path, version)
185
- url = release_tarball_url(version, :debug)
186
- hermes_log("Using release tarball from URL: #{url}")
187
- download_stable_hermes(react_native_path, version, :debug)
188
- download_stable_hermes(react_native_path, version, :release)
189
- return {:http => url}
190
- end
191
-
192
- def podspec_source_download_prebuilt_nightly_tarball(version)
193
- url = nightly_tarball_url(version)
194
- hermes_log("Using nightly tarball from URL: #{url}")
195
- return {:http => url}
196
- end
197
-
198
- # HELPERS
199
-
200
- def artifacts_dir()
201
- return File.join(Pod::Config.instance.project_pods_root, "hermes-engine-artifacts")
202
- end
203
-
204
- def hermestag_file(react_native_path)
205
- return File.join(react_native_path, "sdks", ".hermesversion")
206
- end
207
-
208
- def release_tarball_url(version, build_type)
209
- maven_repo_url = "https://repo1.maven.org/maven2"
210
- namespace = "com/facebook/react"
211
- # Sample url from Maven:
212
- # 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
213
- return "#{maven_repo_url}/#{namespace}/react-native-artifacts/#{version}/react-native-artifacts-#{version}-hermes-ios-#{build_type.to_s}.tar.gz"
214
- end
215
-
216
- def download_stable_hermes(react_native_path, version, configuration)
217
- tarball_url = release_tarball_url(version, configuration)
218
- download_hermes_tarball(react_native_path, tarball_url, version, configuration)
219
- end
220
-
221
- def download_hermes_tarball(react_native_path, tarball_url, version, configuration)
222
- destination_path = configuration == nil ?
223
- "#{artifacts_dir()}/hermes-ios-#{version}.tar.gz" :
224
- "#{artifacts_dir()}/hermes-ios-#{version}-#{configuration}.tar.gz"
225
-
226
- unless File.exist?(destination_path)
227
- # Download to a temporary file first so we don't cache incomplete downloads.
228
- tmp_file = "#{artifacts_dir()}/hermes-ios.download"
229
- `mkdir -p "#{artifacts_dir()}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"`
230
- end
231
- return destination_path
232
- end
233
-
234
- def nightly_tarball_url(version)
235
- params = "r=snapshots\&g=com.facebook.react\&a=react-native-artifacts\&c=hermes-ios-debug\&e=tar.gz\&v=#{version}-SNAPSHOT"
236
- return resolve_url_redirects("http://oss.sonatype.org/service/local/artifact/maven/redirect\?#{params}")
237
- end
238
-
239
- def resolve_url_redirects(url)
240
- return (`curl -Ls -o /dev/null -w %{url_effective} \"#{url}\"`)
241
- end
242
-
243
- # [macOS react-native-macos does not publish macos specific hermes artifacts
244
- # so we attempt to find the latest patch version of the iOS artifacts and use that
245
- def findLastestVersionWithArtifact(version)
246
- # See https://central.sonatype.org/search/rest-api-guide/ for details on query params
247
- versionWithoutPatch = "#{version.match(/^(\d+\.\d+)/)}"
248
- res, = Open3.capture3("curl -s https://search.maven.org/solrsearch/select?q=g:com.facebook.react+AND+a:react-native-artifacts+AND+v:#{versionWithoutPatch}.*&core=gav&rows=1&wt=json")
249
- wt = JSON.parse(res)
250
- response = wt['response']
251
- return response['docs'][0]['v'] unless response['numFound'] == 0
252
- end
253
- # macOS]
254
-
255
- # This function checks that Hermes artifact exists.
256
- # As of now it should check it on the Maven repo.
257
- #
258
- # Parameters
259
- # - version: the version of React Native
260
- # - build_type: debug or release
261
- def hermes_artifact_exists(tarball_url)
262
- # -L is used to follow redirects, useful for the nightlies
263
- # I also needed to wrap the url in quotes to avoid escaping & and ?.
264
- return (`curl -o /dev/null --silent -Iw '%{http_code}' -L "#{tarball_url}"` == "200")
265
- end
266
-
267
- def hermes_log(message, level = :warning)
268
- if !Object.const_defined?("Pod::UI")
269
- return
270
- end
271
- hermes_log_messgae = '[Hermes] ' + message
272
- case level
273
- when :info
274
- Pod::UI.puts hermes_log_messgae.green
275
- when :error
276
- Pod::UI.puts hermes_log_messgae.red
277
- else
278
- Pod::UI.puts hermes_log_messgae.yellow
279
- end
280
- 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
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)"