Make direct winapi deps optional (#767)
This commit is contained in:
parent
1af259f9ce
commit
b354b4cc34
4
.github/workflows/crossterm_test.yml
vendored
4
.github/workflows/crossterm_test.yml
vendored
@ -63,8 +63,12 @@ jobs:
|
||||
run: cargo test --all-features -- --nocapture --test-threads 1
|
||||
continue-on-error: ${{ matrix.can-fail }}
|
||||
- name: Test no default features
|
||||
if: matrix.os != 'windows-2019'
|
||||
run: cargo test --no-default-features -- --nocapture --test-threads 1
|
||||
continue-on-error: ${{ matrix.can-fail }}
|
||||
- name: Test no default features with windows feature enabled
|
||||
if: matrix.os == 'windows-2019'
|
||||
run: cargo test --no-default-features --features windows -- --nocapture --test-threads 1
|
||||
- name: Test Packaging
|
||||
if: matrix.rust == 'stable'
|
||||
run: cargo package
|
||||
|
@ -26,7 +26,8 @@ all-features = true
|
||||
# Features
|
||||
#
|
||||
[features]
|
||||
default = ["bracketed-paste"]
|
||||
default = ["bracketed-paste", "windows"]
|
||||
windows = ["winapi", "crossterm_winapi"]
|
||||
bracketed-paste = []
|
||||
event-stream = ["futures-core"]
|
||||
use-dev-tty = ["filedescriptor"]
|
||||
@ -48,9 +49,10 @@ serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
version = "0.3.9"
|
||||
features = ["winuser", "winerror"]
|
||||
optional = true
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
crossterm_winapi = "0.9"
|
||||
crossterm_winapi = { version = "0.9", optional = true }
|
||||
|
||||
#
|
||||
# UNIX dependencies
|
||||
|
@ -257,3 +257,12 @@ pub mod ansi_support;
|
||||
mod command;
|
||||
mod error;
|
||||
pub(crate) mod macros;
|
||||
|
||||
#[cfg(all(windows, not(feature = "windows")))]
|
||||
compile_error!("Compiling on Windows with \"windows\" feature disabled. Feature \"windows\" should only be disabled when project will never be compiled on Windows.");
|
||||
|
||||
#[cfg(all(winapi, not(feature = "winapi")))]
|
||||
compile_error!("Compiling on Windows with \"winapi\" feature disabled. Feature \"winapi\" should only be disabled when project will never be compiled on Windows.");
|
||||
|
||||
#[cfg(all(crossterm_winapi, not(feature = "crossterm_winapi")))]
|
||||
compile_error!("Compiling on Windows with \"crossterm_winapi\" feature disabled. Feature \"crossterm_winapi\" should only be disabled when project will never be compiled on Windows.");
|
||||
|
Loading…
Reference in New Issue
Block a user