Closed devios1 closed 6 years ago
I solved it! Sure enough it was just something dumb: I had forgotten to mention SwiftShell in the target dependencies.
Got it now!
So just to clarify that this works with Swift Package Manager 4, and that in Package.swift the following is needed:
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "commandlinetest",
dependencies: [
.package(url: "https://github.com/kareman/SwiftShell.git", from: "4.0.0"),
.package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "4.0.0")
],
targets: [
.target(
name: "commandlinetest",
dependencies: ["SwiftShell", "SwiftyJSON"]),
]
)
Yes exactly. You need to include it in both places: first as a dependency of the package and secondly as a dependency of the target. Then it should be able to be imported and linked into the target.
Hi there, I'm having some difficulty getting a test project compiling with SwiftShell. I'm pretty new to Swift Package Manager so that doesn't help. I wonder if I'm missing something.
Here is my Package.swift file:
I have a very simple main.swift file that just tries to import SwiftShell, but fails when I try to build it:
Compile Swift Module 'commandlinetest' (1 sources) /Users/…/commandlinetest/Sources/commandlinetest/main.swift:1:8: error: no such module 'SwiftShell' import SwiftShell ^ error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/…/commandlinetest/.build/debug.yaml main
My test project (commandlinetest) was created using "swift package init --type executable". I haven't done anything custom at all yet, but I can't get past this step.
I feel like I must be missing something dumb or something. Any help would be appreciated. I've been banging my head over this for an hour or so.