[swift-build-dev] SwiftPM PackageVersions

Ankit Agarwal ankit at ankit.im
Fri Jul 8 04:05:48 CDT 2016


>From what I understand, swiftpm will generate a module with structs of each
dep with their version meta data, something like:

// Module PackageVersions
public struct FirstDependency {
    // meta data}
public struct SecondDependency {
    // meta data}
public struct MyPackage {
    // meta data}

And then somewhere in the package you can dump/use the version info like
this:

// Somewhere in MyPackage
import PackageVersionsprint("\(PackageVersions.FirstDependency)")


Sounds good but if its only generated for root package what happens when
that root package is being used as a dependency somewhere?



On Mon, Jul 4, 2016 at 9:32 PM, Kostiantyn Koval via swift-build-dev <
swift-build-dev at swift.org> wrote:

> 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 - https://github.com/IBM-Swift/Kitura/pull/352/files
>
> *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
>
>
>
>
>
> _______________________________________________
> swift-build-dev mailing list
> swift-build-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-build-dev
>
>


-- 
Ankit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20160708/2c0b7886/attachment.html>


More information about the swift-build-dev mailing list