swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

Swiftly arbitrarily selects `swift` executables in `PATH`

Open SimplyDanny opened this issue 2 months ago • 1 comments

This happens in macOS with swift available in the PATH twice, namely one from Xcode and another one installed with swiftly. A fixed version has been set with swiftly use -g 6.2.1, but that doesn't matter. Asking for swift --version repeatedly gives:

$ swift --version
Apple Swift version 6.2.1 (swift-6.2.1-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions
$ swift --version
Apple Swift version 6.2.1 (swift-6.2.1-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions
$ swift --version
Apple Swift version 6.2.1 (swift-6.2.1-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions
$ swift --version
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0
$ swift --version
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0
$ swift --version
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0
$ swift --version
Apple Swift version 6.2.1 (swift-6.2.1-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions

Obviously, Swiftly arbitrarily selects one or the other. That's causing huge build overheads given that every project needs to be built from scratch every time the underlying swift is not the one used to built the project before.

SimplyDanny avatar Nov 09 '25 16:11 SimplyDanny

I found the root cause in swift-subprocess which I propose to fix with https://github.com/swiftlang/swift-subprocess/pull/211.

SimplyDanny avatar Nov 09 '25 16:11 SimplyDanny