Releases: tsolomko/SWCompression
4.5.4
- Fixed Swift Package Manager and Xcode sometimes being unable to add SWCompression as a package dependency (#9).
Comment: This was commonly happening when specific settings related to Git LFS were present in the git config, but SPM/Xcode were unable to find Git LFS in their PATH environment variable for any reason. Fixing this required changing the development workflow of SWCompression, so if you are working on SWCompression itself, please read the updated "Executing tests locally" section in the README.
- Fixed incompatibility with Swift Package Manager from Swift 4.2.
Comment: At the moment SWCompression supports Swift 4.2 (only via CocoaPods and SPM) and Swift 5.X.
4.5.3
4.5.3 Test
Testing that nothing is broken before releasing 4.5.3.
4.5.2
4.5.1
- Minimum required version of BitByteData is now 1.4.0.
- Updated to support Swift 4.2.
- Added default values to the properties of
LZMAProperties
struct based on the documentation from LZMA SDK. - Added
init()
toLZMAProperties
struct which setslc
,lp
,pb
, anddictionarySize
properties to their default values. - Improved the detection of Swift versions less than 4.2 in the workaround for the crash in
Data.prefix(upTo:)
. - Documentation updates:
- Fixed an outdated example in README (PR #4 by @brianantonelli).
- Fixed grammar issues related to the usage of articles, during/while, and others.
- swcomp changes:
- Minimum required version of SwiftCLI is now 5.2.0.
- Improved the layout of output of benchmark commands.
4.5.0
- Added
LZMAProperties
struct with simple member-wise initializer. - Added
LZMA.decompress(data:properties:uncompressedSize:)
function (withuncompressedSize
argument being optional) which allows to specify LZMA properties.- Useful in situations when properties are known from some external source instead of being encoded at the beginning of
data
. - Note, that these new APIs are intended to be used by expert users and as such no validation is performed on LZMA properties values.
- Useful in situations when properties are known from some external source instead of being encoded at the beginning of
- Added support for Delta "filter" in both XZ archives and 7-Zip containers.
- Added support for SHA-256 check type in XZ archives.
- As a result
XZError.checkTypeSHA256
is now never thrown and will be removed in the next major update.
- As a result
- Added
ZipEntryInfo.crc
property. - Fixed a problem where
XZArchive.unarchive
andXZArchive.splitUnarchive
functions would produce incorrect result when more than one "filter" was used (though it was practically impossible to encounter this issue since only one filter was supported (LZMA2) until this update). - Reduced in-memory size of
ZipEntryInfo
instances.- Some rough estimates indicate that the reduction is up to 68%.
- Clarified documentation for
LZMA.decompress(data:)
to explain expectation aboutdata
argument.- Particularly, it is explained that it expects LZMA properties encoded with standard LZMA encoding scheme at the beginning of
data
.
- Particularly, it is explained that it expects LZMA properties encoded with standard LZMA encoding scheme at the beginning of
- swcomp changes:
zip -i
command now also prints CRC32 for all entries.-v
is now accepted as an alias for--verbose
option.
4.5.0 Test
This is the first and only test release for the upcoming 4.5.0 update. It includes new LZMAProperties
APIs, support for SHA-256 check for XZ archives and support for delta filter in 7-ZIP and XZ, as well as a couple of fixes.
Known issue: no documentation for new APIs.
4.4.0
A couple of side notes before diving into release notes:
- I've started a github project board where I am going to track and plan changes and additions for 5.0 Update.
- If you ever wanted to financially support either this project or me you can now do so using this link.
Creating TAR containers
The main addition in this update is a set of APIs which allow to create a new TAR container.
- Added
TarContainer.create(from:)
function which creates a new TAR container with provided array ofTarEntry
objects as its content and generates container'sData
. - Added
TarCreateError
error type with a single caseutf8NonEncodable
.
Comment: This enum is planned to be merged withTarError
in 5.0. A new enum had to be created since otherwise it would be a breaking change to introduce a new case to already existing enum.
To enable reasonable usage scenarios for these new APIs, additional changes to existing APIs have been made:
TarEntry.info
andTarEntry.data
are nowvar
-properties (instead oflet
).- Accessing setter of
TarEntry.data
now automatically updatesTarEntry.info.size
withdata.count
value (or 0 ifdata
isnil
).
Comment: Maintaining consistency between these two properties is extremely important for producing correct and valid containers. - Added (or, rather, made public)
TarEntry.init(info:data:)
initializer. - Most public properties of
TarEntryInfo
are nowvar
-properties (instead oflet
). Exceptions:size
andtype
.
Comment: Propertysize
is kept read-only for reasons mentioned above. The reason for not allowing mutatingtype
property is more vague: it is hard to imagine usage scenario where changing the type of an entry makes sense. Moreover, there are some concerns about (potential future) behavior in more generic context with type-erasedContainerEntryInfo
objects, etc. - Added
TarEntryInfo.init(name:type:)
initializer.
I do realize that this set of APIs is somewhat limited. For example, it is not easy to convert ZIP container (array of ZipEntry
objects) to TAR using these new additions. But rest assured, there are plans to provide more generic functionality for creating new containers in the future (something like TarContainer.create(from entries: [ContainerEntry]) throws -> Data
).
Other Changes
- Improved compatibility with other TAR implementations:
- All string fields of TAR headers are now treated as UTF-8 strings.
Comment: This is compatible with previous behavior since ASCII strings are UTF-8 strings. - Non-well-formed numeric fields of TAR headers no longer cause
TarError.wrongField
to be thrown and instead result innil
values of corresponding properties ofTarEntryInfo
(exception:size
field).
Comment: Mainly, this change was made to accommodate situations when a TAR header field is absent (i.e. filled with NULLs). Absentsize
field is still not accepted since its value impacts the structure of the container. This particular behavior is consistent with other implementations. - Base-256 encoding of numeric fields, which is sometimes used for very big or negative values, is now supported.
- Leading NULLs and whitespaces in numeric fields are now correctly skipped.
- Sun Extended Headers are now processed as local PAX extended headers instead of being considered entries with
.unknown
type. - GNU TAR format features for incremental backups are now partially supported (access and creation time).
- All string fields of TAR headers are now treated as UTF-8 strings.
TarContainer.formatOf
now correctly returnsTarFormat.gnu
when GNU format "magic" field is encountered.- A new (copy)
Data
object is now created forTarEntry.data
property instead of using a slice of input container data.
Comment: This change makes indices ofTarEntry.data
zero-based which is consistent with other containers. This should also prevent keeping in memoryData
for the entire container until theTarEntry
object is destroyed. - Fixed incorrect file name of TAR entries from containers with GNU TAR format-specific features being used.
- Fixed
TarError.wrongPaxHeaderEntry
error being thrown when header with multi-byte UTF-8 characters is encountered. - Fixed incorrect values of
TarEntryInfo.ownerID
,groupID
,deviceMajorNumber
anddeviceMinorNumber
properties (previously, they were assumed to be encoded as decimal numbers). - Slightly improved performance of LZMA/LZMA2 operations by making internal classes declared as
final
. - swcomp changes:
- Added
-c
,--create
option totar
command which creates a new TAR container. - Output of bencmark commands is now properly flushed on non-Linux platforms.
- Results for omitted iterations of benchmark commands are now also printed.
- Iteration number in benchmark commands is now printed with leading zeros.
- Fixed compilation error on Linux platforms due to
ObjCBool
no longer being an alias forBool
.
- Added
4.4.0 Test
This is the first and only test release for the upcoming 4.4.0 update. It includes functionality for creating new TAR containers as well as numerous fixes for TAR open/info functions.
Known issue: no documentation for new APIs.
4.3.0
ZIP Custom Extra Fields
ZIP format provides capabilities to define third-party extra fields, so it is impossible for SWCompression to support all possible extra fields. In this update several APIs were added which allow users to define their own extra fields (aka "custom extra fields") and make SWCompression recognize them. All extra fields previously supported by SWCompression (aka "standard extra fields") are still supported.
- Added
ZipExtraField
protocol. - Added
ZipExtraFieldLocation
enum. - Added
ZipContainer.customExtraFields
property. - Added
ZipEntryInfo.customExtraFields
property.
To add support of a custom extra field one must first create a type which conforms to ZipExtraField
protocol. Then it must be added to ZipContainer.customExtraFields
dictionary with the key equal to the id
property of the type being added. If during execution of open(container:)
or info(container:)
functions custom extra field is found it will be processed using initializer of the provided type and stored in ZipEntryInfo.customExtraFields
property of entry where this extra field was found.
Note: It is impossible to define custom extra field with the same ID as any of the standard extra fields and make SWCompression use user-defined extra field instead of the standard one (i.e. SWCompression first checks if ID is one of the standard IDs and then tries to find it in ZipContainer.customExtraFields
dictionary).
TAR Formats
- Added
TarContainer.Format
enum which represents various formats of TAR containers. - Added
TarContainer.formatOf(container:)
function which returns format of the TAR container. - Added
-f
,--format
option to swcomp'star
command which prints format of the TAR container.
Comment: In the context of TAR containers "format" means a set of extensions to the basic TAR container layout which must be supported to successfully process given container.
Benchmark changes
- Number of benchmark iterations increased from 6 to 10.
- Benchmarks now have a zeroth iteration which is excluded from averages.
Comment: For some reason when benchmarked functions are being executed for the first time they perform significantly worse than any of the following iterations. So it was decided to drop this "zeroth" iteration from calculating of averages. This change, of course, artificially improves benchmark results, but, hopefully, makes them more reliable. On the other hand, the increase in number of iterations aims to improve accuracy of benchmarks in general.
Other changes
- Updated to support Swift 4.1.
- Minuimum required version of BitByteData is now 1.2.0.
- Added
TarEntryInfo.compressionMethod
property which is always equal to.copy
. - Added documenation for
Container.Entry
andContainerEntry.Info
associated types. - Reverted "disable symbol stripping" change from 4.2.0 update, since underlying problem was fixed in Carthage.