X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=build.rs;h=018375dbada874db7ddb8fc908222da41b83a1df;hb=9cd0f504a9219fa033d59e84f2f1ff92eefe8b6d;hp=3b9f217c8848fa968dd5a70092ad2284c0f7ad78;hpb=d3f78d64bd024cb793743d76da1c53f538b895d7;p=rust.git diff --git a/build.rs b/build.rs index 3b9f217c884..018375dbada 100644 --- a/build.rs +++ b/build.rs @@ -1,23 +1,19 @@ -//! 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 - -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() + ); + println!( + "cargo:rustc-env=RUSTC_RELEASE_CHANNEL={}", + rustc_tools_util::get_channel().unwrap_or_default() + ); }