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

Support Runtime/Platforms Downloading and Install 🚀 #448

Merged
merged 9 commits into from
Dec 1, 2023

Conversation

MattKiazyk
Copy link
Contributor

With Apple's change of splitting out the runtimes outside the of the main Xcode download, we need to support that in Xcodes so that users can still feel the speed and ease of downloading GB more of required data

The Xcode CLI had support for this for a while.. sorry it took long to get this in.

What's new

XcodesKit

I started splitting out shared code into a new package called... XcodesKit so that, in the future, both CLI and UI can reuse the same code. Currently there's a lot of duplicated code. There are lots of shell calls that are exactly the same for both.

Any new code that can be shared between the 2 should be moved to XcodesKit when at all possible

Runtime Download

Xcodes CLI currently only uses the current selected Xcode to determine if it's installed. Anytime you have multiple Xcodes installed, it doesn't do a great job of showing you what other runtimes are installed.

This PR includes code that uses /Library/Developer/CoreSimulator/Images (where the downloaded runtimes exist) to determine whether or not you have that it installed.

I'm still working on tweaking the UI for downloading but currently looks like:

Installed Downloading
Screenshot 2023-11-23 at 2 46 28 PM Screenshot 2023-11-23 at 2 46 50 PM

This code started in June - so please give it a run if you have time.

@MattKiazyk MattKiazyk added the enhancement New feature or request label Nov 23, 2023
Copy link
Contributor

@marcusziade marcusziade left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 69 to 87
// self.runtimePublishers[runtime.identifier] = downloadRunTimeFull(runtime: runtime)
// .receive(on: DispatchQueue.main)
// .sink(
// receiveCompletion: { [unowned self] completion in
// self.runtimePublishers[runtime.identifier] = nil
// if case let .failure(error) = completion {
// Logger.appState.error("Error downloading runtime: \(error.localizedDescription)")
//// // Prevent setting the app state error if it is an invalid session, we will present the sign in view instead
//// if error as? AuthenticationError != .invalidSession {
//// self.error = error
//// self.presentedAlert = .generic(title: localizeString("Alert.Install.Error.Title"), message: error.legibleLocalizedDescription)
//// }
//// if let index = self.allXcodes.firstIndex(where: { $0.id == id }) {
//// self.allXcodes[index].installState = .notInstalled
//// }
// }
// },
// receiveValue: { _ in }
// )
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we leave this in with a todo comment or remove it entirely?

@@ -112,6 +112,74 @@ public struct Shell {
return (progress, publisher)
}

// public var downloadWithAria2Async: (Path, URL, Path, [HTTPCookie]) async throws -> Progress = { aria2Path, url, destination, cookies in
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a TODO here or remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added TODO to support Aria 2 with AsyncStream/Sequence

$0.sdkBuildUpdate == sdkBuild
}
}
// let runtimes = appState.getRunTimes(xcode: xcode)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed?

@hstdt
Copy link

hstdt commented Nov 24, 2023

Network change error makes ObservingProgressIndicator freezing even install button clicked and download task start again, until InfoPane reload.

PS: How about a installing status text or cancel button instead of the install button when installing.

Thanks for your nice work!

@MattKiazyk
Copy link
Contributor Author

@hstdt thanks for the feedback. Going to work on supporting cancelling for runtimes in a future PR as I def missed that in this pr.

@MattKiazyk MattKiazyk merged commit c5ada02 into main Dec 1, 2023
1 check passed
@MattKiazyk MattKiazyk deleted the matt/runtimeDownload branch December 1, 2023 16:06
@Lakr233
Copy link

Lakr233 commented Dec 1, 2023

Can't wait for you to release! So excited!

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

Successfully merging this pull request may close these issues.

4 participants