diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-04-14 18:23:36 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-05-18 10:06:59 +0300 |
commit | b1b5abe8e8a1016ac5a35c315c259275abe1a0ac (patch) | |
tree | 4fc38783021e87fd20ee7f969c7f1a1e70e85aaa | |
parent | 873ca81c3b053a8abd2f6af2284acf131c81f509 (diff) | |
download | subplot-b1b5abe8e8a1016ac5a35c315c259275abe1a0ac.tar.gz |
fix: if subplotlib's build.rs fails, print the error message
Sponsored-by: author
-rw-r--r-- | subplotlib/build.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/subplotlib/build.rs b/subplotlib/build.rs index 77e493a..977f432 100644 --- a/subplotlib/build.rs +++ b/subplotlib/build.rs @@ -14,7 +14,7 @@ use glob::glob; use std::{fs, path::Path}; -fn gen_tests() { +fn gen_tests() -> Result<(), subplot_build::SubplotError> { let subplots = glob("*.subplot").expect("failed to find subplots in subplotlib"); let tests = Path::new("tests"); let subplots = subplots.chain(Some(Ok("../subplot.subplot".into()))); @@ -31,12 +31,16 @@ fn gen_tests() { println!("cargo:rerun-if-changed={}", entry.display()); subplot_build::codegen(Path::new(&entry)).expect("failed to generate code with Subplot"); } + Ok(()) } fn main() { // Because we cannot generate tests if we're not fully inside the main subplot tree // we only generate them if we can see ../subplot.subplot which is a good indicator. if fs::metadata("../subplot.subplot").is_ok() { - gen_tests(); + if let Err(e) = gen_tests() { + eprintln!("Failed to generate code from subplot: {e}"); + std::process::exit(1); + } } } |