<div dir="ltr">Not sure if already mentioned, but the issue of duplicated dependencies in targets can be easily handled like this:<div><br></div><div><div>import PackageDescription</div><div><br></div><div>let sharedDependency: Package.Dependency = .Package(url: "...", majorVersion: 1)</div><div><br></div><div>let package = Package(</div><div> name: "MyPkg",</div><div> targets: [</div><div> .Target(name: "First"),</div><div> .Target(name: "Second", dependencies: ["First", sharedDependency]),</div><div> .Target(name: "Third", dependencies: [sharedDependency])</div><div> ]</div><div>)</div></div><div><br></div><div>That's assuming we'll be able to add external deps to targets.</div><div><br></div><div>- Honza</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 29, 2016 at 7:07 AM Daniel Dunbar via swift-build-dev <<a href="mailto:swift-build-dev@swift.org">swift-build-dev@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I completely agree with your original email, and agree the target-access control proposal amounts to a variant of #2.<br>
<br>
We definitely need a per-target dependency solution, and if we got one that included some kind of solution for managing the duplicate declaration, that would solve the con you list with #2. That might suggest that one approach here is to add it the list of reasons we should do a per-target dependency proposal.<br>
<br>
On the other hand, that has proven more complicated than approach #1, and is likely to take longer to get right. I wonder if there are reasons we might end up wanting #1 even if we had a working #2 (one reason might be if we couldn't solve the duplicate declaration problem).<br>
<br>
My leaning here is towards trying to figure out a good approach for #2 first, and see where that leaves us, but I could probably be persuaded that the problem is pressing enough we should consider a more targeted fix sooner.<br>
<br>
- Daniel<br>
<br>
> On Aug 28, 2016, at 7:48 PM, Paul Cantrell via swift-build-dev <<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>> wrote:<br>
><br>
><br>
>> On Aug 28, 2016, at 9:23 PM, Ankit Aggarwal <<a href="mailto:ankit_aggarwal@apple.com" target="_blank">ankit_aggarwal@apple.com</a>> wrote:<br>
>><br>
>> 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.<br>
><br>
> That’s what I had in mind with “Approach 2” in my original message. Approach 3 is a related but different alternative.<br>
><br>
> Please see remarks in the original message for my take on the pros and cons.<br>
><br>
>> 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.<br>
><br>
> That proposal is getting warm — especially if test packages are _not_ exposed by default, something it seems to me that proposal should specify.<br>
><br>
> 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:<br>
><br>
>> 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.<br>
><br>
> Cheers,<br>
><br>
> Paul<br>
><br>
> _______________________________________________<br>
> swift-build-dev mailing list<br>
> <a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-build-dev</a><br>
<br>
_______________________________________________<br>
swift-build-dev mailing list<br>
<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-build-dev</a><br>
</blockquote></div>