Xcode 13.3 beta 3: "swift package init" shows warning: "~/Library/org.swift.swiftpm/collections.json has been deprecated" but dunno how to use new one

Viewed 4953

Just upgraded to Xcode 13.3 beta 3 (from Xcode 13.2.1) and ran swift package init. It generated a deprecation warning, I have not seen this before:

warning: Usage of /Users/sajjon/Library/org.swift.swiftpm/collections.json has been deprecated. Please delete it and use the new /Users/sajjon/Library/org.swift.swiftpm/configuration/collections.json instead.

But I do not know HOW to "use the new ... instead"? In fact I don't even know how or when org.swift.swiftpm/collections.json was created.

What to do?

Full print:

~/Developer/DeleteMe ⌚ 13:57:37
$ swift package init
2022-02-25 13:57:42.211 xcodebuild[54679:13318505] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-02-25 13:57:42.212 xcodebuild[54679:13318505] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-02-25 13:57:43.052 xcodebuild[54754:13318823] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-02-25 13:57:43.053 xcodebuild[54754:13318823] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
warning: Usage of /Users/sajjon/Library/org.swift.swiftpm/collections.json has been deprecated. Please delete it and use the new /Users/sajjon/Library/org.swift.swiftpm/configuration/collections.json instead.
Creating library package: DeleteMe
5 Answers

The warning says that you need to delete the file.

Please delete it and use the new /Users/sajjon/Library/org.swift.swiftpm/configuration/collections.json instead.

So please delete it and it will help.

I face this problem after I install Xcode 14.0. This works for me: Go to directory and delete the entire file NOT only collection but the whole file "org.swift.swiftpm" and if it's there "org.swift.swiftpm.lock" and MAKE sure the anything related to SPM is not running including Xcode so close them all before you delete them

Based on a comment from @jalone, this may cause Xcode to crash upon opening the project. It did not do that in my case but all I had was the generic Apple collections: https://developer.apple.com/swift/packages/collections/apple.json

Proceed with caution

It looks like all I needed to do is run this to get rid of the warning.

rm ~/.swiftpm/config/collections.json

There should be an additional collections.json located at ~/.swiftpm/config/configuration/collections.json that is where the packages are now stored when you use

swift package-collection add <package.json>

For more information see the SE proposal documentation here

I saw this warning in Xcode 14 RC and was able to resolve it by removing and re-adding one of my packages (under Project > Package Dependencies).

go to the path and open org.swift.swiftpm file, it will be open into IDE then remove collection.json that is available outside of the configuration folder. warning will be resolved.

Related