-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[ios][prebuild] Added backwards compatible use of prebuild through cocoapods #52223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrfalch
wants to merge
30
commits into
main
Choose a base branch
from
@chrfalch/cocoa-pods-rn-core-final
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+331
−379
Conversation
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
This introduces the first working version of building React Native apps on iOS using prebuilt RNCore and cocoapods. - Added React-Core-prebuilt.podspec for installing/consuming XCFrameworks - Added logic in react_native_pods.rb for switching between build from source and using prebuilts - Added rncore.rb - utilities for the ReactCore prebuilts - Updated rndependencies with some extra error handling modelled after rncode.rb - Added support for hard linking headers and modules in each inner framework in the XCFramework in xcframework.js Swift: To enable support for the objective-c types from swift, the swift compiler uses a module map to gather exports from the framework (module.modulemap). This file basically points to an umbrella header file that exports the valid objective-c types (non c++) to Swift. In addition these files are read from the DerivedData and not the project source - so it is a bit hard to control everyting. I was initially not able to use cocoapods own module definitions (module_name, module_file props) to use a custom module map. I finally found that these files are expected in the deriveddata (build folder) where only the active inner framework is copied - so then I had to hard link both module map and header files for each arch.
Co-authored-by: Christian Falch <[email protected]>
Added support for prebuilt.
Added a few missing search paths
Package.swift was missing the RCTVibration target. This commit adds this target.
Instead of declaring two different sets of Pods for prebuilt and build from source, this commit now keeps the pod structure the same for both modes so that consuming libraries can expect to have the same pods and header files available - without this, libraries would have to be updated to take advantage of the prebuilds. This commit does: - Added React-Core-prebuilt as a pod in React-Core if prebuilt is enabled - Simplified react_native_pods to keep pods structure and add React-Core-prebuilt pod if prebuilts are enabled - Added function for selecting source sets based on prebuilt/build from source
To be able to function both in prebuilt and in regular build from source mode, all podspecs are now using the switch function podspec_sources so that they only include header files if we are in prebuild mode. Also added React-Core-prebuilt as dependency on React-Core if we are in prebuilt mode so that we install the React.XCFramework.
Reverting changes
cipolleschi
reviewed
Jun 24, 2025
cipolleschi
approved these changes
Jun 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a file that needs to be removed. The rest is good to me.
After adding the podspec_source function we needed to be a bit more explicit with types, so where source files was originally defined in a variable and contained more than one entry we now needed to wrap it in an explicit array.
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
p: Expo
Partner: Expo
Partner
Shared with Meta
Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
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:
Instead of declaring two different sets of Pods for prebuilt and build from source, this commit now keeps the pod structure the same for both modes so that consuming libraries can expect to have the same pods and header files available - without this, libraries would have to be updated to take advantage of the prebuilds.
This PR does:
To be able to function both in prebuilt and in regular build from source mode, all podspecs are now using the switch function podspec_sources so that they only include header files if we are in prebuild mode.
Also added React-Core-prebuilt as dependency on React-Core if we are in prebuilt mode so that we install the React.XCFramework.
Changelog:
[IOS] [FIXED] - Added backwards compatible use of prebuild through cocoapods
Test Plan:
Tested in RN-Tester both with and without prebuild.