diff options
author | Seivan Heidari <[email protected]> | 2019-12-23 14:35:31 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-12-23 14:35:31 +0000 |
commit | b21d9337d9200e2cfdc90b386591c72c302dc03e (patch) | |
tree | f81f5c08f821115cee26fa4d3ceaae88c7807fd5 /crates/ra_lsp_server/build.rs | |
parent | 18a0937585b836ec5ed054b9ae48e0156ab6d9ef (diff) | |
parent | ce07a2daa9e53aa86a769f8641b14c2878444fbc (diff) |
Merge branch 'master' into feature/themes
Diffstat (limited to 'crates/ra_lsp_server/build.rs')
-rw-r--r-- | crates/ra_lsp_server/build.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/build.rs b/crates/ra_lsp_server/build.rs new file mode 100644 index 000000000..05f9772c0 --- /dev/null +++ b/crates/ra_lsp_server/build.rs | |||
@@ -0,0 +1,15 @@ | |||
1 | //! Just embed git-hash to `--version` | ||
2 | |||
3 | use std::process::Command; | ||
4 | |||
5 | fn main() { | ||
6 | let rev = rev().unwrap_or_else(|| "???????".to_string()); | ||
7 | println!("cargo:rustc-env=REV={}", rev) | ||
8 | } | ||
9 | |||
10 | fn rev() -> Option<String> { | ||
11 | let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().ok()?; | ||
12 | let stdout = String::from_utf8(output.stdout).ok()?; | ||
13 | let short_hash = stdout.get(0..7)?; | ||
14 | Some(short_hash.to_owned()) | ||
15 | } | ||