Skip to content

Commit 36f068e

Browse files
committed
Merge branch 'release-4.0.0'
2 parents 7c03fc7 + e8064ae commit 36f068e

File tree

243 files changed

+15436
-12996
lines changed

Some content is hidden

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

243 files changed

+15436
-12996
lines changed

.codeclimate.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ playground.xcworkspace
4141
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
4242
# Packages/
4343
.build/
44+
Package.pins
4445

4546
# CocoaPods
4647
#
@@ -68,3 +69,9 @@ fastlane/report.xml
6869
fastlane/Preview.html
6970
fastlane/screenshots
7071
fastlane/test_output
72+
73+
# Ignore symbolic link to swcomp executable built by SPM.
74+
swcomp
75+
76+
# Ignore Package.resolved, because there is no dependencies by default for this package.
77+
Package.resolved

.jazzy.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ clean: true
33
exclude: Tests/
44
author: Timofey Solomko
55
module: SWCompression
6-
module_version: 3.4.0
6+
module_version: 4.0.0
77
copyright: '© 2017 Timofey Solomko'
88
readme: README.md
99
github_url: https://github.com/tsolomko/SWCompression
10-
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/v3.4.0
10+
github_file_prefix: https://github.com/tsolomko/SWCompression/tree/v4.0.0
1111
theme: fullwidth
1212

1313
custom_categories:
@@ -31,24 +31,34 @@ custom_categories:
3131
- SevenZipEntryInfo
3232
- TarContainer
3333
- TarEntry
34+
- TarEntryInfo
3435
- ZipContainer
3536
- ZipEntry
37+
- ZipEntryInfo
3638
- name: Errors
3739
children:
3840
- BZip2Error
3941
- DeflateError
42+
- GzipError
4043
- LZMAError
4144
- LZMA2Error
4245
- SevenZipError
4346
- TarError
44-
- ZipError
45-
- GzipError
4647
- XZError
48+
- ZipError
4749
- ZlibError
4850
- name: Protocols
4951
children:
5052
- Archive
5153
- Container
5254
- ContainerEntry
55+
- ContainerEntryInfo
5356
- CompressionAlgorithm
5457
- DecompressionAlgorithm
58+
- name: Common Auxiliary Types
59+
children:
60+
- ContainerEntryType
61+
- DosAttributes
62+
- Permissions
63+
- CompressionMethod
64+
- FileSystemType

.markdownlint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"MD007": { "indent": 4 },
33
"MD013": { "line_length": 120 },
44
"MD024": false,
5+
"MD026": { "punctuation": ".,;:!"},
56
"MD029": { "style": "ordered" }
67
}

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.1
1+
4.0

.swiftlint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ disabled_rules:
44
- function_body_length
55
- type_body_length
66
opt_in_rules:
7+
- array_init
78
- block_based_kvo
89
- conditional_returns_on_newline
10+
- contains_over_first_not_nil
911
- discouraged_direct_init
1012
- explicit_init
1113
- fatal_error_message
1214
- first_where
1315
- implicit_return
1416
- implicitly_unwrapped_optional
1517
- joined_default_parameter
18+
- literal_expression_end_indentation
1619
- no_grouping_extension
1720
- operator_usage_whitespace
1821
- pattern_matching_keywords
1922
- redundant_nil_coalescing
2023
- single_test_class
24+
- sorted_first_last
2125
- strict_fileprivate
2226
- switch_case_on_newline
2327
- trailing_closure

.travis.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
env:
22
global:
33
- FRAMEWORK_NAME=SWCompression
4-
- CC_TEST_REPORTER_ID=87379ba4ed4c1c2f6cd9ab95560364759898a0902effca0c23eddfc16a9ff5ff
5-
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
64
matrix:
75
include:
86
- language: objective-c
9-
osx_image: xcode8.3
7+
osx_image: xcode9
108
xcode_project: SWCompression.xcodeproj
119
xcode_scheme: SWCompression
1210
before_install:
13-
- gem install slather
1411
- brew update
15-
- brew upgrade carthage
12+
# `brew outdated` is necessary to prevent build error when there is no updates for Carthage.
13+
- brew outdated carthage || brew upgrade carthage
1614
- brew install git-lfs
1715
- git lfs install
1816
before_script:
1917
- cd Tests/Test\ Files
2018
- git lfs pull
2119
- cd ../..
22-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter
23-
- chmod +x ./cc-test-reporter
24-
- ./cc-test-reporter before-build
2520
before_deploy:
2621
- carthage build --no-skip-current
2722
- carthage archive $FRAMEWORK_NAME
2823
script:
2924
- xcodebuild clean build test -project SWCompression.xcodeproj -scheme SWCompression
30-
after_success:
31-
- slather coverage -x --scheme SWCompression SWCompression.xcodeproj/
32-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
3325
deploy:
3426
provider: releases
3527
api_key:

CHANGELOG.md

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

3+
## 4.0.0
4+
5+
- Reworked Container API:
6+
- New protocol: `ContainerEntryInfo`.
7+
- `ContainerEntry`:
8+
- Now has an associated type `Info: ContainerEntryInfo`.
9+
- Now has only two members: `info` and `data` properties; all previous members were removed.
10+
- `Container`:
11+
- Now has an associated type `Entry: ContainerEntry`.
12+
- `open` function now returns an array of associated type `Entry`.
13+
- Added new function `info`, which returns an array of `Entry.Info`.
14+
- All existing ZIP, TAR and 7-Zip types now conform to these protocols.
15+
- All `Entry` types now have only two members: `info` and `data` (see `ContainerEntry` protocol).
16+
- Added missing types for ZIP, TAR and 7-Zip with conformance to these protocols.
17+
- Standardized behavior when `ContainerEntry.data` can be `nil`:
18+
- If entry is a directory.
19+
- If data is unavailable, but error wasn't thrown for some reason.
20+
- 7-Zip only: if entry is an anti-file.
21+
22+
- Added several new common types, which are used across the framework:
23+
- `CompressionMethod`.
24+
- Used in `GzipHeader.compressionMethod`, `ZlibHeader.compressionMethod`, `ZipEntryInfo.compressionMethod`.
25+
- `ContainerEntryType`.
26+
- Used in `ContainerEntryInfo.type` and types that conform to `ContainerEntryInfo` protocol.
27+
- `DosAttributes`.
28+
- It is the same as previous `SevenZipEntryInfo.DosAttributes` type.
29+
- Used in `SevenZipEntryInfo.dosAttributes` and `ZipEntryInfo.dosAttributes`.
30+
- `Permissions`.
31+
- It is the same as previous `SevenZipEntryInfo.Permissions` type.
32+
- Used in `ContainerEntryInfo.permissions` and types that conform to `ContainerEntryInfo` protocol.
33+
- `FileSystemType`.
34+
- Used in `GzipHeader.osType` and `ZipEntryInfo.fileSystemType`.
35+
- Removed `GzipHeader.FileSystemType`.
36+
- Removed `GzipHeader.CompressionMethod`.
37+
- Removed `TarEntry.EntryType`.
38+
39+
- Removed following errors:
40+
- `SevenZipError.dataIsUnavailable`
41+
- `LZMAError.decoderIsNotInitialised`
42+
- `LZMA2Error.wrongProperties` (`LZMA2Error.wrongDictionarySize` is thrown instead).
43+
- `TarError.wrongUstarVersion`.
44+
- `TarError.notAsciiString` (`TarError.wrongField` is thrown instead).
45+
- `XZError.wrongFieldValue` (`XZError.wrongField` is thrown instead).
46+
- Renamed following errors:
47+
- `BZip2Error.wrongHuffmanLengthCode` to `BZip2Error.wrongHuffmanCodeLength`.
48+
- `BZip2Error.wrongCompressionMethod` to `BZip2Error.wrongVersion`.
49+
- `TarError.fieldIsNotNumber` to `TarError.wrongField`.
50+
- `XZError.reservedFieldValue` to `XZError.wrongField`.
51+
- Standardized behavior for errors named similar to `wrongCRC`:
52+
- These errors mean that everything went well, except for comparing the checksum.
53+
- Their associated values now contain all "successfully" unpacked data, including the one, which caused such an error.
54+
- This change affects `BZip2.decompress`, `GzipArchive.multiUnarchive`, `XZArchive.unarchive`,
55+
`XZArchive.splitUnarchive`, `ZipContainer.open`.
56+
- Some of these errors now have arrays as associated values to account for the situations with unpacked data split.
57+
- This change affects `GzipArchive.multiUnarchive`, `XZArchive.unarchive`, `XZArchive.splitUnarchive`, `ZipContainer.open`.
58+
59+
- Removed `SevenZipEntryInfo.isDirectory`. Use `type` property instead.
60+
- `SevenZipEntryInfo.name` is no longer `Optional`.
61+
- Now throws `SevenZipError.internalStructureError` when file names cannot be properly processed.
62+
- Entries now have empty strings as names when no names were found in container.
63+
- Renamed `XZArchive.multiUnarchive` to `XZArchive.splitUnarchive`.
64+
- `XZArchive.unarchive` now processes all XZ streams similar to `splitUnarchive`, but combines them into one output `Data`.
65+
- Fixed "bitReader is not aligned" precondition crash in Zlib.
66+
- Fixed potential incorrect behavior when opening ZIP containers with size bigger than 4 GB..
67+
- Updated to use Swift 4.
68+
- Various improvements to documentation.
69+
- "swcomp" is now included is as part of this repository.
70+
371
## 3.4.0
472

573
- Added support for BZip2 compression.

Package.swift

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
// swift-tools-version:4.0
12
import PackageDescription
23

34
let package = Package(
45
name: "SWCompression",
5-
swiftLanguageVersions: [3],
6-
exclude: [
7-
"Sources/Service/",
8-
"Tests/"
9-
]
6+
products: [
7+
.library(
8+
name: "SWCompression",
9+
targets: ["SWCompression"])
10+
],
11+
// SWCOMP: Uncomment the lines below to build swcomp example program.
12+
// dependencies: [
13+
// .package(url: "https://github.com/jakeheis/SwiftCLI", from: "4.0.0")
14+
// ],
15+
targets: [
16+
// SWCOMP: Uncomment the lines below to build swcomp example program.
17+
// .target(
18+
// name: "swcomp",
19+
// dependencies: ["SWCompression", "SwiftCLI"],
20+
// path: "Sources",
21+
// sources: ["swcomp"]),
22+
.target(
23+
name: "SWCompression",
24+
path: "Sources",
25+
sources: ["Common", "7-Zip", "BZip2", "Deflate", "GZip", "LZMA", "LZMA2", "TAR", "XZ", "ZIP", "Zlib"])
26+
],
27+
swiftLanguageVersions: [4]
1028
)

0 commit comments

Comments
 (0)