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
Asked Answered
P

5

82

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
Pelion answered 25/2, 2022 at 13:3 Comment(1)
I just upgraded Xcode 13.3 and same error...... I am on a flutter project though – Bind
I
124

I faced this problem after I installed Xcode 14.0. Deleting org.swift.swiftpm worked for me:

  1. Make sure that anything related to SPM is not running including Xcode. Close them all before you delete anything.

  2. Go to directory and delete the entire org.swift.swiftpm directory (Not only collection directory, but the whole org.swift.swiftpm directory) and if there is also a org.swift.swiftpm.lock, delete that one as well.

enter image description here

Inga answered 14/9, 2022 at 17:2 Comment(4)
Quick, easy. Warning was gone as soon as I re-launched XCode. – Irenairene
This should be the accepted answer. Easy and efficient solutionπŸ‘ – Crumpler
"and if it's there org.swift.swiftpm.lock" what does this mean? – Ardellearden
I guess it means that you might not have that file in you directory, but if it is there to make sure to delete it also. – Belden
S
22

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.

Spearing answered 16/3, 2022 at 9:39 Comment(4)
This is not the same problem. The core issue is xcodebuild error, not deprecation warning. – Veron
@DaumantasVersockas there's no xcodebuild error in OP's question. It's clear about referring to the deprecation warning. – Nursery
Yes, that's what I did, remove the file is enough. – Padgett
I believe this should be the accepted answer. Deleting this file worked for me also. We don't have to create the file it says to use instead, because it's already there and has the exact same contents. I can't see any other steps required for how to "use" the file it says to use instead. It seems it uses the file automatically in the absence of the one it says to delete. Xcode 14.2. MacOS Ventura 13.2 – Drop
M
13

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

Mclendon answered 15/3, 2022 at 23:2 Comment(3)
BEWARE after removal of the file xcode 13.3 crashes continuosly upon opening the project on my instance. I had to clean up a lot of caches and files to make the project open again (and the warning at least was gone). I suggest you find an alternative solution for this sadly. – Corelation
Does this still happen with Xcode 13.4? – Resumption
Back up just in case ... worked fine otherwise. mv ~/.swiftpm/config/collections.json ~/.swiftpm/config/collections.json.bak – Bybidder
P
4

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.

Picrate answered 14/9, 2022 at 7:38 Comment(0)
C
3

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).

Christenechristening answered 8/9, 2022 at 12:45 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.