diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-10-25 02:07:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-25 05:07:28 +0300 |
commit | 5a3bf69e3fd771271921f62219cdb8f920db39ee (patch) | |
tree | 0a2315b5a5c486fb13d6e7f693a04f769c2a1c81 /alacritty/build.rs | |
parent | 269f00051ea85e423a078e9b952ea526230e5338 (diff) | |
download | r-alacritty-5a3bf69e3fd771271921f62219cdb8f920db39ee.tar.gz r-alacritty-5a3bf69e3fd771271921f62219cdb8f920db39ee.tar.bz2 r-alacritty-5a3bf69e3fd771271921f62219cdb8f920db39ee.zip |
Remove rustc_tools_util dependency
Since our usage of the rustc_tools_util crate is so trivial, it seems
like we should be able to just inline it directly into Alacritty.
It's a very well trusted crate, being hosted directly by rust-lang and
it does not pull in any other dependencies, but having a dependency for
just 6 lines of code seems a bit extreme.
Diffstat (limited to 'alacritty/build.rs')
-rw-r--r-- | alacritty/build.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/alacritty/build.rs b/alacritty/build.rs index e8e0c114..3c0ec110 100644 --- a/alacritty/build.rs +++ b/alacritty/build.rs @@ -1,12 +1,12 @@ -use gl_generator::{Api, Fallbacks, GlobalGenerator, Profile, Registry}; - use std::env; use std::fs::File; use std::path::Path; +use std::process::Command; + +use gl_generator::{Api, Fallbacks, GlobalGenerator, Profile, Registry}; fn main() { - let hash = rustc_tools_util::get_commit_hash().unwrap_or_default(); - println!("cargo:rustc-env=GIT_HASH={}", hash); + println!("cargo:rustc-env=GIT_HASH={}", commit_hash()); let dest = env::var("OUT_DIR").unwrap(); let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap(); @@ -18,3 +18,12 @@ fn main() { #[cfg(windows)] embed_resource::compile("../extra/windows/windows.rc"); } + +fn commit_hash() -> String { + Command::new("git") + .args(&["rev-parse", "--short", "HEAD"]) + .output() + .ok() + .and_then(|output| String::from_utf8(output.stdout).ok()) + .unwrap_or_default() +} |