zed/crates/extension_api/build.rs
Piotr Osiewicz e6c1c51b37
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
2024-09-06 11:58:39 +02:00

15 lines
602 B
Rust

fn main() {
let version = std::env::var("CARGO_PKG_VERSION").unwrap();
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut parts = version.split(|c: char| !c.is_ascii_digit());
let major = parts.next().unwrap().parse::<u16>().unwrap().to_be_bytes();
let minor = parts.next().unwrap().parse::<u16>().unwrap().to_be_bytes();
let patch = parts.next().unwrap().parse::<u16>().unwrap().to_be_bytes();
std::fs::write(
std::path::Path::new(&out_dir).join("version_bytes"),
[major[0], major[1], minor[0], minor[1], patch[0], patch[1]],
)
.unwrap();
}