Accurately determining Alamofire Swift version compatibility for the Swift Package Index

Hello!

We’ve been doing a bit of investigation into a discrepancy between the Swift version compatibility results for Alamofire on the Swift Package Index and what the intended compatibility is.

You state in your badges 5.3+ and have Package@5.4 and Package@5.3 files, and sure enough, those all work fine, but we also get a successful build on watchOS with Swift 5.2 using xcodebuild from Xcode 11.6. See the full build results here and a specific build for watchOS with Swift 5.2 on the 5.5.0 tag here.

I’ve verified our build results using xcodebuild with Xcode 11.6 and the log you see on the build page above is what gets output. Of course, when you try and import the package into a watchOS app project with Xcode 11.6 you get an incompatibility warning:

Screenshot 2022-01-19 at 12.21.36@2x

We do get failures when xcodebuild attempts to resolve dependencies with Swift 5.2 and other platforms (example).

We’d love for our package compatibility to be accurate as people are potentially making decisions from it but we’re struggling to figure out what’s letting the watchOS build succeed where the others fail and we wondered if you had any insight on what might be different for this build?

Of course, the easiest way for a package author to “remove” compatibility would be with an #if and an #error, which may be the best situation here too, but we’re interested if we can make any adjustments on our side before resorting to that.

There's nothing different about the watchOS build, so I'm not sure why it works. Essentially, our support of Swift 5.3 or greater is more about only supporting Xcode 12 and above rather than any specific Swift version, as you can no longer ship software to the stores using Xcode 11 (AFAIK), and to simplify our support matrix.

I'm not sure what to suggest here other than to somehow parse the supported package versions and use that as your lower bound.

Thanks for the quick reply, Jon. It's curious why it succeeds.

The problem will solve itself, of course, as we drop off old versions of Swift from the matrix. We've certainly talked about dropping the Xcode 11 versions, but for now, we're running everything that can run on Big Sur or above.

Would you be open to a PR that gives an error on Swift versions < 5.3?

Sure. In the Package or in code? If in code, the Alamofire.swift file is the logical place.

Yes, I was thinking in the code would be the best place. I'll pop a PR in over the next few days.