[swift-evolution] [swift-build-dev] [Draft] Package Manager Custom Targets Layout

Ankit Aggarwal ankit_aggarwal at apple.com
Mon Mar 27 01:56:07 CDT 2017

Hi Karl,

Thank you for the feedback, comments inline.

> 1) I’m not sure about listing all of the test targets together with the
> product targets. I feel it may be better to have them as separate Arrays.

They both are similar entity so they stay together. Another example is
products, which can be an executable or a library. It is also easier to
scale if these are not separate. Otherwise, we need to keep adding new
properties to the top level Package structure every time we introduce a new
type of target.

2) I think we need a way to specify directories non-recursively. For
> example:
> - Sources
> | - Foo
> | | - MultipleImplementations
> | | | - Impl1
> | | | - Impl2
> In this case, “MultipleImplementations” contains some common definitions,
> but has multiple potential implementations. Impl1 and Impl2 will each
> implement the functionality in their own way, perhaps making use of
> platform-specific features or optional dependencies. Basically, I want to
> import “MultipleImplementations” non-recursively, then decide which
> subdirectory/implementation to use based on some build condition:
> .Target(“Foo”, sources: [“Sources/Foo”, “[NR]Sources/Foo/
> MultipleImplementations”])
> if someCondition {
>   package.targets[0].sources.append(“Sources/Foo/
> MultipleImplementations/Impl1”)
> else {
>   package.targets[0].sources.append(“Sources/Foo/
> MultipleImplementations/Impl2”)
> }
> The workaround today is to test for the inverse and add every other
> directory to “exclude”, but that’s not an elegant long-term solution.

We agree we need to support more complex specifications. We plan to add
support for globbing and conditionals in future (there is a note about that
in the proposal). Both of these are additive features and this proposals
gives us a good base for designing that.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170327/7223030c/attachment.html>

More information about the swift-evolution mailing list