Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/react-native/scripts/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ source "$REACT_NATIVE_DIR/scripts/node-binary.sh"
HERMES_ENGINE_PATH="$PODS_ROOT/hermes-engine"
[ -z "$HERMES_CLI_PATH" ] && HERMES_CLI_PATH="$HERMES_ENGINE_PATH/destroot/bin/hermesc"

# SwiftPM consumers have no Pods directory to provide hermesc. When there is
# no Pods installation at all and the current HERMES_CLI_PATH does not exist
# (unset, or an injector-baked path gone stale after a package-store move),
# resolve the hermes-compiler npm package THROUGH react-native's own dependency
# graph — react-native pins the hermes-compiler version, so the compiler's
# bytecode version always matches the prebuilt hermes VM artifacts (a
# mismatched pair crashes at launch with "Wrong bytecode version").
# STRICTLY SwiftPM-scoped: in a CocoaPods build the hermes-engine pod owns both
# the VM and hermesc, and its hermes train may legitimately differ from the npm
# hermes-compiler — falling back there would compile bundles the podded VM
# rejects.
if [[ ( -z "$PODS_ROOT" || ! -d "$PODS_ROOT" ) && ! -f "$HERMES_CLI_PATH" ]]; then
# SwiftPM consumers have no hermes-engine pod to provide hermesc, so resolve the
# hermes-compiler npm package THROUGH react-native's own dependency graph —
# react-native pins the hermes-compiler version, so the compiler's bytecode
# version always matches the prebuilt hermes VM artifacts (a mismatched pair
# crashes at launch with "Wrong bytecode version").
# Fires only when Hermes is on, no hermes-engine pod is installed, and the
# resolved path is not a file. Keyed on the pod DIRECTORY, not on PODS_ROOT: a
# SwiftPM app may keep side-by-side non-RN pods, giving it a real PODS_ROOT.
# Any app that does have the pod keeps its previous behavior exactly — including
# a partial prebuild, where the missing hermesc must stay a build failure rather
# than compile a bundle the podded VM rejects.
if [[ "$USE_HERMES" != false && ! -d "$HERMES_ENGINE_PATH" && ! -f "$HERMES_CLI_PATH" ]]; then
NODE_HERMESC=$(RN_DIR="$REACT_NATIVE_DIR" "$NODE_BINARY" --print \
"require('path').join(require('path').dirname(require.resolve('hermes-compiler/package.json', {paths: [process.env.RN_DIR]})), 'hermesc', 'osx-bin', 'hermesc')" \
2>/dev/null || true)
Expand Down
Loading
Loading