Skip to content

Commit c39839a

Browse files
authored
only cache successfully parsed manifets (#3141)
motivation: caching manifests that fail to parse makes development of swift-pm harder, and is not meaningful from a performance point of view changes: only cache manifests if they have no parse errors
1 parent 4fed86c commit c39839a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,12 @@ public final class ManifestLoader: ManifestLoaderProtocol {
665665
toolsVersion: key.toolsVersion
666666
)
667667

668-
try keyHash.withData {
669-
try cache.put(key: $0, value: self.jsonEncoder.encode(result))
668+
// only cache successfully parsed manifests,
669+
// this is important for swift-pm development
670+
if !result.hasErrors {
671+
try keyHash.withData {
672+
try cache.put(key: $0, value: self.jsonEncoder.encode(result))
673+
}
670674
}
671675

672676
return result

0 commit comments

Comments
 (0)