Repository navigation
Conversation
Signed-off-by: izbari <73957984+izbari@users.noreply.github.com>
This branch has not been deployed
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
Fixes #60503. An iOS app that uses two Swift static-library pods with
spm_dependencycan fail to compile. CocoaPods looks underPodA/PodA.modulemapwhen 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
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.pod installand built for the arm64 iOS simulator. With the original hook, the dependent case failed with a missingPodA/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 passedxcodebuild -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../run_ruby_tests.shfrompackages/react-native/scripts) stops loading CocoaPods after another test defines a mockPod::Executableclass. 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.