[swift-build-dev] Test-only dependencies

Paul Cantrell cantrell at pobox.com
Sun Aug 28 21:48:02 CDT 2016


> On Aug 28, 2016, at 9:23 PM, Ankit Aggarwal <ankit_aggarwal at apple.com> wrote:
> 
> I agree that building test specific dependencies is not useful for packages which just uses the some package, however I think that should be controlled by some other general mechanism like specifying exact external package/target the target in question depends on.

That’s what I had in mind with “Approach 2” in my original message. Approach 3 is a related but different alternative.

Please see remarks in the original message for my take on the pros and cons.

> That way all the unused targets in an external package will not build. See thread “Proposal: SwiftPM Target Access Control“ for some more discussion on this idea.

That proposal is getting warm — especially if test packages are _not_ exposed by default, something it seems to me that proposal should specify.

The new “External” in that proposal has the right semantics, but seems to me to add yet more complexity to a package DSL whose readability is already a bit strained. In particular, this seems likely to cause confusion:

> An external package dependency declaration implicitly becomes dependency of each target in the package. We propose this behaviour should be retained but if a target dependency contains an External declaration then all other targets which wants to use that external dependency should explicitly state their dependency on that external package using External.

Cheers,

Paul



More information about the swift-build-dev mailing list