When Coder is installed on Windows via winget, the installed executable is named coder.exe.
However, the binary lookup logic currently resolves the filename using getCoderCLIForOS(), which returns the downloadable release artifact name such as coder-windows-amd64.exe.
As a result, the plugin does not find the CLI when it is installed through winget and the binary directory is set via setings.
installed/local CLI lookup on Windows using winget should look for coder.exe
auto-install via jetbrains tooling may still use coder-windows-amd64.exe
It should not only be able to use the downloaded binary via the coder server, but also pre-installed coder binaries already available.
Code:
|
private fun getCoderCLIForOS(os: OS?, arch: Arch?): String { |
|
logger.debug("Resolving binary for $os $arch") |
|
|
|
val (osName, extension) = when (os) { |
|
OS.WINDOWS -> "windows" to ".exe" |
|
OS.LINUX -> "linux" to "" |
|
OS.MAC -> "darwin" to "" |
|
null -> { |
|
logger.error("Could not resolve client OS and architecture, defaulting to WINDOWS AMD64") |
|
return "coder-windows-amd64.exe" |
|
} |
|
} |
|
|
|
val archName = when (arch) { |
|
Arch.AMD64 -> "amd64" |
|
Arch.ARM64 -> "arm64" |
|
Arch.ARMV7 -> "armv7" |
|
else -> "amd64" // default fallback |
|
} |
|
|
|
return "coder-$osName-$archName$extension" |
|
} |
Tests:
|
|
|
private fun assertBinaryAndSignature( |
|
osName: String?, |
|
arch: String?, |
|
expectedBinary: String, |
|
expectedSignature: String |
|
) { |
|
if (osName == null) System.clearProperty("os.name") else System.setProperty("os.name", osName) |
|
if (arch == null) System.clearProperty("os.arch") else System.setProperty("os.arch", arch) |
|
|
|
Assertions.assertEquals(expectedBinary, store.defaultCliBinaryNameByOsAndArch) |
|
Assertions.assertEquals(expectedSignature, store.defaultSignatureNameByOsAndArch) |
|
} |
When Coder is installed on Windows via winget, the installed executable is named coder.exe.
However, the binary lookup logic currently resolves the filename using
getCoderCLIForOS(), which returns the downloadable release artifact name such ascoder-windows-amd64.exe.As a result, the plugin does not find the CLI when it is installed through winget and the binary directory is set via setings.
installed/local CLI lookup on Windows using winget should look for coder.exe
auto-install via jetbrains tooling may still use coder-windows-amd64.exe
It should not only be able to use the downloaded binary via the coder server, but also pre-installed coder binaries already available.
Code:
jetbrains-coder/src/main/kotlin/com/coder/gateway/settings/CoderSettings.kt
Lines 423 to 444 in 4233ee7
Tests:
jetbrains-coder/src/test/kotlin/com/coder/gateway/settings/CoderSettingsTest.kt
Lines 464 to 476 in 4233ee7