vscode-swift
vscode-swift copied to clipboard
Improve logic for launch configuration executable path
Looking at the code base, the extension is making an assumption as to the location of the executables targets location.
See https://github.com/swiftlang/vscode-swift/blob/96192cb6451cae879a929818c458dfd48c524f24/src/debugger/launch.ts#L133-L137
This will fail when the default build system for swift build changes. It would be better to use the --show-bin-path command line option passed to swift build to determine the build output location.
❯ swift build --show-bin-path
/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager-2/.build/arm64-apple-macosx/debug
❯ swift build --show-bin-path --configuration release
/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager-2/.build/arm64-apple-macosx/release
❯ swift build --show-bin-path --build-system swiftbuild
/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager-2/.build/arm64-apple-macosx/Products/Debug
❯ swift build --show-bin-path --build-system swiftbuild --configuration release
/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager-2/.build/arm64-apple-macosx/Products/Release
❯ swift build --show-bin-path --configuration release --scratch-path /my-temp
/my-temp/arm64-apple-macosx/release
❯ swift build --show-bin-path --configuration release --scratch-path /my-temp --triple my-triple --build-system swiftbuild
/my-temp/my-triple/Products/Release