Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Make `ZED_BUILD_REMOTE_SERVER` opt-out for dev builds (#39653)
Cole Millerabc1e67221a4
diff --git a/Cross.toml b/Cross.tomldeleted file mode 100644index b5f0f1103af..00000000000--- a/Cross.toml+++ /dev/null@@ -1,2 +0,0 @@-[build]-dockerfile = "Dockerfile-cross"diff --git a/Dockerfile-cross b/Dockerfile-crossdeleted file mode 100644index 488309641ca..00000000000--- a/Dockerfile-cross+++ /dev/null@@ -1,17 +0,0 @@-# syntax=docker/dockerfile:1--ARG CROSS_BASE_IMAGE-FROM ${CROSS_BASE_IMAGE}-WORKDIR /app-ARG TZ=Etc/UTC \- LANG=C.UTF-8 \- LC_ALL=C.UTF-8 \- DEBIAN_FRONTEND=noninteractive-ENV CARGO_TERM_COLOR=always--COPY script/install-mold script/-RUN ./script/install-mold "2.34.0"-COPY script/remote-server script/-RUN ./script/remote-server--COPY . .diff --git a/crates/remote/src/transport.rs b/crates/remote/src/transport.rsindex 62144d56534..33d98f4d643 100644--- a/crates/remote/src/transport.rs+++ b/crates/remote/src/transport.rs@@ -121,14 +121,19 @@ async fn build_remote_server_from_source(delegate: &dyn crate::RemoteClientDelegate,cx: &mut AsyncApp,) -> Result<Option<std::path::PathBuf>> {+ use smol::process::{Command, Stdio};+ use std::env::VarError;use std::path::Path;- let Some(build_remote_server) = std::env::var("ZED_BUILD_REMOTE_SERVER").ok() else {- return Ok(None);- };+ let build_remote_server = std::env::var("ZED_BUILD_REMOTE_SERVER").unwrap_or_default();- use smol::process::{Command, Stdio};- use std::env::VarError;+ if build_remote_server == "false"+ || build_remote_server == "no"+ || build_remote_server == "off"+ || build_remote_server == "0"+ {+ return Ok(None);+ }async fn run_cmd(command: &mut Command) -> Result<()> {let output = command@@ -192,50 +197,6 @@ async fn build_remote_server_from_source(.env("RUSTFLAGS", &rust_flags),).await?;- } else if build_remote_server.contains("cross") {- use util::paths::SanitizedPath;-- delegate.set_status(Some("Installing cross.rs for cross-compilation"), cx);- log::info!("installing cross");- run_cmd(Command::new("cargo").args([- "install",- "cross",- "--git",- "https://github.com/cross-rs/cross",- ]))- .await?;-- delegate.set_status(- Some(&format!(- "Building remote server binary from source for {} with Docker",- &triple- )),- cx,- );- log::info!("building remote server binary from source for {}", &triple);-- let src = SanitizedPath::new(&smol::fs::canonicalize("target").await?).to_string();-- run_cmd(- Command::new("cross")- .args([- "build",- "--package",- "remote_server",- "--features",- "debug-embed",- "--target-dir",- "target/remote_server",- "--target",- &triple,- ])- .env(- "CROSS_CONTAINER_OPTS",- format!("--mount type=bind,src={src},dst=/app/target"),- )- .env("RUSTFLAGS", &rust_flags),- )- .await?;} else {let which = cx.background_spawn(async move { which::which("zig") })@@ -245,13 +206,13 @@ async fn build_remote_server_from_source(#[cfg(not(target_os = "windows"))]{anyhow::bail!(- "zig not found on $PATH, install zig (see https://ziglang.org/learn/getting-started or use zigup) or pass ZED_BUILD_REMOTE_SERVER=cross to use cross"+ "zig not found on $PATH, install zig (see https://ziglang.org/learn/getting-started or use zigup)")}#[cfg(target_os = "windows")]{anyhow::bail!(- "zig not found on $PATH, install zig (use `winget install -e --id zig.zig` or see https://ziglang.org/learn/getting-started or use zigup) or pass ZED_BUILD_REMOTE_SERVER=cross to use cross"+ "zig not found on $PATH, install zig (use `winget install -e --id zig.zig` or see https://ziglang.org/learn/getting-started or use zigup)")}}