swift3xcode8xctestswift-package-managerserver-side-swift

Test-only Dependencies When Using the Swift Package Manager


I've seen mentions of test-only dependencies when using the Swift package manager but haven't been able to get them to work. For example:

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160104/005409.html https://github.com/apple/swift-package-manager/pull/74 http://blog.krzyzanowskim.com/2016/08/09/package-swift-manual/#testDependencies

What I want is to have the dependency used in my XCtests (e.g., for a specific target), but not applied in the deployed package.

Pointers to working examples would be appreciated.


Solution

  • Currently "Test-only dependencies" feature is disabled in the Swift Package Manager. It was implemented initially, but was removed in this commit.

    From the commit's description:

    Remove testDependencies from PackageDescription This feature was supposed to support dependencies only for the root package but at some point it stopped working however the API still remained open. This patch removes the public API. This is a valid and desired feature which is supposed to come back after it goes through proper review on swift evolution.