`carton init` should check locally installed swift wasm version before installing from github
felixf4xu opened this issue · 2 comments
Hi,
My swift wasm
is locally installed by adding its path to .bashrc
, so when I run:
swift --version
SwiftWasm Swift version 5.9.1 (swift-5.9.1-RELEASE)
Target: x86_64-unknown-linux-gnu
which swift
/home/cc/Downloads/swift-wasm-5.9.1/usr/bin/swift
But when I run carton init --template tokamak
I got this:
Creating new project with template tokamak in TokamakApp
- checking Swift compiler path: /home/cc/.carton/sdk/wasm-5.9.1-RELEASE/usr/bin/swift
- checking Swift compiler path: /home/cc/.swiftenv/versions/wasm-5.9.1-RELEASE/usr/bin/swift
Fetching release assets from https://api.github.com/repos/swiftwasm/swift/releases/tags/swift-wasm-5.9.1-RELEASE
Response contained body, parsing it now...
Response succesfully parsed, choosing from this number of assets: 7
Local installation of Swift version wasm-5.9.1-RELEASE not found
Swift toolchain/SDK download URL: https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.9.1-RELEASE/swift-wasm-5.9.1-RELEASE-ubuntu22.04_x86_64.tar.gz
it seems that carton
is looking for swift
either at ~/.carton/sdk/wasm-5.9.1-RELEASE/usr/bin/swift
or ~/.swiftenv/versions/wasm-5.9.1-RELEASE/usr/bin/swift
. If not found, it tries to install it from github.
I think this is not ideal for the case when swift is actually already installed.
Unfortunately there is no good way to detect if a given swift
executable is built from a specific revision of SwiftWasm, so we conservatively check only known installation layouts.
Is it possible to run some command like swift --version
or which swift
to find the installed swiftwasm?