build.rs
1fn main() {
2 let cargo_toml =
3 std::fs::read_to_string("../zed/Cargo.toml").expect("Failed to read crates/zed/Cargo.toml");
4 let version = cargo_toml
5 .lines()
6 .find(|line| line.starts_with("version = "))
7 .expect("Version not found in crates/zed/Cargo.toml")
8 .split('=')
9 .nth(1)
10 .expect("Invalid version format")
11 .trim()
12 .trim_matches('"');
13 println!("cargo:rustc-env=ZED_PKG_VERSION={}", version);
14}