diff options
| author | figsoda <figsoda@pm.me> | 2023-03-25 10:38:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-25 15:38:34 +0100 |
| commit | e70ec5f3c06312b7ff2388630e05e3c2d745896f (patch) | |
| tree | 02c18565153d594ffcf379f69054d1ef4c8e1326 | |
| parent | d0782b18530c1c3767764129e60b47a81696b163 (diff) | |
Don't let the build script overwrite TYPST_VERSION (#154)
| -rw-r--r-- | cli/build.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cli/build.rs b/cli/build.rs index 06d4b0b0..47809487 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -1,11 +1,16 @@ use std::process::Command; fn main() { + println!("cargo:rerun-if-env-changed=TYPST_VERSION"); + if option_env!("TYPST_VERSION").is_some() { + return; + } + let version = Command::new("git") - .args(&["rev-parse", "HEAD"]) + .args(["rev-parse", "HEAD"]) .output() .ok() - .and_then(|output| output.status.success().then(|| output)) + .filter(|output| output.status.success()) .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}"); |
