I am running sudo swift test
and got following error:
error: could not find target(s): MyLib; use the 'path' property in the Swift 4 manifest to set a custom target path
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "MyLib",
targets: [
.target(name: "MyLib"),
.testTarget(
name: "MyLibTests",
dependencies: ["MyLib"])
]
)
According to the proposal there is an impact on exiting code. The purposal says:
These enhancements will be added to the version 4 manifest API, which will release with Swift 4. There will be no impact on packages using the version 3 manifest API. When packages update their minimum tools version to 4.0, they will need to update the manifest according to the changes in this proposal.
Since your minimum tools version is 4.0
, you must add path: "path/to/sources"
in .Target()
.
Your Package.swift
should look like this:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "MyLib",
targets: [
.target(
name: "MyLib",
path: "Sources"), //path for target to look for sources
.testTarget(
name: "MyLibTests",
dependencies: ["MyLib"],
path: "Tests")
]
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With