I have a project that I recently added swift-docc-plugin to, so that I can export the DocC documentation as a static website.
// swift-tools-version:5.5
import PackageDescription
let package = Package(
name: "Saga",
platforms: [
.macOS(.v12)
],
products: [
.library(name: "Saga", targets: ["Saga"]),
.executable(name: "watch", targets: ["SagaCLI"])
],
dependencies: [
.package(url: "https://github.com/kylef/PathKit", from: "1.0.1"),
.package(url: "https://github.com/JohnSundell/Codextended.git", from: "0.1.0"),
.package(url: "https://github.com/apple/swift-docc-plugin.git", branch: "main"),
],
targets: [
.target(
name: "Saga",
dependencies: [
"PathKit",
"Codextended",
]
),
.executableTarget(
name: "SagaCLI",
dependencies: ["PathKit"]
),
.testTarget(
name: "SagaTests",
dependencies: ["Saga"]
),
]
)
The problem is that on Swift Package Index all builds on Swift 5.5 and below are failing:
error: package at 'https://github.com/apple/swift-docc-plugin.git' @ 859caac534e94ace18b894ccd9ed301ae4aeda84 is using Swift tools version 5.6.0 but the installed version is 5.5.0 in https://github.com/apple/swift-docc-plugin.git
See https://swiftpackageindex.com/builds/1DF06709-E2CA-4F56-B793-9CC7C8FC0A9D for a full build log.
How do I solve this? I could remove swift-docc-plugin from the dependencies I guess, and add it every time I want to export the docs, but that seems like a ridiculously annoying workaround. I don't really want to increase the minimum version of my library just because of swift-docc-plugin either.
The solution was pretty easy in the end. Just add this to the end of Package.swift