Is .package(path:) supported on Linux?

I've got the following Package.swift

// swift-tools-version:5.1
import PackageDescription

let package = Package(
    name: "app",
    dependencies: [
        // 💧 A server-side Swift web framework.
        .package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-alpha.2"),
        .package(url: "https://github.com/vapor/fluent.git", from: "4.0.0-alpha.2"),
        .package(path: "/mnt/mydata/fluent-sqlite-driver"),
    ],
    targets: [
        .target(name: "App", dependencies: ["Fluent", "FluentSQLiteDriver", "Vapor"]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App"])
    ]
)

I'm trying to run my app inside a Linux Docker container on macOS 10.14. When I swift package update however, it completes the update without fetching fluent-sqlite-driver and without error.

$ swift package update
Updating https://github.com/vapor/vapor.git
Updating https://github.com/vapor/fluent.git
Updating https://github.com/vapor/open-crypto.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/vapor/async-kit.git
Updating https://github.com/vapor/routing-kit.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/apple/swift-nio-ssl.git
Updating https://github.com/apple/swift-nio-http2.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/apple/swift-nio-extras.git
Updating https://github.com/swift-server/async-http-client.git
Updating https://github.com/vapor/fluent-kit.git
Updating https://github.com/vapor/sql-kit.git
Completed resolution in 11.28s
Everything is already up-to-date

The same setup works as expected from the same macOS machine locally. Is .package(path:) supported on Linux? Is there a workaround if not?

Thanks!

It sounds like that part is working correctly.

package(path: ...) points directly at the directory. It simply uses whatever state is on disk at that location. There is no fetching involved, and there is nothing to update to.

If you want to treat a local package as a versioned repository that behaves the same as remote packages, you need to instead use some variation of package(url: "file:///path/to/local/repository", from: "1.0.0").


If it errors when you do swift build, then something else is the problem.

Ahhh yeah it looks like you're right. I think my error is unrelated actually. There's a package that's failing to build on Linux but not macOS.

My bad, I was running an old version of Swift 5.1. I updated and my problem went away. Thanks anyway!

Terms of Service

Privacy Policy

Cookie Policy