diff options
author | oxalica <[email protected]> | 2020-06-18 13:31:32 +0100 |
---|---|---|
committer | oxalica <[email protected]> | 2020-06-18 15:33:23 +0100 |
commit | bed0b794e54c22093ae5f822e9a6adca181112c2 (patch) | |
tree | 2499b485f049a7b39fedb45b8a1de7c10050d12e /crates | |
parent | 0262dba97ef114bd7664a4e32be21caef2d63f0a (diff) |
Allow overriding rust-analyzer display revision
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/build.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/rust-analyzer/build.rs b/crates/rust-analyzer/build.rs index d4b010c04..5f2162cba 100644 --- a/crates/rust-analyzer/build.rs +++ b/crates/rust-analyzer/build.rs | |||
@@ -5,11 +5,13 @@ use std::{env, path::PathBuf, process::Command}; | |||
5 | fn main() { | 5 | fn main() { |
6 | set_rerun(); | 6 | set_rerun(); |
7 | 7 | ||
8 | let rev = rev().unwrap_or_else(|| "???????".to_string()); | 8 | let rev = env::var("RUST_ANALYZER_REV").ok().or_else(rev).unwrap_or_else(|| "???????".to_string()); |
9 | println!("cargo:rustc-env=REV={}", rev) | 9 | println!("cargo:rustc-env=REV={}", rev) |
10 | } | 10 | } |
11 | 11 | ||
12 | fn set_rerun() { | 12 | fn set_rerun() { |
13 | println!("cargo:rerun-if-env-changed=RUST_ANALYZER_REV"); | ||
14 | |||
13 | let mut manifest_dir = PathBuf::from( | 15 | let mut manifest_dir = PathBuf::from( |
14 | env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."), | 16 | env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."), |
15 | ); | 17 | ); |