react-native
react-native copied to clipboard
chore: Increase iOS script portability
Summary:
pod install and CocoaPods are actually not macOS specific.
Still, the pod lifecycle scripts of react-native depend on macOS-only utilities and will fail on Linux.
This is an attempt to make the scripts portable and make the pod install cleanly on Linux as well as macOS.
Changelog:
[INTERNAL] [FIXED] - Skip XCode patching when not run on macOS
[INTERNAL] [FIXED] - Fall back to `which gcc`/`which g++` to identify C/C++ compiler when `xcrun` not available
[INTERNAL] [FEAT] - Recognize CC and CXX env vars supplied to the script and prefer them over autodetection
Test Plan:
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 19,542,747 | -6 |
| android | hermes | armeabi-v7a | n/a | -- |
| android | hermes | x86 | n/a | -- |
| android | hermes | x86_64 | n/a | -- |
| android | jsc | arm64-v8a | 22,912,806 | -11 |
| android | jsc | armeabi-v7a | n/a | -- |
| android | jsc | x86 | n/a | -- |
| android | jsc | x86_64 | n/a | -- |
Base commit: 93c079b92a028354cb7926b2029601238bf82d7d Branch: main
I kinda suspect this breaks a lot of other assumptions in the build logic. What is use-case and how far does this actually get?
I kinda suspect this breaks a lot of other assumptions in the build logic. What is use-case and how far does this actually get?
I think the use-case can be summarized as "can run pod install for a project using react-native as dependency on Linux without error". This can be useful e.g. in CI jobs validating Podfile.lock consistency as well as for auditing and experimental development on Linux.
I believe this will retain existing behavior for any scenario that wasn't already erroring before this change.
(Separately, it does feel surprising even on macOS that installing this as a dependency would be automatically and silently be changing the user's Xcode project settings - but that's not the point here)
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
Rebased on main; no changes.
@cipolleschi Thanks!
Some small improvements, should be good to go now I believe. PR description updated.
/rebase - this comment automatically rebase on top of main
Sorry for the delay, I have been busy with the React Conf and couldn't really work on anything else. I'm rebasing automatically on top of main, given that many tests were red in CI.
Sorry for the delay, I have been busy with the React Conf and couldn't really work on anything else. I'm rebasing automatically on top of main, given that many tests were red in CI.
Thanks! I am surprised to see the errors show up. I just reverted the change which allows overriding the Xcode CC and CXX via env vars to see if that's what's causing it.
EDIT: Looks like that was it.
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@cipolleschi merged this pull request in facebook/react-native@99704800a13136510562f197bcb54d603a7c35a5.
This pull request was successfully merged by @legobeat in 99704800a13136510562f197bcb54d603a7c35a5.
When will my fix make it into a release? | How to file a pick request?