aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-19 14:43:42 +0100
committerGitHub <[email protected]>2020-06-19 14:43:42 +0100
commitec6df5d3e866c215f7e699366ba55a7112ab4149 (patch)
tree103cc4e4e68253076516455fc2fee2016c1ce73d /crates
parent4575c38810c8874838d2a2b0ea1bbd789a774af6 (diff)
parentf9ce7cd961482310547b656364dc40f8ccffd6fc (diff)
Merge #4937
4937: Allow overriding rust-analyzer display version r=matklad a=oxalica The build script invokes `git` for version information which is displayed when rust-analyzer is called with `--version`. But in build environment without `git` or when the source code is not a git repo, there's no way to manually specify the version information. This patch respects environment variable ~`REV`~ `RUST_ANALYZER_REV` in compile time for overriding. Related: https://github.com/NixOS/nixpkgs/pull/90976 Co-authored-by: oxalica <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/build.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/rust-analyzer/build.rs b/crates/rust-analyzer/build.rs
index d4b010c04..5ae76ba30 100644
--- a/crates/rust-analyzer/build.rs
+++ b/crates/rust-analyzer/build.rs
@@ -5,11 +5,14 @@ use std::{env, path::PathBuf, process::Command};
5fn main() { 5fn main() {
6 set_rerun(); 6 set_rerun();
7 7
8 let rev = rev().unwrap_or_else(|| "???????".to_string()); 8 let rev =
9 env::var("RUST_ANALYZER_REV").ok().or_else(rev).unwrap_or_else(|| "???????".to_string());
9 println!("cargo:rustc-env=REV={}", rev) 10 println!("cargo:rustc-env=REV={}", rev)
10} 11}
11 12
12fn set_rerun() { 13fn set_rerun() {
14 println!("cargo:rerun-if-env-changed=RUST_ANALYZER_REV");
15
13 let mut manifest_dir = PathBuf::from( 16 let mut manifest_dir = PathBuf::from(
14 env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."), 17 env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."),
15 ); 18 );