xcpretty / xcode-install

🔽 Install and update your Xcodes
https://fastlane.tools
MIT License
2.59k stars 239 forks source link

Deletes all unavailable simulators after an xcode uninstall #358

Closed ChristianOrgler closed 3 years ago

ChristianOrgler commented 4 years ago

In order to reduce disk space we should delete all unavailable simulators once an xcode version gets uninstalled.

I also had this in mind to do for an install as maybe developers remove their Xcode versions via the Finder - but it violates the single responsibility principle I guess. What do you think?

Vyazovoy commented 4 years ago

If you have several Xcode versions installed and decide to delete one then simctl delete unavailable will delete all unavailable devices for current Xcode version. So after you switch to one of the installed versions you will find out that you have empty device list 😊 So the task of deletion of unavailable simulators requires more comprehensive logic

ChristianOrgler commented 4 years ago

Yes this depends how the usage is going, if you install a new one first and then uninstall an old one I think this is fine. However if you switch from one to the other by uninstalling first then I guess it makes more sense to put it in the install logic rather than the un-install logic, right?

So whenever you install a new Xcode version, we clean up potential stuff from previous actions. As a side-benefit we could also add this option within the simulators command.

What would you suggest @Vyazovoy ?

Vyazovoy commented 4 years ago

@ChristianOrgler , I think an ideal solution would be to loop through all installed Xcode versions, collect all unavailable devices for each one, add them to set and delete only those devices those unavailable for all Xcode versions. Also I think this step should be in post-uninstall phase as that is the only case when unavailable devices could appear.

ChristianOrgler commented 4 years ago

I see what you mean, okay I will work on that logic then (hopefully soon) :)

Thanks for your input @Vyazovoy !