Hive
SwifterPM installs incorrect version of (binary) Package
GitHub issue · Open
What happened?
Seems there is issue with SwifterPM and caching when installing some Swift Packages. I have stumbled on this Issue after bumping Intercom (SPM optimized) package from 19.1.2 -> 19.8.0 Package repo: https://github.com/intercom/intercom-ios-sp/blob/19.1.2/Package.swift
After resolving project with package in version 19.8.0 and going back to previous commits with 19.1.2 version - I started getting compilation issues. Turned out project was still referencing Intercom 19.8.0.
This seems to be critical issue because actual copied package version is not the same as in declaration (Package.swift & Package.resolved). This can lead to issues in case mismatched version compiles fine.
Above issue is tested and verified for binary packages like Intercom. Similar issue was not observed on Packages with source code - like Alamofire.
How do we reproduce it?
Repo allowing to reproduce the issue: https://github.com/TomaszLizer/tuist-package-resolution-issue or Package Resolution Issue.zip
Use above project to reproduce the issue.
Steps to reproduce:
- Checkout
Integrate Intercomcommit - Run
tuist install; tuist generateto setup project - Compile project - it should succeed
- Checkout
Update Intercom to 19.8.0commit - Run
tuist clean; tuist install; tuist generate- tuist install without clean fails for me with error:
error: 'intercom-ios-sp': Couldn’t check out revision ‘58c62766abb306053ac06366806474d9e882473e‘
- tuist install without clean fails for me with error:
- Compile project - it should succeed
- Checkout
Integrate Intercomcommit again - Run
tuist clean; tuist install; tuist generate - Compile project - it should succeed, but fails
- Compilation Issue:
Ambiguous use of 'setDeviceToken' - Underlying problem: tuist / SwifterPM copied Intercom version 19.8.0 into the project.
- Compilation Issue:
Error log
There are no errors in the log of tuist.
Results of tuist clean; tuist install; tuist generate:
❯ tuist clean; tuist install; tuist generate
✔ Success
Successfully cleaned artifacts at path /Users/tomasz.lizer/Workspace/Repositories/Playground/Package Resolution Issue/.build
Resolving and fetching plugins.
Resolving and fetching dependencies.
intercom-ios-sp 19.1.2 eda17ebd60ede445e205cfa8f880c14569dc58da https://github.com/intercom/intercom-ios-sp
restored intercom-ios-sp.Intercom -> /Users/tomasz.lizer/.cache/swifterpm/artifacts/intercom-ios-sp/Intercom-01fbce7cb1a3
restored intercom-ios-sp -> /Users/tomasz.lizer/.cache/swifterpm/sources/intercom-ios-sp/19.1.2-eda17ebd60ede445e205cfa8f880c14569dc58da
restored 1 source-control packages into /Users/tomasz.lizer/Workspace/Repositories/Playground/Package Resolution Issue/.build/checkouts
restored 0 registry packages into /Users/tomasz.lizer/Workspace/Repositories/Playground/Package Resolution Issue/.build/registry/downloads
cached package manifest JSON into /Users/tomasz.lizer/Workspace/Repositories/Playground/Package Resolution Issue/.build/swifterpm/package-info
✔ Success
Plugins resolved and fetched successfully.
Loading and constructing the graph
It might take a while if the cache is empty
Using cache binaries for the following targets:
Generating workspace Package Resolution Issue.xcworkspace
Generating project Package Resolution Issue
Total time taken: 0.814s
✔ Success
Project generated.
Framework version under paths above:
/Users/tomasz.lizer/.cache/swifterpm/artifacts/intercom-ios-sp/Intercom-01fbce7cb1a3->Intercom 19.8.0(actual xcframework)/Users/tomasz.lizer/.cache/swifterpm/sources/intercom-ios-sp/19.1.2-eda17ebd60ede445e205cfa8f880c14569dc58da->Intercom 19.8.0(see package.json found at that path)/Users/tomasz.lizer/Workspace/Repositories/Playground/Package Resolution Issue/.build/checkouts->Intercom 19.8.0(actual xcframework)
macOS version
26.6.2
Tuist version
4.209.0
Xcode version
26.4.1
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.