diff --git a/build/application.rs b/build/application.rs index 4a6dc42f..459aa5b1 100644 --- a/build/application.rs +++ b/build/application.rs @@ -4,6 +4,14 @@ use crate::util::render_template; /// Generate manpage and shell completions for the bat application. pub fn gen_man_and_comp() -> anyhow::Result<()> { + println!("cargo:rerun-if-changed=assets/manual/"); + println!("cargo:rerun-if-changed=assets/completions/"); + + println!("cargo:rerun-if-env-changed=PROJECT_NAME"); + println!("cargo:rerun-if-env-changed=PROJECT_EXECUTABLE"); + println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION"); + println!("cargo:rerun-if-env-changed=BAT_ASSETS_GEN_DIR"); + // Read environment variables. let project_name = env::var("PROJECT_NAME").unwrap_or("bat".into()); let executable_name = env::var("PROJECT_EXECUTABLE").unwrap_or(project_name.clone()); diff --git a/build/main.rs b/build/main.rs index 5d33418b..416d90d5 100644 --- a/build/main.rs +++ b/build/main.rs @@ -3,6 +3,10 @@ mod application; mod util; fn main() -> anyhow::Result<()> { + // only watch manually-designated files + // see: https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed + println!("cargo:rerun-if-changed=build/"); + #[cfg(feature = "application")] application::gen_man_and_comp()?;