Skip to content

feat!: zip 3.0: Adjust flate2-related features for 3.0 #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
feature_flag:
- "--all-features"
- "--no-default-features"
- "--no-default-features --features deflate-flate2"
- "--no-default-features --features deflate-flate2-zlib-rs"
- "--no-default-features --features deflate-zopfli"
- ""
include:
- rustalias: stable
rust: stable
- rustalias: msrv
rust: '1.74'
rust: '1.75'
- rustalias: nightly
rust: nightly
name: 'Build and test ${{ matrix.feature_flag }}: ${{ matrix.os }}, ${{ matrix.rustalias }}'
Expand All @@ -50,7 +50,7 @@ jobs:
feature_flag:
- "--all-features"
- "--no-default-features"
- "--no-default-features --features deflate-flate2"
- "--no-default-features --features deflate-flate2-zlib-rs"
- "--no-default-features --features deflate-zopfli"
- ""
name: 'Miri ${{ matrix.feature_flag }}'
Expand Down
15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/zip-rs/zip2.git"
keywords = ["zip", "archive", "compression"]
# Any change to rust-version must be reflected also in `README.md` and `.github/workflows/ci.yaml`.
# The MSRV policy is documented in `README.md`.
rust-version = "1.74.0"
rust-version = "1.75.0"
description = """
Library to support the reading and writing of zip files.
"""
Expand All @@ -32,7 +32,7 @@ bzip2 = { version = "0.5.0", optional = true }
chrono = { version = "0.4", optional = true }
constant_time_eq = { version = "0.3", optional = true }
crc32fast = "1.4"
flate2 = { version = "1.0", default-features = false, optional = true }
flate2 = { version = "1.1.1", default-features = false, optional = true }
getrandom = { version = "0.3.1", features = ["wasm_js", "std"], optional = true}
hmac = { version = "0.12", optional = true, features = ["reset"] }
indexmap = "2"
Expand Down Expand Up @@ -71,10 +71,13 @@ aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1", "getrandom",
chrono = ["chrono/default"]
_deflate-any = []
_all-features = [] # Detect when --all-features is used
deflate = ["deflate-zopfli", "deflate-flate2", "flate2/rust_backend"]
deflate-flate2 = ["_deflate-any"]
deflate-zlib = ["flate2/zlib", "deflate-flate2"]
deflate-zlib-ng = ["flate2/zlib-ng", "deflate-flate2"]
deflate = ["deflate-zopfli", "deflate-flate2-zlib-rs"]
# Pull in flate2, but don't choose a backend; useful if you want to choose your own flate2 backend
deflate-flate2 = ["_deflate-any", "dep:flate2"]
# Pull in flate2 and the fast zlib-rs backend; this is what most users will want
deflate-flate2-zlib-rs = ["deflate-flate2", "flate2/zlib-rs"]
# Pull in flate2 and the zlib backend; only use this if you need a dynamically linked system zlib
deflate-flate2-zlib = ["deflate-flate2", "flate2/zlib"]
deflate-zopfli = ["zopfli", "_deflate-any"]
jiff-02 = ["dep:jiff"]
nt-time = ["dep:nt-time"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ By default `aes-crypto`, `bzip2`, `deflate`, `deflate64`, `lzma`, `time` and `zs
MSRV
----

Our current Minimum Supported Rust Version is **1.74**. When adding features,
Our current Minimum Supported Rust Version is **1.75**. When adding features,
we will follow these guidelines:

- We will always support a minor Rust version that has been stable for at least 6 months.
Expand Down
20 changes: 0 additions & 20 deletions examples/write_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ struct Args {
enum CompressionMethod {
Stored,
Deflated,
DeflatedZlib,
DeflatedZlibNg,
Bzip2,
Zstd,
}
Expand All @@ -50,24 +48,6 @@ fn real_main() -> i32 {
#[cfg(feature = "deflate-flate2")]
zip::CompressionMethod::Deflated
}
CompressionMethod::DeflatedZlib => {
#[cfg(not(feature = "deflate-zlib"))]
{
println!("The `deflate-zlib` feature is not enabled");
return 1;
}
#[cfg(feature = "deflate-zlib")]
zip::CompressionMethod::Deflated
}
CompressionMethod::DeflatedZlibNg => {
#[cfg(not(feature = "deflate-zlib-ng"))]
{
println!("The `deflate-zlib-ng` feature is not enabled");
return 1;
}
#[cfg(feature = "deflate-zlib-ng")]
zip::CompressionMethod::Deflated
}
CompressionMethod::Bzip2 => {
#[cfg(not(feature = "bzip2"))]
{
Expand Down
Loading