[swift-build-dev] Version update and clean option

王巍 onevcat at gmail.com
Fri Dec 4 01:48:15 CST 2015

Hi, all

It seems currently there is no way to update a dependency to a compatible version unless we remove the cloned dependency folder from Packages manually.

Take example, consider the Package.swift file as follows:

let package = Package(
    name: "Dealer",
    dependencies: [
        .Package(url: "https://github.com/apple/example-package-deckofplayingcards.git", majorVersion: 1),

It will clone and build the latest 1.x.y (currently 1.0.2, https://github.com/apple/example-package-deckofplayingcards/releases) for me. Let’s assume later a new compatible version 1.0.3 is released. However, even I run `swift build` again, it seems the package manager will not update this dependency, since the existing version is already match the requirement. ( https://github.com/apple/swift-package-manager/blob/master/Sources/dep/get.swift#L260-L270 ).

Even I run a `swift build -k` before building the package, the dependency wouldn’t get updated. The only way to update to a most recent compatible version seems to be a `rm -rf Packages` before build.

As I specified the major version should be 1, IMO, it means I may want the latest version before 2.0.0. Is current behavior expected, or is there any plan to provide a better way to upgrade the dependencies? Maybe we need some options like `swift build —clean_all` or `swift build upgrade`?

Best regards.
Wei Wang (王巍, @onevcat)
im.onevcat.com <http://im.onevcat.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20151204/32b2694b/attachment.html>

More information about the swift-build-dev mailing list