From f790630f731947d4969a61eafd0c93c39c18c8be Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Thu, 3 Jun 2021 15:54:02 +0200 Subject: [PATCH] Stop skeptic from having to be compiled by all downstream users --- .github/workflows/CI.yml | 3 +++ Cargo.toml | 2 +- build.rs | 4 ++++ tests/skeptic.rs | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 300d51cd..89e7469a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,6 +15,9 @@ on: # Run against the last commit on the default branch on Friday at 8pm (UTC?) - cron: '0 20 * * 5' +env: + RUSTFLAGS: '--cfg skeptic' + jobs: test: runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index fd1e1ee2..65a5f35a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,5 +46,5 @@ getrandom = "0.2" skeptic = "0.13" tokio = { version = "1", features = ["rt-multi-thread", "macros" ] } -[build-dependencies] +[target.'cfg(skeptic)'.build-dependencies] skeptic = "0.13" diff --git a/build.rs b/build.rs index 7c44726d..61802ec7 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,8 @@ +#[cfg(skeptic)] fn main() { // generates doc tests for `README.md`. skeptic::generate_doc_tests(&["README.md"]); } + +#[cfg(not(skeptic))] +fn main() {} diff --git a/tests/skeptic.rs b/tests/skeptic.rs index ff46c9c0..6b54ee21 100644 --- a/tests/skeptic.rs +++ b/tests/skeptic.rs @@ -1 +1,2 @@ +#[cfg(skeptic)] include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs"));