TIL how make Swift package depend another package on local machine
Swift package manager documentation doesn’t show clearly how to make package depend on other package on local machine which is extreemly useful during development. Here is what you use: .package(url: "../swift-geometrize/", branch: "feature/asynciterator")
. As alternative .package(path: "../Modules/MySwiftLib")
could be used or its variant with package name .package(name: "MyPackage", path: "/local/path/to/package")
. This .package(url: "file:///path/to/MySwiftLib", from: "1.0.0")
technically is also possible but it is not too much useful during development. This is exert from package manifest which I use during development of geometrizebot:
let package = Package(
name: "geometrizebot",
platforms: [
.macOS(.v12)
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.76.0"),
.package(url: "https://github.com/vapor/leaf", from: "4.2.4"),
.package(url: "https://github.com/vapor/leaf-kit", from: "1.10.2"),
.package(url: "https://github.com/nerzh/telegram-vapor-bot", from: "2.4.3"),
//.package(url: "https://github.com/valeriyvan/swift-geometrize.git", from: "1.1.2"),
.package(url: "../swift-geometrize/", branch: "feature/asynciterator"),
.package(url: "https://github.com/valeriyvan/jpeg.git", from: "1.0.2"),
.package(url: "https://github.com/kelvin13/swift-png.git", from: "4.0.2"),
.package(url: "https://github.com/awslabs/aws-sdk-swift", exact: "0.17.0")
],