微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

swift4 – 错误:找不到目标:MyLib;使用Swift 4清单中的’path’属性来设置自定义目标路径

我正在运行sudo swift测试并得到以下错误

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 / 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")
    ]
)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐