Skip to content

Commit 0ff80e3

Browse files
committed
Merge branch 'release-4.7.0'
2 parents 730672e + 1e8ad0e commit 0ff80e3

55 files changed

Lines changed: 2396 additions & 331 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.jazzy.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ sourcekitten_sourcefile: docs.json
33
clean: false
44
author: Timofey Solomko
55
module: SWCompression
6-
module_version: 4.6.1
6+
module_version: 4.7.0
77
copyright: '© 2021 Timofey Solomko'
88
readme: README.md
99
github_url: https://github.com/tsolomko/SWCompression
10-
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.6.1
10+
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.7.0
1111
theme: fullwidth
1212

1313
custom_categories:
@@ -18,6 +18,7 @@ custom_categories:
1818
- LZMA
1919
- LZMAProperties
2020
- LZMA2
21+
- LZ4
2122
- name: Archives
2223
children:
2324
- GzipArchive
@@ -41,6 +42,7 @@ custom_categories:
4142
- name: Errors
4243
children:
4344
- BZip2Error
45+
- DataError
4446
- DeflateError
4547
- GzipError
4648
- LZMAError

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 4.7.0
4+
5+
- Added full-featured support for LZ4 compression and decompression by introducing 5 new functions inside `LZ4` enum.
6+
- This enum conforms to the `DecompressionAlgorithm` and `CompressionAlgorithm` protocols.
7+
- Added SWCompression/LZ4 subspec for CocoaPods users.
8+
- Added support for LZ4 algorithm used in 7-Zip containers.
9+
- Added `DataError` enum which conforms to `Error` and `Equatable` protocols.
10+
- Swift 5.0 is no longer supported.
11+
- Fixed an issue where in some cases Deflate compression would produce incorrect output.
12+
- Optimized performance of Deflate compression.
13+
- swcomp changes:
14+
- Increased the lowest required version of SwiftCLI dependency to 6.0.0.
15+
- Added `lz4` command with many options to support all LZ4 features (both compression and decompression).
16+
- Added `--use-format` option to the `tar` command which when used with the `-c` option allows to force usage of a
17+
selected TAR format when creating a TAR container.
18+
- The `-j` and `-z` options of the `tar` command can now be used together with the `-c` option to create compressed
19+
TAR containers.
20+
- Added `un-lz4`, `comp-lz4`, and `comp-lz4-bd` subcommands to the `benchmark` command.
21+
- Benchmark commands for compression now report compression ratio.
22+
323
## 4.6.1
424

525
- Fixed a crash in LZMA2 when trying to process an empty `Data`.

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:5.1
22
import PackageDescription
33

44
let package = Package(
@@ -11,7 +11,7 @@ let package = Package(
1111
dependencies: [
1212
// SWCOMP: Uncomment the line below to build swcomp example program.
1313
// .package(url: "https://github.com/jakeheis/SwiftCLI",
14-
// from: "5.2.0"),
14+
// from: "6.0.0"),
1515
.package(url: "https://github.com/tsolomko/BitByteData",
1616
from: "2.0.0"),
1717
],
@@ -26,7 +26,7 @@ let package = Package(
2626
name: "SWCompression",
2727
dependencies: ["BitByteData"],
2828
path: "Sources",
29-
sources: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib"]),
29+
sources: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZ4", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib"]),
3030
],
3131
swiftLanguageVersions: [.v5]
3232
)

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SWCompression
22

3-
[![Swift 5.X](https://img.shields.io/badge/Swift-5.X-blue.svg)](https://developer.apple.com/swift/)
3+
[![Swift 5.1+](https://img.shields.io/badge/Swift-5.1+-blue.svg)](https://developer.apple.com/swift/)
44
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/tsolomko/SWCompression/master/LICENSE)
55
[![Build Status](https://dev.azure.com/tsolomko/SWCompression/_apis/build/status/tsolomko.SWCompression?branchName=develop)](https://dev.azure.com/tsolomko/SWCompression/_build/latest?definitionId=3&branchName=develop)
66

@@ -18,10 +18,10 @@ It also works on Apple platforms, Linux, __and Windows__.
1818

1919
All features are listed in the tables below. "TBD" means that feature is planned but not implemented (yet).
2020

21-
| | Deflate | BZip2 | LZMA/LZMA2 |
22-
| ------------- | ------- | ----- | ---------- |
23-
| Decompression ||||
24-
| Compression ||| TBD |
21+
| | Deflate | BZip2 | LZMA/LZMA2 | LZ4 |
22+
| ------------- | ------- | ----- | ---------- | --- |
23+
| Decompression |||||
24+
| Compression ||| TBD ||
2525

2626
| | Zlib | GZip | XZ | ZIP | TAR | 7-Zip |
2727
| ----- | ---- | ---- | --- | --- | --- | ----- |
@@ -45,7 +45,7 @@ let package = Package(
4545
name: "PackageName",
4646
dependencies: [
4747
.package(url: "https://github.com/tsolomko/SWCompression.git",
48-
from: "4.6.0")
48+
from: "4.7.0")
4949
],
5050
targets: [
5151
.target(
@@ -60,7 +60,7 @@ More details you can find in [Swift Package Manager's Documentation](https://git
6060

6161
### CocoaPods
6262

63-
Add `pod 'SWCompression', '~> 4.6'` and `use_frameworks!` lines to your Podfile.
63+
Add `pod 'SWCompression', '~> 4.7'` and `use_frameworks!` lines to your Podfile.
6464

6565
To complete installation, run `pod install`.
6666

@@ -71,6 +71,7 @@ If you need only some parts of framework, you can install only them using sub-po
7171
- SWCompression/Gzip
7272
- SWCompression/LZMA
7373
- SWCompression/LZMA2
74+
- SWCompression/LZ4
7475
- SWCompression/SevenZip
7576
- SWCompression/TAR
7677
- SWCompression/XZ
@@ -97,13 +98,14 @@ List of "optional dependecies":
9798
- For SWCompression/SevenZip:
9899
- SWCompression/BZip2
99100
- SWCompression/Deflate
101+
- SWCompression/LZ4
100102

101103
__Note:__ If you use Swift Package Manager or Carthage you always have everything (ZIP and 7-Zip are built with Deflate,
102-
BZip2 and LZMA/LZMA2 support).
104+
BZip2, LZMA/LZMA2 and LZ4 support).
103105

104106
### Carthage
105107

106-
Add to your Cartfile `github "tsolomko/SWCompression" ~> 4.6`.
108+
Add to your Cartfile `github "tsolomko/SWCompression" ~> 4.7`.
107109

108110
Then:
109111

@@ -184,31 +186,40 @@ was created manually and you shouldn't use `swift package generate-xcodeproj` co
184186

185187
### Executing tests locally
186188

187-
If you want to run tests on your computer, you need to do an additional step after cloning the repository:
189+
If you want to run tests on your computer, you need to do a couple of additional steps after cloning the repository:
188190

189191
```bash
190-
./utils.py prepare-workspace {macos|other}
192+
./utils.py download-bbd-macos
193+
git submodule update --init --recursive
194+
cd "Tests/Test Files"
195+
cp gitattributes-copy .gitattributes
196+
git lfs pull
197+
git lfs checkout
191198
```
192199

193-
The argument of this function is an operating system that you're using. This command will download files used in tests,
194-
and on macOS it will also try to download BitByteData dependency, which requires having Carthage installed. When using
195-
Xcode 12 or later, you should also pass the `--xcf` option, or use the
196-
[xconfig workaround](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md).
197-
Please also note that when working on SWCompression in Xcode when building the project you may see ld warnings about a
198-
directory not being found. These are expected and harmless. Finally, you should keep in mind that support for non-xcframework
199-
method of installing dependencies is likely to be dropped in the future major update.
200+
The first command will download the BitByteData dependency, which requires having Carthage installed. When using Xcode
201+
12 or later, you should also pass the `--xcf` option, or use the
202+
[xconfig workaround](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md). Please note
203+
that when building SWCompression's Xcode project you may see ld warnings about a directory not being found. These are
204+
expected and harmless. Finally, you should keep in mind that support for non-xcframework method of installing
205+
dependencies is likely to be dropped in the future major update.
200206

201-
Test files are stored in a [separate repository](https://github.com/tsolomko/SWCompression-Test-Files), using Git LFS.
202-
There are two reasons for this complicated setup. Firstly, some of these files can be quite big, and it would be
203-
unfortunate if the users of SWCompression had to download them every time during the installation. Secondly, Swift
204-
Package Manager and contemporary versions of Xcode don't always work well with git-lfs-enabled repositories. To prevent
205-
any potential problems test files were moved into another repository. Additionaly, the custom command line tool `utils.py`
206-
is used to work around issues occuring on certain user systems (see, for example, [#9](https://github.com/tsolomko/SWCompression/issues/9)).
207+
The remaining commands will download the files used in tests. These files are stored in a
208+
[separate repository](https://github.com/tsolomko/SWCompression-Test-Files), using Git LFS. There are two reasons for
209+
this complicated setup. Firstly, some of these files can be quite big, and it would be unfortunate if the users of
210+
SWCompression had to download them during the installation. Secondly, Swift Package Manager and contemporary versions of
211+
Xcode don't always work well with git-lfs-enabled repositories. To prevent any potential problems test files were moved
212+
into another repository.
207213

208214
Please note, that if you want to add a new _type_ of test files, in addition to running `git lfs track`, you have to
209215
also copy into the "Tests/Test Files/gitattributes-copy" file a line this command adds to the "Tests/Test Files/.gitattributes"
210216
file. __Do not commit the ".gitattributes" file to the git history. It is git-ignored for a reason!__
211217

218+
Please also be mindful of Git LFS bandwidth quota on GitHub: try to limit downloading lfs'd files using `git lfs pull`.
219+
In CI we use some caching techniques to help with the quota, so if you're going to add new tests that require several
220+
new test files you should try to submit them all together to reduce the amount of times CI needs to recreate the cache
221+
(recreating the cache requires to do `git lfs pull` for all test files).
222+
212223
## Performance
213224

214225
Using whole module optimizations is recommended for the best performance. They are enabled by default in the Release build
@@ -256,3 +267,6 @@ completely in Swift without Objective-C, it can also be used on __Linux__.
256267
- [Apache Commons Compress](https://commons.apache.org/proper/commons-compress/)
257268
- [A walk through the SA-IS Suffix Array Construction Algorithm](http://zork.net/~st/jottings/sais.html)
258269
- [Wikipedia article about BZip2](https://en.wikipedia.org/wiki/Bzip2)
270+
- [LZ4 Frame Format Description](https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md)
271+
- [LZ4 Block Format Description](https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md)
272+
- [xxHash specification](https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md)

SWCompression.podspec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "SWCompression"
4-
s.version = "4.6.1"
4+
s.version = "4.7.0"
55
s.summary = "A framework with functions for working with compression, archives and containers."
66

77
s.description = "A framework with (de)compression algorithms and functions for processing various archives and containers."
@@ -54,6 +54,11 @@ Pod::Spec.new do |s|
5454
sp.source_files = "Sources/{LZMA2/*,Common/*}.swift"
5555
end
5656

57+
s.subspec "LZ4" do |sp|
58+
sp.source_files = "Sources/{LZ4/*,Common/*}.swift"
59+
sp.pod_target_xcconfig = { "OTHER_SWIFT_FLAGS" => "-DSWCOMPRESSION_POD_LZ4" }
60+
end
61+
5762
s.subspec "XZ" do |sp|
5863
sp.dependency "SWCompression/LZMA2"
5964
sp.source_files = "Sources/{XZ/*,Common/*}.swift"

SWCompression.xcodeproj/SWCompression.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>4.6.1</string>
18+
<string>4.7.0</string>
1919
<key>CFBundleVersion</key>
20-
<string>81</string>
20+
<string>83</string>
2121
<key>NSHumanReadableCopyright</key>
2222
<string>Copyright © 2021 Timofey Solomko</string>
2323
</dict>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "7E23A357-7F2B-40CE-A7EE-BA2D541E111E",
5+
"name" : "Default Configuration",
6+
"options" : {
7+
8+
}
9+
}
10+
],
11+
"defaultOptions" : {
12+
"codeCoverage" : false,
13+
"targetForVariableExpansion" : {
14+
"containerPath" : "container:SWCompression.xcodeproj",
15+
"identifier" : "06BE1AC71DB410F100EE0F59",
16+
"name" : "SWCompression"
17+
},
18+
"testExecutionOrdering" : "random"
19+
},
20+
"testTargets" : [
21+
{
22+
"parallelizable" : true,
23+
"target" : {
24+
"containerPath" : "container:SWCompression.xcodeproj",
25+
"identifier" : "06F065941FFB761600312A82",
26+
"name" : "TestSWCompression"
27+
}
28+
}
29+
],
30+
"version" : 1
31+
}

SWCompression.xcodeproj/TestSWCompression.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>4.6.1</string>
18+
<string>4.7.0</string>
1919
<key>CFBundleVersion</key>
20-
<string>81</string>
20+
<string>83</string>
2121
</dict>
2222
</plist>

0 commit comments

Comments
 (0)