question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PodFile Multiple targets break Flipper support

See original GitHub issue

Environment

System:
    OS: macOS 10.15.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 24.69 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Java: 10.0.2 - /usr/bin/javac
    Python: 2.7.17 - /usr/local/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

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.

target 'RnDiffApp' do
...
add_flipper_pods!
post_install do |installer|
  flipper_post_install(installer)
end
...
end

Trying to add the same piece of code into my other target Prod like this:

target 'RnDiffAppProd' do
...
add_flipper_pods!
post_install do |installer|
  flipper_post_install(installer)
end
...
end

When running pod install i got the following error:

[!] Invalid `Podfile` file: [!] Specifying multiple `post_install` hooks is unsupported

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:

target 'RnDiffApp' do
....
end
target 'RnDiffAppProd' do
....
end
add_flipper_pods!
post_install do |installer|
  flipper_post_install(installer)
end

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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

21reactions
matt-oakescommented, Apr 15, 2020

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
2reactions
priteshrnandgaonkarcommented, Apr 21, 2020

Raised a PR here. Let me know if that change is sufficient.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Flipper to Generic iOS Apps
Swift and Objective-C are supported for Flipper with CocoaPods as build and ... NOTE Doing this may lead to a broken build if...
Read more >
how to manage cocoapods autolinking in different targets
So my question is, is there any way to remove a pod that is autolinked between different targets in a podfile? Podfile for...
Read more >
Podfile - Adding multiple targets - YouTube
Project link - https://github.com/alexpaul/ Podfile -Mulitple- Targets.
Read more >
IPHONEOS_DEPLOYMENT_TA...
Hi, I'm getting warning in my Swift package where one of external dependency supports from iOS8.0, is it as bug in xcode or...
Read more >
Flipper-Folly on CocoaPods.org
Your code should not use files in folly/experimental lest it may break when ... some of these platforms; at a minimum, we aim...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found