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

Vadim Eisenberg VADIME at il.ibm.com
Thu Dec 8 08:55:08 CST 2016


Thanks, Ankit!

>From your answer: "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.", I understand that even if package B is called 
CAdapter, and its sole purpose is to adapt C package to A, A still should 
specify dependency on both CAdapter and C, if it uses classes directly 
from CAdapter and C, despite being 100% sure that CAdapter will always 
depend on C.

Best Regards,
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:37 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 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