From bed0b794e54c22093ae5f822e9a6adca181112c2 Mon Sep 17 00:00:00 2001 From: oxalica Date: Thu, 18 Jun 2020 20:31:32 +0800 Subject: Allow overriding rust-analyzer display revision --- crates/rust-analyzer/build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates') 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}; 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."), ); -- cgit v1.2.3 From f9ce7cd961482310547b656364dc40f8ccffd6fc Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 19 Jun 2020 02:25:07 +0800 Subject: Fix fmt --- crates/rust-analyzer/build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/rust-analyzer/build.rs b/crates/rust-analyzer/build.rs index 5f2162cba..5ae76ba30 100644 --- a/crates/rust-analyzer/build.rs +++ b/crates/rust-analyzer/build.rs @@ -5,7 +5,8 @@ use std::{env, path::PathBuf, process::Command}; fn main() { set_rerun(); - let rev = env::var("RUST_ANALYZER_REV").ok().or_else(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) } -- cgit v1.2.3