[swift-build-dev] advice on best practices for transitive dependencies

Ankit Aggarwal ankit_aggarwal at apple.com
Thu Dec 8 08:17:57 CST 2016


> On 08-Dec-2016, at 7:40 PM, Vadim Eisenberg via swift-build-dev <swift-build-dev at swift.org> wrote:
> 
> Hello,
> 
> I have a question regarding best practices for transitive dependencies. 
> Suppose I have package A, that depends on (uses classes from) package B 
> and package C. Package B also depends on package C.
> 
> 
> For package A, I have to specify dependency on package B. Should I also 
> specify dependency on package C, if I know for sure that package B depends 
> on package C, so package C will be fetched by SwiftPM anyway.
> 

You should only specify the dependencies on packages you directly want to use.
So, if your package A wants to use classes from B but not from C and B depends on C
then you shouldn't specify C as dependency in A. But in this case you should never use 
any of the classes defined in C from package A— this is something we'd like to enforce but can't at the moment.

> Vadim Eisenberg
> 
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-build-dev



More information about the swift-build-dev mailing list