You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be ideal if swiftly automatically installed the project toolchain if it's not currently installed.
Steps to reproduce
Create a swift package
List all installed versions
In the created package, specify a version in .swift-version file that is not currently installed
swift build or swift --version, or swift test etc...
❯ swift --version
The swift version file `/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.swift-version` uses toolchain version main-snapshot-2025-02-24, but it doesn't match any of the installed toolchains. You can install the toolchain with `swiftly install`
Instead of that message, running swift should automatically install the version of the toolchain, thus streamlining the build process.
The text was updated successfully, but these errors were encountered:
bkhouri
changed the title
Automatically install toolchain
Automatically install project toolchain version if it is not currently installed on the host
Mar 2, 2025
This would be a nice feature. There are a few things to consider.
People running a toolchain command like swift or lldb might find it surprising that a seemingly local and fast operation is instead of network intensive, and long running operation. Sometimes the download can be more than 1GB.
Because you're running a toolchain command, there's no opportunity to specify any command-line options for the swiftly install command, such as --use to use the toolchain for the next commands, or the --verify/--no-verify options.
Note that the install operation is potentially fallible, requiring system packages to be installed before continuing with the toolchain command that was originally requested. System packages are installed by the user either by running the recommended command as root, or specifying as a command-line parameter the "post-install file" where the command is placed. In the case of the latter there is no way to specify that command-line option in this workflow.
Given these considerations this is why swiftly currently opts to give an actionable message in this situation.
rustup has a similar functionality to automatically install toolchain when a proxy binary is invoked. However, they removed the feature for its too much implicit behavior:
It would be ideal if
swiftly
automatically installed the project toolchain if it's not currently installed.Steps to reproduce
.swift-version
file that is not currently installedswift build
orswift --version
, orswift test
etc...Instead of that message, running
swift
should automatically install the version of the toolchain, thus streamlining the build process.The text was updated successfully, but these errors were encountered: