How to depend on a specified Pre-release version of package with the Swift Package Manager

Thank you for taking me time to reply!

Kostiantyn’s suggestion should work, though you’ll need to specify it as

an inclusive range of the provided Version() twice.

An error has occurred as Kostiantyn’s suggestion is, I arranged it just a
little as Example 1.
And then I think Max’s suggestion is Example 2.
But in any case, the swiftPM fetched a package with 2.0.0-beta.2 tag.

# Example 1
.Package(url: "https://github.com/ikesyo/Himotoki.git",
    Version(2, 0, 0, prereleaseIdentifiers: ["beta.1"]))

# Example 2
.Package(url: "https://github.com/ikesyo/Himotoki.git",
    versions: Version(2, 0, 0, prereleaseIdentifiers:
["beta.1"])...Version(2, 0, 0, prereleaseIdentifiers: ["beta.1"]))

By the way, the version of the package is required to follow Semantic
Versioning (SemVer) conventions, therefore we must be determined by
comparing each dot separated identifier.

- http://semver.org/
- "Precedence for two pre-release versions with the same major, minor, and
patch version MUST be determined by comparing each dot separated identifier
from left to right until a difference is found"

So, I think the specifying as Example 3 is better.
But the swiftPM fetched a package with 2.0.0-beta.2 tag.

# Example 3
Package(url: "https://github.com/ikesyo/Himotoki.git",
    versions: Version(2, 0, 0, prereleaseIdentifiers: ["beta",
"1"])...Version(2, 0, 0, prereleaseIdentifiers: ["beta", "1"]))

As it turned out, Example 4 is expected behavior.
The swiftPM fetched a package with 2.0.0-beta.1 tag.

# Example 4
.Package(url: "https://github.com/ikesyo/Himotoki.git",
    versions: Version(2, 0, 0, prereleaseIdentifiers: ["beta",
"1"])..<Version(2, 0, 0, prereleaseIdentifiers: ["beta", "2"]))

# Consideration for Pre-release Versions

I understand what Max means.

However, we need to specify a dependency package with a specific
pre-release identifier until the stable version is released in our
development environment.
In fact, we had needed Xcode 7.3-beta version before Xcode 7.3 and Swift
2.2 were released.

I think we don't specify single version forever, but it should be possible
to specify a dependency package with a specific pre-release identifier in
Manifest and the swiftPM should fetch that exact version temporarily.

By the way, it seems the same thing has discussed here.
- Fix documentation on version specification examples of `Package.swift` by norio-nomura · Pull Request #179 · apple/swift-package-manager · GitHub
I hadn't watched it thorouoghly enough, I'm sorry.

Thanks for reading such a long mail.

Best regards,
JPMartha

···

2016-03-22 3:10 GMT+09:00 Max Howell <max.howell@apple.com>:

Strictly, we don’t really want people specifying such exact version
requirements in Package.swift, since it would be easy to forget and then be
trapped on a single version forever despite updates being available.

The lockfile proposal is more for this kind of restriction, but this is
not yet implemented (or approved).

However Kostiantyn’s suggestion should work, though you’ll need to specify
it as an inclusive range of the provided Version() twice.

On Mar 21, 2016, at 2:36 AM, Kostiantyn Koval via swift-build-dev < > swift-build-dev@swift.org> wrote:

Hi JPMartha,

I think it should be possible to specify a dependency package with a
specific pre-release identifier in Manifest and swiftpm should fetch that
exact version.
Example:

Package(url: ""https://github.com/ikesyo/Himotoki.git&quot;,
  versions: Version(1, 0, 0, prereleaseIdentifiers: “beta.1”)

The swiftPM should fetch a package with *v-1.0.0-beta-1 *tag

On 21 Mar 2016, at 06:43, Martha JP via swift-build-dev < > swift-build-dev@swift.org> wrote:

Hi, I'm JPMartha.

I had filed an issue of the Swift Package Manager first.
But, I should have heard your feedback on my opinion beforehand.

Please see the following:
[SR-965] How to depend on a specified Pre-release version of package with the Swift Package Manager · Issue #5381 · apple/swift-package-manager · GitHub

I think it's unexpected behavior.
I'm curious to hear your feedback!

Best regards,
JPMartha
_______________________________________________
swift-build-dev mailing list
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