-
Notifications
You must be signed in to change notification settings - Fork 32
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
[WIP] Allow Accio dependencies to be integrated in a CocoaPods setup #50
Conversation
@@ -1,17 +1,20 @@ | |||
import Foundation | |||
|
|||
struct FrameworkProduct { | |||
let framework: Framework |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to create the .podspec
files I required to know the path to the framework (in the Dependencies
folder) together with the framework information (dependencies, versions... etc). I found that having a reference to the Framework
inside the FrameworkProduct
was the easiest and safest way to go, and also makes sense to me: a FrameworkProduct
always has an associated Framework
.
There may be some source code improvements that can be done around now that FrameworkProduct
contains Framework
, but I did not include them in this PR in order to keep it as small and as easy to review as possible.
@acecilia Thanks for working on this 🚀 I didn't have an in-depth look on the implementation, but thought a bit about how this fits Accio's goal of targeting compatibility with SwiftPM. From the README: Still, if this a problem many face, why should we artificially constraint what Accio does? Personally, I'm okay with such changes. 👍 Nonetheless, we should think a bit about it, as this is quite a fundamental decision about Accio's further development. Maybe @mrylmz has some thoughts? |
@acecilia thanks for the great work! It is fine to have support for CocoaPods usage as I have understand you right, then you want to integrate Accio dependencies into CocoaPods projects right? Do you have any examples where we have the use-case to choose CocoaPods for dependency management over Accio? I have also checked your commits looks good overall maybe we could come up with a better solution for the CocoaPods usage with something like a configuration file in the project root. The naming convention inside the Package.swift as you have proposed could be error-prone and could be too implicit. |
@mrylmz I can not think in any use case where CocoaPods is preferred over Accio. This is for projects already setup on CocoaPods. For example: at the moment I am working in a project with a CocoaPods setup with multiple dependencies. I want to go away from it due to numerous reasons:
Removing CocoaPods for me means that I have to migrate all my private pods to a Carthage setup at once (because one depends on another, and that other on a third one, and so on). This is problematic, as depending on the project configuration such work may not be easy. Also, it may be that some of them are preferred to be used in CocoaPods in order to easily develop on them (configuring them as development pods). Finally, in my personal case migrating all my dependencies at once is not possible due to the high number of them. Instead, a better solution is to slowly move the dependencies to frameworks following the technique used in this PR, and at some point in the future remove CocoaPods completely from my project (if that is even possible :D) About the setup, I do not quiet see what is the problem of having a suffix in the targets inside the ‘Package.swift’ file. Can you elaborate a bit more on that? Thanks for the feedback! |
@acecilia The suffix naming requires additional maintenance in the My suggestion would be to add a feature for project specific Accio configuration where you can specify which dependencies should handle CocoaPods support. In that way you could just remove CocoaPods dependencies from that list on partial Accio adoption. |
@mrylmz I do not fully understand what you mean by About the second point, I still do not see the problem. if you misspell the suffix, then your project will not build, as your CocoaPods setup will fail. I think adding a second Accio configuration file has some caveats:
On the other hand, related to this issue we may need to add a way to specify how a dependency is integrated in the project. Options I can think at the moment (based on that issue and this PR) are:
With that said, I expect SPM to add support for static frameworks at some point (the same as Xcode did), so the consumer of the dependency can specify how the framework is built and linked: dynamic or static. |
In order to continue with this PR I need to know which one of this options to go for: a) Approve this PR as it is (then, I will work in the tests). I am more into option b) or c), as it will be useful also for #48. |
If you want to finish this PR, I would suggest option a) as short term solution and then we can open a new issue for a collection of configurations which we are not able to gather from SPM and then we will know the direction we want to go. Also involving @Dschee into the discussions would be great, so we could defer the configuration file issue for a few days. Thanks for supporting Accio! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just had a look at the README changes and a cursory look into the implementation and while the implementation looks okay-ish on first glance, I'm not sure yet about the goal here. To be honest, this sounds like a very specific issue to me.
Using Accio and CocoaPods within one and the same project should be already possible with the current state of Accio. What this adds – if I understand it correctly – is an option to integrate some of the subdependencies of a dependency via Accio to save build time on clean builds while the actual dependency is still included via CocoaPods (cause it doesn't support Accio) – is that right?
If so, I'm not sure if this is worth all the code considering that this really is a performance improvement only and doesn't apply to many cases. Feel free to explain why I might be wrong here, but to me it sounds like the more "correct" fix in those situations would be to make the actual dependency compatible with Accio and include it via Accio only.
As of my understanding now, I'm against merging this until either someone clarifies a misunderstanding on my side or more people may actually run into this very problem and profit from it. Then, of course, I will take a second look.
Please also note, that I don't like the idea on adding some prefix to the name of a target like "-AccioCocoaPodsIntegration" and using that as the source for decision making. I'd rather add a comment-style parameter or use some other solution. Targets should be named as what they are IMHO.
@Dschee About the concept:
This is correct, but only if the dependencies integrated using CocoaPods do not depend on the ones integrated using Accio.
Correct, but with some details:
This implementation did very few changes to the way
I do not this this is only a performance improvement:
About the implementation:
Of course, the implementation may not be ideal, and as commented here there may be other ways of doing this instead of using custom target names. This is also very much related to the outcome of #54. |
I'm still not completely sold on this feature, but I can see how big projects with old dependencies who are unwilling to update to a modern package manager would profit from it. Therefore I'm not against merging this, once it's implementation is reviewed and tested by at least one other person who also runs into such problems to evaluate if this is useful for them as well. Having that said, since this is more of an edge case rather than "the usual use case" for Accio, having tests (also integration tests) for this feature is very important. For that, you could either actually write unit tests (at least for some of the code changes) or at least provide a Demo-project like setup that we can run manually and then run the unit tests there to ensure this actually continues to work. Please have a look into the existing Demo project, which I use to manually check if some of the most popular frameworks can still be built and integrated via Accio by running Also I think it should be made clearer in the documentation what the setup where users could use this feature looks like. An example like "App Project >> Dependency via CocoaPods >> Subdependency via Accio (mixed into CocoaPods by Accio)" would be great, also listing the advantages of the feature (like less subdependency build time, indirect support for CocoaPods-only frameworks). Another idea: What if we introduced a way of specifying that a dependency doesn't support Accio but only CocoaPods and Accio would automatically generate the required Podfile itself? Is your use case, that "only some" libraries don't support CocoaPods (or are developed upon) so that this would be even cleaner or is it more like "most dependencies are defined via CocoaPods, I just want to speed some supdependencies up"? I think I would feel much better if the Podfile wasn't ever touched by the users directly but instead be an implementation detail generated by Accio. But that's just an idea ... I could think of other modes as well, like the Podfile only being generated temporarily to run CocoaPods commands and then deleting it again so it's never checked in into source control. But I'm not sure if such things are possible with the very "controlling" way of how CocoaPods integrates with Xcode ... |
I will close this, as I will be working on it on another branch |
Please see the readme changes, which explains this PR.
This is WIP. Todo:
☐ Get feedback about the concept and the implementation.
☐ Add tests.
PD: thanks for Accio! During the past 4 months I have been dreaming about a package manager that can integrate binaries automatically in my Xcode project, doing proper version resolution. After working in the codebase for the last 3 days I can say it is exactly that :) I am very excited about the potential it has, I hope adoption happens fast!