react-native icon indicating copy to clipboard operation
react-native copied to clipboard

chore: Increase iOS script portability

Open legobeat opened this issue 1 year ago • 6 comments

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:

legobeat avatar May 05 '24 23:05 legobeat

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

analysis-bot avatar May 06 '24 00:05 analysis-bot

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?

NickGerleman avatar May 06 '24 21:05 NickGerleman

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)

legobeat avatar May 06 '24 21:05 legobeat

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar May 07 '24 16:05 facebook-github-bot

Rebased on main; no changes.

legobeat avatar May 14 '24 22:05 legobeat

@cipolleschi Thanks!

Some small improvements, should be good to go now I believe. PR description updated.

legobeat avatar May 16 '24 23:05 legobeat

/rebase - this comment automatically rebase on top of main

cipolleschi avatar May 20 '24 09:05 cipolleschi

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.

cipolleschi avatar May 20 '24 09:05 cipolleschi

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.

legobeat avatar May 20 '24 09:05 legobeat

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar May 20 '24 12:05 facebook-github-bot

@cipolleschi merged this pull request in facebook/react-native@99704800a13136510562f197bcb54d603a7c35a5.

facebook-github-bot avatar May 20 '24 13:05 facebook-github-bot

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?

github-actions[bot] avatar May 20 '24 13:05 github-actions[bot]