加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift4 – 错误:找不到目标:MyLib;使用Swift 4清单中的’path

发布时间:2020-12-14 02:25:49 所属栏目:百科 来源:网络整理
导读:我正在运行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.0import PackageDescriptionlet package
我正在运行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")
    ]
)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读