diff --git a/Cargo.toml b/Cargo.toml index cf36d0041..7492316fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,6 +63,7 @@ tempdir = "0.3.7" aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1", "rand", "zeroize"] chrono = ["chrono/default"] _deflate-any = [] +_all-features = [] # Detect when --all-features is used deflate = ["flate2/rust_backend", "_deflate-any"] # DEPRECATED: previously enabled `flate2/miniz_oxide` which is equivalent to `flate2/rust_backend` diff --git a/examples/write_dir.rs b/examples/write_dir.rs index a34c3bb0a..5475f7bcc 100644 --- a/examples/write_dir.rs +++ b/examples/write_dir.rs @@ -25,8 +25,8 @@ struct Args { enum CompressionMethod { Stored, Deflated, - DeflatedMiniz, DeflatedZlib, + DeflatedZlibNg, Bzip2, Zstd, } @@ -50,22 +50,22 @@ fn real_main() -> i32 { #[cfg(feature = "deflate")] zip::CompressionMethod::Deflated } - CompressionMethod::DeflatedMiniz => { - #[cfg(not(feature = "deflate-miniz"))] + CompressionMethod::DeflatedZlib => { + #[cfg(not(feature = "deflate-zlib"))] { - println!("The `deflate-miniz` feature is not enabled"); + println!("The `deflate-zlib` feature is not enabled"); return 1; } - #[cfg(feature = "deflate-miniz")] + #[cfg(feature = "deflate-zlib")] zip::CompressionMethod::Deflated } - CompressionMethod::DeflatedZlib => { - #[cfg(not(feature = "deflate-zlib"))] + CompressionMethod::DeflatedZlibNg => { + #[cfg(not(feature = "deflate-zlib-ng"))] { - println!("The `deflate-zlib` feature is not enabled"); + println!("The `deflate-zlib-ng` feature is not enabled"); return 1; } - #[cfg(feature = "deflate-zlib")] + #[cfg(feature = "deflate-zlib-ng")] zip::CompressionMethod::Deflated } CompressionMethod::Bzip2 => { diff --git a/src/build.rs b/src/build.rs index 8ec1aeab2..e548c957e 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1,7 +1,8 @@ use std::env::var; fn main() { - if var("CARGO_FEATURE_DEFLATE_MINIZ").is_ok() { + if var("CARGO_FEATURE_DEFLATE_MINIZ").is_ok() + && var("CARGO_FEATURE__ALL_FEATURES").is_err() { println!("cargo:warning=Feature `deflate-miniz` is deprecated; replace it with `deflate`"); } }