From 7333de70a7546896db88e83d1248c7263926377f Mon Sep 17 00:00:00 2001 From: Robert Vojta Date: Wed, 20 Nov 2019 14:03:22 +0100 Subject: [PATCH] Remove all feature flags except event-stream (#322) Signed-off-by: Robert Vojta --- .github/workflows/crossterm_test.yml | 29 +++++++----------- .travis.yml | 12 ++++---- Cargo.toml | 44 +++++++++++++++++++--------- src/lib.rs | 5 ---- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.github/workflows/crossterm_test.yml b/.github/workflows/crossterm_test.yml index 4d5b64c..3ce9f1f 100644 --- a/.github/workflows/crossterm_test.yml +++ b/.github/workflows/crossterm_test.yml @@ -50,26 +50,17 @@ jobs: - name: Test Build run: cargo build continue-on-error: ${{ matrix.can-fail }} + - name: Test default features + run: cargo test --lib -- --nocapture --test-threads 1 + continue-on-error: ${{ matrix.can-fail }} + - name: Test serde feature + run: cargo test --lib --features serde -- --nocapture --test-threads 1 + continue-on-error: ${{ matrix.can-fail }} + - name: Test event-stream feature + run: cargo test --lib --features event-stream -- --nocapture --test-threads 1 + continue-on-error: ${{ matrix.can-fail }} - name: Test all features - run: cargo test --all-features --no-default-features -- --nocapture --test-threads 1 - continue-on-error: ${{ matrix.can-fail }} - - name: Test cursor feature - run: cargo test --features cursor --no-default-features --lib -- --nocapture --test-threads 1 - continue-on-error: ${{ matrix.can-fail }} - - name: Test style feature - run: cargo test --features style --no-default-features --lib -- --nocapture --test-threads 1 - continue-on-error: ${{ matrix.can-fail }} - - name: Test terminal feature - run: cargo test --features terminal --no-default-features --lib -- --nocapture --test-threads 1 - continue-on-error: ${{ matrix.can-fail }} - - name: Test screen feature - run: cargo test --features screen --no-default-features --lib -- --nocapture --test-threads 1 - continue-on-error: ${{ matrix.can-fail }} - - name: Test event feature - run: cargo test --features event --no-default-features --lib -- --nocapture --test-threads 1 - continue-on-error: ${{ matrix.can-fail }} - - name: Test async-event feature - run: cargo test --features event-stream --no-default-features --lib -- --nocapture --test-threads 1 + run: cargo test --all-features -- --nocapture --test-threads 1 continue-on-error: ${{ matrix.can-fail }} - name: Test Packaging if: matrix.rust == 'stable' diff --git a/.travis.yml b/.travis.yml index 326dcc1..c18a687 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,10 +35,8 @@ script: - if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then cargo fmt --all -- --check; fi - cargo clippy -- -D clippy::all - cargo build - - cargo test --all-features --no-default-features -- --nocapture --test-threads 1 - - cargo test --features cursor --no-default-features --lib -- --nocapture --test-threads 1 - - cargo test --features style --no-default-features --lib -- --nocapture --test-threads 1 - - cargo test --features terminal --no-default-features --lib -- --nocapture --test-threads 1 - - cargo test --features screen --no-default-features --lib -- --nocapture --test-threads 1 - - cargo test --features event --no-default-features --lib -- --nocapture --test-threads 1 - - cargo test --features event-stream --no-default-features --lib -- --nocapture --test-threads 1 + - cargo test --lib -- --nocapture --test-threads 1 + - cargo test --lib --features serde -- --nocapture --test-threads 1 + - cargo test --lib --features event-stream -- --nocapture --test-threads 1 + - cargo test --all-features -- --nocapture --test-threads 1 + - if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then cargo package; fi diff --git a/Cargo.toml b/Cargo.toml index f3b6c88..b36ddce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,34 +16,50 @@ categories = ["command-line-interface", "command-line-utilities"] name = "crossterm" path = "src/lib.rs" +# +# Build documentation with all features -> EventStream is available +# [package.metadata.docs.rs] all-features = true +# +# Features +# [features] -default = ["cursor", "style", "terminal", "screen", "event"] -cursor = ["lazy_static", "event", "winapi/wincon", "winapi/winnt", "winapi/minwindef"] -style = ["lazy_static", "winapi/wincon"] -terminal = ["cursor"] -screen = ["lazy_static", "winapi/wincon", "winapi/minwindef"] -event = ["bitflags", "mio", "lazy_static", "parking_lot", "screen", "terminal", "winapi/winnt", "winapi/winuser", "winapi/wincon", "winapi/synchapi", "winapi/namedpipeapi", "winapi/impl-default"] -event-stream = ["event", "futures"] +default = [] +event-stream = ["futures"] +# +# Shared dependencies +# [dependencies] -bitflags = { version = "1.2", optional = true } -lazy_static = { version = "1.4", optional = true } -parking_lot = { version = "0.9", optional = true } +bitflags = "1.2" +futures = { version = "0.3", optional = true } +lazy_static = "1.4" +parking_lot = "0.9" serde = { version = "1.0.0", features = ["derive"], optional = true } -futures = {version = "0.3", optional = true } + +# +# Windows dependencies +# +[target.'cfg(windows)'.dependencies.winapi] +version = "0.3.8" +features = ["winuser"] [target.'cfg(windows)'.dependencies] -winapi = "0.3.8" crossterm_winapi = "0.5.0" +# +# UNIX dependencies +# [target.'cfg(unix)'.dependencies] libc = "0.2.51" -mio = { version = "0.6.19", optional = true } -signal-hook = { version = "0.1.11", features=["mio-support"]} +mio = "0.6.19" +signal-hook = { version = "0.1.11", features = ["mio-support"] } +# +# Dev dependencies (examples, ...) +# [dev-dependencies] tokio = "0.2.0-alpha.6" futures = "0.3" diff --git a/src/lib.rs b/src/lib.rs index 7431e87..8753f31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -232,19 +232,14 @@ pub use utils::functions::supports_ansi; pub use utils::{Command, ErrorKind, ExecutableCommand, Output, QueueableCommand, Result}; /// A module to work with the terminal cursor -#[cfg(feature = "cursor")] pub mod cursor; /// A module to read events. -#[cfg(feature = "event")] pub mod event; /// A module to work with the terminal screen. -#[cfg(feature = "screen")] pub mod screen; /// A module to apply attributes and colors on your text. -#[cfg(feature = "style")] pub mod style; /// A module to work with the terminal. -#[cfg(feature = "terminal")] pub mod terminal; /// Shared utilities. pub mod utils;