Allow overriding rust-analyzer display revision

This commit is contained in:
oxalica 2020-06-18 20:31:32 +08:00
parent 0262dba97e
commit bed0b794e5
No known key found for this signature in database
GPG Key ID: CED392DE0C483D00

View File

@ -5,11 +5,13 @@ use std::{env, path::PathBuf, process::Command};
fn main() {
set_rerun();
let rev = rev().unwrap_or_else(|| "???????".to_string());
let rev = env::var("RUST_ANALYZER_REV").ok().or_else(rev).unwrap_or_else(|| "???????".to_string());
println!("cargo:rustc-env=REV={}", rev)
}
fn set_rerun() {
println!("cargo:rerun-if-env-changed=RUST_ANALYZER_REV");
let mut manifest_dir = PathBuf::from(
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."),
);