-
Notifications
You must be signed in to change notification settings - Fork 349
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
Add support for the specification of dependencies by configuration #52
Conversation
An option to only link a specific pod to the target when building in a specific configuration. The exact syntax is still TBD, pending discussion in CocoaPods/CocoaPods#1668 which implements the corresponding functionality.
The point about my syntax was to create a This is what I'm proposing in CocoaPods/CocoaPods#840 (comment) i.e. to make 3 classes each one which can have children definitions and inherits all the definitions of the parent:
Those classes should inherit from the Later I will elaborate more on this. |
This is a very important perspective to take into account. However I would prefer to be explicit over implicit (the second step of your guide assumes that the user is looking to integrate the first target). I think that discussing the intended syntax is important because if we deduce to take a different approach later on (like an inheritance based one like I'm proposing) we basically would need to unwind this patch.
This affects affects the clarity of the syntax for end users and the maintainability/flexibility of the codebase. If you ask to me I would rework the current syntax but I'm not even considering it at the moment for backward compatibility and resources. For example it makes more sense to me do: target '1' do
pod 'MY_POD'
end
target '2' do
pod 'MY_POD'
end
use_source 'MY_POD', :git => 'www.example.com' instead of target '1' do
pod 'MY_POD', :git => 'www.example.com'
end
target '2' do
pod 'MY_POD', :git => 'www.example.com'
end Same goes for warnings inhibition, the This point also highlights how sticky are the syntax choices for the Podfile. @alloy I would love to hear your opinion. |
While you are correct, with regards to implementation details, this is a DSL and as such is intrinsically an application of the facade pattern. Therefore I want a Podfile like this to work: target '1' do
pod 'MY_POD', :git => 'www.example.com'
end Internally the DSL should immediately separate those concerns, which is what it already does, which then also makes it possible to use the I’m maintaining my ‘it should be possible in both ways’ stance, purely from a UX pov, of which I am convinced they like being able to specify it inline. Consider that probably most Podfiles out there will only have one or two pods, let alone multiple targets. |
Fully agree! Nonetheless I would prefer, for maintenability reasons, to match the DSL with the implementation as we have full control of both of them and they represent the same concepts. Also I think that the implementation should use inheritance regardless of the decision for the DSL.
I don't agree on the I have some idealistic mantras in this regard:
Considering the Lookback guide, and applying them, I think that the best solution would be:
Note that with this description there are no assumptions about the target and the solution offers the same grade of convenience (imo). Also note that
I'm not big fan of the Perl way but I see your point.
This argument is gained some ground with me and I consider it solid! CocoaPods – as Xcode – curse is that it is a developer tool so it should support all the reasonable configurations while still being as much convenient as possible, and everyone knows how things end up with two bosses. |
I have no opinion on whether your suggested structure makes sense, but I'd rather do such a restructuring separate from this feature (and I'd rather not do it). This patch is small and easy to rewrite; the important part is to stick the functionality in there so all us developer tool developers can ease our users' lives.
I really don't want to make my user go hunt documentation to figure out what that sentence means, nor reference abstract locations in scary text files. Right now, they can drag-and-drop a file into their project and they're done. I disagree that your suggestion is even nearly as convenient. I'm making the assumption that most of my users have created an Xcode project from one of the templates, and stuck mostly with that for the lifetime of their project, and thus have only one target. For experienced developers on large projects that might not be the case, but they will have no problem adapting. (If I remember correctly I think I saw in a previous discussion that you have already decided to drop the default target in a future version, so maybe you've already had this discussion and disagree with the premise.) The oneliner "pod 'Lookback', :configurations => ['Test']" is succinct and pragmatic in either case.
Does this mean you're okay with merging this patch and the one that depends on it? |
I would generally prefer to properly address the underlying architecture before addressing patches. However I see that this discussion is stalled, hence I will let the call to @alloy (i.e. I consider either way reasonable).
project 'MyProject.xcodeproj' do
target 'MyApp' do
configuration 'debug' do
end
configuration 'release' do
end
end
end I personally, don't consider this more scarier than the one liner. Moreover, I think the sentence is pretty clear in the context of the automatically generated Podfile.
This is the problem that I wan't to avoid, this assumption is not clear for non experienced developers. And thus makes the jump much more confusing than what it should be. |
@irrationalfab I’m sorry, but I really disagree with you on this. We should support the one liner and the implementation details should never influence the DSL. |
That is not to say that I don’t think your suggestion should work as well, but definitely not as the only way to do it. |
Closing in favour of #154. Re-reading this thread and the related discussion I realise that I didn't handle it in the most optima way. I mixed different changes (thanks @kylef for pointing out the way) and jeopardised the situation. This patch should have landed in CocoaPods a long time ago. I apologies to the users waiting for it and especially to @nevyn. |
Podfile parsing of the functionality for CocoaPods/CocoaPods#1668 .
@irrationalfab has opinions on the syntax. I built what @alloy suggested. I think @alloy's syntax is easier for beginners (I'm thinking from the perspective of being the author of http://lookback.io/docs/install-using-cocoapods , where I want to make step #2 as short as possible). I also agree that it's weird to overload a hash whose primary usage is to specify where the code is, with linker settings. I think the usability argument is stronger, though. Both syntaxes could easily be supported.
I've written the code so it should be easy to switch to @irrationalfab's syntax, or to support both. Where do we go from here? (Also, what should I fix in my PR before it's mergeable? :) )