SwiftPM: stop baking an absolute HERMES_CLI_PATH into the app pbxproj - #58292
Open
chrfalch wants to merge 1 commit into
Open
SwiftPM: stop baking an absolute HERMES_CLI_PATH into the app pbxproj#58292chrfalch wants to merge 1 commit into
chrfalch wants to merge 1 commit into
Conversation
`spm add` wrote the machine-specific absolute path of hermesc from the hermes-compiler npm package into every build configuration, and apps commit that pbxproj. react-native-xcode.sh already resolves hermesc at build time through react-native's dependency graph, so drop the write. Widen the shell fallback correctly: it was gated on PODS_ROOT being absent, so a SwiftPM app keeping side-by-side non-RN pods never reached it. Key it on the hermes-engine pod directory instead, so any app that has the pod keeps its previous behavior exactly. Existing injected projects clean up on the next `spm add`/`update`, which strips every recorded scalar before re-injecting. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
npx react-native spm addwrites aHERMES_CLI_PATHbuild setting into the app'sproject.pbxproj. The value is the absolute path ofhermescinside thehermes-compilernpm package, resolved on the machine that ran the command, for example/Users/<me>/repos/<app>/node_modules/hermes-compiler/hermesc/osx-bin/hermesc. The pbxproj is committed, so every SwiftPM-converted app commits one developer's disk layout to its repository.The setting is redundant.
react-native-xcode.shalready resolveshermescat build time through react-native's own dependency graph when the currentHERMES_CLI_PATHis not a file, using the samehermes-compilerversion the artifact download pins (#57928). A relative build setting is not an option:$(REACT_NATIVE_PATH)/../hermes-compilerbreaks whenreact-nativeis a symlink, and$(SRCROOT)/../node_modules/...breaks for hoisted monorepos.This change:
HERMES_CLI_PATHwrite fromgenerate-spm-xcodeproj.js. Existing injected projects clean themselves up on the nextspm addorspm update, becauseremoveRecordedBuildSettingsalready strips every scalar recorded in.spm-injected.jsonbefore re-injecting.PODS_ROOTbeing absent, so a SwiftPM app that keeps side-by-side non-RN pods never reached it and had nohermesc. It is now keyed on thehermes-enginepod directory being absent, with Hermes enabled, so every app that has the pod keeps its previous behavior exactly, including a partial prebuild still failing the build.Changelog:
[IOS] [FIXED] - SwiftPM: stop baking an absolute, machine-specific HERMES_CLI_PATH into the app's pbxproj; resolve hermesc at build time instead
Test Plan:
Red first. New test at the entry point that resolved the path, with a
hermes-compilerfixture seeded so the old code provably wrote the setting:Green after the change:
Also:
yarn eslint --max-warnings 0andyarn prettier --checkon the changed files,yarn flow-check(0 errors),bash -n packages/react-native/scripts/react-native-xcode.sh.End to end: a React Native 0.87.1 SwiftPM app (
@shopify/react-native-skiaexample, no Pods) with theHERMES_CLI_PATHlines deleted from its pbxproj builds in Release. The bundling phase logs the fallback resolvinghermescfromnode_modules/hermes-compiler, andmain.jsbundleis produced. There is no shell test harness forreact-native-xcode.sh, so that path is covered by this build only.🤖 Generated with Claude Code