Open TheSolly opened 4 years ago
@TheSolly I have moved your issue from upgrade-helper
as this is the proper repository to report it, can you please edit it to follow the issue template?
@lucasbento Done, thanks 🙏
@TheSolly I put the Question
label but this should be a Solution
, right?
@lucasbento Exactly, although this is my proposed solution. Am sure open to improvement.
@TheSolly cool!
cc @priteshrnandgaonkar & @alloy, any thoughts on this?
Technically, I think the add_flipper_pods!
should be inside each target which you want it to be used by. Moving it outside all targets will add it to all targets which, if you have a "Test" target, might not be the desired behaviour.
If your targets share the same set of pods, I would recommend defining a method to "share" the pod list:
def shared_pods
# Core React Native libraries
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
... etc ...
# Auto-linked pods
use_native_modules!
# Flipper pods
add_flipper_pods!
end
target 'RnDiffApp' do
shared_pods
end
target 'RnDiffAppProd' do
shared_pods
end
post_install do |installer|
flipper_post_install(installer)
end
What @matt-oakes said. Also note that CocoaPods has the notion of a ‘abstract target’ to share pods, but either solution will work for most cases.
Thanks for info, applied @matt-oakes methodology and everything is working smoothly 🙏 I think it would be helpful to add this comment/info in the upgrade helper 🤔
I didn’t know about abstract targets. Good to know!
I don’t think it needs to be covered in the upgrade helper as it’s a bit more “advanced” than most users will need.
@lucasbento, I just checked the post_install hook may not be required and the newer YogaKit is compatible with swift 5. We may as well remove it altogether.
@priteshrnandgaonkar Even better! 🚀 Will you be removing it from the template?
Yupp, I can put up a PR.
@alloy, where does the template exist ? is it in the cli repo ? 😅
Raised a PR here. Let me know if that change is sufficient.
@priteshrnandgaonkar the template can be found here: https://github.com/facebook/react-native/tree/master/template
I have already closed the PR.
Technically, I think the
add_flipper_pods!
should be inside each target which you want it to be used by. Moving it outside all targets will add it to all targets which, if you have a "Test" target, might not be the desired behaviour.If your targets share the same set of pods, I would recommend defining a method to "share" the pod list:
def shared_pods # Core React Native libraries pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" ... etc ... # Auto-linked pods use_native_modules! # Flipper pods add_flipper_pods! end target 'RnDiffApp' do shared_pods end target 'RnDiffAppProd' do shared_pods end post_install do |installer| flipper_post_install(installer) end
Thanks
Environment
Upgrading version
from=0.61.5 --> to=0.62.2
Description
I am Having multiple target in the PodFile, and according to the upgrade helper process i should put this code inside the my target for Flipper.
Trying to add the same piece of code into my other target Prod like this:
When running
pod install
i got the following error:According to this issue 6172 CocoaPods doesn't support multiple
post_install
hooks.To solve this issue, i had to rewrite the code as below:
So far both my target build successfully in debug mode with flipper support.
IMO, this should be the default way to insert the
post-install
hook for Flipper in the upgrade helper.