Update build-hermes-xcode.sh
to fail faster
#47894
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
While debugging an error building hermes from source in a React Native app, I kept getting this weird error:
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 inbuild-hermesc-xcode.sh
:react-native/packages/react-native/sdks/hermes-engine/utils/build-hermesc-xcode.sh
Line 7 in 2f523f0
Changelog:
[Internal] - Ensure building hermes from source exits early on failures
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 typedasd
in the top of the file) and built the app from Xcode:If you scroll up, you can see the failed cmake build, but it just continues trying to build the framework, effectively hiding the error:
When applying this patch and cleaning the build folder, the error is more prominent and actionable: