Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes iOS 18+ runtime downloads #391

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

spadafiva
Copy link

@spadafiva spadafiva commented Oct 23, 2024

This PR attempts to port the logic from XcodesOrg/XcodesApp#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).

  1. Check that we're using a new enough version of Xcode
  2. Start downloading using Xcodebuild and create an AsyncStream of the progress
  3. 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:

  1. try to install a runtime with the correct xcode selected
  2. 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.

@spadafiva spadafiva marked this pull request as ready for review October 24, 2024 17:42
@spadafiva spadafiva changed the title Gets downloads working a bit Fixes iOS 18+ runtime downloads Oct 24, 2024


private extension Progress {
func updateFromXcodebuild(text: String) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken directly from the other PR

return AsyncThrowingStream<Progress, Swift.Error> { continuation in
Task {
// Assume progress will not have data races, so we manually opt-out isolation checks.
let progress = Progress()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less verbatim from the other PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS 18 runtime can not be downloaded
1 participant