jzi
(Jochen Zilske)
May 12, 2026, 10:28am
1
I know that the Swift tools version 5.6 introduced version 2 of the Package.resolved file. I recently noticed that apparently there is also a version 3, but I was unable to find when it was introduced. Is this documented/tracked anywhere?
ole
(Ole Begemann)
May 12, 2026, 12:33pm
2
I looks like version 3 was introduced 2023-08 in this pull request:
main ← tomerd:prefer-resolved-file
opened 03:13AM - 12 Jul 23 UTC
prefer versions in package.resolved file when one exists and matches the origina… l manifest
motivation: when a package.resolved file exists the dependencies resolution should stick to it, unless requested otherwise
changes:
* compute a hash of the source for the package.resolved file and use it to decide if dependency resolution is required or package.resolved is sufficient
* prefer the versions specified in package.resolved by default and no changes in the original manifest are detected
* refactor code flow to make the logic easier to reason about
* add and adjust tests
Take a look at the PinsStore.V3 struct (the current name for this is ResolvedPackagesStorage.V3). Search for "// v3 storage format" in the diff view.
1 Like
Kyle-Ye
(Kyle)
May 12, 2026, 12:53pm
3
Version 3 was added in swift-package-manager#6698, merged on Aug 8, 2023:
main ← tomerd:prefer-resolved-file
opened 03:13AM - 12 Jul 23 UTC
prefer versions in package.resolved file when one exists and matches the origina… l manifest
motivation: when a package.resolved file exists the dependencies resolution should stick to it, unless requested otherwise
changes:
* compute a hash of the source for the package.resolved file and use it to decide if dependency resolution is required or package.resolved is sufficient
* prefer the versions specified in package.resolved by default and no changes in the original manifest are detected
* refactor code flow to make the logic easier to reason about
* add and adjust tests
The actual format change is pretty small: v3 is basically v2 plus an originHash field:
// v3 storage format
struct V3: Codable {
static let version = 3
let version: Int
let originHash: String?
let pins: [V2.Pin]
init(
pins: PinsStore.Pins,
mirrors: DependencyMirrors,
originHash: String?
) throws {
self.version = Self.version
self.pins = try pins.values
.sorted(by: { $0.packageRef.identity < $1.packageRef.identity })
.map { try V2.Pin($0, mirrors: mirrors) }
self.originHash = originHash
It gets written when toolsVersion > .v5_9, so effectively Swift tools version 5.10 and later:
1 Like