swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.65k stars 1.31k forks source link

Make traits optional in manifest deserialization #7681

Closed FranzBusch closed 2 weeks ago

FranzBusch commented 2 weeks ago

Motivation

We are caching manifest JSONs to speed up loading. It can happen that we cached a manifest with an older SwiftPM version and have to load the manifest from JSON with a newer SwiftPM version. With the first traits PR we made the new fields non-optional. This led to failures when loading the manifest from the cache https://github.com/apple/swift-package-manager/pull/7680.

Modification

This PR makes the fields optional and we default to empty sets after loading deserialization.

MaxDesiatov commented 2 weeks ago

@swift-ci test

FranzBusch commented 2 weeks ago

@MaxDesiatov i was trying to write a test for it but I wasn't able to find a way to inject things into the cache.