Skip to content
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

Improve the script that patches the Pods inside post_install hook #14240

Closed
pinarol opened this issue Jun 3, 2020 · 1 comment
Closed

Improve the script that patches the Pods inside post_install hook #14240

pinarol opened this issue Jun 3, 2020 · 1 comment
Labels
Tooling Build, Release, and Validation Tools [Type] Tech Debt

Comments

@pinarol
Copy link
Contributor

pinarol commented Jun 3, 2020

We have a post_install hook in the Podfile and have a piece of Script there that patches a couple of files from React Native.

        puts 'Patching RCTShadowView to fix nested group block - it could be removed after upgrade to 0.62'
        %x(patch "#{project_root}/Pods/React-Core/React/Views/RCTShadowView.m" < "#{project_root}/patches/react-native+0.61.5.patch")
        puts 'Patching RCTActionSheet to add possibility to disable action sheet buttons -
        it could be removed once PR with that functionality will be merged into RN'
        %x(patch "#{project_root}/Pods/React-RCTActionSheet/RCTActionSheetManager.m" < "#{project_root}/patches/react-native+0.61.5.patch")

Currently when it fails, it fails silently and it is hard to notice these kinds of issues. So, instead of using %x(...) can we experiment with replacing that line with system('patch ... < ...') || exit(1). system(...) returns the exit value of the shell so it can help us detecting when the patch fails. But, we should make sure it is not producing false positives and causing the termination of the process unnecessarily.

To Test:

Clear Pods folder
cd to Script folder and run bundle exec pod install
Check the logs to see that no errors are produced during patching
Open the patched file /Users/pinarolguc/Development/WordPress-iOS/Pods/React-RCTActionSheet/RCTActionSheetManager.m make sure this line exists:
NSArray<NSNumber *> *disabledButtonIndices = [RCTConvert NSArray:options[@"disabledButtonIndices"]];

run bundle exec pod install again and make sure it is not producing errors

clear Pods folder
run rake dependencies in the root folder(WordPress-iOS)
Check the logs again

run rake dependencies again and make sure it is not producing errors

bonus: open the gutenberg editor and see the mover buttons getting disabled

@chipsnyder
Copy link
Contributor

This is being updated again as part of #14776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tooling Build, Release, and Validation Tools [Type] Tech Debt
Projects
None yet
Development

No branches or pull requests

2 participants