Fixes iOS 18+ runtime downloads
This PR attempts to port the logic from https://github.com/XcodesOrg/XcodesApp/pull/622 to the CLI tool.
Fixes #384
The logic in the downloadAndInstallRuntime was modified to now switch over the runtime's content type. The previous existing package and disk image installs were left unchanged, but the .cryptexDiskImage case is now handled by the downloadAndInstallUsingXcodeBuild function.
This function does 3 main things (broken into some smaller helper functions for those).
- Check that we're using a new enough version of Xcode
- Start downloading using Xcodebuild and create an AsyncStream of the progress
- Write out that progress to the console
Testing:
In order to test this out you will need to have xcode 16.1 or newer installed.
Things I tested and seemed to work for me:
- try to install a runtime with the correct xcode selected
- try to install a cryptex runtime with a too low version selected
Caveats:
I'm not sure what happens to the underlying xcodebuild install process if you cancel the command from the terminal with CMD+C.
When the selected runtime is already installed, the tool will still go through the download process but complete quickly:
[1A[KDownloading Runtime iOS 18.1: 0%
[1A[KDownloading Runtime iOS 18.1: 0%
[1A[KDownloading Runtime iOS 18.1: 0%
[1A[KDownloading Runtime iOS 18.1: 0%
Finished
It might be worth following up in a future PR to check if the runtime is actually already installed instead of doing this.