Closed drekka closed 3 years ago
Which Xcode/Swift are you using?
Can you also show the first line of the Package.swift
, which defines your tools version?
Oh, nevermind, the dependency specification is not right. You have to specify a product as your dependency, but swift-nio-transport-services
is a package. We define only one product:
Change the dependency name to NIOTransportServices
and you should be fine.
Hi @Lukasa Thanks for replying. I'm using swift tools version 5.5 in Xcode 13 beta. I already tried using "NIOTransportServices" as the reference and it insisted that to do that I had to add the name to the dependency, so I tried this:
dependencies: [
.package(name: "NIOTransportServices", url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.0.0")
],
targets: [
.target(
name: "Simulcra",
dependencies: ["NIOTransportServices"],
),
But now it's giving this error:
'simulcra' dependency on 'https://github.com/apple/swift-nio-transport-services.git' has an explicit name 'NIOTransportServices' which does not match the name 'swift-nio-transport-services' set for 'https://github.com/apple/swift-nio-transport-services.git'
Any Idea?
SPM is a new experiment for me so I don't know all the tricks :-)
BTW, NIO and NIO Transport Services are resolving and I can see them in Xcodes dependencies, browse their package files and source. So that's working. It's just trying to get them to resolve when I add them as a dependency that's causing the problem. Note I'm also not specifying NIO, as it appears that Transport Services is dealing with it for me.
I would suggest trying to use the full `.product(name: "NIOTransportServices", package: "swift-nio-transport-services") syntax
Following up on @Davidde94’s comment you also need to clean up your dependencies
stanza. You want to end up with:
dependencies: [
.package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.0.0")
],
targets: [
.target(
name: "Simulcra",
dependencies: [.product(name: "NIOTransportServices", package: "swift-nio-transport-services")],
),
I figured it out eventually. I was miss-reading one of the error messages.
I have the following fragment in my package file:
But it won't resolve, telling me "product 'swift-nio-transport-services' required by package 'simulcra' target 'Simulcra' not found."
How do I get this to work?