From ad8dc8c4c795fa02fec4cee1ade2a4901b90151c Mon Sep 17 00:00:00 2001 From: Berwyn Jamesson <berwyn.codeweaver@gmail.com> Date: Tue, 21 Jul 2020 08:04:48 -0400 Subject: [PATCH] Add an off-by-default 'unstable' flag (#202) * Add an off-by-default 'unstable' flag * Remove explicit web framework feature names Having forgotten that deps and features can't have the same name, attempts to better document all the features in one place were misplaced. * Split up tests on Travis `cargo test` doesn't allow `--workspace` and `--features` simultaneously, so we're forced to test each package separately in order to manually specify features (or in this case, test everything but unstable) * Update Travis Config - Document the state of Cargo workspaces and features - Update the benchmarks to trickle down the 'unstable' feature --- .travis.yml | 15 +++++++++++++-- benchmarks/Cargo.toml | 3 +++ maud/Cargo.toml | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 215c4da..caf05c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,15 @@ jobs: - | RUN_CLIPPY=true rustup component add clippy --toolchain=nightly || RUN_CLIPPY=false - - cargo test --all --all-features + # As of right now, these need to be tested individually becuase `--workspace` + # (which is implied by `workspace = true`) cannot be used with `--features` + # This _may_ be resolved with the `--package` flag, however this requires + # opting in to a `-Z` unstable feature as of time of commit. + # + # Follow https://github.com/rust-lang/cargo/issues/5364 for updates. + - cargo test --manifest-path maud/Cargo.toml --features actix-web,iron,rocket + - cargo test --manifest-path maud_htmlescape/Cargo.toml + - cargo test --manifest-path maud_macros/Cargo.toml - | if $RUN_CLIPPY; then CLIPPY_STATUS=0 @@ -18,9 +26,12 @@ jobs: done (exit $CLIPPY_STATUS) fi + - name: "Unstable" + script: + - cargo test --all --all-features - name: "Benchmarks" script: - - (cd benchmarks && cargo test --benches) + - (cd benchmarks && cargo test --benches --features unstable) - name: "Documentation" script: - (cd docs && make -j$(nproc)) diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index adcce70..fe8ec2f 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.2" authors = ["Chris Wong <lambda.fairy@gmail.com>"] edition = "2018" +[features] +unstable = ["maud/unstable"] + [dependencies] maud = { path = "../maud" } handlebars = "*" diff --git a/maud/Cargo.toml b/maud/Cargo.toml index 4558fb6..2664158 100644 --- a/maud/Cargo.toml +++ b/maud/Cargo.toml @@ -12,8 +12,14 @@ categories = ["template-engine"] edition = "2018" [features] +default = [] + +# Web framework integrations actix-web = ["actix-web-dep", "futures"] +# Unstable features +unstable = [] + [dependencies] maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" } maud_macros = { version = "0.22.0", path = "../maud_macros" }