Files
zed/crates/util/Cargo.toml
T
Jakub Konka a13d872bff util: Embed fs_embed assets with debug-embed (#63583)
Zed's `fs_embed!` macro normally reads assets from the checkout in debug
builds. The new `util/debug-embed` feature is intended to compile those
assets into debug binaries, but it previously changed only the
`rust_embed::Filenames` variant while leaving file loading on the
runtime path.

That breaks downstream workspaces such as Delta: the runtime loader
identifies Delta as the repository root, then looks for Zed grammar
assets under Delta's checkout. Tests consequently panic when language
configuration files cannot be found.

This makes `util/debug-embed` select a compile-time `RustEmbed`
expansion in every profile. Builds without the feature retain live
filesystem loading in debug mode. The runtime iterator no longer depends
on a feature-specific `rust_embed::Filenames` variant, so Cargo feature
unification remains safe when another package enables
`rust-embed/debug-embed` directly. The regression fixture uses a
deliberately invalid runtime path when `debug-embed` is enabled, so it
proves that the embedded path is used rather than passing only because
the Zed checkout contains the test assets.

Testing performed:

- `cargo fmt --all -- --check`
- `cargo nextest run -p util --lib`
- `cargo nextest run -p util --lib --features debug-embed`
- `cargo check -p remote_server --features debug-embed`
- `./script/clippy -p util`
- Delta's previously failing
`tools::edit_file::tests::test_edit_file_rejects_scratch_paths_as_read_only`
against this PR's head commit

Release Notes:

- N/A
2026-09-01 21:42:01 +00:00

72 lines
1.7 KiB
TOML

[package]
name = "util"
version = "0.1.0"
edition.workspace = true
publish = false
license = "Apache-2.0"
description = "A collection of utility structs and functions used by Zed and GPUI"
[lints]
workspace = true
[lib]
path = "src/util.rs"
doctest = true
[features]
test-support = ["rand", "util_macros", "path/test-support"]
# Embed `fs_embed!` assets at compile time even in debug builds.
debug-embed = ["rust-embed/debug-embed"]
[dependencies]
anyhow.workspace = true
async_zip.workspace = true
collections.workspace = true
dunce.workspace = true
futures-lite.workspace = true
futures.workspace = true
globset.workspace = true
itertools.workspace = true
log.workspace = true
rand = { workspace = true, optional = true }
regex.workspace = true
rust-embed.workspace = true
schemars.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_json_lenient.workspace = true
shlex.workspace = true
take-until.workspace = true
tempfile.workspace = true
unicase.workspace = true
url.workspace = true
percent-encoding.workspace = true
util_macros = { workspace = true, optional = true }
gpui_util.workspace = true
path = { workspace = true, features = ["serde"] }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
smol.workspace = true
which.workspace = true
async-fs.workspace = true
walkdir.workspace = true
dirs.workspace = true
[target.'cfg(unix)'.dependencies]
command-fds = "0.3.1"
libc.workspace = true
nix = { workspace = true, features = ["user"] }
[target.'cfg(target_os = "macos")'.dependencies]
mach2.workspace = true
[target.'cfg(windows)'.dependencies]
tendril = "0.5"
windows.workspace = true
[dev-dependencies]
rand.workspace = true
util_macros.workspace = true
path = { workspace = true, features = ["test-support"] }