дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02:00
fix(tools): pick the platform archive for kotlin-lsp (#726)
kotlin-lsp releases renamed their archives to kotlin-server-*, so no rule matched and the loose kotlin-*.zip fallback picked the Windows zip on every OS. Match the current names per platform: .sit (a zip archive) on macOS, .tar.gz on Linux, .win.zip on Windows; extract .sit as zip; drop the loose fallback. Co-authored-by: a-rookie-of-C-language <[email protected]>
Цей коміт міститься в:
1 джерело
4015a5b71f
коміт
e7f00ee7ce
2 files changed
+64
-5
No files matched your search
@@ -21,7 +21,8 @@ pub enum ArchiveKind {
|
||||
impl ArchiveKind {
|
||||
pub fn from_name(name: &str) -> Self {
|
||||
let n = name.to_ascii_lowercase();
|
||||
if n.ends_with(".zip") || n.ends_with(".vsix") {
|
||||
// JetBrains' macOS .sit distributions are zip archives.
|
||||
if n.ends_with(".zip") || n.ends_with(".vsix") || n.ends_with(".sit") {
|
||||
Self::Zip
|
||||
} else if n.ends_with(".tar.gz") || n.ends_with(".tgz") {
|
||||
Self::TarGz
|
||||
@@ -393,6 +394,7 @@ mod tests {
|
||||
fn kinds() {
|
||||
assert_eq!(ArchiveKind::from_name("a.vsix"), ArchiveKind::Zip);
|
||||
assert_eq!(ArchiveKind::from_name("a.ZIP"), ArchiveKind::Zip);
|
||||
assert_eq!(ArchiveKind::from_name("kotlin-server-263.7084.0-aarch64.sit"), ArchiveKind::Zip);
|
||||
assert_eq!(ArchiveKind::from_name("a.tar.gz"), ArchiveKind::TarGz);
|
||||
assert_eq!(ArchiveKind::from_name("a.tgz"), ArchiveKind::TarGz);
|
||||
assert_eq!(ArchiveKind::from_name("zls.tar.xz"), ArchiveKind::TarXz);
|
||||
|
||||
@@ -614,15 +614,25 @@ pub static TOOLS: &[ToolSpec] = &[
|
||||
method: Method::Release {
|
||||
source: ReleaseSource::GitHub { repo: "Kotlin/kotlin-lsp" },
|
||||
assets: &[
|
||||
// Current releases (kotlin-server-*): the CLI distribution is a
|
||||
// .sit on macOS, .tar.gz on Linux and .win.zip on Windows. x64 ships as the
|
||||
// un-suffixed archive, aarch64 as `-aarch64`; the un-suffixed one
|
||||
// comes first in the release notes, which is what the x64 pattern
|
||||
// matches first. Without a matching rule the installer used to fall
|
||||
// through to a loose `kotlin-*.zip` pattern and POSIX picked the
|
||||
// Windows archive (#723).
|
||||
rule(Mac, Arm64, "kotlin-server-*-aarch64.sit"),
|
||||
rule(Mac, X64, "kotlin-server-*.sit"),
|
||||
rule(Linux, Arm64, "kotlin-server-*-aarch64.tar.gz"),
|
||||
rule(Linux, X64, "kotlin-server-*.tar.gz"),
|
||||
rule(Windows, X64, "kotlin-server-*.win.zip"),
|
||||
rule(Windows, Arm64, "kotlin-server-*-aarch64.win.zip"),
|
||||
// Old releases named the archives kotlin-lsp-*.
|
||||
rule(Mac, Arm64, "kotlin-lsp-*-mac-aarch64.zip"),
|
||||
rule(Mac, X64, "kotlin-lsp-*-mac-x64.zip"),
|
||||
rule(Linux, X64, "kotlin-lsp-*-linux-x64.zip"),
|
||||
rule(Linux, Arm64, "kotlin-lsp-*-linux-aarch64.zip"),
|
||||
rule(Windows, X64, "kotlin-lsp-*-win-x64.zip"),
|
||||
// Older releases ship one platform-independent archive.
|
||||
any_arch(Mac, "kotlin-*.zip"),
|
||||
any_arch(Linux, "kotlin-*.zip"),
|
||||
any_arch(Windows, "kotlin-*.zip"),
|
||||
],
|
||||
locate: &["kotlin-lsp", "kotlin-lsp.sh", "kotlin-lsp.cmd"],
|
||||
},
|
||||
@@ -988,4 +998,51 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The v263 kotlin-server-* release notes: the CLI distribution archives plus
|
||||
/// the VS Code extension and checksums; each platform must pick its native
|
||||
/// distribution and the aarch64 archive must never be picked on x64.
|
||||
#[test]
|
||||
fn kotlin_lsp_picks_the_native_archive_for_each_platform() {
|
||||
use crate::platform::{Platform, select_asset};
|
||||
let names = [
|
||||
"kotlin-server-0.0.27-mac-amd64.vsix",
|
||||
"kotlin-server-0.0.27-mac-amd64.vsix.sha256",
|
||||
"kotlin-server-0.0.27-mac-aarch64.vsix",
|
||||
"kotlin-server-0.0.27-mac-aarch64.vsix.sha256",
|
||||
"kotlin-server-0.0.27-linux-amd64.vsix",
|
||||
"kotlin-server-0.0.27-linux-amd64.vsix.sha256",
|
||||
"kotlin-server-0.0.27-linux-aarch64.vsix",
|
||||
"kotlin-server-0.0.27-linux-aarch64.vsix.sha256",
|
||||
"kotlin-server-0.0.27-win-amd64.vsix",
|
||||
"kotlin-server-0.0.27-win-amd64.vsix.sha256",
|
||||
"kotlin-server-0.0.27-win-aarch64.vsix",
|
||||
"kotlin-server-0.0.27-win-aarch64.vsix.sha256",
|
||||
"kotlin-server-263.7084.0.sit",
|
||||
"kotlin-server-263.7084.0.sit.sha256",
|
||||
"kotlin-server-263.7084.0-aarch64.sit",
|
||||
"kotlin-server-263.7084.0-aarch64.sit.sha256",
|
||||
"kotlin-server-263.7084.0.tar.gz",
|
||||
"kotlin-server-263.7084.0.tar.gz.sha256",
|
||||
"kotlin-server-263.7084.0-aarch64.tar.gz",
|
||||
"kotlin-server-263.7084.0-aarch64.tar.gz.sha256",
|
||||
"kotlin-server-263.7084.0.win.zip",
|
||||
"kotlin-server-263.7084.0.win.zip.sha256",
|
||||
"kotlin-server-263.7084.0-aarch64.win.zip",
|
||||
"kotlin-server-263.7084.0-aarch64.win.zip.sha256",
|
||||
];
|
||||
let rules = find("kotlin-lsp").unwrap().asset_rules();
|
||||
let mac_arm = Platform { os: Mac, arch: Arm64 };
|
||||
assert_eq!(select_asset(&names, rules, mac_arm), Some("kotlin-server-263.7084.0-aarch64.sit"));
|
||||
let mac_x64 = Platform { os: Mac, arch: X64 };
|
||||
assert_eq!(select_asset(&names, rules, mac_x64), Some("kotlin-server-263.7084.0.sit"));
|
||||
let linux_x64 = Platform { os: Linux, arch: X64 };
|
||||
assert_eq!(select_asset(&names, rules, linux_x64), Some("kotlin-server-263.7084.0.tar.gz"));
|
||||
let linux_arm = Platform { os: Linux, arch: Arm64 };
|
||||
assert_eq!(select_asset(&names, rules, linux_arm), Some("kotlin-server-263.7084.0-aarch64.tar.gz"));
|
||||
let win_x64 = Platform { os: Windows, arch: X64 };
|
||||
assert_eq!(select_asset(&names, rules, win_x64), Some("kotlin-server-263.7084.0.win.zip"));
|
||||
let win_arm = Platform { os: Windows, arch: Arm64 };
|
||||
assert_eq!(select_asset(&names, rules, win_arm), Some("kotlin-server-263.7084.0-aarch64.win.zip"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача