mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
13 lines
414 B
Rust
13 lines
414 B
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
let version = Command::new("git")
|
|
.args(&["rev-parse", "HEAD"])
|
|
.output()
|
|
.ok()
|
|
.and_then(|output| output.status.success().then(|| output))
|
|
.and_then(|output| String::from_utf8(output.stdout.get(..8)?.into()).ok())
|
|
.unwrap_or_else(|| "(unknown version)".into());
|
|
println!("cargo:rustc-env=TYPST_VERSION={version}");
|
|
}
|