Skip to content

Commit 9677f91

Browse files
committed
Restore Minizip in ReadiumShared
1 parent 9dc13a0 commit 9677f91

20 files changed

+399
-398
lines changed

Cartfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
github "dexman/Minizip" ~> 1.4.0
12
github "krzyzanowskim/CryptoSwift" ~> 1.8.0
23
github "ra1028/DifferenceKit" ~> 1.3.0
34
github "readium/Fuzi" ~> 4.0.0

Package.swift

+1-18
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ let package = Package(
2121
// Adapters to third-party dependencies.
2222
.library(name: "ReadiumAdapterGCDWebServer", targets: ["ReadiumAdapterGCDWebServer"]),
2323
.library(name: "ReadiumAdapterLCPSQLite", targets: ["ReadiumAdapterLCPSQLite"]),
24-
.library(name: "ReadiumAdapterMinizip", targets: ["ReadiumAdapterMinizip"]),
2524
],
2625
dependencies: [
2726
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.8.0"),
@@ -39,6 +38,7 @@ let package = Package(
3938
dependencies: [
4039
"ReadiumInternal",
4140
"SwiftSoup",
41+
"Zip",
4242
.product(name: "ReadiumFuzi", package: "Fuzi"),
4343
.product(name: "ReadiumZIPFoundation", package: "ZIPFoundation"),
4444
],
@@ -159,23 +159,6 @@ let package = Package(
159159
path: "Sources/Adapters/LCPSQLite"
160160
),
161161

162-
.target(
163-
name: "ReadiumAdapterMinizip",
164-
dependencies: [
165-
"ReadiumShared",
166-
"Zip",
167-
],
168-
path: "Sources/Adapters/Minizip"
169-
),
170-
.testTarget(
171-
name: "ReadiumAdapterMinizipTests",
172-
dependencies: ["ReadiumAdapterMinizip"],
173-
path: "Tests/Adapters/MinizipTests",
174-
resources: [
175-
.copy("Fixtures"),
176-
]
177-
),
178-
179162
.target(
180163
name: "ReadiumInternal",
181164
path: "Sources/Internal"

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ Note that Carthage will build all Readium modules and their dependencies, but yo
5454

5555
Refer to the following table to know which dependencies are required for each Readium library.
5656

57-
| | `ReadiumShared` | `ReadiumStreamer` | `ReadiumNavigator` | `ReadiumOPDS` | `ReadiumLCP` | `ReadiumAdapterGCDWebServer` | `ReadiumAdapterLCPSQLite` | `ReadiumAdapterMinizip` |
58-
|------------------------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|------------------------------|---------------------------|-------------------------|
59-
| **`ReadiumShared`** | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
60-
| **`ReadiumInternal`** | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | |
61-
| `CryptoSwift` | | :heavy_check_mark: | | | :heavy_check_mark: | | | |
62-
| `DifferenceKit` | | | :heavy_check_mark: | | | | | |
63-
| `ReadiumFuzi` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | |
64-
| `ReadiumGCDWebServer` | | | | | | :heavy_check_mark: | | |
65-
| `ReadiumZIPFoundation` | :heavy_check_mark: | | | | :heavy_check_mark: | | | |
66-
| `Minizip` | | | | | | | | :heavy_check_mark: |
67-
| `SQLite.swift` | | | | | | | :heavy_check_mark: | |
68-
| `SwiftSoup` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | |
57+
| | `ReadiumShared` | `ReadiumStreamer` | `ReadiumNavigator` | `ReadiumOPDS` | `ReadiumLCP` | `ReadiumAdapterGCDWebServer` | `ReadiumAdapterLCPSQLite` |
58+
|------------------------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|------------------------------|---------------------------|
59+
| **`ReadiumShared`** | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
60+
| **`ReadiumInternal`** | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
61+
| `CryptoSwift` | | :heavy_check_mark: | | | :heavy_check_mark: | | |
62+
| `DifferenceKit` | | | :heavy_check_mark: | | | | |
63+
| `ReadiumFuzi` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
64+
| `ReadiumGCDWebServer` | | | | | | :heavy_check_mark: | |
65+
| `ReadiumZIPFoundation` | :heavy_check_mark: | | | | :heavy_check_mark: | | |
66+
| `Minizip` | :heavy_check_mark: | | | | | | |
67+
| `SQLite.swift` | | | | | | | :heavy_check_mark: |
68+
| `SwiftSoup` | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | |
6969

7070
### CocoaPods
7171

Sources/Adapters/Minizip/MinizipArchiveOpener.swift Sources/Shared/Toolkit/ZIP/Minizip/MinizipArchiveOpener.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
//
66

77
import Foundation
8-
import ReadiumShared
98

109
/// An ``ArchiveOpener`` able to open ZIP archives using Minizip.
1110
///
12-
/// Compared to the default ZIPFoundation implementation shipped with
13-
/// ReadiumShared, the ``MinizipArchiveOpener``:
14-
///
11+
/// Compared to the ``ZIPFoundationArchiveOpener`` it:
1512
/// - Does not support HTTP streaming of ZIP archives.
1613
/// - Has better performance when reading an LCP-protected package containing
1714
/// large deflated ZIP entries (instead of stored).

Sources/Adapters/Minizip/MinizipContainer.swift Sources/Shared/Toolkit/ZIP/Minizip/MinizipContainer.swift

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import Foundation
88
import Minizip
9-
import ReadiumShared
109

1110
/// A ZIP ``Container`` using the Minizip library.
1211
final class MinizipContainer: Container, Loggable {

Sources/Shared/Toolkit/ZIP/ZIPArchiveOpener.swift

+6-11
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@
77
import Foundation
88

99
/// An ``ArchiveOpener`` for ZIP resources.
10-
public class ZIPArchiveOpener: ArchiveOpener {
11-
private let opener = ZIPFoundationArchiveOpener()
12-
13-
public init() {}
14-
15-
public func open(resource: any Resource, format: Format) async -> Result<ContainerAsset, ArchiveOpenError> {
16-
await opener.open(resource: resource, format: format)
17-
}
18-
19-
public func sniffOpen(resource: any Resource) async -> Result<ContainerAsset, ArchiveSniffOpenError> {
20-
await opener.sniffOpen(resource: resource)
10+
public class ZIPArchiveOpener: CompositeArchiveOpener {
11+
public init() {
12+
super.init([
13+
MinizipArchiveOpener(),
14+
ZIPFoundationArchiveOpener(),
15+
])
2116
}
2217
}

0 commit comments

Comments
 (0)