use glob::glob; use std::path::Path; fn main() { if let Err(err) = real_main() { eprintln!("ERROR: {}", err); std::process::exit(1); } } fn real_main() -> anyhow::Result<()> { 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?; 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))?; } Ok(()) }