From 465d449dac6b6604ea88ab9c312ba76acaee0f57 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Sun, 26 Aug 2018 14:28:34 -0400 Subject: [PATCH] If we don't have `feature = "toml"` set, don't run rust-skeptic --- build.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build.rs b/build.rs index a780b3d..494e454 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,20 @@ +#[cfg(feature = "toml")] extern crate skeptic; +#[cfg(feature = "toml")] fn main() { skeptic::generate_doc_tests(&["README.md"]); } + +#[cfg(not(feature = "toml"))] +fn main() { + // tests/skeptic.rs still expects a file to be at OUT_DIR/skeptic-tests.rs, so + // make a dummy one + use std::{env, fs::OpenOptions, path::Path}; + let out_dir = Path::new(&env::var("OUT_DIR").expect("no out_dir set")).join("skeptic-tests.rs"); + let f = OpenOptions::new() + .create(true) + .write(true) + .open(out_dir) + .expect("couldn't write to file"); +}