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.
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.
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.
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.
Wow, I just stumbled upon this thread.. thank you! This has been bugging me so much ever since we started to modularize our app with SPM.
Making this simple change now cut the time until Xcode becomes usable for me after launching it from ~55 seconds to ~12 seconds!
And this is considering we had just two playgrounds in there: one from SQLite.swift, and one from Promises.
Here's the command I used, and also added to our project's Makefile: