diff --git a/.cargo/bundle-config.toml b/.cargo/bundle-config.toml new file mode 100644 index 0000000000..66c1f2ec08 --- /dev/null +++ b/.cargo/bundle-config.toml @@ -0,0 +1,5 @@ +[env] +RUSTC_BOOTSTRAP = "1" + +[build] +rustflags = ["-Z", "share-generics=y"] diff --git a/script/bundle-linux b/script/bundle-linux index 79de85b2a8..1664fbf5dc 100755 --- a/script/bundle-linux +++ b/script/bundle-linux @@ -83,7 +83,7 @@ if [[ "$(uname -m)" == "aarch64" ]]; then else export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib" fi -cargo build --release --target "${target_triple}" --package zed --package cli +cargo --config .cargo/bundle-config.toml build --release --target "${target_triple}" --package zed --package cli # Build remote_server in separate invocation to prevent feature unification from other crates # from influencing dynamic libraries required by it. if [[ "$remote_server_triple" == "$musl_triple" ]]; then @@ -91,7 +91,7 @@ if [[ "$remote_server_triple" == "$musl_triple" ]]; then musl_cc_var="CC_$(echo "$remote_server_triple" | tr '-' '_')" export "$musl_cc_var"=musl-gcc fi -cargo build --release --target "${remote_server_triple}" --package remote_server +cargo --config .cargo/bundle-config.toml build --release --target "${remote_server_triple}" --package remote_server # Upload debug info to sentry.io if ! command -v sentry-cli >/dev/null 2>&1; then diff --git a/script/bundle-mac b/script/bundle-mac index eae4f861ba..477efb5a4f 100755 --- a/script/bundle-mac +++ b/script/bundle-mac @@ -87,10 +87,10 @@ script/generate-licenses rustup target add $target_triple echo "Compiling zed binaries" -cargo build ${build_flag} --package zed --package cli --target $target_triple +cargo --config .cargo/bundle-config.toml build ${build_flag} --package zed --package cli --target $target_triple # Build remote_server in separate invocation to prevent feature unification from other crates # from influencing dynamic libraries required by it. -cargo build ${build_flag} --package remote_server --target $target_triple +cargo --config .cargo/bundle-config.toml build ${build_flag} --package remote_server --target $target_triple echo "Creating application bundle" pushd crates/zed diff --git a/script/bundle-windows.ps1 b/script/bundle-windows.ps1 index 99b2858f8e..786f07922b 100644 --- a/script/bundle-windows.ps1 +++ b/script/bundle-windows.ps1 @@ -116,20 +116,20 @@ function GenerateLicenses { function BuildZedAndItsFriends { Write-Output "Building Zed and its friends, for channel: $channel" # Build zed.exe, cli.exe and auto_update_helper.exe - cargo build --release --package zed --package cli --package auto_update_helper --target $target + cargo --config .cargo/bundle-config.toml build --release --package zed --package cli --package auto_update_helper --target $target Copy-Item -Path ".\$CargoOutDir\zed.exe" -Destination "$innoDir\Zed.exe" -Force Copy-Item -Path ".\$CargoOutDir\cli.exe" -Destination "$innoDir\cli.exe" -Force Copy-Item -Path ".\$CargoOutDir\auto_update_helper.exe" -Destination "$innoDir\auto_update_helper.exe" -Force # Build explorer_command_injector.dll switch ($channel) { "stable" { - cargo build --release --features stable --no-default-features --package explorer_command_injector --target $target + cargo --config .cargo/bundle-config.toml build --release --features stable --no-default-features --package explorer_command_injector --target $target } "preview" { - cargo build --release --features preview --no-default-features --package explorer_command_injector --target $target + cargo --config .cargo/bundle-config.toml build --release --features preview --no-default-features --package explorer_command_injector --target $target } default { - cargo build --release --package explorer_command_injector --target $target + cargo --config .cargo/bundle-config.toml build --release --package explorer_command_injector --target $target } } Copy-Item -Path ".\$CargoOutDir\explorer_command_injector.dll" -Destination "$innoDir\zed_explorer_command_injector.dll" -Force @@ -137,7 +137,7 @@ function BuildZedAndItsFriends { function BuildRemoteServer { Write-Output "Building remote_server for $target" - cargo build --release --package remote_server --target $target + cargo --config .cargo/bundle-config.toml build --release --package remote_server --target $target # Create zipped remote server binary $remoteServerSrc = (Resolve-Path ".\$CargoOutDir\remote_server.exe").Path