error: could not find target(s): MyLib; use the 'path' property in the Swift 4 manifest to set a custom target path
error: could not find target(s): MyLib; use the 'path' property in the Swift 4 manifest to set a custom target path
我是 运行 sudo swift test
并收到以下错误:
error: could not find target(s): MyLib; use the 'path' property in the Swift 4 manifest to set a custom target path
Package.swift:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "MyLib",
targets: [
.target(name: "MyLib"),
.testTarget(
name: "MyLibTests",
dependencies: ["MyLib"])
]
)
根据 proposal 对退出代码有影响。目的说:
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.
由于您的最低工具版本是4.0
,您必须在.Target()
中添加path: "path/to/sources"
。
您的 Package.swift
应如下所示:
// 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")
]
)
我是 运行 sudo swift test
并收到以下错误:
error: could not find target(s): MyLib; use the 'path' property in the Swift 4 manifest to set a custom target path
Package.swift:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "MyLib",
targets: [
.target(name: "MyLib"),
.testTarget(
name: "MyLibTests",
dependencies: ["MyLib"])
]
)
根据 proposal 对退出代码有影响。目的说:
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.
由于您的最低工具版本是4.0
,您必须在.Target()
中添加path: "path/to/sources"
。
您的 Package.swift
应如下所示:
// 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")
]
)