Conditional compilation using traits

Like @FranzBusch mentioned, building for a root package would result in building all targets defined in your root when executing a swift build.

I expanded on this and how traits can conditionally include transitive dependencies on another forum post here if it’s of any interest, but the TLDR is that SwiftPM doesn’t currently handle target-based resolution by default. I’m interested in looking into this area in the near future, but for now I’ve done some work on an experimental feature that you can enable with --experimental-prune-unused-dependencies . Since it is experimental, however, I would proceed with caution :slight_smile:

1 Like