Automatically install simulator runtimes for chosen platforms - #856
Open
anandghegde wants to merge 1 commit into
Open
anandghegde wants to merge 1 commit into
anandghegde wants to merge 1 commit into
Conversation
Pick the platforms you always need in the Platforms window and Xcodes installs the newest runtime for each of them as soon as an Xcode install finishes, instead of making you come back and start every runtime by hand. - `RuntimeAutoInstallService` picks the newest downloadable runtime per selected platform and skips platforms whose newest runtime is already installed, so repeat installs don't re-download anything. - Beta runtimes are only considered for users who already opted into automatically installing Xcode betas. - `downloadRuntime` gained `presentingErrors:` so an automatic install that can't run right now (for example no selected Xcode yet) logs instead of raising an alert. - The chosen platforms are stored under `autoInstallRuntimePlatforms` as a comma separated list of platform identifiers, so they can also be managed by a configuration profile. Fixes XcodesOrg#298
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #298.
Manual runtime installs already exist, but you have to come back to the Platforms window after every Xcode install and start each one by hand. This adds the "pick once, always ready" half that the issue asks for.
What it does
The Platforms window gets an Install Automatically section with a toggle per platform (iOS, watchOS, tvOS, visionOS). When an Xcode install finishes, Xcodes installs the newest runtime for each selected platform through the same
downloadRuntimepath a manual click uses.A platform is skipped when its newest runtime is already installed, so repeat Xcode installs never re-download a runtime that is already on disk, and nothing happens at all when no platform is selected.
Details
RuntimeAutoInstallServiceholds the decision logic: newest runtime per selected platform, version-compared (so26.0beats18.5rather than sorting as strings), already-installed platforms filtered out by matchingsimulatorVersion.buildUpdateagainst the installedCoreSimulatorImagebuilds — the same matchPlatformsListViewalready uses.autoInstallation == .newestBeta). For everyone else only released runtimes are installed automatically; betas are still installable by hand. When prereleases are in play, a release always wins over a beta of the same version, otherwise the higher seed wins.downloadRuntime(runtime:presentingErrors:)— automatic installs passpresentingErrors: false, so a runtime that can't be installed right now (for exampleRuntimeInstallPolicyError.noSelectedXcode, which is possible right after a first install) is logged instead of throwing an alert at the user. Manual installs keep the existing alert behaviour via the default argument.autoInstallRuntimePlatformsas a comma separated list of platform identifiers via aRawRepresentablewrapper, which means it works with@AppStorageand can also be pushed by a configuration profile — the toggles disable themselves whenPreferenceKey.autoInstallRuntimePlatforms.isManaged().DownloadableRuntime.icon()now forwards to a newDownloadableRuntime.Platform.icon()so the new rows can show a platform icon without a runtime instance.installAsyncpreviously bailed out early with aguardwhen the installed Xcode wasn't inallXcodes; that is now anif letso the auto-install step runs either way. Behaviour is otherwise unchanged.Tests
15 new tests in
XcodesTests/RuntimeAutoInstallServiceTests.swiftcover platform selection, version ordering, the already-installed skip, the beta policy, and the preference round trip. Full suite: 66 tests, 0 failures.Strings
Two new keys (
PlatformsList.AutoInstall.Title,PlatformsList.AutoInstall.Description) with English values only — happy to leave the other locales to the usual translation pass, or to adjust the wording.