Hello Swift Package Manager contributors
We have been working on a PackageVersions feature and we would like to hear your feedback and ideas.
Idea:
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 - Added ServerInfo and Server response header by rfdickerson · Pull Request #352 · Kitura/Kitura · GitHub
Format:
- 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"
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://bugs.swift.org/browse/SR-473
Looking forward for your feedback
- Kostiantyn