-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fix post_install_workaround downgrading development targets #32633
Conversation
Hi @Yonom! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Base commit: fab4752 |
Base commit: a981528 |
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.
This is close to perfect,
My only hesitation is that if someone targets deployment version 13 in their podfile (for whatever reason...) then both this change and the time symbol redefinition would fail
Ideally - not sure if it is possible! - the workaround would detect the Podfile's top-level ios deployment version and use that dynamically here for the conditional and upgrade version, and use it dynamically in the sed for the time redefinition below
This is incremental improvement though, I think this is a positive step by only altering the target to upgrade / avoiding a possible downgrade
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@mikehardy Why would targetting v13 fail? I might be missing a slice of the bigger picture... I updated my Podfile to say:
and the build still compiles just fine... (dependencies are still being bumped to minimum target 11 of course) |
Very interesting result - I was expecting the time symbol redefinition hack to fail because of the way that test works. See facebook/flipper#834 (comment) If target is 13 and that test has been modified to 12 (via our hack), I expect the symbol to be defined in that code, resulting in it being redefined in the build as a whole and breaking the build. I'm sort of shocked that built. I assume that object was not rebuilt when you did the build, also testing that part of the hack is difficult as it edits the file in place based on a regex from the original file, that is to say, after you run it once the sed will never happen again until you delete pods (maybe also) node_modules) and reinstall. I used |
The time symbol redefinition errors only happen if I bump the minimum version in the workaround script to 12 / 13. In that case, the time symbols get duplicated definitions and that causes the build to fail. Example of a change that causes the build to fail in the way you predict: -config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
+config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' But if I understand correctly, there is no reason to bump the minimum targets to anything above 11.0, right? The main Podfile version seems to have no influence on the target versions of the dependencies |
If original file is:
and Podfile defines That is the original workaround. Next case: and Podfile defines General case: and Podfile defines That's my understanding.
It was my understanding that Perhaps that's my error - is If it is ===, then I don't understand how the time symbol redefinition will work as Podfile version is moved to 12 or NN unless that workaround is also moved to match. Perhaps it's best at this point to stop being so fiddly about it and say the intention of the hack is to always have that conditional clause return true, so we should just edit to always return true. ? |
Unfortunately I can't find any documentation on Edit:
If and only if you edit __apply_Xcode_12_5_M1_post_install_workaround to use '12.0' instead of '11.0' you will also need to update the Changing __apply_Xcode_12_5_M1_post_install_workaround to use '12.0' is one way of getting 12.0 libraries to work in your react native project (because then no library will be downgraded). This PR implements another way which does not require continously bumping the target version and thus the sed command needs no change. |
I don't believe that is true based on reports of build failures I have seen
Ah, so I still worry. I think people will still be affected by it, I have seen reports of people being affected by a build failure that were fixed by bumping that sed line to use 13, but did not know exactly why. Perhaps it is the pbxproj / Xcode setting moved independent of podfile and that triggers it. This part may be the real "no need to look at this again" patch to the hack:
|
Looking around, I can see that there are snippets of the fix going around where the minimum version is set to '12.0', for example: #32483 (comment) This would explain why people are encountering the issue you describe. I agree that removing the check completely will potentially save some people headaches. Thank you for the idea :) Added a commit. |
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.
Awesome, for what my approval is worth, I think this is good, and will help more people avoid these subtle compile failures. Fantastic @Yonom
@philIip has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Hi @Yonom! Can we integrate this fix into your awesome PR: reactwg/react-native-releases#1 (reply in thread) It is a one-line fix to get us closer to re-supporting MacCatalyst on RN by adding |
Hey @ZComwiz, My PR deals with the temporary function From my understanding, your issue is unrelated to XCode 12.5 or M1 machines, I do not think that it is a good idea to integrate any unrelated fixes to that function... Perhaps its best to apply your changes to RCT-Folly package itself (and in a separate PR)? |
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.
thanks for working on this @Yonom!
can you rebase and resubmit? i will go for the land soon.
@philIip rebased on current main |
@philIip has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Thanks both of you @Yonom and @philIip for keeping this alive just a bit longer - it is of course a bit 🤢 to have a hack like this in there, but I also know it is helping a huge number of people because the issue traffic in all my repos regarding broken iOS builds is now literally zero :-). It was off the charts before. Cheers |
Summary: The `__apply_Xcode_12_5_M1_post_install_workaround` script changes the `IPHONEOS_DEPLOYMENT_TARGET` to `11.0` for all pods. This causes problems if the pods were targetting `12.0` or higher. Many expo modules are targetting `12.0`. I fixed this issue by checking the existing version and only bumping the target if it is lower than `11.0`. See also: this discussion post by mikehardy reactwg/react-native-releases#1 (comment) ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - __apply_Xcode_12_5_M1_post_install_workaround causing pods targetting iOS 12 and above to fail Pull Request resolved: #32633 Test Plan: ### Test (failing before this patch, passing after this patch) 1. pick an iOS Pod that has a minimum deployment target of iOS 12 or higher, I chose the Braintree package 2. `npx react-native init myrnapp` 3. Open `ios/Podfile` and add the pod as a dependency: `pod 'Braintree', '~> 5'` (and upgrade the Podfile target to 12 (`platform :ios, '12.0'`)) 4. Compile the app. Before applying this patch: ❌ Build fails because Braintree uses iOS 12 features and was downgraded to target 11.0 After applying this patch: ✅ Build succeeds Reviewed By: fkgozali Differential Revision: D32638171 Pulled By: philIip fbshipit-source-id: 0487647583057f3cfefcf515820855c7d4b16d31
…32715) Summary: The `__apply_Xcode_12_5_M1_post_install_workaround` script changes the `IPHONEOS_DEPLOYMENT_TARGET` to `11.0` for all pods. This causes problems if the pods were targetting `12.0` or higher. Many expo modules are targetting `12.0`. I fixed this issue by checking the existing version and only bumping the target if it is lower than `11.0`. See also: this discussion post by mikehardy reactwg/react-native-releases#1 (comment) <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - __apply_Xcode_12_5_M1_post_install_workaround causing pods targetting iOS 12 and above to fail Pull Request resolved: #32633 Test Plan: 1. pick an iOS Pod that has a minimum deployment target of iOS 12 or higher, I chose the Braintree package 2. `npx react-native init myrnapp` 3. Open `ios/Podfile` and add the pod as a dependency: `pod 'Braintree', '~> 5'` (and upgrade the Podfile target to 12 (`platform :ios, '12.0'`)) 4. Compile the app. Before applying this patch: ❌ Build fails because Braintree uses iOS 12 features and was downgraded to target 11.0 After applying this patch: ✅ Build succeeds Reviewed By: fkgozali Differential Revision: D32638171 Pulled By: philIip fbshipit-source-id: 0487647583057f3cfefcf515820855c7d4b16d31
…#32633) Summary: The `__apply_Xcode_12_5_M1_post_install_workaround` script changes the `IPHONEOS_DEPLOYMENT_TARGET` to `11.0` for all pods. This causes problems if the pods were targetting `12.0` or higher. Many expo modules are targetting `12.0`. I fixed this issue by checking the existing version and only bumping the target if it is lower than `11.0`. See also: this discussion post by mikehardy reactwg/react-native-releases#1 (comment) ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - __apply_Xcode_12_5_M1_post_install_workaround causing pods targetting iOS 12 and above to fail Pull Request resolved: facebook#32633 Test Plan: ### Test (failing before this patch, passing after this patch) 1. pick an iOS Pod that has a minimum deployment target of iOS 12 or higher, I chose the Braintree package 2. `npx react-native init myrnapp` 3. Open `ios/Podfile` and add the pod as a dependency: `pod 'Braintree', '~> 5'` (and upgrade the Podfile target to 12 (`platform :ios, '12.0'`)) 4. Compile the app. Before applying this patch: ❌ Build fails because Braintree uses iOS 12 features and was downgraded to target 11.0 After applying this patch: ✅ Build succeeds Reviewed By: fkgozali Differential Revision: D32638171 Pulled By: philIip fbshipit-source-id: 0487647583057f3cfefcf515820855c7d4b16d31
Summary
The
__apply_Xcode_12_5_M1_post_install_workaround
script changes theIPHONEOS_DEPLOYMENT_TARGET
to11.0
for all pods. This causes problems if the pods were targetting12.0
or higher. Many expo modules are targetting12.0
.I fixed this issue by checking the existing version and only bumping the target if it is lower than
11.0
.See also: this discussion post by @mikehardy reactwg/react-native-releases#1 (comment)
Changelog
[iOS] [Fixed] - __apply_Xcode_12_5_M1_post_install_workaround causing pods targetting iOS 12 and above to fail
Test Plan
Test (failing before this patch, passing after this patch)
npx react-native init myrnapp
ios/Podfile
and add the pod as a dependency:pod 'Braintree', '~> 5'
(and upgrade the Podfile target to 12 (platform :ios, '12.0'
))Before applying this patch: ❌ Build fails because Braintree uses iOS 12 features and was downgraded to target 11.0
After applying this patch: ✅ Build succeeds