diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c689fde8..a531681b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,9 +15,7 @@ jobs: - 1.40.0 features: - "" - - --features skeptic_tests - --no-default-features - - --no-default-features --features skeptic_tests - --features clippy env: diff --git a/.travis.yml b/.travis.yml index 8479ee2f..b6882349 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ sudo: false language: rust -# cache: cargo # blocked by https://github.com/brson/rust-skeptic/issues/18 rust: - beta - stable @@ -16,9 +15,7 @@ matrix: env: matrix: - JOB=test CARGO_DEFAULT_FEATURES="" CARGO_FEATURES="" - - JOB=test CARGO_DEFAULT_FEATURES="" CARGO_FEATURES="skeptic_tests" - JOB=test CARGO_DEFAULT_FEATURES="--no-default-features" CARGO_FEATURES="" - - JOB=test CARGO_DEFAULT_FEATURES="--no-default-features" CARGO_FEATURES="skeptic_tests" - JOB=test CARGO_DEFAULT_FEATURES="" CARGO_FEATURES="clippy" global: - RUST_BACKTRACE=1 diff --git a/derive_builder/Cargo.toml b/derive_builder/Cargo.toml index 25be25fc..63d21ec7 100644 --- a/derive_builder/Cargo.toml +++ b/derive_builder/Cargo.toml @@ -14,7 +14,6 @@ license = "MIT/Apache-2.0" categories = ["development-tools", "rust-patterns"] keywords = ["derive", "macro", "builder", "setter", "struct"] readme = "README.md" -build = "build/mod.rs" [badges] travis-ci = { repository = "colin-kiegel/rust-derive-builder" } @@ -22,7 +21,6 @@ travis-ci = { repository = "colin-kiegel/rust-derive-builder" } [features] default = ["std"] std = [] -skeptic_tests = ["skeptic", "derive_builder_macro/skeptic_tests", "derive_builder_core/skeptic_tests"] clippy = ["derive_builder_macro/clippy", "derive_builder_core/clippy"] [dependencies] @@ -31,9 +29,5 @@ derive_builder_core = { version = "=0.10.0-alpha", path = "../derive_builder_cor [dev-dependencies] pretty_assertions = "0.6" -skeptic = "0.13" rustversion = "1" trybuild = "1" - -[build-dependencies] -skeptic = { version = "0.13", optional = true } diff --git a/derive_builder/build/mod.rs b/derive_builder/build/mod.rs deleted file mode 100644 index e318e1db..00000000 --- a/derive_builder/build/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(not(feature = "skeptic_tests"))] -fn main() {} - -#[cfg(feature = "skeptic_tests")] -include!("skeptic.rs"); diff --git a/derive_builder/build/skeptic.rs b/derive_builder/build/skeptic.rs deleted file mode 100644 index d5a26e0d..00000000 --- a/derive_builder/build/skeptic.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate skeptic; - -fn main() { - println!("INFO: Run with `RUST_LOG=build_script_build=trace` for debug information."); - skeptic::generate_doc_tests(&["README.md"]); -} diff --git a/derive_builder/tests/skeptic.rs b/derive_builder/tests/skeptic.rs deleted file mode 100644 index 4b744dc3..00000000 --- a/derive_builder/tests/skeptic.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![cfg(feature = "skeptic_tests")] - -// NOTE this combination may cause -// `error[E0464]: multiple matching crates for `derive_builder` -// -// - rust-skeptic -// - cargo check -// - cargo test -// - on a proc_macro crate -// -// => see https://github.com/brson/rust-skeptic/issues/18 - -include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs")); diff --git a/derive_builder_core/Cargo.toml b/derive_builder_core/Cargo.toml index 209db1ca..c8c5fe52 100644 --- a/derive_builder_core/Cargo.toml +++ b/derive_builder_core/Cargo.toml @@ -13,11 +13,8 @@ documentation = "https://docs.rs/derive_builder_core" license = "MIT/Apache-2.0" readme = "README.md" -build = "build/mod.rs" - [features] clippy = [] -skeptic_tests = ["skeptic"] [badges] travis-ci = { repository = "colin-kiegel/rust-derive-builder" } @@ -30,6 +27,3 @@ syn = { version = "1.0", features = ["full", "extra-traits"] } [dev-dependencies] pretty_assertions = "0.6" - -[build-dependencies] -skeptic = { version = "0.13", optional = true } diff --git a/derive_builder_core/build/mod.rs b/derive_builder_core/build/mod.rs deleted file mode 100644 index e318e1db..00000000 --- a/derive_builder_core/build/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(not(feature = "skeptic_tests"))] -fn main() {} - -#[cfg(feature = "skeptic_tests")] -include!("skeptic.rs"); diff --git a/derive_builder_core/build/skeptic.rs b/derive_builder_core/build/skeptic.rs deleted file mode 100644 index c1f867dd..00000000 --- a/derive_builder_core/build/skeptic.rs +++ /dev/null @@ -1,100 +0,0 @@ -extern crate skeptic; - -fn main() { - let mut files = generate_doc_tpl_tests().unwrap(); - files.push("README.md".to_string()); - - let files_ref: Vec<&str> = files.iter().map(|x| x.as_str()).collect(); - - skeptic::generate_doc_tests(files_ref.as_slice()); -} - -const DOC_TPL_HEADER: &'static str = r###" -////////////////////////////////////////////////////////////////// -// START of Header -// NOTE: -// - This file is auto-generated by the `build.rs` script. -// - The following skeptic-template is a Rust format specifier, -// so braces are treated specially, and need to be escaped -// with double-braces. -// See: https://github.com/brson/rust-skeptic#skeptic-templates -```rust,skeptic-template -#[macro_use] -extern crate derive_builder; - -#[derive(Builder)] -struct Foo {{ - #[allow(dead_code)] - default: bool, -}} - -fn main() {{ - {} -}} -``` -// END of Header -////////////////////////////////////////////////////////////////// - -"###; - -use std::error::Error; -use std::path::Path; -use std::env; -use std::fs::{File, DirBuilder, read_to_string}; -use std::io::Write; - -const DOC_TPL_DIR: &'static str = "src/doc_tpl/"; -const DOC_TPL_OUT_DIR: &'static str = "doc_tpl/"; - -fn generate_doc_tpl_tests() -> Result, Box> { - let tpl_dir = Path::new(&env::var("CARGO_MANIFEST_DIR")?).join(DOC_TPL_DIR); - let out_dir = Path::new(&env::var("OUT_DIR")?).join(DOC_TPL_OUT_DIR); - - if !out_dir.is_dir() { - DirBuilder::new().create(&out_dir)?; - } - - let docs = tpl_dir.read_dir() - .map_err(|e| format!("Could not open {}: {}.", tpl_dir.display(), e))?; - - let mut files = Vec::::new(); - - for doc in docs { - let path = doc?.path(); - - if !is_markdown(&path) { - continue; - } - - let filename = match path.file_name() { - Some(filename) => filename, - None => continue, - }; - - let tpl = read_to_string(&path) - .map_err(|e| format!("Cannot read file {}: {}.", path.display(), e))?; - - println!("cargo:rerun-if-changed={}", path.display()); - let out_file = out_dir.join(filename); - - let mut out = File::create(&out_file) - .map_err(|e| format!("Cannot create file {}: {}.", out_file.display(), e))?; - out.write_all(DOC_TPL_HEADER.as_bytes())?; - - let tpl = tpl.replace("{struct_name}", "Foo") - .replace("{builder_name}", "FooBuilder") - .replace("{field_name}", "default"); - out.write_all(tpl.as_ref())?; - - files.push(out_file.to_str() - .ok_or_else(|| "Path must not be empty")? - .to_string() - ); - } - - Ok(files) -} - -fn is_markdown(path: &Path) -> bool { - path.extension().map_or(false, |extension| extension == "md") -} diff --git a/derive_builder_core/src/doc_tpl/mod.rs b/derive_builder_core/src/doc_tpl/mod.rs index 705750b3..ccce3d4d 100644 --- a/derive_builder_core/src/doc_tpl/mod.rs +++ b/derive_builder_core/src/doc_tpl/mod.rs @@ -6,9 +6,6 @@ //! - {builder_name} //! - {field_name} //! -//! The `build.rs` script will generate documentation tests with the help -//! of `skeptic`. -//! //! Templates are used like this: //! //! ```rust,ignore diff --git a/derive_builder_macro/Cargo.toml b/derive_builder_macro/Cargo.toml index 96fa39b3..03cf6b1f 100644 --- a/derive_builder_macro/Cargo.toml +++ b/derive_builder_macro/Cargo.toml @@ -23,7 +23,6 @@ proc-macro = true [features] clippy = ["derive_builder_core/clippy"] -skeptic_tests = ["derive_builder_core/skeptic_tests"] [dependencies] syn = { version = "1", features = ["full", "extra-traits"] } diff --git a/dev/checkfeatures.sh b/dev/checkfeatures.sh index e94bcd0a..6dfa0218 100755 --- a/dev/checkfeatures.sh +++ b/dev/checkfeatures.sh @@ -4,7 +4,7 @@ function main { export CARGO_TARGET_DIR="../target/__checkfeatures" commands=( - "cd derive_builder && rustup run 1.18.0 cargo test --all --color always --features \"skeptic_tests\"" + "cd derive_builder && rustup run 1.18.0 cargo test --all --color always" ) dev/travis-run-all.sh "${commands[@]}" diff --git a/dev/githook.sh b/dev/githook.sh index 0daaea81..2276187f 100755 --- a/dev/githook.sh +++ b/dev/githook.sh @@ -64,7 +64,7 @@ function run_tests_on { if [ "$rustup" == true ]; then rustup update $1 || exit fi - cd derive_builder && rustup run "$1" cargo test --all --color always --features skeptic_tests + cd derive_builder && rustup run "$1" cargo test --all --color always ); ret=$? check_or_echo $ret "" "$result" } diff --git a/dev/nightlytests.sh b/dev/nightlytests.sh index 5a972256..c4463979 100755 --- a/dev/nightlytests.sh +++ b/dev/nightlytests.sh @@ -4,7 +4,7 @@ function main { export CARGO_TARGET_DIR="../target/__nightlytests" commands=( - "cd derive_builder && rustup run nightly cargo test --all --color always --features \"skeptic_tests nightlytests\"" + "cd derive_builder && rustup run nightly cargo test --all --color always --features \"nightlytests\"" ) dev/travis-run-all.sh "${commands[@]}"