mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-21 15:23:19 +01:00
Rerun build script only when necessary
This commit is contained in:
parent
79a03b4299
commit
5498c24c33
@ -4,6 +4,14 @@ use crate::util::render_template;
|
|||||||
|
|
||||||
/// Generate manpage and shell completions for the bat application.
|
/// Generate manpage and shell completions for the bat application.
|
||||||
pub fn gen_man_and_comp() -> anyhow::Result<()> {
|
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.
|
// Read environment variables.
|
||||||
let project_name = env::var("PROJECT_NAME").unwrap_or("bat".into());
|
let project_name = env::var("PROJECT_NAME").unwrap_or("bat".into());
|
||||||
let executable_name = env::var("PROJECT_EXECUTABLE").unwrap_or(project_name.clone());
|
let executable_name = env::var("PROJECT_EXECUTABLE").unwrap_or(project_name.clone());
|
||||||
|
@ -3,6 +3,10 @@ mod application;
|
|||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
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")]
|
#[cfg(feature = "application")]
|
||||||
application::gen_man_and_comp()?;
|
application::gen_man_and_comp()?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user