I am trying to compile a small swift program, "main.swift" to an executable on Ubuntu 18.08. I use the Swift Package Manager to manage my dependencies. In this very simple case I only have one dependency, namely this open-source CryptoKit. I have one swift file which just tries to import CryptoKit.
import Foundation
import CryptoKit
print("phew")
My Package.swift file looks like this:
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "decryp",
dependencies: [
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMajor(from: "1.0.1"))
],
targets: [
.target(
name: "decryp",
dependencies: ["swift-crypto"]
),
.testTarget(
name: "decrypTests",
dependencies: ["decryp"]),
]
)
When I try to build the executable with swift build it fetches the repository, but then gives an error with a product not found. stdout from swift build:
Fetching https://github.com/apple/swift-crypto.git
Cloning https://github.com/apple/swift-crypto.git
Resolving https://github.com/apple/swift-crypto.git at 1.0.2
'decryp' /home/kah/decryp: error: product 'swift-crypto' not found. It is required by target 'decryp'.
warning: dependency 'swift-crypto' is not used by any target
Maybe I am missing something obvious? I am still a beginner in the swift world.