firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

FR: Carthage support

Open okydk opened this issue 9 years ago • 101 comments

Now that the Firebase SDKs are open source, can we then have Carthage support? 😍

*** Cloning firebase-ios-sdk
*** Checking out firebase-ios-sdk at "4.0.0"
*** Skipped building firebase-ios-sdk due to the error:
Dependency "firebase-ios-sdk" has no shared framework schemes

okydk avatar May 17 '17 21:05 okydk

We can't add Carthage support via a shared framework scheme for the time being since all the Firebase libraries have a common dependency in Analytics, which is still closed source and vended as a static library. If we were to try to distribute the other Firebase libs as dynamic frameworks, they would all have link time dependencies on Analytics and would end up duplicating the Analytics classes in the runtime, bloating app size and causing undefined behavior in some instances.

Carthage does support vending binaries, so we could still distribute these as static binaries with static dependencies on Analytics. Others wouldn't be able to easily build and redistribute libraries wrapping Firebase, but otherwise we'd retain many of the benefits of using Carthage. But before this can happen Analytics also needs to be distributed through Carthage, since mixing dependency managers is not something we should encourage developers to do.

The most straightforward solution would be to distribute Analytics as a dynamic framework through Carthage and then build the open source Firebase frameworks on top of that via a shared framework scheme. This is unlikely to happen in the very short term. In the longer term, we'd need to weigh the drawback of causing longer app launch times for dylib users versus the benefit of allowing users to install Firebase through Carthage and easily build frameworks wrapping Firebase. If you have either of these concerns (app launch times/want to build on top of Firebase), please share your thoughts!

morganchen12 avatar May 17 '17 21:05 morganchen12

Ok, fingers crossed for support in the future 🤞 and thanks for the clarification.

okydk avatar May 17 '17 22:05 okydk

For time being I already created a carthage compatible for firebase. https://github.com/soheilbm/firebase

soheilbm avatar May 18 '17 02:05 soheilbm

@morganchen12 I'm very much interested in building frameworks on top of Firebase, and I think the more Firebase continues to grow as a defacto database and auth/etc. solution, the more people/companies are going to be wrapping it, at least for internal use (but probably convenience frameworks at some point too). At the moment though I'm most interested in this Analytics topic. From what I can tell at first pass of the source (at least of FirebaseCore), Analytics being present is desired but not required. Is this actually/will this continue to be, the case?

mhuusko5 avatar May 20 '17 12:05 mhuusko5

Hi @mhuusko5. Google Analytics for Firebase is what enables us to offer an integrated experience across the various other Firebase services we offer. As such we try to make Firebase Analytics included in the default experience since this is will maximize the value to our users. A great example of this is the AdMob integration with Firebase. When used together, we are able to combine metrics from both AdMob and Analytics to answer more sophisticated questions like "On which screens are users being exposed to advertising the most or the least?" However, we know that some advanced users may explicitly only want the AdMob SDK which is why we avoid having hard dependencies. So yes, since this is by design, you can expect that we will continue to only be using weak dependencies for the majority of our inter-product integrations. There are other weak dependencies in the codebase as well, such as between Database and Auth, such that Database works without it, but when Auth is included in an app its functionality is enhanced. Hope that clarifies this.

salqadri avatar May 20 '17 20:05 salqadri

@salqadri fantastic, thanks for the breakdown, and I love the design strategy. 👍

mhuusko5 avatar May 21 '17 12:05 mhuusko5

@mhuusko5 for the time being you can create frameworks wrapping Firebase for your own personal use by just embedding them in a target and using CocoaPods' inherit! :search_paths without any issues. Life becomes much harder once you try to distribute the framework afterwards.

morganchen12 avatar May 22 '17 17:05 morganchen12

Distributing Analytics through Carthage shouldn't be too hard. For example, this is what mapbox does: https://www.mapbox.com/ios-sdk/

Relevant line in a consumer's cartfile would be binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> 3.5, which just points to a JSON file (https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json ) with version numbers and a URL from where to download the .framework

I understand that it will take some time to work through the bureaucracy that comes with being at Google, so I understand that adding complete Carthage support will potentially be a long-term goal 😄 Take your time, thank you for going (almost completely) open source ❤️

AndrewSB avatar May 23 '17 21:05 AndrewSB

@AndrewSB for reference the issue here isn't Carthage, it's that we currently don't ship Analytics as a dynamic framework, which we must (should) before distributing it through Carthage.

morganchen12 avatar May 23 '17 21:05 morganchen12

Ahh, I see. Still a static framework, I take back what I said then. So I guess we're waiting on that dynamic framework then

AndrewSB avatar May 23 '17 21:05 AndrewSB

Carthage has recently added some info to its README about integrating static frameworks that could be helpful - https://github.com/Carthage/Carthage#build-static-frameworks-to-speed-up-your-apps-launch-times

paulb777 avatar May 23 '17 21:05 paulb777

I create some dynamic frameworks compatible with carthage for my own projects with dependencies between them. It's not really complex. And if you want to create a cross-platform framework compatible with carthage you can follow this tutorial I created: Swift Cross Platform Framework 👍

TofPlay avatar May 25 '17 06:05 TofPlay

+1

paulocoutinhox avatar Aug 11 '17 12:08 paulocoutinhox

+1

alokc83 avatar Aug 25 '17 04:08 alokc83

+1

Davtyanag avatar Sep 10 '17 22:09 Davtyanag

Still waiting for direct Carthage support.

monsantovernon avatar Sep 29 '17 13:09 monsantovernon

+1

floriangbh avatar Oct 16 '17 14:10 floriangbh

+1

ghost avatar Oct 17 '17 16:10 ghost

Is there any progress?

iSevenDays avatar Oct 19 '17 07:10 iSevenDays

This PR will be updated when there is progress.

Please don't add additional comments unless you are interested in contributing to the implementation.

Use :+1: to indicate interest.

paulb777 avatar Oct 19 '17 13:10 paulb777