Skip to content

Commit bc2e670

Browse files
committed
fix a bug where resoved files looses pacakge name case
motivation: fixing dar://52529014 and rdar://52529011 caused a regression in resolved files serialization in which pacakge name lost its original form, causing slight difference between resolved files in 5.4 and 5.5 changes: udpate serialization code to correctly preserve the package original name when constructing the package ref from the mirrors
1 parent 3553e0f commit bc2e670

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/PackageGraph/PinsStore.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ extension PinsStore: JSONSerializable {
131131
let pinsWithOriginalLocations = self.pins.map { pin -> Pin in
132132
let url = self.mirrors.originalURL(for: pin.packageRef.location) ?? pin.packageRef.location
133133
let identity = PackageIdentity(url: url) // FIXME: pin store should also encode identity
134-
return Pin(packageRef: .remote(identity: identity, location: url), state: pin.state)
134+
return Pin(packageRef: .init(identity: identity, kind: pin.packageRef.kind, location: url, name: pin.packageRef.name), state: pin.state)
135135
}
136-
137136
return JSON([
138137
"pins": pinsWithOriginalLocations.sorted(by: { $0.packageRef.identity < $1.packageRef.identity }).toJSON(),
139138
])
@@ -170,7 +169,7 @@ extension PinsStore: SimplePersistanceProtocol {
170169
let pinsWithMirroredLocations = pins.map { pin -> Pin in
171170
let url = self.mirrors.effectiveURL(for: pin.packageRef.location)
172171
let identity = PackageIdentity(url: url) // FIXME: pin store should also encode identity
173-
return Pin(packageRef: .remote(identity: identity, location: url), state: pin.state)
172+
return Pin(packageRef: .init(identity: identity, kind: pin.packageRef.kind, location: url, name: pin.packageRef.name), state: pin.state)
174173
}
175174
self.pinsMap = try Dictionary(pinsWithMirroredLocations.map({ ($0.packageRef.identity, $0) }), uniquingKeysWith: { first, _ in throw StringError("duplicated entry for package \"\(first.packageRef.name)\"") })
176175
}

0 commit comments

Comments
 (0)