Skip to content

Commit acecf99

Browse files
kraenhansenfacebook-github-bot
authored andcommitted
Update build-hermes-xcode.sh to fail faster (#47894)
Summary: While debugging an error building hermes from source in a React Native app, I kept getting this weird error: > Building for 'iOS-simulator', but linking in dylib ({redacted}/ios/Pods/hermes-engine/destroot/Library/Frameworks/ios/hermes.framework/hermes) built for 'macOS' The root cause was a call to `cmake` failing, but `/sdks/hermes-engine/utils/build-hermes-xcode.sh` didn't exit on the error and instead continued building the hermes.framework from the dummy frameworks created by `./sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh`. I suggest fixing this by introducing a `set -e` call similar to that used in `build-hermesc-xcode.sh`: https://github.com/facebook/react-native/blob/2f523f0acf3b589bf962d5d20d2c04e453baf1da/packages/react-native/sdks/hermes-engine/utils/build-hermesc-xcode.sh#L7 ## Changelog: [Internal] - Ensure building hermes from source exits early on failures Pull Request resolved: #47894 Test Plan: I followed https://github.com/facebook/hermes/blob/main/doc/ReactNativeIntegration.md getting to a state of building a React Native app with Hermes built from source. I then introduced an error in `hermes/API/hermes/hermes.cpp` (I simply typed `asd` in the top of the file) and built the app from Xcode: ![Screenshot 2024-11-22 at 15 13 04](https://github.com/user-attachments/assets/c8c4a1e2-3bf1-4d08-b9f9-583dba3df159) If you scroll up, you can see the failed cmake build, but it just continues trying to build the framework, effectively hiding the error: ![Screenshot 2024-11-22 at 15 14 19](https://github.com/user-attachments/assets/3accf7b1-1667-42fc-b9c0-01fd9b1c2d8f) When applying this patch and cleaning the build folder, the error is more prominent and actionable: ![Screenshot 2024-11-22 at 15 18 27](https://github.com/user-attachments/assets/f01afd6c-c1bb-4e87-9d28-dcdea41feb3e) Reviewed By: andrewdacenko Differential Revision: D66494603 Pulled By: dmytrorykun fbshipit-source-id: dbeeba17b4cc1101001c9628914135bea6006d4a
1 parent ae775af commit acecf99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the MIT license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
set -x
7+
set -x -e
88

99
release_version="$1"; shift
1010
hermesc_path="$1"; shift

0 commit comments

Comments
 (0)