From 69d172e06ce957d24e8ff07e42120ad2006bdc9a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 4 Dec 2021 12:43:21 +0200 Subject: build.rs Sponsored-by: author --- build.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 build.rs diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..0f5c264 --- /dev/null +++ b/build.rs @@ -0,0 +1,18 @@ +use glob::glob; +use std::path::Path; + +fn main() { + println!("cargo:rerun-if-env-changed=DEB_BUILD_OPTIONS"); + let subplots = glob("[a-z]*.md").expect("failed to find subplots"); + let tests = Path::new("tests"); + for entry in subplots { + let entry = entry.expect("failed to get subplot dir entry"); + let mut inc = tests.join(&entry); + inc.set_extension("rs"); + if !inc.exists() { + panic!("missing include file: {}", inc.display()); + } + println!("cargo:rerun-if-changed={}", inc.display()); + subplot_build::codegen(Path::new(&entry)).expect("failed to generate code with Subplot"); + } +} -- cgit v1.2.1