Error adding target dependencies with Swift Package Manager

时间:2015-12-14 18:08:17

标签: swift swift-package-manager

When trying to include a target dependency I get the error: The manifest describes a target that cannot be found in your source tree: parser

Here is my Package.swift file:

import PackageDescription

let package = Package(
    name: "Phoenix",
          targets: [
            Target(
                name: "Phoenix",
                dependencies: [.Target(name: "parser")]),
            Target(
                name: "parser")
    ]
)

I am following the format described here: https://github.com/apple/swift-package-manager/blob/master/Documentation/Package.swift.md

3 个答案:

答案 0 :(得分:6)

您有parser目录吗?

你应该有一个类似的布局:

     .
     └── Sources
         └── Phoenix
         │   └── File1.swift
         └── parser
             └── File2.swift

或者:

     .
     └── Phoenix
     │   └── File1.swift
     └── parser
         └── File2.swift

这指示SwiftPM创建两个模块,一个名为Phoenix,一个名为" parser"。

答案 1 :(得分:3)

虽然你是对的,但我的实际问题是我的子目录没有包含任何快速代码,所以模块没有被生成

答案 2 :(得分:0)

链接到状态The targets are named how your subdirectories are named.的Swift Package Manager文档如果找不到目标parser,可能是您的parser子目录位于Package.swift的目录中1}}文件位于。

您应该明确目录结构,以便将其与Package.swift内容进行比较。

修改

Max提供了一个很好的例子。请注意,“来源”' dir也可以是“来源”,“src'或者' srcs'