From d197d767696552fba28f9c681296aa749078fec9 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Tue, 8 Jun 2021 20:24:15 +0300 Subject: [PATCH 01/12] [TAR] Check if the data is truncated before extracting entry data --- Sources/TAR/TarContainer.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/TAR/TarContainer.swift b/Sources/TAR/TarContainer.swift index ad3329f3..dc6db9c7 100644 --- a/Sources/TAR/TarContainer.swift +++ b/Sources/TAR/TarContainer.swift @@ -126,6 +126,9 @@ public class TarContainer: Container { } else { let dataStartIndex = entryInfo.blockStartIndex + 512 let dataEndIndex = dataStartIndex + entryInfo.size! + // Verify that data is not truncated. + guard dataStartIndex > data.startIndex && dataEndIndex < data.endIndex + else { throw TarError.wrongField } let entryData = data.subdata(in: dataStartIndex.. Date: Tue, 8 Jun 2021 20:23:12 +0300 Subject: [PATCH 02/12] [CI] Add AZP config (with Swift 4.2), remove all but Swift 5.4 on macos from travis config --- .travis.yml | 192 -------------------------------------------- azure-pipelines.yml | 105 ++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 192 deletions(-) create mode 100644 azure-pipelines.yml diff --git a/.travis.yml b/.travis.yml index e47ec207..c82083ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,112 +3,7 @@ git: depth: 1 submodules: false jobs: - allow_failures: - # There is an issue with Swift 5.4 on Linux which fails the build. See https://bugs.swift.org/browse/SR-14594. - env: - - SWIFT_VERSION=5.4 include: - # We test only building using SPM with Swift 4.2 on macos since Carthage doesn't support multiple Swift language versions. - - stage: test - language: swift - os: osx - osx_image: xcode10.1 # Swift 4.2 - script: - - swift --version - - swift build - - swift build -c release - - stage: test - language: swift - os: osx - osx_image: xcode10.3 # Swift 5.0 - env: - - HOMEBREW_NO_INSTALL_CLEANUP=1 - - WATCHOS_ACTIONS='clean build' - - WATCHOS_SIMULATOR='Apple Watch Series 4 - 44mm' - before_install: - - brew update - install: - - ./utils.py ci install-macos - before_script: - - ./utils.py prepare-workspace macos - script: - - ./utils.py ci script-macos - - stage: test - language: swift - os: osx - osx_image: xcode11.3 # Swift 5.1 - env: - - HOMEBREW_NO_INSTALL_CLEANUP=1 - - WATCHOS_ACTIONS='clean build' - - WATCHOS_SIMULATOR='Apple Watch Series 4 - 44mm' - before_install: - - brew update - install: - - ./utils.py ci install-macos - before_script: - - ./utils.py prepare-workspace macos - script: - - ./utils.py ci script-macos - - stage: test - language: swift - os: osx - osx_image: xcode11.4 # Swift 5.2 - env: - - HOMEBREW_NO_INSTALL_CLEANUP=1 - - WATCHOS_ACTIONS='clean build' - - WATCHOS_SIMULATOR='Apple Watch Series 4 - 44mm' - before_install: - - brew update - install: - - ./utils.py ci install-macos - before_script: - - ./utils.py prepare-workspace macos - script: - - ./utils.py ci script-macos - - stage: test - # TODO: Remove this stage when the non-xcf installation method with Carthage is no longer supported. - language: swift - os: osx - osx_image: xcode12 # Swift 5.3 - env: - - HOMEBREW_NO_INSTALL_CLEANUP=1 - - WATCHOS_ACTIONS='clean build' - - WATCHOS_SIMULATOR='Apple Watch Series 6 - 44mm' - before_install: - - brew update - install: - - ./utils.py ci install-macos - before_script: - - xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) - - trap 'rm -f "$xcconfig"' INT TERM HUP EXIT - - echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig - - echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig - - export XCODE_XCCONFIG_FILE="$xcconfig" - - carthage bootstrap - - git submodule update --init --recursive - - cp "Tests/Test Files/gitattributes-copy" "Tests/Test Files/.gitattributes" - - cd "Tests/Test Files/" - - git lfs pull - - git lfs checkout - - cd - - script: - - ./utils.py ci script-macos - - stage: test - language: swift - os: osx - osx_image: xcode12.4 # Swift 5.3.2 - env: - - HOMEBREW_NO_INSTALL_CLEANUP=1 - - WATCHOS_ACTIONS='clean build' - - WATCHOS_SIMULATOR='Apple Watch Series 6 - 44mm' - before_install: - - brew update - install: - - ./utils.py ci install-macos - before_script: - - ./utils.py prepare-workspace macos --xcf - script: - - ./utils.py ci script-macos - stage: test language: swift os: osx @@ -125,90 +20,3 @@ jobs: - ./utils.py prepare-workspace macos --xcf script: - ./utils.py ci script-macos - - stage: test - language: generic - os: linux - dist: bionic - env: - - SWIFT_VERSION=4.2.3 - install: - - ./utils.py ci install-linux - script: - - ./utils.py ci script-linux - - stage: test - language: generic - os: linux - dist: bionic - env: - - SWIFT_VERSION=5.0.3 - install: - - ./utils.py ci install-linux - script: - - ./utils.py ci script-linux - - stage: test - language: generic - os: linux - dist: bionic - env: - - SWIFT_VERSION=5.1.5 - install: - - ./utils.py ci install-linux - script: - - ./utils.py ci script-linux - - stage: test - language: generic - os: linux - dist: bionic - env: - - SWIFT_VERSION=5.2.5 - install: - - ./utils.py ci install-linux - script: - - ./utils.py ci script-linux - - stage: test - language: generic - os: linux - dist: bionic - env: - - SWIFT_VERSION=5.3.3 - install: - - ./utils.py ci install-linux - script: - - ./utils.py ci script-linux - - stage: test - language: generic - os: linux - dist: bionic - env: - - SWIFT_VERSION=5.4 - install: - - ./utils.py ci install-linux - script: - - ./utils.py ci script-linux - - stage: deploy - # Don't deploy if it is a test release. - if: (tag IS present) AND (tag =~ /^\d+\.\d+\.\d+$/) - language: generic - os: osx - osx_image: xcode12 - env: - - HOMEBREW_NO_INSTALL_CLEANUP=1 - env: - secure: iavIkrus2Xd3b086nz2srMGl52yqzLuCdhyEAhMODVqkzqMQ17s10y1TNb+vkepd0HgxI9j57d5X7tfChjWuWDwE2hZKjr/Kx2DfiUr1AKQD6ymuGrq/0Vv6yL9dfPU8goFArcrsBcyVKczLtTuLCKL498ZqokkQc/3kGvzW74lv+z410MfHS9/tvToO/yXJckL6qJ2XBAiElfOO0rEkllTeCo6N3bjcHZ2o7PE0K+CHYxwNKj0TmPmuNWZ3U4fzoWzkk01re1C1l5cpSb20g+2aGyi0yYX+PomX7fIIqNq9vmmyoeNdr35yqoQv/0zFeFnps83NKmZLAjSUhiUdhlbuBLBE+w8544LOaZnMDlFmpDjgyaVnRrOh0NrBB1FwU48aGfX5ljRQmk/07FTEUjvwvGGoOpz8lrLZi148FMHEospL3Sf7d8K+Q9WdtLTGk7HCnbOVcxS6oB/SWF/Cj6n5wu+EI1floBaZEsNPR40Gd4eM/Ik/E3lDrZThGDCWQsao981wm7IfEDBR1nuMME8gpZINFANNS1+5miFaGdTnDTp4Yd5MGEFZm+K8x+TG1891NwNH1ZmKXlypJXiUzvSjbh2ViNJGekdQj9q2gj2ZFlCfHJ05adwJ4w9qRuF00HpAOD6At6EnsjDXFJeTZS5dj8fi2YsU9or8KfTFoNY= - addons: - homebrew: - packages: - - sourcekitten - update: true - install: - - gem install -N jazzy - - gem update -N cocoapods - before_deploy: - - ./utils.py ci before-deploy - deploy: - - provider: pages - github_token: $GITHUB_TOKEN - local_dir: docs - skip_cleanup: true - on: - tags: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..f64b7f7e --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,105 @@ +trigger: + branches: + exclude: + - master + tags: + include: + - '*' + exclude: + - '*-test*' + +stages: +- stage: test + displayName: 'Build & Test' + jobs: + - job: macosSwift42 + pool: + vmImage: 'macOS-10.14' + variables: + DEVELOPER_DIR: '/Applications/Xcode_10.1.app' + steps: + - script: | + set -e -o xtrace + swift --version + swift build + swift build -c release + displayName: 'Build SPM Debug & Release' + - job: macos + # TODO: Add Xcode 12.5/Swift 5.4. It requires macOS 11 which is currently unavailable on AZP. For Xcode 12.5 we can also enable testing on watchos. + strategy: + matrix: + macosSwift50: + imageName: 'macOS-10.14' + DEVELOPER_DIR: '/Applications/Xcode_10.3.app' + WATCHOS_ACTIONS: 'clean build' + WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm' + macosSwift51: + imageName: 'macOS-10.15' + DEVELOPER_DIR: '/Applications/Xcode_11.3.1.app' + WATCHOS_ACTIONS: 'clean build' + WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm' + macosSwift52: + imageName: 'macOS-10.15' + DEVELOPER_DIR: '/Applications/Xcode_11.4.1.app' + WATCHOS_ACTIONS: 'clean build' + WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm' + macosSwift53: + imageName: 'macOS-10.15' + DEVELOPER_DIR: '/Applications/Xcode_12.4.app' + WATCHOS_ACTIONS: 'clean build' + WATCHOS_SIMULATOR: 'Apple Watch Series 4 - 44mm' + UTILS_PW_XCF_FLAG: '--xcf' + # macosSwift54: + # imageName: 'macOS-11.3' + # DEVELOPER_DIR: '/Applications/Xcode_12.5.app' + # WATCHOS_ACTIONS: 'clean test' + # WATCHOS_SIMULATOR: 'Apple Watch Series 6 - 44mm' + # UTILS_PW_XCF_FLAG: '--xcf' + pool: + vmImage: $(imageName) + steps: + - script: | + set -e -o xtrace + brew update + ./utils.py ci install-macos + displayName: 'Install' + - script: ./utils.py prepare-workspace macos $UTILS_PW_XCF_FLAG + displayName: 'Prepare Workspace' + - script: ./utils.py ci script-macos + displayName: 'Build & Test' + - script: swift build -c release + displayName: 'Build SPM Release' + - job: linux + strategy: + matrix: + linuxSwift42: + imageName: 'ubuntu-18.04' + containerImage: 'swift:4.2.4' + linuxSwift50: + imageName: 'ubuntu-18.04' + containerImage: 'swift:5.0.3-bionic' + linuxSwift51: + imageName: 'ubuntu-18.04' + containerImage: 'swift:5.1.5-bionic' + linuxSwift52: + imageName: 'ubuntu-18.04' + containerImage: 'swift:5.2.5-bionic' + linuxSwift53: + imageName: 'ubuntu-18.04' + containerImage: 'swift:5.3.3-bionic' + linuxSwift54: + imageName: 'ubuntu-18.04' + containerImage: 'swift:5.4.1-bionic' + pool: + vmImage: $(imageName) + container: $[ variables['containerImage'] ] + steps: + - script: | + set -e -o xtrace + swift --version + swift build + swift build -c release # Check Release build just in case. + displayName: 'Build SPM Debug & Release' +# - stage: Deploy +# dependsOn: Test +# condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') # Deploy on tags only From 358067b43a075c0f20e19d5bdc4f935d07656905 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Tue, 8 Jun 2021 20:33:50 +0300 Subject: [PATCH 03/12] Add AZP badge to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e7e589cc..de82588f 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Swift 5.X](https://img.shields.io/badge/Swift-5.X-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://travis-ci.com/tsolomko/SWCompression.svg?branch=develop)](https://travis-ci.com/tsolomko/SWCompression) +[![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) A framework with (de)compression algorithms and functions for working with various archives and containers. From fe816ebb71e15c3364716399c4b9c3c67313d4ce Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Thu, 27 May 2021 16:40:17 +0300 Subject: [PATCH 04/12] utils.py: remove install-linux and script-linux sub-subcommands They are no longer used, since we can't use them when we use docker containers for linux ci. (cherry picked from commit 45c055dc0ce67c1d3f35591c64dbdd0c64a9ecd1) --- utils.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/utils.py b/utils.py index 2267e7eb..b48b2144 100755 --- a/utils.py +++ b/utils.py @@ -28,9 +28,6 @@ def _ci_install_macos(): _sprun_shell(script) _sprun(["git", "lfs", "install"]) -def _ci_install_linux(): - _sprun_shell("eval \"$(curl -sL https://swiftenv.fuller.li/install.sh)\"") - def _ci_script_macos(): _sprun_shell("xcodebuild -version") _sprun(["swift", "--version"]) @@ -45,25 +42,13 @@ def _ci_script_macos(): # If xcodebuild is not run inside shell, then destination parameters are ignored for some reason. _sprun_shell(" ".join(xcodebuild_command)) -def _ci_script_linux(): - env = os.environ.copy() - env["SWIFTENV_ROOT"] = env["HOME"] +"/.swiftenv" - env["PATH"] = env["SWIFTENV_ROOT"] + "/bin:" + env["SWIFTENV_ROOT"] + "/shims:"+ env["PATH"] - _sprun(["swift", "--version"], env=env) - _sprun(["swift", "build"], env=env) - _sprun(["swift", "build", "-c", "release"], env=env) - def action_ci(args): if args.cmd == "before-deploy": _ci_before_deploy() elif args.cmd == "install-macos": _ci_install_macos() - elif args.cmd == "install-linux": - _ci_install_linux() elif args.cmd == "script-macos": _ci_script_macos() - elif args.cmd == "script-linux": - _ci_script_linux() else: raise Exception("Unknown CI command") @@ -107,7 +92,7 @@ subparsers = parser.add_subparsers(title="commands", help="a command to perform" # Parser for 'ci' command. parser_ci = subparsers.add_parser("ci", help="a subset of commands used by CI", description="a subset of commands used by CI") -parser_ci.add_argument("cmd", choices=["before-deploy", "install-macos", "install-linux", "script-macos", "script-linux"], +parser_ci.add_argument("cmd", choices=["before-deploy", "install-macos", "script-macos"], help="a command to perform on CI", metavar="CI_CMD") parser_ci.set_defaults(func=action_ci) From f766fbc7ed067411f43757e3fa6ab3f3bd970dc2 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Wed, 9 Jun 2021 21:14:58 +0300 Subject: [PATCH 05/12] [TAR] Add a comment explaining why the new data indices check uses strict inequalitites --- Sources/TAR/TarContainer.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sources/TAR/TarContainer.swift b/Sources/TAR/TarContainer.swift index dc6db9c7..a8ede371 100644 --- a/Sources/TAR/TarContainer.swift +++ b/Sources/TAR/TarContainer.swift @@ -36,7 +36,8 @@ public class TarContainer: Container { */ public static func formatOf(container data: Data) throws -> Format { // TAR container should be at least 512 bytes long (when it contains only one header). - guard data.count >= 512 else { throw TarError.tooSmallFileIsPassed } + guard data.count >= 512 + else { throw TarError.tooSmallFileIsPassed } /// Object with input data which supports convenient work with bit shifts. var infoProvider = TarEntryInfoProvider(data) @@ -127,6 +128,9 @@ public class TarContainer: Container { let dataStartIndex = entryInfo.blockStartIndex + 512 let dataEndIndex = dataStartIndex + entryInfo.size! // Verify that data is not truncated. + // The data.startIndex inequality is strict since by this point at least one header (i.e. 512 bytes) + // has been processed. The data.endIndex inequality is strict since there must be a 1024 bytes-long EOF + // marker block which isn't included into any entry. guard dataStartIndex > data.startIndex && dataEndIndex < data.endIndex else { throw TarError.wrongField } let entryData = data.subdata(in: dataStartIndex.. [TarEntryInfo] { - // First, if the TAR container contains only header, it should be at least 512 bytes long. - // So we have to check this. - guard data.count >= 512 else { throw TarError.tooSmallFileIsPassed } + // TAR container should be at least 512 bytes long (when it contains only one header). + guard data.count >= 512 + else { throw TarError.tooSmallFileIsPassed } /// Object with input data which supports convenient work with bit shifts. var infoProvider = TarEntryInfoProvider(data) From 6a8413e62c05e0f0f0d6e77ef15601041dfdeb44 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Wed, 9 Jun 2021 21:15:58 +0300 Subject: [PATCH 06/12] [Tests] Update TAR empty container test to have only 1024 bytes of zeros This more closely corresponds to the notion of an empty container, containing only the EOF blocks. --- Tests/Test Files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Test Files b/Tests/Test Files index 25a663fd..b11a3090 160000 --- a/Tests/Test Files +++ b/Tests/Test Files @@ -1 +1 @@ -Subproject commit 25a663fdbeafc4047a6701c830cb7c16af0680a6 +Subproject commit b11a3090304037141155b6aab01ae49c94ee12bf From b481310c60df8848b8d4dd0e2307fb42bfa7cd9a Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Fri, 11 Jun 2021 23:30:02 +0300 Subject: [PATCH 07/12] [CI] Add building on windows with Swift 5.4 --- azure-pipelines.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f64b7f7e..426ebb25 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -100,6 +100,47 @@ stages: swift build swift build -c release # Check Release build just in case. displayName: 'Build SPM Debug & Release' + - job: windows + strategy: + matrix: + windowsSwift54: + imageName: 'windows-2019' + SWIFT_VERSION: '5.4.1' + pool: + vmImage: $(imageName) + variables: + DEVELOPER_DIR: 'C:\Library\Developer' + SDKROOT: 'C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk' + XCTEST_DIR: 'C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development' + SWIFTFLAGS: '--sdk $(SDKROOT)' + SWIFTTESTFLAGS: '-Xswiftc -I -Xswiftc $(XCTEST_DIR)\usr\lib\swift\windows\x86_64 -Xswiftc -L -Xswiftc $(XCTEST_DIR)\usr\lib\swift\windows -Xswiftc -sdk -Xswiftc $(SDKROOT)' + steps: + - task: BatchScript@1 + inputs: + filename: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/VsDevCmd.bat + arguments: -no_logo -arch=x64 -host_arch=x64 + modifyEnvironment: true + displayName: 'vsvarsall.bat' + - pwsh: Invoke-WebRequest -Uri https://swift.org/builds/swift-$(SWIFT_VERSION)-release/windows10/swift-$(SWIFT_VERSION)-RELEASE/swift-$(SWIFT_VERSION)-RELEASE-windows10.exe -OutFile swift-install.exe + displayName: 'Download Swift' + - task: BatchScript@1 + inputs: + filename: .\swift-install.exe + arguments: /install /quiet + modifyEnvironment: true + displayName: 'Install Swift' + - script: | + copy %SDKROOT%\usr\share\ucrt.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" + copy %SDKROOT%\usr\share\visualc.modulemap "%VCToolsInstallDir%\include\module.modulemap" + copy %SDKROOT%\usr\share\visualc.apinotes "%VCToolsInstallDir%\include\visualc.apinotes" + copy %SDKROOT%\usr\share\winsdk.modulemap "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" + displayName: 'Configure SDK' + - script: | + set PATH=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;%PATH% + swift.exe --version + swift.exe build %SWIFTFLAGS% + swift.exe build -c release %SWIFTFLAGS% + displayName: 'Build SPM Debug & Release' # - stage: Deploy # dependsOn: Test # condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') # Deploy on tags only From b4a75e101dcfb467e93b9af5d6502286d210aced Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 12 Jun 2021 12:38:18 +0300 Subject: [PATCH 08/12] README updates: mention Windows support, update section about Carthage difficulties during development, remove broken gh project link, fix a typo --- README.md | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index de82588f..92eb628b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ SWCompression — is a framework with a collection of functions for: 2. Reading (and sometimes writing) archives of different formats. 3. Reading (and sometimes writing) containers such as ZIP, TAR and 7-Zip. -It also works both on Apple platforms and __Linux__. +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). @@ -193,14 +193,12 @@ If you want to run tests on your computer, you need to do an additional step aft ``` 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. - -Currently, the Carthage part of this procedure may fail when using Xcode 12 or later. In that case you should manually -run `carthage update --use-xcframeworks --no-use-binaries` or use -[xconfig workaround](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md). Please also -note that when on 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. +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. 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 @@ -233,9 +231,6 @@ completely in Swift without Objective-C, it can also be used on __Linux__. ## Future plans -See [5.0 Update](https://github.com/tsolomko/SWCompression/projects/2) Project for the list of planned API changes and -new features. - - Performance... - Better Deflate compression. - Something else... @@ -249,7 +244,7 @@ new features. - [pyflate](http://www.paul.sladen.org/projects/pyflate/) - [Deflate specification](https://www.ietf.org/rfc/rfc1951.txt) - [GZip specification](https://www.ietf.org/rfc/rfc1952.txt) -- [Zlib specfication](https://www.ietf.org/rfc/rfc1950.txt) +- [Zlib specification](https://www.ietf.org/rfc/rfc1950.txt) - [LZMA SDK and specification](http://www.7-zip.org/sdk.html) - [XZ specification](http://tukaani.org/xz/xz-file-format-1.0.4.txt) - [Wikipedia article about LZMA](https://en.wikipedia.org/wiki/Lempel–Ziv–Markov_chain_algorithm) From 1fa0abce0602a9284793361b76926bdcade8b88a Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 12 Jun 2021 18:38:57 +0300 Subject: [PATCH 09/12] [docs] Add docs for LZMAProperties.init() --- Sources/LZMA/LZMAProperties.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/LZMA/LZMAProperties.swift b/Sources/LZMA/LZMAProperties.swift index 4d52418c..79051e3e 100644 --- a/Sources/LZMA/LZMAProperties.swift +++ b/Sources/LZMA/LZMAProperties.swift @@ -43,6 +43,7 @@ public struct LZMAProperties { self.dictionarySize = dictionarySize } + /// Initializes LZMA properties with default values of lc, lp, pb, and dictionary size. public init() { } init(lzmaByte: UInt8, _ dictSize: Int) throws { From ab569e826165878edb4372e6fcc083b9dd597660 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 12 Jun 2021 18:39:14 +0300 Subject: [PATCH 10/12] [docs] Don't clean docs directory in jazzy config --- .jazzy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jazzy.yaml b/.jazzy.yaml index 2a023beb..b3a73c91 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -1,6 +1,6 @@ # Run: sourcekitten doc --spm --module-name SWCompression > docs.json sourcekitten_sourcefile: docs.json -clean: true +clean: false author: Timofey Solomko module: SWCompression module_version: 4.5.10 From 6203b65595dcb469aa7b8cde6146a17fc08ef574 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 12 Jun 2021 12:41:28 +0300 Subject: [PATCH 11/12] [CI] Add github pages deployment stage to azp --- azure-pipelines.yml | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 426ebb25..ec72f9e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -141,6 +141,43 @@ stages: swift.exe build %SWIFTFLAGS% swift.exe build -c release %SWIFTFLAGS% displayName: 'Build SPM Debug & Release' -# - stage: Deploy -# dependsOn: Test -# condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') # Deploy on tags only +- stage: deploy + displayName: Deploy + dependsOn: test + # Deploy on tags only; test tags are excluded in trigger section. + condition: and(not(eq(variables['Build.Reason'], 'PullRequest')), startsWith(variables['Build.SourceBranch'], 'refs/tags')) + jobs: + - job: ghPages + displayName: 'Publish API docs to GH Pages' + pool: + vmImage: 'macOS-10.15' + variables: + DEVELOPER_DIR: '/Applications/Xcode_12.4.app' + steps: + - script: | + set -e -o xtrace + brew update + brew install sourcekitten + gem install -N jazzy + displayName: 'Install Tools' + - task: InstallSSHKey@0 + inputs: + knownHostsEntry: 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' + sshPublicKey: '$(swcPubDeployKey)' + sshKeySecureFile: 'swc_deploy_key' + displayName: 'Install an SSH key' + - script: git worktree add docs gh-pages + displayName: 'Prepare Worktree' + - script: ./utils.py ci before-deploy + displayName: 'Before Deploy' + - script: | + set -e -o xtrace + git config --local user.name "Azure Pipelines" + git config --local user.email "azuredevops@microsoft.com" + cd docs + git add --all + git commit -m "Deploy to GH Pages [skip ci]" --amend + cd .. + git remote set-url --push origin git@github.com:tsolomko/SWCompression.git + git push --force origin gh-pages:gh-pages + displayName: 'Deploy to GH Pages' From ff5732a7147e5f1ef39b00aed2a3d77dfe14956b Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 12 Jun 2021 18:50:39 +0300 Subject: [PATCH 12/12] Prepare for 4.5.11 release --- .jazzy.yaml | 4 ++-- CHANGELOG.md | 6 ++++++ SWCompression.podspec | 2 +- SWCompression.xcodeproj/SWCompression.plist | 4 ++-- SWCompression.xcodeproj/TestSWCompression.plist | 4 ++-- SWCompression.xcodeproj/project.pbxproj | 8 ++++---- Sources/swcomp/main.swift | 2 +- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.jazzy.yaml b/.jazzy.yaml index b3a73c91..247e1986 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -3,11 +3,11 @@ sourcekitten_sourcefile: docs.json clean: false author: Timofey Solomko module: SWCompression -module_version: 4.5.10 +module_version: 4.5.11 copyright: '© 2021 Timofey Solomko' readme: README.md github_url: https://github.com/tsolomko/SWCompression -github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.5.10 +github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.5.11 theme: fullwidth custom_categories: diff --git a/CHANGELOG.md b/CHANGELOG.md index d28dce1b..d47da297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 4.5.11 + +- Fixed a crash when processing a truncated TAR file. +- Added missing documentation for `LZMAProperties.init()`. +- Windows is now supported. + ## 4.5.10 - Fixed compilation issues on Windows (PR #22 by @trametheka). diff --git a/SWCompression.podspec b/SWCompression.podspec index d02424bd..a2544376 100644 --- a/SWCompression.podspec +++ b/SWCompression.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "SWCompression" - s.version = "4.5.10" + s.version = "4.5.11" 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." diff --git a/SWCompression.xcodeproj/SWCompression.plist b/SWCompression.xcodeproj/SWCompression.plist index dc55faec..29025807 100644 --- a/SWCompression.xcodeproj/SWCompression.plist +++ b/SWCompression.xcodeproj/SWCompression.plist @@ -15,9 +15,9 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.5.10 + 4.5.11 CFBundleVersion - 77 + 78 NSHumanReadableCopyright Copyright © 2021 Timofey Solomko diff --git a/SWCompression.xcodeproj/TestSWCompression.plist b/SWCompression.xcodeproj/TestSWCompression.plist index 1b2400fd..c6fd15cd 100644 --- a/SWCompression.xcodeproj/TestSWCompression.plist +++ b/SWCompression.xcodeproj/TestSWCompression.plist @@ -15,8 +15,8 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 4.5.10 + 4.5.11 CFBundleVersion - 77 + 78 diff --git a/SWCompression.xcodeproj/project.pbxproj b/SWCompression.xcodeproj/project.pbxproj index 7bcbf9eb..bd60d0fe 100644 --- a/SWCompression.xcodeproj/project.pbxproj +++ b/SWCompression.xcodeproj/project.pbxproj @@ -1258,7 +1258,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 77; + CURRENT_PROJECT_VERSION = 78; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1339,7 +1339,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 77; + CURRENT_PROJECT_VERSION = 78; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; "FRAMEWORK_SEARCH_PATHS[sdk=appletvos*]" = ( @@ -1400,7 +1400,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 77; + DYLIB_CURRENT_VERSION = 78; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -1427,7 +1427,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 77; + DYLIB_CURRENT_VERSION = 78; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; diff --git a/Sources/swcomp/main.swift b/Sources/swcomp/main.swift index 3e8b1885..860d5169 100644 --- a/Sources/swcomp/main.swift +++ b/Sources/swcomp/main.swift @@ -7,7 +7,7 @@ import Foundation import SWCompression import SwiftCLI -let cli = CLI(name: "swcomp", version: "4.5.10", +let cli = CLI(name: "swcomp", version: "4.5.11", description: """ swcomp - small command-line client for SWCompression framework. Serves as an example of SWCompression usage.