material-components-ios
material-components-ios copied to clipboard
Add Carthage support
https://github.com/Carthage/Carthage
We should consider supporting this alongside CocoaPods.
Internal data
- Associated internal bug: b/117179591
Blocked on #841 so we can use dynamic frameworks.
There are solid references on adding Carthage support in #1102.
I don't want to look like the nagging type 😅 is this still in the roadmap?
Hi @sohayb . We are still interested in supporting Carthage, but the last time we looked into it there was some functionality in our Cocoapods that was difficult to mimic in Carthage.
@ianegordon curious to know what that functionality is.
Hi @AlexanderBollbach thank you giving this issue a nudge. Unfortunately, we don't have currently have this on our immediate timeline. I'll raise this at our next planning meeting.
@ianegordon Funny story: I asked about this specific issue when I attended Google I/O last month, someone at the code labs said you were there but I just missed you 😂 Thanks for bringing this issue at your planning meeting 🙌
Hi @sohayb , I'm sorry to have missed you and for being so long since an update. I'd hoped to be able to share good news, but unfortunately we don't have this on our current roadmap. 😞
The structure of our repo may be not be ideal for Carthage because we'd have to deploy a single .framework with all of our code in it (there's a lot of code). As a result, this likely isn't going to be an immediate priority for us unless there's a good proposal for a way to have each of the individual components be a separate Carthage dependency.
Any workaround?
No workaround at present other than manually cloning the repository and adding it as a dependency via Xcode (similar to what Carthage would do).
The structure of our repo may be not be ideal for Carthage because we'd have to deploy a single .framework with all of our code in it (there's a lot of code).
I don't understand this part. RxSwift has no issues deploying code from one repository in multiple frameworks. AFAIK it has nothing to do with repository structure, Carthage uses shared schemas and can build them all as separate build targets. So it's just a matter of Xcode Project setup.
+1 we also like to move from Cocoapods to Carthage.
"material-components" is one of the last few libs why we are still bound to Cococapods ;-)
Bumping this up, it would be pretty good to get this support.
I don't know much about Cocoapod and only ever used Carthage, but doesn't Cocoapod create XCode projects? Would it be possible to have a CI create an XCode project for each submodule, then push that somewhere else (material-components-ios-carthage or something) so that Carthage can import it? If that's possible, then it would not require any change to this repo and anyone could do it, but I guess it's not as it's not been done.
Bumping up as well
bump
Carthage uses shared schemas and can build them all as separate build targets
Ah this is interesting. Is it possible to generate multiple libraries that will be resolved at link time with Carthage? This would let us deploy one Carthage binary for each subspec.
Bumping this up as well.
Is it possible to generate multiple libraries that will be resolved at link time with Carthage?
Not sure what this means. With Carthage, you can built multiple .framework
files in one go. But this has nothing to do with linking. Carthage doesn't modify the XCode project of your app, so you have to link each dependency you need manually. Obviously, it is possible to link just the dependency that you need, even if Carthage will generate .framework
files for multiple targets and you just need one. That has nothing to do with Carthage itself, it's as if those .framework
files existed somehow on your filesystem already.
This would let us deploy one Carthage binary for each subspec.
Yes, Carthage does indeed allow you to deploy a binary for each schema. Important to note is, that it's not a Carthage binary. There's nothing special about these binaries that would tie them to Carthage. It's just a regular Swift .framework
binary.
Thanks for the clarifications everyone. I believe then there are a couple levels to delivering support for this:
Level 1: Create a single Carthage-compatible .framework for MDC and upload it as part of our release process.
Level 2: Create individual Carthage-compatible .frameworks for each subspec in MDC, allowing a client to pick and use subsets of MDC as needed. These individual frameworks should be uploaded as part of our release process.
bump
Would be really interested in Carthage support as well.
bump
Installation with Carthage
Create a new sample project (lets call it TestApp
) and set it up with the following Podfile
:
platform :ios, "10.0"
use_frameworks!
target 'TestApp' do
pod 'MaterialComponents'
end
You must add use_frameworks!
but can also install specific components rather than installing them all.
Run the app at least once then locate the project included frameworks. These will be in the Xcode Derived Data directory, a quick way to access them is by right clicking on the framework name under Products
in Xcode Project Navigator and click Show in Finder
.
If you install all the components, the following Material components will be installed:
- MaterialComponents.framework
- MDFIntertionalization.framework
- MDFTextAccessibility.framework
- MotionAnimator.framework
- MotionInterchange.framework
- MotionTransitioning.framework
Copy all these frameworks to the Carthage build directory of your actual project (e.g. Carthage/Build/iOS/....
) and update the input list to Carthage copy-frameworks
build step (it is better to use a tool like carting
to perfrom this update).
Run your actual project and enjoy using Material Components.
The internal issue b/117179591 is now closed. This issue is being closed as a result.
Re-opening this due to community interest.
Is there any progress or activity on this? Because I dont see anything.
Any movement on carthage support?
bump