-
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
Conversation
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 <875252+chrfalch@users.noreply.github.com>
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
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. |
1 similar comment
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: `Package.swift` was missing the `RCTVibration` target. This commit adds this target. ## Changelog: [Internal] - Added RCTVibration to SwiftPM Pull Request resolved: facebook#52223 Test Plan: Tested in RN-Tester both with and without prebuild. Differential Revision: D77257066
…k#52223) 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: - 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. ## Changelog: [IOS] [FIXED] - Added backwards compatible use of prebuild through cocoapods Pull Request resolved: facebook#52223 Test Plan: Tested in RN-Tester both with and without prebuild. Rollback Plan: Differential Revision: D77296047 Pulled By: cipolleschi
Summary: Pull Request resolved: #52252 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: - 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. ## Changelog: [IOS] [FIXED] - Added backwards compatible use of prebuild through cocoapods Pull Request resolved: #52223 Test Plan: Tested in RN-Tester both with and without prebuild. Rollback Plan: Reviewed By: cortinico Differential Revision: D77296047 Pulled By: cipolleschi fbshipit-source-id: f3eb4d56b2a78bfc8e10ad852746be1ceaf828b2
This pull request was successfully merged by @chrfalch in 07f6f70 When will my fix make it into a release? | How to file a pick request? |
@cipolleschi merged this pull request in 07f6f70. |
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.