Skip to content

Keep Swift pod module maps in per-pod directories for SPM builds - #60551

Open
izbari wants to merge 1 commit into
react:mainfrom
izbari:fix/spm-pod-modulemaps
Open

izbari wants to merge 1 commit into
react:mainfrom
izbari:fix/spm-pod-modulemaps

Conversation

@izbari

@izbari izbari commented Dec 4, 2026

Copy link
Copy Markdown

Summary

Fixes #60503. An iOS app that uses two Swift static-library pods with spm_dependency can fail to compile. CocoaPods looks under PodA/PodA.modulemap when PodB imports PodA. When the pods are independent, Clang sees their two umbrella module maps in the same directory.

Keep building Swift package products in the shared directory used by #57602. Direct CocoaPods' compatibility-header phase and its declared outputs to the original per-pod directory. Both the aggregate target and other pods can then use CocoaPods' original module-map flags.

Changelog

[IOS] [FIXED] - Fix iOS builds when multiple static-library pods use Swift package dependencies.

Test Plan

  • Ran ruby packages/react-native/scripts/cocoapods/__tests__/spm-test.rb. Wrote the regression test first and saw it fail on the module map in the shared directory. With the fix, all 9 tests and 29 assertions passed, including the pod whose module name differs from its target name.
  • Tested the two local pods from the reporter's reproduction in a minimal CocoaPods app using this checkout's SPM post-install hook, Xcode 26.6, and CocoaPods 1.16.2. Ran pod install and built for the arm64 iOS simulator. With the original hook, the dependent case failed with a missing PodA/PodA.modulemap. Removing the dependency and its use in PodB reproduced Clang's “Umbrella for module 'PodA' already covers this directory”. With the fix, both configurations passed xcodebuild -workspace Demo.xcworkspace -scheme Demo -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath DerivedData ARCHS=arm64 CODE_SIGNING_ALLOWED=NO clean build. Each pod had its own module map, umbrella header and Swift compatibility header.
  • The combined Ruby runner (./run_ruby_tests.sh from packages/react-native/scripts) stops loading CocoaPods after another test defines a mock Pod::Executable class. Reproduced on unmodified main. Running the remaining 118 tests separately from the SPM tests gave the same 6 failures and 1 error on main and this branch.

Codex assisted with the implementation and ran the tests and builds above.

Signed-off-by: izbari <73957984+izbari@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Two pods that use spm_dependency cannot build together since 0.87 (module map not found / "Umbrella for module … already covers this directory")

1 participant