]> git.lizzy.rs Git - rust.git/blobdiff - build.rs
Merge pull request #3287 from JoshMcguigan/cmp_owned-2925
[rust.git] / build.rs
index 3b9f217c8848fa968dd5a70092ad2284c0f7ad78..336f0295bdf6fc9fda9b593a69bf22cdf6fb7dbf 100644 (file)
--- a/build.rs
+++ b/build.rs
@@ -1,23 +1,25 @@
-//! This build script ensures that Clippy is not compiled with an
-//! incompatible version of rust. It will panic with a descriptive
-//! error message instead.
-//!
-//! We specifially want to ensure that Clippy is only built with a
-//! rustc version that is newer or equal to the one specified in the
-//! `min_version.txt` file.
-//!
-//! `min_version.txt` is in the repo but also in the `.gitignore` to
-//! make sure that it is not updated manually by accident. Only CI
-//! should update that file.
-//!
-//! This build script was originally taken from the Rocket web framework:
-//! https://github.com/SergioBenitez/Rocket
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
 
-use std::env;
 
 fn main() {
     // Forward the profile to the main compilation
-    println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
+    println!("cargo:rustc-env=PROFILE={}", std::env::var("PROFILE").unwrap());
     // Don't rebuild even if nothing changed
     println!("cargo:rerun-if-changed=build.rs");
+    // forward git repo hashes we build at
+    println!(
+        "cargo:rustc-env=GIT_HASH={}",
+        rustc_tools_util::get_commit_hash().unwrap_or_default()
+    );
+    println!(
+        "cargo:rustc-env=COMMIT_DATE={}",
+        rustc_tools_util::get_commit_date().unwrap_or_default()
+    );
 }