yeatse / opencv-spm

Integrate OpenCV into your project using Swift Package Manager.
Apache License 2.0
71 stars 23 forks source link

Xcode package resolver doesn't seem to like the "+4" version suffix #28

Open dougboberg opened 1 month ago

dougboberg commented 1 month ago

Previously I was able to successfully use this opencv-spm with version 4.10.0. My project is configured to use the "Exact Version" with a value of "4.10.0"

Today I updated my projects dependencies including this opencv-spm package and received errors for this package:

Revision dd26dba92773b39488768888c107e5ef6b0e7c1b for opencv-spm remoteSourceControl https://github.com/yeatse/opencv-spm.git version 4.10.0 does not match previously recorded value ed61dc59456dce41d36de0817a89e367c1bf8849

I cleared all of Xcode's caches and tried again with no luck. Then in Terminal I ran xcodebuild -resolvePackageDependencies and received a similar error message:

Updating from https://github.com/yeatse/opencv-spm.git Revision dd26dba92773b39488768888c107e5ef6b0e7c1b for opencv-spm remoteSourceControl https://github.com/yeatse/opencv-spm.git version 4.10.0 does not match previously recorded value ed61dc59456dce41d36de0817a89e367c1bf88492024-09-04 15:15:24.969 xcodebuild[6244:162967] Writing error result bundle to /var/folders/_y/k7mjbd_16dvc546x383c8qvw0000gn/T/ResultBundle_2024-04-09_15-15-0024.xcresult xcodebuild: error: Could not resolve package dependencies: Revision dd26dba92773b39488768888c107e5ef6b0e7c1b for opencv-spm remoteSourceControl https://github.com/yeatse/opencv-spm.git version 4.10.0 does not match previously recorded value ed61dc59456dce41d36de0817a89e367c1bf8849

Checking on this project's Releases page I see 4.10.0+4 with hash dd26dba92773b39488768888c107e5ef6b0e7c1b and 4.10.0 with hash ed61dc59456dce41d36de0817a89e367c1bf8849 https://github.com/yeatse/opencv-spm/releases

It appears that the resolver is confused between the newest "4.10.0+4" and "4.10.0" and failing when the commit hash does not match.

I have tried adding "+4" to my "Exact Version" setting but that did not help. I tried changing Exact Version to "Up to Next Major Version" so it shows < 5.0.0 but that did not help either.

My guess is that the resolver is limited to a strict X.Y.Z format for versions.

I realize this may be a problem with the SPM resolver more than it is a problem with this project. I am reporting this scenario in case you receive other users with a similar issue.

yeatse commented 1 month ago

The intention behind the versioning scheme for opencv-spm was to closely align with OpenCV’s version numbers. For example, if OpenCV is at version 4.10.0, opencv-spm should ideally also start with 4.10.0. If I were to move to something like 4.10.1, it could create confusion if OpenCV itself releases a 4.10.1.

As a result, I opted for the 4.10.0+X format, but this appears to be incompatible with Xcode’s package resolver, which seems to expect strict X.Y.Z versioning.

In your case, I would recommend using the commit hash or a specific branch to reference the package. This should bypass the versioning issue with the resolver.