Skip to content

Commit 6b8e13f

Browse files
dmytrorykunfacebook-github-bot
authored andcommitted
Integrate Hermes with the Xcode build process
Summary: ## Context If React Native is built from *main* of any non-stable commit, then Hermes is built from source. The build is performed by `build-ios-framework.sh` and `build-mac-framework.sh` scripts in `hermes-engine.podspec` `prepare_command` stage. Since those scripts have no access build target information, they build all possible architectures and platforms just in case. That takes ages. ## Solution The idea is to integrate build script into Xcode *run script* phase, and use build target information to build Hermes for active architecture only. ## Implementation - Existing behaviour remains unchanged for local tarball and remote prebuild cases. - `build-hermesc-xcode.sh` builds Hermesc as `hermes-engine.podspec` `prepare_command`. Default build location is `react-native/sdks/hermes-engine/build_host_hermesc`. - `build-hermes-xcode.sh` builds Hermes in 'Build Hermes' Xcode script phase. It uses `$PLATFORM_NAME`, `$CONFIGURATION`, `$ARCHS`, `$IPHONEOS_DEPLOYMENT_TARGET` and `$MACOSX_DEPLOYMENT_TARGET` environment variables to configure cmake project so it builds only active architecture. The script also gets RN version, *cmake* path and *hermesc* path from the podspec. - `copy-hermes-xcode.sh` copies Hermes.framework inside the app bundle. This script phase is added to the user app target in a `post_install` hook, after pods are integrated in a user project. - `OTHER_LDFLAGS -framework "hermes"` added to the user project to enable linking against Hermes.framework. - If `HERMES_OVERRIDE_HERMESC_PATH` is set, then Hermesc building is skipped, and `HERMES_OVERRIDE_HERMESC_PATH` is used for `build-hermes-xcode.sh`. - `HERMES_CLI_PATH` is injected into user project config to enable Hermes source maps in `react-native-xcode.sh`. ## Things that didn't work - *Running build-hermesc-xcode.sh in Xcode run script phase*. This doesn't work because Hermesc is supposed to be built for macos, and if build target is ios, then Xcode configures environment in such a way that Hermesc build fails. - *Installing Hermesc into CocoaPods download folder*. So it then ends up in `Pods/hermes-engine/build_host_hermesc`, and all the housekeeping is handled by CocoaPods. This doesn't work because cmake uses absolute paths in a configured project. If configured project is moved to a different location, nothing builds. - *Installing Hermesc directly into Pods/hermes-engine*. This doesn't work because CocoaPods runs prepare_command before Pods folder clean up, and everything gets wiped. ## Known issue - If `Pods/hermes-engine` is manually removed, then `sdks/hermes-engine/build_host_hermesc` must also be removed before running `pod install`. Otherwise cmake will complain about stale cache: ``` CMake Error: The source "<CocoaPodsCache>/hermes-engine/<hash2>/CMakeLists.txt" does not match the source "<CocoaPodsCache>/hermes-engine/<has1>/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory. ``` ## Benchmark MacBook M1 2021 32 GB. ``` export REACT_NATIVE_PATH=~/fbsource/xplat/js/react-native-github cd $REACT_NATIVE_PATH/packages/rn-tester pod install rm -rf $REACT_NATIVE_PATH/sdks/hermes-engine/build_host_hermesc cd $REACT_NATIVE_PATH/packages/rn-tester/Pods/hermes-engine echo 't1=$(date +%s); $@; t2=$(date +%s); diff=$(echo "$t2 - $t1" | bc); echo Operation took $diff seconds.' > /tmp/benchmark.sh ``` ``` # Before export BUILD_TYPE=Debug export JSI_PATH=$REACT_NATIVE_PATH/ReactCommon/jsi export RELEASE_VERSION=1000.0 export IOS_DEPLOYMENT_TARGET=iphonesimulator export MAC_DEPLOYMENT_TARGET=12.6 cd $REACT_NATIVE_PATH/packages/rn-tester/Pods/hermes-engine . /tmp/benchmark.sh $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-ios-framework.sh # Operation took 252 seconds . /tmp/benchmark.sh $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-mac-framework.sh # Operation took 179 seconds ``` ``` # After . /tmp/benchmark.sh source $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-hermesc-xcode.sh $REACT_NATIVE_PATH/sdks/hermes-engine/build_host_hermesc # Operation took 59 seconds. . /tmp/benchmark.sh xcodebuild -workspace $REACT_NATIVE_PATH/packages/rn-tester/RNTesterPods.xcworkspace -scheme hermes-engine # Operation took 106 seconds. ``` |Before|||After||| |--| |iOS framework (s)|Mac framework (s)|Total (s)|Hermesc (s)|Target-specific framework (s)|Total (s)| |252|179|431|59|106|**165 (-266) (-61%)**| The performance win is fixed, and does not depend on the project size and structure. As an example, this is how these changes affect build time of RNTester. |Before||||After||| |--| ||Pod install (s)|Xcode build (s)|Total (s)|Pod install (s)|Xcode build (s)|Total (s)| |Clean build|1219|132|1352|734 (-485)|249(+117)|**983 (-369)**| |Incremental build|82|30|112|105 (+23)|**34 (+4)**|139 (+27)| The most important values here are the total clean build time and the incremental Xcode build time. The first one went down by 369 seconds, the second one went up by 4 seconds. I consider it a reasonable tradeoff. The extra 4 seconds in the incremental Xcode build time can potentially be mitigated by setting up output file lists for the new script phases. allow-large-files Changelog: [iOS][Changed] - Hermes is integrated into Xcode build. Reviewed By: hramos Differential Revision: D40063686 fbshipit-source-id: e6993d62225789377db769244bc07786cc978a27
1 parent f49b251 commit 6b8e13f

File tree

9 files changed

+200
-40
lines changed

9 files changed

+200
-40
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ package-lock.json
122122
/sdks/download
123123
/sdks/hermes
124124
/sdks/hermesc
125+
/sdks/hermes-engine/build_host_hermesc
125126

126127
# Visual studio
127128
.vscode

ReactCommon/hermes/React-hermes.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Pod::Spec.new do |s|
4040
s.public_header_files = "executor/HermesExecutorFactory.h"
4141
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
4242
s.pod_target_xcconfig = {
43-
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include\""
43+
"HEADER_SEARCH_PATHS" => "\"${PODS_ROOT}/hermes-engine/destroot/include\" \"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include\""
4444
}.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {})
4545
s.header_dir = "reacthermes"
4646
s.dependency "React-cxxreact", version

packages/rn-tester/Podfile.lock

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ PODS:
7373
- FlipperKit/FlipperKitNetworkPlugin
7474
- fmt (6.2.1)
7575
- glog (0.3.5)
76-
- hermes-engine (1000.0.0)
76+
- hermes-engine (1000.0.0):
77+
- hermes-engine/Hermes (= 1000.0.0)
78+
- hermes-engine/JSI (= 1000.0.0)
79+
- hermes-engine/Public (= 1000.0.0)
80+
- hermes-engine/Hermes (1000.0.0)
81+
- hermes-engine/JSI (1000.0.0)
82+
- hermes-engine/Public (1000.0.0)
7783
- libevent (2.1.12)
7884
- OpenSSL-Universal (1.1.1100)
7985
- RCT-Folly (2021.07.22.00):
@@ -933,7 +939,7 @@ SPEC CHECKSUMS:
933939
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
934940
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
935941
FBLazyVector: 19e408e76fa9258dd32191a50d60c41444f52d29
936-
FBReactNativeSpec: 27a89a8eea1b441a73a78f420dd18dad3ed13723
942+
FBReactNativeSpec: 9761d52cf2d3727e2557fbf4014c514909d76b6b
937943
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
938944
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
939945
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
@@ -945,7 +951,7 @@ SPEC CHECKSUMS:
945951
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
946952
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
947953
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
948-
hermes-engine: cd15ebd246edff3a995ec666e898dd1cbdcaa10d
954+
hermes-engine: 445a2267b04cb39ca4a0b2d6758b5a0e5a58ccad
949955
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
950956
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
951957
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
@@ -960,7 +966,7 @@ SPEC CHECKSUMS:
960966
React-cxxreact: ebed982230716c3515ab2f435cb13aec8a56af02
961967
React-Fabric: 141459e61c825acf02d26ece099acbd9cbd87b99
962968
React-graphics: 2dda97baebb0082bb85499c862c3f269a194f416
963-
React-hermes: 0a5145bae4207edf0def8e28fbcb6a8fd6e806c2
969+
React-hermes: 4912383b4f062173cb623e570ead70ab380f7bef
964970
React-jsi: c24dbcfdf7ea075138b73372387c7f17c0db56ef
965971
React-jsidynamic: 2b14ac1b6d3a1b7daa1e5a424b98de87da981698
966972
React-jsiexecutor: 14e899380e3fe9ca74c4e19727540a03e7574721

scripts/cocoapods/jsengine.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,23 @@ def setup_hermes!(react_native_path: "../node_modules/react-native", fabric_enab
3434
pod 'React-hermes', :path => "#{react_native_path}/ReactCommon/hermes"
3535
pod 'libevent', '~> 2.1.12'
3636
end
37+
38+
def add_copy_hermes_framework_script_phase(installer, react_native_path)
39+
utils_dir = File.join(react_native_path, "sdks", "hermes-engine", "utils")
40+
phase_name = "[RN]Copy Hermes framework"
41+
project = installer.generated_aggregate_targets.first.user_project
42+
target = project.targets.first
43+
if target.shell_script_build_phases.none? { |phase| phase.name == phase_name }
44+
phase = target.new_shell_script_build_phase(phase_name)
45+
phase.shell_script = ". #{utils_dir}/copy-hermes-xcode.sh"
46+
project.save()
47+
end
48+
end
49+
50+
def remove_copy_hermes_framework_script_phase(installer, react_native_path)
51+
utils_dir = File.join(react_native_path, "sdks", "hermes-engine", "utils")
52+
phase_name = "[RN]Copy Hermes framework"
53+
project = installer.generated_aggregate_targets.first.user_project
54+
project.targets.first.shell_script_build_phases.delete_if { |phase| phase.name == phase_name }
55+
project.save()
56+
end

scripts/react_native_pods.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ def react_native_post_install(installer, react_native_path = "../node_modules/re
203203
flipper_post_install(installer)
204204
end
205205

206+
if ReactNativePodsUtils.has_pod(installer, 'hermes-engine') && ENV['HERMES_BUILD_FROM_SOURCE'] == "1"
207+
add_copy_hermes_framework_script_phase(installer, react_native_path)
208+
else
209+
remove_copy_hermes_framework_script_phase(installer, react_native_path)
210+
end
211+
206212
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
207213
ReactNativePodsUtils.fix_library_search_paths(installer)
208214
ReactNativePodsUtils.fix_react_bridging_header_search_paths(installer)

sdks/hermes-engine/hermes-engine.podspec

Lines changed: 70 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ version = package['version']
1919
hermestag_file = File.join(react_native_path, "sdks", ".hermesversion")
2020
isInCI = ENV['CI'] == true
2121

22-
# sdks/hermesc/osx-bin/ImportHermesc.cmake
23-
import_hermesc_file=File.join(react_native_path, "sdks", "hermesc", "osx-bin", "ImportHermesc.cmake")
24-
2522
source = {}
2623
git = "https://github.com/facebook/hermes.git"
2724

@@ -32,7 +29,7 @@ if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
3229
Pod::UI.puts '[Hermes] Using pre-built Hermes binaries from local path.' if Object.const_defined?("Pod::UI")
3330
source[:http] = "file://#{ENV['HERMES_ENGINE_TARBALL_PATH']}"
3431
elsif isInMain
35-
Pod::UI.puts '[Hermes] Installing hermes-engine may take a while, building Hermes from source...'.yellow if Object.const_defined?("Pod::UI")
32+
Pod::UI.puts '[Hermes] Installing hermes-engine may take slightly longer, building Hermes compiler from source...'.yellow if Object.const_defined?("Pod::UI")
3633
source[:git] = git
3734
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
3835
elsif isNightly
@@ -62,42 +59,80 @@ Pod::Spec.new do |spec|
6259
spec.source = source
6360
spec.platforms = { :osx => "10.13", :ios => "12.4" }
6461

65-
spec.preserve_paths = ["destroot/bin/*"].concat(build_type == :debug ? ["**/*.{h,c,cpp}"] : [])
66-
spec.source_files = "destroot/include/**/*.h"
67-
spec.exclude_files = [
68-
"destroot/include/jsi/jsi/JSIDynamic.{h,cpp}",
69-
"destroot/include/jsi/jsi/jsilib-*.{h,cpp}",
70-
]
71-
spec.header_mappings_dir = "destroot/include"
72-
73-
spec.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
74-
spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
62+
spec.preserve_paths = '**/*.*'
63+
spec.source_files = ''
7564

7665
spec.xcconfig = {
7766
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
7867
"CLANG_CXX_LIBRARY" => "compiler-default"
7968
}.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {})
8069

81-
if source[:git] then
82-
ENV['REACT_NATIVE_PATH'] = react_native_path
83-
hermes_utils_path = "/sdks/hermes-engine/utils"
84-
85-
spec.prepare_command = <<-EOS
86-
export BUILD_TYPE=#{build_type.to_s.capitalize}
87-
export RELEASE_VERSION="#{version}"
88-
export IOS_DEPLOYMENT_TARGET="#{spec.deployment_target('ios')}"
89-
export MAC_DEPLOYMENT_TARGET="#{spec.deployment_target('osx')}"
90-
export JSI_PATH="$REACT_NATIVE_PATH/ReactCommon/jsi"
91-
92-
# Set HERMES_OVERRIDE_HERMESC_PATH if pre-built HermesC is available
93-
#{File.exist?(import_hermesc_file) ? "export HERMES_OVERRIDE_HERMESC_PATH=#{import_hermesc_file}" : ""}
94-
#{File.exist?(import_hermesc_file) ? "echo \"Overriding HermesC path...\"" : ""}
95-
96-
# Build iOS framework
97-
$REACT_NATIVE_PATH#{hermes_utils_path}/build-ios-framework.sh
98-
99-
# Build Mac framework
100-
$REACT_NATIVE_PATH#{hermes_utils_path}/build-mac-framework.sh
101-
EOS
70+
if source[:http] then
71+
72+
spec.subspec 'Pre-built' do |ss|
73+
ss.preserve_paths = ["destroot/bin/*"].concat(build_type == :debug ? ["**/*.{h,c,cpp}"] : [])
74+
ss.source_files = "destroot/include/**/*.h"
75+
ss.exclude_files = ["destroot/include/jsi/jsi/JSIDynamic.{h,cpp}", "destroot/include/jsi/jsi/jsilib-*.{h,cpp}"]
76+
ss.header_mappings_dir = "destroot/include"
77+
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
78+
ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
79+
end
80+
81+
elsif source[:git] then
82+
83+
ENV['HERMES_BUILD_FROM_SOURCE'] = "1"
84+
85+
spec.subspec 'Hermes' do |ss|
86+
ss.source_files = ''
87+
ss.public_header_files = 'API/hermes/*.h'
88+
ss.header_dir = 'hermes'
89+
end
90+
91+
spec.subspec 'JSI' do |ss|
92+
ss.source_files = ''
93+
ss.public_header_files = 'API/jsi/jsi/*.h'
94+
ss.header_dir = 'jsi'
95+
end
96+
97+
spec.subspec 'Public' do |ss|
98+
ss.source_files = ''
99+
ss.public_header_files = 'public/hermes/Public/*.h'
100+
ss.header_dir = 'hermes/Public'
101+
end
102+
103+
hermesc_path = ""
104+
105+
if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then
106+
hermesc_path = ENV['HERMES_OVERRIDE_HERMESC_PATH']
107+
else
108+
# Keep hermesc_path synchronized with .gitignore entry.
109+
ENV['REACT_NATIVE_PATH'] = react_native_path
110+
hermesc_path = "${REACT_NATIVE_PATH}/sdks/hermes-engine/build_host_hermesc"
111+
spec.prepare_command = ". #{react_native_path}/sdks/hermes-engine/utils/build-hermesc-xcode.sh #{hermesc_path}"
112+
end
113+
114+
spec.user_target_xcconfig = {
115+
'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/hermes-engine/destroot/Library/Frameworks/iphoneos" ' +
116+
'"$(PODS_ROOT)/hermes-engine/destroot/Library/Frameworks/iphonesimulator" ' +
117+
'"$(PODS_ROOT)/hermes-engine/destroot/Library/Frameworks/macosx" ' +
118+
'"$(PODS_ROOT)/hermes-engine/destroot/Library/Frameworks/catalyst"',
119+
'OTHER_LDFLAGS' => '-framework "hermes"',
120+
'HERMES_CLI_PATH' => "#{hermesc_path}/bin/hermesc"
121+
}
122+
123+
spec.script_phases = [
124+
{
125+
:name => 'Build Hermes',
126+
:script => <<-EOS
127+
. ${PODS_ROOT}/../.xcode.env
128+
export CMAKE_BINARY=${CMAKE_BINARY:-#{%x(command -v cmake | tr -d '\n')}}
129+
. ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermes-xcode.sh #{version} #{hermesc_path}/ImportHermesc.cmake
130+
EOS
131+
},
132+
{
133+
:name => 'Copy Hermes Framework',
134+
:script => ". ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/copy-hermes-xcode.sh"
135+
}
136+
]
102137
end
103138
end
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
12+
build_cli_tools="false"
13+
if [[ "$PLATFORM_NAME" == macosx ]]; then
14+
build_cli_tools="true"
15+
fi
16+
17+
enable_debugger="false"
18+
if [[ "$CONFIGURATION" == "Debug" ]]; then
19+
enable_debugger="true"
20+
fi
21+
22+
deployment_target=${IPHONEOS_DEPLOYMENT_TARGET}
23+
if [ -z "$deployment_target" ]; then
24+
deployment_target=${MACOSX_DEPLOYMENT_TARGET}
25+
fi
26+
27+
architectures=$( echo "$ARCHS" | tr " " ";" )
28+
29+
echo "Configure Apple framework"
30+
31+
"$CMAKE_BINARY" \
32+
-S "${PODS_ROOT}/hermes-engine" \
33+
-B "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}" \
34+
-DHERMES_APPLE_TARGET_PLATFORM:STRING="$PLATFORM_NAME" \
35+
-DCMAKE_OSX_ARCHITECTURES:STRING="$architectures" \
36+
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$deployment_target" \
37+
-DHERMES_ENABLE_DEBUGGER:BOOLEAN="$enable_debugger" \
38+
-DHERMES_ENABLE_INTL:BOOLEAN=true \
39+
-DHERMES_ENABLE_LIBFUZZER:BOOLEAN=false \
40+
-DHERMES_ENABLE_FUZZILLI:BOOLEAN=false \
41+
-DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false \
42+
-DHERMES_ENABLE_BITCODE:BOOLEAN=false \
43+
-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true \
44+
-DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true \
45+
-DHERMES_ENABLE_TOOLS:BOOLEAN="$build_cli_tools" \
46+
-DIMPORT_HERMESC:PATH="${hermesc_path}" \
47+
-DHERMES_RELEASE_VERSION="for RN $release_version" \
48+
-DCMAKE_INSTALL_PREFIX:PATH="${PODS_ROOT}/hermes-engine/destroot" \
49+
-DCMAKE_BUILD_TYPE="$CONFIGURATION"
50+
51+
echo "Build Apple framework"
52+
53+
"$CMAKE_BINARY" \
54+
--build "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}" \
55+
--target "install/strip" \
56+
-j "$(sysctl -n hw.ncpu)"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
hermesc_dir_path="$1"
10+
11+
CMAKE_BINARY=${CMAKE_BINARY:-cmake}
12+
13+
if ! "$CMAKE_BINARY" -S . -B "$hermesc_dir_path"
14+
then
15+
echo "Failed to configure Hermesc cmake project."
16+
exit 1
17+
fi
18+
if ! "$CMAKE_BINARY" --build "$hermesc_dir_path" --target hermesc -j "$(sysctl -n hw.ncpu)"
19+
then
20+
echo "Failed to build Hermesc cmake project."
21+
exit 1
22+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
source="${PODS_ROOT}/hermes-engine/destroot/Library/Frameworks/${PLATFORM_NAME}/hermes.framework"
10+
11+
if [[ ! -f "$source" ]]; then
12+
cp -R "$source" "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes/hermes.framework"
13+
cp -R "$source" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
14+
fi

0 commit comments

Comments
 (0)