Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
conpty: Bump version and fetch from GitHub for dev-builds (#46026)
Lukas Wirthc32a811b4ef9
diff --git a/crates/zed/build.rs b/crates/zed/build.rsindex dd26a1152e9..18139a679d6 100644--- a/crates/zed/build.rs+++ b/crates/zed/build.rs@@ -53,22 +53,117 @@ fn main() {println!("cargo:rustc-link-arg=/stack:{}", 8 * 1024 * 1024);}- if cfg!(target_arch = "x86_64") {- println!("cargo::rerun-if-changed=resources\\windows\\bin\\x64\\conpty.dll");- println!("cargo::rerun-if-changed=resources\\windows\\bin\\x64\\OpenConsole.exe");- let conpty_target = std::env::var("OUT_DIR").unwrap() + "\\..\\..\\..\\conpty.dll";- match std::fs::copy("resources/windows/bin/x64/conpty.dll", &conpty_target) {- Ok(_) => println!("Copied conpty.dll to {conpty_target}"),- Err(e) => println!("cargo::warning=Failed to copy conpty.dll: {}", e),- }- let open_console_target =- std::env::var("OUT_DIR").unwrap() + "\\..\\..\\..\\OpenConsole.exe";- match std::fs::copy(- "resources/windows/bin/x64/OpenConsole.exe",- &open_console_target,- ) {- Ok(_) => println!("Copied OpenConsole.exe to {open_console_target}"),- Err(e) => println!("cargo::warning=Failed to copy OpenConsole.exe: {}", e),+ if cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64") {+ let out_dir = std::env::var("OUT_DIR").unwrap();+ let out_dir: &std::path::Path = out_dir.as_ref();+ let target_dir = std::path::Path::new(&out_dir)+ .parent()+ .and_then(|p| p.parent())+ .and_then(|p| p.parent())+ .expect("Failed to find target directory");++ let conpty_dll_target = target_dir.join("conpty.dll");+ let open_console_target = target_dir.join("OpenConsole.exe");++ let conpty_url = "https://github.com/microsoft/terminal/releases/download/v1.23.13503.0/Microsoft.Windows.Console.ConPTY.1.23.251216003.nupkg";+ let nupkg_path = out_dir.join("conpty.nupkg");+ let extract_dir = out_dir.join("conpty");++ let download_script = format!(+ "$ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '{}' -OutFile '{}'",+ conpty_url,+ nupkg_path.display()+ );++ let download_result = Command::new("powershell")+ .args([+ "-NoProfile",+ "-NonInteractive",+ "-Command",+ &download_script,+ ])+ .output();++ match download_result {+ Ok(output) if output.status.success() => {+ println!("Downloaded conpty nupkg successfully");++ let extract_script = format!(+ "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '{}' -DestinationPath '{}' -Force",+ nupkg_path.display(),+ extract_dir.display()+ );++ let extract_result = Command::new("powershell")+ .args(["-NoProfile", "-NonInteractive", "-Command", &extract_script])+ .output();++ match extract_result {+ Ok(output) if output.status.success() => {+ let (conpty_dll_source, open_console_source) =+ if cfg!(target_arch = "x86_64") {+ (+ extract_dir.join("runtimes/win-x64/native/conpty.dll"),+ extract_dir+ .join("build/native/runtimes/x64/OpenConsole.exe"),+ )+ } else {+ (+ extract_dir.join("runtimes/win-arm64/native/conpty.dll"),+ extract_dir+ .join("build/native/runtimes/arm64/OpenConsole.exe"),+ )+ };++ match std::fs::copy(&conpty_dll_source, &conpty_dll_target) {+ Ok(_) => {+ println!("Copied conpty.dll to {}", conpty_dll_target.display())+ }+ Err(e) => println!(+ "cargo::warning=Failed to copy conpty.dll from {}: {}",+ conpty_dll_source.display(),+ e+ ),+ }++ match std::fs::copy(&open_console_source, &open_console_target) {+ Ok(_) => println!(+ "Copied OpenConsole.exe to {}",+ open_console_target.display()+ ),+ Err(e) => println!(+ "cargo::warning=Failed to copy OpenConsole.exe from {}: {}",+ open_console_source.display(),+ e+ ),+ }+ }+ Ok(output) => {+ println!(+ "cargo::warning=Failed to extract conpty nupkg: {}",+ String::from_utf8_lossy(&output.stderr)+ );+ }+ Err(e) => {+ println!(+ "cargo::warning=Failed to run PowerShell for extraction: {}",+ e+ );+ }+ }+ }+ Ok(output) => {+ println!(+ "cargo::warning=Failed to download conpty nupkg: {}",+ String::from_utf8_lossy(&output.stderr)+ );+ }+ Err(e) => {+ println!(+ "cargo::warning=Failed to run PowerShell for download: {}",+ e+ );+ }}}diff --git a/crates/zed/resources/windows/bin/x64/OpenConsole.exe b/crates/zed/resources/windows/bin/x64/OpenConsole.exedeleted file mode 100644index 8bb6ab2188f..00000000000Binary files a/crates/zed/resources/windows/bin/x64/OpenConsole.exe and /dev/null differdiff --git a/crates/zed/resources/windows/bin/x64/conpty.dll b/crates/zed/resources/windows/bin/x64/conpty.dlldeleted file mode 100644index 555d6bf655a..00000000000Binary files a/crates/zed/resources/windows/bin/x64/conpty.dll and /dev/null differdiff --git a/script/bundle-windows.ps1 b/script/bundle-windows.ps1index 48114a970ff..49024be70d7 100644--- a/script/bundle-windows.ps1+++ b/script/bundle-windows.ps1@@ -202,8 +202,8 @@ function DownloadAMDGpuServices {}function DownloadConpty {- $url = "https://github.com/microsoft/terminal/releases/download/v1.23.12811.0/Microsoft.Windows.Console.ConPTY.1.23.251008001.nupkg"- $zipPath = ".\Microsoft.Windows.Console.ConPTY.1.23.251008001.nupkg"+ $url = "https://github.com/microsoft/terminal/releases/download/v1.23.13503.0/Microsoft.Windows.Console.ConPTY.1.23.251216003.nupkg"+ $zipPath = ".\Microsoft.Windows.Console.ConPTY.1.23.251216003.nupkg"Invoke-WebRequest -Uri $url -OutFile $zipPathExpand-Archive -Path $zipPath -DestinationPath ".\conpty" -Force}