XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.58k stars 119 forks source link

Potentially wrong command to get installed runtimes #363

Open wow-such-amazing opened 2 months ago

wow-such-amazing commented 2 months ago

Hey there!

Thanks a lot for the library, it's very useful in our setup!

I've started to use the library to install required runtimes to run screenshots generation with fastlane. And while I was exploring xcrun simctl from terminal and setting up our small swift script I've noticed something that probably is an issue in the library code as well 👀 But since the documentation of the xcrun simctl is not very big it's hard to say if I'm correct. So I'll share my thoughts and you could tell me if my findings make any sense 👀

So in the project I've found this command being used to find installed runtimes: https://github.com/XcodesOrg/xcodes/blob/aa795f81ad4ffe2c696f643a36fdeac116389e87/Sources/XcodesKit/Environment.swift#L44

If I run this command from terminal this is the output:

Screenshot 2024-05-03 at 18 44 50

Which seems fine at first. We get runtimes by their udid. However if I remove the option to list those as json here is an output:

Screenshot 2024-05-03 at 18 45 47

There is a tiny change that maybe is a big thing. Here it says Disk Images. And I believe that Disk Images are not the same as Installed Runtimes. Basically I think it's possible to have a Disk Image that it not installed.

Another clue which makes it even more obvious is this output on one of our build machines. As you can see there are 3 disk images, 3 of which are ready. While 0 runtimes available: image

Let me know what you think about those findings. Maybe I misinterpret something wrong?

Cheers!