Is package.resolved generation not backwards compatible?

I updated my iPad to iOS 15.6 which required me to update Xcode to 13.4.1 which required me to update some of my dependencies.

Doing this regenerated package.resolved which I am tracking in source control. (Which I understand is the correct practice to synchronize packages across the team and have a history of which deps. were included in releases)

When I try to merge these changes, the Xcode version used by my CI to build and run tests doesn't recognize the package.resolved format. I get the following error:

Package.resolved file is corrupted or malformed; fix or delete the file to continue: unsupported schema version 2

It seems to me that this is a backwards compatibility bug: a package.resolved file generated in a newer version of Xcode shouldn't be unreadable by previous versions of Xcode (within reason).

Is the only way to fix this updating Xcode in the CI?
Or am I missing something.

I don't believe a Package.resolved will switch to the version 2 schema until the package's Package.swift is updated to swift-tools-version:5.6 or greater, regardless of the compiler version you're using. But I'm not sure what happens to your 5.5-or-below Swift package if it depends on a package declaring 5.6+.

That is true for standalone packages, but I don't think there's anything like this for the resolved file of an Xcode project or workspace since it doesn't have any equivalent of a tools-version.

1 Like

In general newer Xcode versions aren't guaranteed to be backward compatible with older. This includes project formats, storyboard / xib formats, project templates (template and code), and probably other artifacts. For your use you'll need to use an older Xcode version to update your SPM dependencies until you're ready to update. But any worthwhile CI should've had Xcode 13.4(.1) available long ago.

1 Like