Bug in Xcode's 'Up to Next Major Version' dependency rule

I made a public repo, GitHub - joesus/TestPackageVersioning, and added the following tags:
1.0.0
3.0.0
6.0.0
9.0.0
10.0.0

As I added them, I confirmed that adding the package from Xcode showed the correct version using the 'Up to Next Major Version' dependency rule.

When I tried to add version 10.0.0, it showed 9.0.0 to 10.0.0

Just to confirm that it wasn't due to some weird bug involving the sequence of tags, I created
a new repo, GitHub - joesus/TestPackageVersioning2, with only one tag - 10.0.0.

Adding it from Xcode shows 0.0.0

This makes it difficult to write onboarding documentation that suggests using this rule if you have a major version past 9.0.0.
It adds friction to adopters if they need to know the tag for the latest release and manually input it.
This feature should work for any tag that is valid under Semantic Versioning 2.0.0.

Thanks!

2 Likes

My guess would be that Xcode is sorting the tags as strings (or accepting the order Git supplied them in), instead of sorting them as semantic versions. 10.0.0 is greater than 9.0.0 as a version, but not as a string:

% git ls-remote --tags https://github.com/joesus/TestPackageVersioning
3cba43c288c5ca0b10a8a3fca041d2e89d1fd28d	refs/tags/1.0.0
4c560f52ee772c692a4d5e0728e200eafcaa4dcc	refs/tags/10.0.0
33e6cdb3b1932f32b86bc6d16d6a19bde5b71a83	refs/tags/3.0.0
53e78b133289ddbf800e8f46e804b8cedf71363b	refs/tags/6.0.0
be53124f19a715c9ce3a355aa53adc895f7e96cf	refs/tags/9.0.0

Regardless, this has nothing to do with open source Swift, so you will have to report it to the Xcode team with Apple’s Feedback Assistant.

1 Like

Just to clarify - neither of your repos are valid packages as they don't have a top-level Package.swift

Fair enough. Weirdly enough that doesn't matter for package discovery by Xcode. I updated them to have packages at the top level and it doesn't make a difference in terms of the bug.