[Accepted with Modifications] SE-0272: Package Manager Binary Dependencies

Hello Swift Community,

The second review for SE-0272: Package Manager Binary Dependencies ran from December 13th through December 20th, 2019. You can find the review thread here .

Feedback was sparse, but we had generally positive feedback during the first round of review. Therefore the proposal has been accepted with modifications, local binary targets will not be able to reference zipped artifacts.

Thank you to everyone who participated in the review!

Boris Buegling
Review Manager

12 Likes

Where can we track the implementation of this?

I have been watching the Swift Package Manager master branch for that. As far as I can tell, it landed in the master branch with this pull request: Merge pull request #2514 from hartbit/binary-targets-linking · apple/swift-package-manager@12cce64 · GitHub

1 Like

It mostly landed in the master branch over multiple pull requests in last weeks. It's only missing diagnostics when using them from other platforms than macOS.

3 Likes

@hartbit would spm team plan to maintain their changelog file ? It’s hard to know which feature is shipped.

3 Likes

I agree with this. Tracking SPM properly is currently very difficult. It would be great to see the changes per version and better understand when things are released.

Please correct us if we’re missing something we should be seeing.

In terms of when things are officially released, I think proposals are updated to indicate when they are implemented and in which version they are available.

Thanks @hartbit.
That means that these evolution proposal:

Are not currently fully implemented ?

There are all implemented, but only SE-0226 is in an announced Swift version (5.2). I'll make sure that proposal is updated. The other proposals are implemented in master and will appear in the major Swift version after 5.2, although that version hasn't be announced yet.

4 Likes

will appear in the major Swift version after 5.2

Just to be sure: this means 6.0, and not 5.3, so it could be relatively far away. Correct?

As Ted has already commented on package resource support coming in 5.3 (SE-0271: Package Manager Resources - #74 by tkremenek) I'd guess that binary dependencies will also come in 5.3.

3 Likes

Correct. Package Manager Resources will come in 5.3

4 Likes

how about binary dependencies? i see no reason for shipping those in different releases as they are needed for SPM to take off

Binary dependencies will also come in 5.3

4 Likes

hooray!

Great news all around! SPM will become the default dependency manager for Apple platforms with Swift 5.3. Monumental! Congratulations to @hartbit and the rest of the team for making it happen.

6 Likes

Binary dependencies is a fantastic feature!
Is there a way to specify system dependencies for static frameworks? I.e. I have a static framework(inside an xcframework) I want to make an SPM package and it has some dependencies like CoreLocation.framework and libsqlite3.dylib.

We didn't actually consider that use case, but I think there might a suitable workaround:

  • declare the binary target as you would for your static framework
  • create a regular target with a dummy source file that declares the additional build settings and depends on the binary target
  • create a product that vends the regular target
  • clients depend on that product and import the module of the binary target, they should get the additional linker flags from the regular target.

I haven't tested this myself, so please report back on your success with this!

1 Like

Thanks for the answer. Actually, I had tried this but with no success. It seems that linker settings only applied to that dummy sources. I've just tried to play with linker settings one more time and still no results. And also I don't see libraries and frameworks in Xcode's build log so maybe I do something wrong.
Another problem is that the framework I try to wrap in a package is ObjC one with some categories that don't work without -ObjC in linker flags. The only way I can set this flag is .unsafeFlags() but this option produce an error during import in Xcode project.

Binary dependencies is a great feature and will hopefully allow me to add SwiftPM packages for several SDKs. However, I have a couple challenges:

  • It isn't possible to reference an XCFramework other than at the root of a zip. This means we have to upload multiple zips for different variations of the SDK (static, dynamic)
  • There is no way to provide credentials for HTTP authentication. Cocapods uses .netrc.
1 Like