Does anyone know what Xcode does within the "Packages. Finishing..." stage and what could be done to debug it? We have quite a big packages tree that is resolved in ~200 seconds, but afterward, it proceed to this stage and Xcode freezes for 10-15 minutes, sometimes longer. I got spindump for this, and it has references to Playground, also on a disk there is a folder in DerivedData Build/Intermediates.noindex/Plagrounds changes size non-stop and grows to some very big numbers. We do not have Playgrounds. What could it be and what are possible ways to analyze and resolve the issue?
I did open radar, as well as wrote to Apple dev support without any answer so far.
4 Likes
Jon_Shier
(Jon Shier)
2
Yes, there’s currently a bug in Xcode’s package handling that produces a hang when packages have playgrounds in their repo. You can either go back to 13.2.1 or go through your packages and delete the playgrounds. May want to go one repo at a time to see if you can narrow it down to just one.
5 Likes
This is amazing. Thank you so much, at least I have now a way forward, so I can start the hunt for the playgrounds.
abertelrud
(Anders Bertelrud)
4
Do you have a bug number handy, as I'd like to to follow up on that? Thanks!
1 Like
FB9964493
Is it now possible to follow radars if you know an id?
1 Like
Robuske
(Rodrigo Cardoso Buske)
6
Just to add to this post, we had a even worse problem:
Xcode wouldn't work with any Xcode 13 versions, so we where in a hurry to find a solution or we wouldn't be able to release any new versions from April 25 (last date that would accept Xcode 12 builds).
Luckily we found this post and its solution worked (after making several forks to remove .playgrounds from dependencies), so thank you @Jon_Shier. 
Before finding the solution we also opened a Feedback (FB9977627) and eventually a DTS. We are still in touch with developer support through the DTS and they are now aware of the issue, hopefully it will lead to a solution soon enough. 
2 Likes
dafurman
(David Furman)
7
@Robuske
Have you made any progress with Apple? I'm seeing that this behavior continues to exist in Xcode 14.1.0.
I can replicate this consistently with the following steps:
- Open your project and let SPM dependencies resolve
- Close, then reopen your project
- Notice that SPM resolution lingers on
Packages | Finishing...
- navigate to ~/Library/Developer/Xcode/DerivedData/YourApp-/SourcePackages/checkouts
- Delete any files in this directory + subdirectories that end in .playground
- Reopen your project
- Notice that SPM resolution does not linger on
Packages | Finishing...
dafurman
(David Furman)
8
As a suggestion, if you're encountering that removing a particular playground file solves your issue, it can be worth adding that file deletion as a post checkout git hook, to ensure it regularly remains deleted whenever you may need to delete and regenerated derived data.
Specifically for me, it was a SQLite.playground file that had to be deleted from our dependency on this library.