feat(cli): add jj-lib version to version output

This commit is contained in:
2026-04-21 21:02:11 +02:00
parent 1bab78cb20
commit c5814ab480
4 changed files with 309 additions and 1 deletions

13
build.rs Normal file
View File

@@ -0,0 +1,13 @@
use cargo_lock::Lockfile;
fn main() {
let lockfile = Lockfile::load("Cargo.lock").expect("Cargo.lock not found");
let version = lockfile
.packages
.iter()
.find(|p| p.name.as_str() == "jj-lib")
.map(|p| p.version.to_string())
.unwrap_or_else(|| "unknown".to_string());
println!("cargo:rustc-env=JJ_LIB_VERSION={version}");
println!("cargo:rerun-if-changed=Cargo.lock");
}