Reputation: 383
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
Upvotes: 8
Views: 3400
Reputation: 383
While you're both right, my actual problem was that my subdirectory didn't contain any swift code so a module wasn't being generated
Upvotes: 4
Reputation: 14374
The Swift Package Manager documentation you link to states The targets are named how your subdirectories are named.
If the target parser
cannot be found, presumably you do not have a subdirectory named parser
located in the directory where your Package.swift
file is located.
You should clarify your directory structure so that it can be compared to your Package.swift
contents.
Edit
Max has provided a good example. Note that the 'Sources' dir could also be 'Source', 'src' or 'srcs'
Upvotes: 1
Reputation: 26913
Do you have a parser
directory?
You should have a layout something like:
.
└── Sources
└── Phoenix
│ └── File1.swift
└── parser
└── File2.swift
Or:
.
└── Phoenix
│ └── File1.swift
└── parser
└── File2.swift
This instructs SwiftPM to create two modules, one called Phoenix and one called "parser".
Upvotes: 7