From 39765bf9c919519688b7af524890d2be5b7282e0 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 3 Sep 2024 15:45:31 +0200 Subject: [PATCH] Do not rebuild the build script unless necessary Without this guard, the build script is rebuilt as soon as any file within the package is changed. This includes files created by external tools such as IDE. --- build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.rs b/build.rs index 428d4b9fa..91e9d0427 100644 --- a/build.rs +++ b/build.rs @@ -15,6 +15,10 @@ pub fn main() { const FEATURE_PREFIX: &str = "feat_"; const OVERRIDE_PREFIX: &str = "uu_"; + // Do not rebuild build script unless the script itself or the enabled features are modified + // See + println!("cargo:rerun-if-changed=build.rs"); + if let Ok(profile) = env::var("PROFILE") { println!("cargo:rustc-cfg=build={profile:?}"); }