我现在觉得自己很傻。我在依赖库中的一个文件中有一个条件,它排除了一些代码。
#if os(Linux) || SERVER
// Code
#endif
我将把这个问题留在这里只是为了说明解决方法。我需要给
SERVER
对于该依赖库的Package.swift:
.target(
name: "ServerAccount",
dependencies: [
"ServerShared",
// For new condition feature, see https://forums.swift.org/t/package-manager-conditional-target-dependencies/31306/26
.product(name: "Kitura", package: "Kitura", condition: .when(platforms: [.linux, .macOS])),
.product(name: "HeliumLogger", package: "HeliumLogger", condition: .when(platforms: [.linux, .macOS])),
.product(name: "Credentials", package: "Kitura-Credentials", condition: .when(platforms: [.linux, .macOS])),
],
swiftSettings: [
// So I can do basic development and editing with this on Mac OS. Otherwise if some dependent library uses this it will not get Account related code. See Account.swift.
.define("SERVER", .when(platforms: [.macOS], configuration: .debug)),
]),