From 66dd21c8577330c625f32c7cf59635dbc7c36115 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 8 Feb 2017 18:33:04 +0100 Subject: Move build script helper code into askama crate --- testing/build.rs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'testing/build.rs') diff --git a/testing/build.rs b/testing/build.rs index 2f868f4..89e3e6b 100644 --- a/testing/build.rs +++ b/testing/build.rs @@ -1,26 +1,5 @@ -use std::env; -use std::fs::{self, DirEntry}; -use std::io; -use std::path::Path; - -fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> { - if dir.is_dir() { - for entry in try!(fs::read_dir(dir)) { - let entry = try!(entry); - let path = entry.path(); - if path.is_dir() { - try!(visit_dirs(&path, cb)); - } else { - cb(&entry); - } - } - } - Ok(()) -} +extern crate askama; fn main() { - let root = env::var("CARGO_MANIFEST_DIR").unwrap(); - visit_dirs(&Path::new(&root).join("templates"), &|e: &DirEntry| { - println!("cargo:rerun-if-changed={}", e.path().to_str().unwrap()); - }).unwrap(); + askama::rerun_if_templates_changed(); } -- cgit