Skip to content

Commit a13a5fb

Browse files
committed
zip 3.0: Adjust flate2-related features for 3.0
Move `deflate-zlib` to `deflate-flate2-zlib` to make it clear it's a flate2 backend, and add `deflate-flate2-zlib-rs` to use the zlib-rs backend. Make the latter the default. Bump the required flate2 version to one that works with zlib-rs 0.5.0, which removes all compatibility considerations by no longer exporting any C symbols that would conflict with another zlib. Remove `deflate-zlib-ng`, largely superseded by `deflate-flate2-zlib-rs`. Remove no-op backend-specific code from an example. Add documentation for the flate2-related feature flags.
1 parent 7762944 commit a13a5fb

File tree

4 files changed

+13
-30
lines changed

4 files changed

+13
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
feature_flag:
2626
- "--all-features"
2727
- "--no-default-features"
28-
- "--no-default-features --features deflate-flate2"
28+
- "--no-default-features --features deflate-flate2-zlib-rs"
2929
- "--no-default-features --features deflate-zopfli"
3030
- ""
3131
include:
3232
- rustalias: stable
3333
rust: stable
3434
- rustalias: msrv
35-
rust: '1.73'
35+
rust: '1.75'
3636
- rustalias: nightly
3737
rust: nightly
3838
name: 'Build and test ${{ matrix.feature_flag }}: ${{ matrix.os }}, ${{ matrix.rustalias }}'
@@ -50,7 +50,7 @@ jobs:
5050
feature_flag:
5151
- "--all-features"
5252
- "--no-default-features"
53-
- "--no-default-features --features deflate-flate2"
53+
- "--no-default-features --features deflate-flate2-zlib-rs"
5454
- "--no-default-features --features deflate-zopfli"
5555
- ""
5656
name: 'Miri ${{ matrix.feature_flag }}'

Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repository = "https://github.com/zip-rs/zip2.git"
1212
keywords = ["zip", "archive", "compression"]
1313
# Any change to rust-version must be reflected also in `README.md` and `.github/workflows/ci.yaml`.
1414
# The MSRV policy is documented in `README.md`.
15-
rust-version = "1.73.0"
15+
rust-version = "1.75.0"
1616
description = """
1717
Library to support the reading and writing of zip files.
1818
"""
@@ -32,7 +32,7 @@ bzip2 = { version = "0.5.0", optional = true }
3232
chrono = { version = "0.4", optional = true }
3333
constant_time_eq = { version = "0.3", optional = true }
3434
crc32fast = "1.4"
35-
flate2 = { version = "1.0", default-features = false, optional = true }
35+
flate2 = { version = "1.1.1", default-features = false, optional = true }
3636
getrandom = { version = "0.3.1", features = ["wasm_js", "std"], optional = true}
3737
hmac = { version = "0.12", optional = true, features = ["reset"] }
3838
indexmap = "2"
@@ -71,10 +71,13 @@ aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1", "getrandom",
7171
chrono = ["chrono/default"]
7272
_deflate-any = []
7373
_all-features = [] # Detect when --all-features is used
74-
deflate = ["deflate-zopfli", "deflate-flate2", "flate2/rust_backend"]
75-
deflate-flate2 = ["_deflate-any"]
76-
deflate-zlib = ["flate2/zlib", "deflate-flate2"]
77-
deflate-zlib-ng = ["flate2/zlib-ng", "deflate-flate2"]
74+
deflate = ["deflate-zopfli", "deflate-flate2-zlib-rs"]
75+
# Pull in flate2, but don't choose a backend; useful if you want to choose your own flate2 backend
76+
deflate-flate2 = ["_deflate-any", "dep:flate2"]
77+
# Pull in flate2 and the fast zlib-rs backend; this is what most users will want
78+
deflate-flate2-zlib-rs = ["deflate-flate2", "flate2/zlib-rs"]
79+
# Pull in flate2 and the zlib backend; only use this if you need a dynamically linked system zlib
80+
deflate-flate2-zlib = ["deflate-flate2", "flate2/zlib"]
7881
deflate-zopfli = ["zopfli", "_deflate-any"]
7982
jiff-02 = ["dep:jiff"]
8083
nt-time = ["dep:nt-time"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ By default `aes-crypto`, `bzip2`, `deflate`, `deflate64`, `lzma`, `time` and `zs
5353
MSRV
5454
----
5555

56-
Our current Minimum Supported Rust Version is **1.73**. When adding features,
56+
Our current Minimum Supported Rust Version is **1.75**. When adding features,
5757
we will follow these guidelines:
5858

5959
- We will always support a minor Rust version that has been stable for at least 6 months.

examples/write_dir.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ struct Args {
2525
enum CompressionMethod {
2626
Stored,
2727
Deflated,
28-
DeflatedZlib,
29-
DeflatedZlibNg,
3028
Bzip2,
3129
Zstd,
3230
}
@@ -50,24 +48,6 @@ fn real_main() -> i32 {
5048
#[cfg(feature = "deflate-flate2")]
5149
zip::CompressionMethod::Deflated
5250
}
53-
CompressionMethod::DeflatedZlib => {
54-
#[cfg(not(feature = "deflate-zlib"))]
55-
{
56-
println!("The `deflate-zlib` feature is not enabled");
57-
return 1;
58-
}
59-
#[cfg(feature = "deflate-zlib")]
60-
zip::CompressionMethod::Deflated
61-
}
62-
CompressionMethod::DeflatedZlibNg => {
63-
#[cfg(not(feature = "deflate-zlib-ng"))]
64-
{
65-
println!("The `deflate-zlib-ng` feature is not enabled");
66-
return 1;
67-
}
68-
#[cfg(feature = "deflate-zlib-ng")]
69-
zip::CompressionMethod::Deflated
70-
}
7151
CompressionMethod::Bzip2 => {
7252
#[cfg(not(feature = "bzip2"))]
7353
{

0 commit comments

Comments
 (0)