Version update and clean option


(Wei Wang) #1

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.

···

---
Sincerely,
Wei Wang (王巍, @onevcat)
im.onevcat.com <http://im.onevcat.com/>


(Lily Ballard) #2

I assume that a lot of this stuff is coming. However, based on the
current state of things, I'm actually really surprised we don't have a
Package.lock file (or equivalent). Being able to reproduce the exact
build on multiple machines or at multiple points in time is really
important. I may specify that I want version 1.x of a package but
everyone who checks out my project and builds it should get the exact
same version (e.g. 1.0.2) of the dependency, even if there's a newer
compatible version.

-Kevin Ballard

···

On Thu, Dec 3, 2015, at 11:48 PM, 王巍 wrote:

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.
---
Sincerely, Wei Wang (王巍, @onevcat) im.onevcat.com[1]

_________________________________________________
swift-build-dev mailing list swift-build-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev

Links:

  1. http://im.onevcat.com/


(Rick Ballard) #3

Hello,

Adding the ability to update your dependencies is high on our priority list to implement soon.

We have an issue in our internal bug database (which we haven't yet migrated to http://bugs.swift.org <http://bugs.swift.org/>) for implementing lock files; we haven't scheduled it yet, but it is something we intend to support. Of course, we welcome pull requests!

Thanks,

  - Rick

···

On Dec 4, 2015, at 1:21 PM, Kevin Ballard <kevin@sb.org> wrote:

I assume that a lot of this stuff is coming. However, based on the current state of things, I'm actually really surprised we don't have a Package.lock file (or equivalent). Being able to reproduce the exact build on multiple machines or at multiple points in time is really important. I may specify that I want version 1.x of a package but everyone who checks out my project and builds it should get the exact same version (e.g. 1.0.2) of the dependency, even if there's a newer compatible version.

-Kevin Ballard

On Thu, Dec 3, 2015, at 11:48 PM, 王巍 wrote:

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.
---
Sincerely,
Wei Wang (王巍, @onevcat)
im.onevcat.com <http://im.onevcat.com/>

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-build-dev

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev