Skip to content

Commit

Permalink
Merge branch 'release-4.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tsolomko committed Nov 4, 2021
2 parents 730672e + 1e8ad0e commit 0ff80e3
Show file tree
Hide file tree
Showing 55 changed files with 2,396 additions and 331 deletions.
6 changes: 4 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ sourcekitten_sourcefile: docs.json
clean: false
author: Timofey Solomko
module: SWCompression
module_version: 4.6.1
module_version: 4.7.0
copyright: '© 2021 Timofey Solomko'
readme: README.md
github_url: https://github.com/tsolomko/SWCompression
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.6.1
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.7.0
theme: fullwidth

custom_categories:
Expand All @@ -18,6 +18,7 @@ custom_categories:
- LZMA
- LZMAProperties
- LZMA2
- LZ4
- name: Archives
children:
- GzipArchive
Expand All @@ -41,6 +42,7 @@ custom_categories:
- name: Errors
children:
- BZip2Error
- DataError
- DeflateError
- GzipError
- LZMAError
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 4.7.0

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

## 4.6.1

- Fixed a crash in LZMA2 when trying to process an empty `Data`.
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.0
// swift-tools-version:5.1
import PackageDescription

let package = Package(
Expand All @@ -11,7 +11,7 @@ let package = Package(
dependencies: [
// SWCOMP: Uncomment the line below to build swcomp example program.
// .package(url: "https://github.com/jakeheis/SwiftCLI",
// from: "5.2.0"),
// from: "6.0.0"),
.package(url: "https://github.com/tsolomko/BitByteData",
from: "2.0.0"),
],
Expand All @@ -26,7 +26,7 @@ let package = Package(
name: "SWCompression",
dependencies: ["BitByteData"],
path: "Sources",
sources: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib"]),
sources: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZ4", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib"]),
],
swiftLanguageVersions: [.v5]
)
62 changes: 38 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SWCompression

[![Swift 5.X](https://img.shields.io/badge/Swift-5.X-blue.svg)](https://developer.apple.com/swift/)
[![Swift 5.1+](https://img.shields.io/badge/Swift-5.1+-blue.svg)](https://developer.apple.com/swift/)
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/tsolomko/SWCompression/master/LICENSE)
[![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)

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

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

| | Deflate | BZip2 | LZMA/LZMA2 |
| ------------- | ------- | ----- | ---------- |
| Decompression ||||
| Compression ||| TBD |
| | Deflate | BZip2 | LZMA/LZMA2 | LZ4 |
| ------------- | ------- | ----- | ---------- | --- |
| Decompression |||||
| Compression ||| TBD ||

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

### CocoaPods

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

To complete installation, run `pod install`.

Expand All @@ -71,6 +71,7 @@ If you need only some parts of framework, you can install only them using sub-po
- SWCompression/Gzip
- SWCompression/LZMA
- SWCompression/LZMA2
- SWCompression/LZ4
- SWCompression/SevenZip
- SWCompression/TAR
- SWCompression/XZ
Expand All @@ -97,13 +98,14 @@ List of "optional dependecies":
- For SWCompression/SevenZip:
- SWCompression/BZip2
- SWCompression/Deflate
- SWCompression/LZ4

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

### Carthage

Add to your Cartfile `github "tsolomko/SWCompression" ~> 4.6`.
Add to your Cartfile `github "tsolomko/SWCompression" ~> 4.7`.

Then:

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

### Executing tests locally

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

```bash
./utils.py prepare-workspace {macos|other}
./utils.py download-bbd-macos
git submodule update --init --recursive
cd "Tests/Test Files"
cp gitattributes-copy .gitattributes
git lfs pull
git lfs checkout
```

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

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

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

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

## Performance

Using whole module optimizations is recommended for the best performance. They are enabled by default in the Release build
Expand Down Expand Up @@ -256,3 +267,6 @@ completely in Swift without Objective-C, it can also be used on __Linux__.
- [Apache Commons Compress](https://commons.apache.org/proper/commons-compress/)
- [A walk through the SA-IS Suffix Array Construction Algorithm](http://zork.net/~st/jottings/sais.html)
- [Wikipedia article about BZip2](https://en.wikipedia.org/wiki/Bzip2)
- [LZ4 Frame Format Description](https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md)
- [LZ4 Block Format Description](https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md)
- [xxHash specification](https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md)
7 changes: 6 additions & 1 deletion SWCompression.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SWCompression"
s.version = "4.6.1"
s.version = "4.7.0"
s.summary = "A framework with functions for working with compression, archives and containers."

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

s.subspec "LZ4" do |sp|
sp.source_files = "Sources/{LZ4/*,Common/*}.swift"
sp.pod_target_xcconfig = { "OTHER_SWIFT_FLAGS" => "-DSWCOMPRESSION_POD_LZ4" }
end

s.subspec "XZ" do |sp|
sp.dependency "SWCompression/LZMA2"
sp.source_files = "Sources/{XZ/*,Common/*}.swift"
Expand Down
4 changes: 2 additions & 2 deletions SWCompression.xcodeproj/SWCompression.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.6.1</string>
<string>4.7.0</string>
<key>CFBundleVersion</key>
<string>81</string>
<string>83</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2021 Timofey Solomko</string>
</dict>
Expand Down
31 changes: 31 additions & 0 deletions SWCompression.xcodeproj/SWCompression.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"configurations" : [
{
"id" : "7E23A357-7F2B-40CE-A7EE-BA2D541E111E",
"name" : "Default Configuration",
"options" : {

}
}
],
"defaultOptions" : {
"codeCoverage" : false,
"targetForVariableExpansion" : {
"containerPath" : "container:SWCompression.xcodeproj",
"identifier" : "06BE1AC71DB410F100EE0F59",
"name" : "SWCompression"
},
"testExecutionOrdering" : "random"
},
"testTargets" : [
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:SWCompression.xcodeproj",
"identifier" : "06F065941FFB761600312A82",
"name" : "TestSWCompression"
}
}
],
"version" : 1
}
4 changes: 2 additions & 2 deletions SWCompression.xcodeproj/TestSWCompression.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>4.6.1</string>
<string>4.7.0</string>
<key>CFBundleVersion</key>
<string>81</string>
<string>83</string>
</dict>
</plist>
Loading

0 comments on commit 0ff80e3

Please sign in to comment.