浏览代码

Update SPM for Swift 4. Update Tests for SPM

Marcin Krzyżanowski 8 年之前
父节点
当前提交
daafe952bf

+ 1 - 0
CHANGELOG

@@ -2,6 +2,7 @@
 - Adds Padding enum (.pkcs5, .pkcs7, .noPadding, .zeroPadding)
 - Adds Padding enum (.pkcs5, .pkcs7, .noPadding, .zeroPadding)
 - Removes Generics from the public API.
 - Removes Generics from the public API.
 - Slightly improves SHA1, SHA2, SHA3 performance.
 - Slightly improves SHA1, SHA2, SHA3 performance.
+- Update SPM configuration for Swift 4
 
 
 0.7.1
 0.7.1
 - Swift 4.0 compatibility release
 - Swift 4.0 compatibility release

+ 2 - 2
CryptoSwift.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
 Pod::Spec.new do |s|
   s.name         = "CryptoSwift"
   s.name         = "CryptoSwift"
-  s.version      = "0.7.1"
+  s.version      = "0.7.2"
   s.source       = { :git => "https://github.com/krzyzanowskim/CryptoSwift.git", :tag => "#{s.version}" }
   s.source       = { :git => "https://github.com/krzyzanowskim/CryptoSwift.git", :tag => "#{s.version}" }
   s.summary      = "Cryptography in Swift. SHA, MD5, CRC, PBKDF, Poly1305, HMAC, ChaCha20, Rabbit, Blowfish, AES."
   s.summary      = "Cryptography in Swift. SHA, MD5, CRC, PBKDF, Poly1305, HMAC, ChaCha20, Rabbit, Blowfish, AES."
   s.description  = "Cryptography functions and helpers for Swift implemented in Swift. SHA, MD5, PBKDF1, PBKDF2, CRC, Poly1305, HMAC, ChaCha20, Rabbit, Blowfish, AES."
   s.description  = "Cryptography functions and helpers for Swift implemented in Swift. SHA, MD5, PBKDF1, PBKDF2, CRC, Poly1305, HMAC, ChaCha20, Rabbit, Blowfish, AES."
@@ -14,5 +14,5 @@ Pod::Spec.new do |s|
   s.tvos.deployment_target = "9.0"
   s.tvos.deployment_target = "9.0"
   s.source_files  = "Sources/CryptoSwift/**/*.swift"
   s.source_files  = "Sources/CryptoSwift/**/*.swift"
   s.requires_arc = true
   s.requires_arc = true
-  s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0', 'SWIFT_OPTIMIZATION_LEVEL' => '-Owholemodule' }
+  s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0', 'SWIFT_OPTIMIZATION_LEVEL' => '-Owholemodule', 'SWIFT_DISABLE_SAFETY_CHECKS' => 'YES', 'GCC_UNROLL_LOOPS' => 'YES'}
 end
 end

+ 8 - 1
Package.swift

@@ -1,3 +1,10 @@
+// swift-tools-version:4.0
+
 import PackageDescription
 import PackageDescription
 
 
-let package = Package(name: "CryptoSwift", swiftLanguageVersions: [4])
+let _ = Package(name: "CryptoSwift", products: [.library(name: "CryptoSwift", targets: ["CryptoSwift"])],
+              targets: [
+                  .target(name:"CryptoSwift"),
+                  .testTarget(name:"CryptoSwiftTests",dependencies:["CryptoSwift"])
+              ],
+              swiftLanguageVersions: [4])

+ 8 - 4
README.md

@@ -149,14 +149,18 @@ Run `carthage` to build the framework and drag the built CryptoSwift.framework i
 
 
 You can use [Swift Package Manager](https://swift.org/package-manager/) and specify dependency in `Package.swift` by adding this:
 You can use [Swift Package Manager](https://swift.org/package-manager/) and specify dependency in `Package.swift` by adding this:
 
 
-```
-Package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", majorVersion: 0)
+```swift
+dependencies: [
+    .Package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", majorVersion: 0)
+]
 ```
 ```
 
 
 or more strict
 or more strict
 
 
-```
-Package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", "0.7.2")
+```swift
+dependencies: [
+    .Package(url: "ttps://github.com/krzyzanowskim/CryptoSwift.git", "0.7.2"),
+]
 ```
 ```
 
 
 See: [Package.swift - manual](http://blog.krzyzanowskim.com/2016/08/09/package-swift-manual/)
 See: [Package.swift - manual](http://blog.krzyzanowskim.com/2016/08/09/package-swift-manual/)

+ 1 - 1
Sources/CryptoSwift/Info.plist

@@ -15,7 +15,7 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>0.7.1</string>
+	<string>0.7.2</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<string>????</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>

+ 2 - 0
Tests/CryptoSwiftTests/DigestTests.swift

@@ -184,6 +184,7 @@ final class DigestTests: XCTestCase {
         }
         }
 
 
         // Keep it to compare
         // Keep it to compare
+        /*
         func testSHA1PerformanceCC() {
         func testSHA1PerformanceCC() {
             measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: false) {
             measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: false) {
                 let arr = Array<UInt8>(repeating: 200, count: 1024 * 1024)
                 let arr = Array<UInt8>(repeating: 200, count: 1024 * 1024)
@@ -193,6 +194,7 @@ final class DigestTests: XCTestCase {
                 self.stopMeasuring()
                 self.stopMeasuring()
             }
             }
         }
         }
+         */
     }
     }
 
 
 #endif
 #endif

+ 15 - 11
Tests/CryptoSwiftTests/ExtensionsTest.swift

@@ -75,16 +75,6 @@ final class ExtensionsTest: XCTestCase {
         let hex = array.toHexString()
         let hex = array.toHexString()
         XCTAssertEqual(str, hex)
         XCTAssertEqual(str, hex)
     }
     }
-
-    func testArrayInitHexPerformance() {
-        var str = "b1b2b3b3b3b3b3b3b1b2b3b3b3b3b3b3"
-        for _ in 0...12 {
-            str += str
-        }
-        measure {
-            _ = Array<UInt8>(hex: str)
-        }
-    }
 }
 }
 
 
 #if !CI
 #if !CI
@@ -99,6 +89,17 @@ final class ExtensionsTest: XCTestCase {
                 self.stopMeasuring()
                 self.stopMeasuring()
             })
             })
         }
         }
+
+        func testArrayInitHexPerformance() {
+            var str = "b1b2b3b3b3b3b3b3b1b2b3b3b3b3b3b3"
+            for _ in 0...12 {
+                str += str
+            }
+            measure {
+                _ = Array<UInt8>(hex: str)
+            }
+        }
+
     }
     }
 #endif
 #endif
 
 
@@ -116,7 +117,10 @@ extension ExtensionsTest {
         ]
         ]
 
 
         #if !CI
         #if !CI
-            tests += [("testArrayChunksPerformance", testArrayChunksPerformance)]
+            tests += [
+                ("testArrayChunksPerformance", testArrayChunksPerformance),
+                ("testArrayInitHexPerformance", testArrayInitHexPerformance)
+            ]
         #endif
         #endif
         return tests
         return tests
     }
     }