0

I want to test Kitura, so I did

swift package init --type executable

I made a minimal Package.swift

import PackageDescription

let package = Package(
    name: "project2",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.0.0")),
        .package(url: "https://github.com/IBM-Swift/HeliumLogger.git", .upToNextMinor(from: "1.7.1")),
        .package(url: "https://github.com/IBM-Swift/Kitura-StencilTemplateEngine", .upToNextMinor(from: "1.8.3"))
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "project2",
            dependencies: ["Kitura", "HeliumLogger", "KituraStencil"]),
        ]
)

when I run swift build, the Error Message is

'Kitura' /Users/myname/Documents/myname/project2/.build/checkouts/Kitura.git-6522211175291160341: error: product dependency 'KituraNet' not found

I happened to do the exactly same thing on my desktop at work and everything was fine. Does anyone see what I am missing here?

  • using .package(url: "https://github.com/IBM-Swift/Kitura-StencilTemplateEngine", from: "1.8.3") of .package(url: "https://github.com/IBM-Swift/Kitura-StencilTemplateEngine", .upToNextMinor(from: "1.8.3") made this work (other dependencies accordingly). –  May 20 '18 at 18:26

1 Answers1

0

You probably have a version mismatch. Try updating Kitura:

.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.3.0")),
Steven Van Impe
  • 1,153
  • 8
  • 15
  • Thank you, this solved my problem. I still do not understand why .package(url: "github.com/IBM-Swift/Kitura-StencilTemplateEngine";, from: "1.8.3") is working as well but .package(url: "github.com/IBM-Swift/Kitura-StencilTemplateEngine";, .upToNextMinor(from: "1.8.3") is not. (Mind the difference concerning the Version parameter. In one case it is a String (works) the other case it is an enum (did not work)). –  May 21 '18 at 10:21
  • I don't think it has anything to do with your Package.swift. My guess is that you needed a newer version of KituraNet than what Kitura 2.0 uses. You asked for `.upToNextMinor(from: "2.0.0")`, which means it will *not* use Kitura 2.1 or later (the current version is 2.3). To avoid these problems, I usually update my dependencies all at once, so they're contemporary. – Steven Van Impe May 21 '18 at 10:39