fix(build): fix x86_64 simulator build and spm_dependency guard#531
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses iOS build failures when LaTeX math rendering (RaTeX via SPM) is enabled, particularly for universal iOS Simulator builds, and fixes a Ruby guard intended to avoid calling spm_dependency when it isn’t available.
Changes:
- Fixes the
spm_dependencyavailability check in the podspec. - Adds simulator
EXCLUDED_ARCHSsettings when math is enabled to prevent x86_64 simulator module resolution failures. - Ignores the example app’s CocoaPods SPM cache directory (
.spm.pods) in.gitignore.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react-native-enriched-markdown/ReactNativeEnrichedMarkdown.podspec | Fixes spm_dependency guard and adds simulator arch exclusions when math is enabled. |
| .gitignore | Ignores the example iOS .spm.pods directory produced by CocoaPods/SPM integration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What/Why?
Fixes #527 — iOS builds fail when compiling universal simulator targets with LaTeX math (RaTeX) enabled (>= 0.7).
RaTeX's Swift wrapper is compiled from SPM source, so its
RaTeX.swiftmoduleis emitted only for the arch(es) the build requests. UnderONLY_ACTIVE_ARCHon Apple Silicon that'sarm64only, but universal simulator builds (archive, "Any iOS Simulator Device", Release) also compile this pod forx86_64and then fail with:Two podspec fixes:
EXCLUDED_ARCHS[sdk=iphonesimulator*]), applied to both the pod target and the app target (user_target_xcconfig) so their arch sets stay in sync. Apple Silicon only; Intel simulator builds aren't supported when math is on (consumers can disable math viaENV['ENRICHED_MARKDOWN_ENABLE_MATH'] = '0').spm_dependencyavailability guard.defined?(:spm_dependency)uses a symbol literal, so it always returns"expression"(truthy) and never guards. On RN versions withoutspm_dependency,pod installcrashed withNoMethodError. Changed todefined?(spm_dependency)for a clean fallback.Testing
pod install+xcodebuild -sdk iphonesimulator -configuration Release -destination 'generic/platform=iOS Simulator' buildin the example app — previously failed, now succeeds.Verified the exclusion lands in both
ReactNativeEnrichedMarkdown.*.xcconfigandPods-*.xcconfig.Verified the guard fix with a Ruby repro: old form passes even when the method is undefined (→
NoMethodError); new form skips cleanly when absent and still passes on RN 0.86. Fullpod installre-run confirms no regression.PR Checklist