Skip to content

Commit

Permalink
Merge pull request #6 from shinjukunian/dev
Browse files Browse the repository at this point in the history
using ZipFoundation instead of SSZipArchive
  • Loading branch information
shinjukunian authored Jun 2, 2021
2 parents 7239856 + 9b49cae commit 3cea48b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 65 deletions.
60 changes: 8 additions & 52 deletions .swiftpm/xcode/xcshareddata/xcschemes/DocX.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DocX_DocX"
BuildableName = "DocX_DocX"
BlueprintName = "DocX_DocX"
BlueprintIdentifier = "DocX"
BuildableName = "DocX"
BlueprintName = "DocX"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
Expand All @@ -34,48 +34,6 @@
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DocX"
BuildableName = "DocX"
BlueprintName = "DocX"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DocX-iOS-Tests"
BuildableName = "DocX-iOS-Tests"
BlueprintName = "DocX-iOS-Tests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DocXTests"
BuildableName = "DocXTests"
BlueprintName = "DocXTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand All @@ -99,9 +57,7 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DocX-iOS-Tests"
Expand Down Expand Up @@ -142,9 +98,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DocX_DocX"
BuildableName = "DocX_DocX"
BlueprintName = "DocX_DocX"
BlueprintIdentifier = "DocX"
BuildableName = "DocX"
BlueprintName = "DocX"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
Expand Down
6 changes: 3 additions & 3 deletions DocX/NSAttributedString+DocX-macOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Foundation
import ZipArchive
import ZIPFoundation
import AEXML


Expand Down Expand Up @@ -61,8 +61,8 @@ extension NSAttributedString{
}

let zipURL=tempURL.appendingPathComponent(UUID().uuidString).appendingPathExtension("zip")
let success=SSZipArchive.createZipFile(atPath: zipURL.path, withContentsOfDirectory: docURL.path, keepParentDirectory: false)
guard success == true else{throw DocXSavingErrors.compressionFailed}

try FileManager.default.zipItem(at: docURL, to: zipURL, shouldKeepParent: false, compressionMethod: .deflate, progress: nil)

do{
try FileManager.default.copyItem(at: zipURL, to: url)
Expand Down
5 changes: 2 additions & 3 deletions DocX/NSAttributedString+Writing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import ZipArchive
import ZIPFoundation
import AEXML


Expand Down Expand Up @@ -40,8 +40,7 @@ extension NSAttributedString{
try xmlData.write(to: docPath, atomically: true, encoding: .utf8)

let zipURL=tempURL.appendingPathComponent(UUID().uuidString).appendingPathExtension("zip")
let success=SSZipArchive.createZipFile(atPath: zipURL.path, withContentsOfDirectory: docURL.path, keepParentDirectory: false)
guard success == true else{throw DocXSavingErrors.compressionFailed}
try FileManager.default.zipItem(at: docURL, to: zipURL, shouldKeepParent: false, compressionMethod: .deflate, progress: nil)

try FileManager.default.copyItem(at: zipURL, to: url)
}
Expand Down
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
}
},
{
"package": "ZipArchive",
"repositoryURL": "https://github.com/victor-pavlychko/ZipArchive.git",
"package": "ZIPFoundation",
"repositoryURL": "https://github.com/weichsel/ZIPFoundation.git",
"state": {
"branch": null,
"revision": "57b6c4814fa8608c10bfb059df651e1cba320524",
"version": null
"revision": "cf10bbff6ac3b873e97b36b9784c79866a051a8e",
"version": "0.9.12"
}
}
]
Expand Down
9 changes: 6 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ let package = Package(
targets: ["DocX"]),
],
dependencies: [
.package(name: "AEXML", url: "https://github.com/shinjukunian/AEXML.git", .branch("master")),
.package(name: "ZipArchive", url: "https://github.com/victor-pavlychko/ZipArchive.git", .revision("57b6c4814fa8608c10bfb059df651e1cba320524")),
.package(url: "https://github.com/shinjukunian/AEXML.git", .branch("master")),
// .package(name: "AEXML", url: "https://github.com/shinjukunian/AEXML.git", .branch("master")),
.package(url: "https://github.com/weichsel/ZIPFoundation.git", .upToNextMajor(from: "0.9.0")),

// .package(name: "ZipArchive", url: "https://github.com/victor-pavlychko/ZipArchive.git", .revision("57b6c4814fa8608c10bfb059df651e1cba320524")),

],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.

.target(name: "DocX",
dependencies: ["AEXML", "ZipArchive"],
dependencies: ["AEXML", "ZIPFoundation"],
path: "DocX",
exclude: ["Info.plist"],
sources: nil,
Expand Down

0 comments on commit 3cea48b

Please sign in to comment.