[swift-users] Swift Package Manager and Git submodules

Anton Bronnikov anton.bronnikov at me.com
Fri Oct 28 15:53:33 CDT 2016


Hi,

I have a question whether what I observe is by-design, a bug, or not yet fully implemented feature in Swift Package Manager.

- Let’s say, I have a C repository with some library, and it has two versions tagged, namely 0.0.1 and 0.0.2.
- Then I have a Swift repository that includes the above as a submodule, provides necessary files and exports C functionality into Swift.  This one also has two versions tagged, 0.0.1 and 0.0.2, each matching corresponding version within C repository.
- Finally, I have an application in Swift, that uses the wrapper package as a dependency and specifies 0.0.1 as the desired version.

Normally, I would expect that `swift build` would have PM to check out 0.0.1/0.0.1 versions of the repositories (SwiftWrapper/CLibrary).  However, in fact what I get is 0.0.1/0.0.2 (in other words, I get the right - older - version of the wrapper package, but wrong - new - version of the C submodule).

The use case is to “escort” a C library that is being continuously developed and used as such (e.g. in Linux community) with its Swift bridge without having to copy-paste the sources from the original repo into the mirror (so that the Swift wrapper would only provide the Package.swift, public header file, and possible a modulemap).

If there are other (better) way to do this, I will be glad to hear.

Thanks for the help.
Cheers,
Anton



More information about the swift-users mailing list