Using SwiftPM as package dependency


I am attempting to build a sample package built on top of libSwiftPM, inspired by, but I get a build error when declaring SwiftPM as an external package dependency


// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "swift-package-info",
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(name: "SwiftPM", url: "", .exact("0.6.0")),
    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 this package depends on.
            name: "swift-package-info",
            dependencies: ["SwiftPM"]),
            name: "swift-package-infoTests",
            dependencies: ["swift-package-info"]),

Reproducible with

Is this an issue from SPM or is using SwiftPM as external package dependency not supported?

Kind regards,

Each tagged release of SwiftPM has to be used with a particular corresponding toolchain. The latest release is compatible with Swift 5.2. When Swift 5.3 was released, SwiftPM never had a version tagged. For more information:

At the bottom of that thread you will find links to a fork that does have a tagged release for Swift 5.3. (The 5.3 and 5.3.2 tags are basically interchangeable and work with any 5.3.x. The more recent one just contains some bug fixes around conditional dependencies.)

1 Like

Thank you Jeremy! I ca conform that this works for me :smile:

.package(name: "SwiftPM", url: "", .exact("0.50302.0")),

Yeah, I was surprised that the official repo did not have more recent tagged releases. You are doing a huge service to the community by maintaining those forks with a tagged release. Kudos!

Terms of Service

Privacy Policy

Cookie Policy