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

Ankit Aggarwal ankit_aggarwal at apple.com
Thu Dec 8 08:37:20 CST 2016


> On 08-Dec-2016, at 8:00 PM, Vadim Eisenberg <VADIME at il.ibm.com> wrote:
> 
> Ankit, let me rephrase the question. I will use term "package X directly 
> depends on package Y, if package X uses classes defined in package Y. So 
> the rephrased question is:
> 
> Suppose I have package A, that directly depends on both package B and 
> package C. Package B directly depends on package C.
> 
> 
> For package A, I have to specify dependency on package B. Should I also 
> specify dependency on package C in package A, if I know for sure that 
> package B depends on package C, so package C will be fetched by SwiftPM 
> anyway.
> 

Yup you should definitely specify both B and C in A because even though you know B depends on C in this version it might not in next. And as I said if SwiftPM were to ever enforce this behaviour using Swift compiler A will not able to use symbols from C because it doesn't directly depend on it.

> Vadim Eisenberg
> 
> 
> 
> 
> From:   Ankit Aggarwal <ankit_aggarwal at apple.com>
> To:     Vadim Eisenberg/Haifa/IBM at IBMIL
> Cc:     swift-build-dev at swift.org
> Date:   12/08/2016 04:18 PM
> Subject:        Re: [swift-build-dev] advice on best practices for 
> transitive dependencies
> Sent by:        ankit_aggarwal at apple.com
> 
> 
> 
> 
>> 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