[swift-build-dev] Test-only dependencies
ankit_aggarwal at apple.com
Sun Aug 28 21:23:39 CDT 2016
Thanks for opening this discussion.
> On 29-Aug-2016, at 1:36 AM, Paul Cantrell via swift-build-dev <swift-build-dev at swift.org> wrote:
> I’ve been working on getting Siesta up and running with SwiftPM, and have hit snags running the tests. At Ankit Aggarwal’s encouragement, I’m opening a discussion thread here.
> By “test-only dependencies,” I mean external packages required by a package’s tests, but not by the package's exported targets. For example, Siesta’s tests depend on Quick, Nimble, and Nocilla, but apps that use Siesta should not have to build those dependencies and would very much not want them baked into the resulting binary.
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 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.
> Proper support for test-only dependencies would have three essential features:
> They are not downloaded or built by “swift build,” but are downloaded and built by “swift test.”
> Any modules they define do not end up in the compiled binary, and are not available for the package’s non-test targets to import.
> A package ignores the test-only dependencies of its dependencies.
I think instead of it being test-only dependency this could be a feature which lets you define dependencies to be used only by the current package (including test targets) which will be helpful for developers to try or play with some external dependency. And in that case it should probably be called something else like for e.g.: `localDependencies`
What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-build-dev