[swift-build-dev] SwiftPM PackageVersions

Kostiantyn Koval konstantin.koval1 at gmail.com
Mon Jul 4 11:02:01 CDT 2016

Hello Swift Package Manager contributors

We have been working on a PackageVersions feature and we would like to hear your feedback and ideas.

We would like to generate Version information about package. The package would be able to import PackageVersions module and use that information.

Use case:
A web server product provides diagnostics when it fails to connect to its port, part of this diagnostics is a dump of the version information for the socket library it uses.
Real uses case - https://github.com/IBM-Swift/Kitura/pull/352/files <https://github.com/IBM-Swift/Kitura/pull/352/files>

- url: a git origin of a package or local path if there is no git (package not published yet),
- package version
- version string representation
- SHA of of a commit made after checked version
- modified, are there any uncommitted changes to the package.

public let url: String = "https://github.com/apple/swift-package-manager.git <https://github.com/apple/swift-package-manager.git>"
public let version: (major: Int, minor: Int, patch: Int, prereleaseIdentifiers: [String], buildMetadata: String?) = (0, 2, 2, [], nil)
public let versionString: String = "0.2.2"
public let sha: String? = "154cf23f74efa6c596bd25f4caa5a3bd20c78c4f"
public let modified: Bool = true 

Concerns and questions:
- "We think that this should only be generated for the root-package, the rationale here is that we don't want packages writing code like if version.major > 2 as this should be a compile time language feature and Swift core are already on board with this idea.”
- Should a package have access to own dependencies VersionData information ?
You can find more information here.
https://github.com/apple/swift-package-manager/pull/122 <https://github.com/apple/swift-package-manager/pull/122>
https://bugs.swift.org/browse/SR-473 <https://bugs.swift.org/browse/SR-473>

Looking forward for your feedback
- Kostiantyn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20160704/6e2135ed/attachment.html>

More information about the swift-build-dev mailing list