ソースを参照

Distribute xcframework binary for apple platforms

Marcin Krzyzanowski 4 年 前
コミット
847edeba96
6 ファイル変更32 行追加8 行削除
  1. 3 0
      CHANGELOG
  2. 1 1
      CryptoSwift.podspec
  3. 24 1
      Package.swift
  4. 2 4
      README.md
  5. 1 1
      config/Project-Shared.xcconfig
  6. 1 1
      scripts/build-framework.sh

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+1.3.4
+- Distribute optimized binary (xcframework) via SPM for apple platforms
+
 1.3.3
 1.3.3
 - Adds OCB Authenticated-Encryption Algorithm (RFC7253)
 - Adds OCB Authenticated-Encryption Algorithm (RFC7253)
 - build-framework.sh output CryptoSwift.xcframework
 - build-framework.sh output CryptoSwift.xcframework

+ 1 - 1
CryptoSwift.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
 Pod::Spec.new do |s|
   s.name         = "CryptoSwift"
   s.name         = "CryptoSwift"
-  s.version      = "1.3.3"
+  s.version      = "1.3.4"
   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, CMAC, HDKF, Scrypt, ChaCha20, Rabbit, Blowfish, AES."
   s.summary      = "Cryptography in Swift. SHA, MD5, CRC, PBKDF, Poly1305, HMAC, CMAC, HDKF, Scrypt, ChaCha20, Rabbit, Blowfish, AES."
   s.description  = "Cryptography functions and helpers for Swift implemented in Swift. SHA-1, SHA-2, SHA-3, MD5, PBKDF1, PBKDF2, Scrypt, CRC, Poly1305, HMAC, ChaCha20, Rabbit, Blowfish, AES"
   s.description  = "Cryptography functions and helpers for Swift implemented in Swift. SHA-1, SHA-2, SHA-3, MD5, PBKDF1, PBKDF2, Scrypt, CRC, Poly1305, HMAC, ChaCha20, Rabbit, Blowfish, AES"

+ 24 - 1
Package.swift

@@ -1,7 +1,29 @@
-// swift-tools-version:5.2
+// swift-tools-version:5.3
 
 
 import PackageDescription
 import PackageDescription
 
 
+#if os(macOS)
+let package = Package(
+  name: "CryptoSwift",
+  platforms: [
+    .macOS(.v10_12), .iOS(.v9), .tvOS(.v9)
+  ],
+  products: [
+    .library(
+      name: "CryptoSwift",
+      targets: ["CryptoSwift"]
+    )
+  ],
+  targets: [
+    .binaryTarget(
+        name: "CryptoSwift",
+        url: "https://github.com/krzyzanowskim/CryptoSwift/releases/download/1.3.4/CryptoSwift.xcframework.zip",
+        checksum: "0072dd9a3bd76f0bf4922ad88424fcff8301502446e550a8f6c86c63692b7592"
+    ),
+    .testTarget(name: "TestsPerformance", dependencies: ["CryptoSwift"])
+  ]
+)
+#else
 let package = Package(
 let package = Package(
   name: "CryptoSwift",
   name: "CryptoSwift",
   platforms: [
   platforms: [
@@ -20,3 +42,4 @@ let package = Package(
   ],
   ],
   swiftLanguageVersions: [.v5]
   swiftLanguageVersions: [.v5]
 )
 )
+#endif

+ 2 - 4
README.md

@@ -113,21 +113,19 @@ It is recommended to enable [Whole-Module Optimization](https://swift.org/blog/w
 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:
 
 
 ```swift
 ```swift
-.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.3.3"))
+.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.3.4"))
 ```
 ```
 
 
 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/)
 
 
 Notice: Swift Package Manager uses debug configuration for debug Xcode build, that may result in significant (up to x10000) worse performance. Performance characteristic is different in Release build. To overcome this prolem, consider embed `CryptoSwift.xcframework` described below.
 Notice: Swift Package Manager uses debug configuration for debug Xcode build, that may result in significant (up to x10000) worse performance. Performance characteristic is different in Release build. To overcome this prolem, consider embed `CryptoSwift.xcframework` described below.
 
 
-Notice: As of Swift 5.3, it's impossible to use Swift Package Manager to distribute binary (pre-compiled, optimized) version of CryptoSwift for every platform.
-
 #### CocoaPods
 #### CocoaPods
 
 
 You can use [CocoaPods](https://cocoapods.org/pods/CryptoSwift).
 You can use [CocoaPods](https://cocoapods.org/pods/CryptoSwift).
 
 
 ```ruby
 ```ruby
-pod 'CryptoSwift', '~> 1.3.3'
+pod 'CryptoSwift', '~> 1.3.4'
 ```
 ```
 
 
 Bear in mind that CocoaPods will build CryptoSwift without [Whole-Module Optimization](https://swift.org/blog/whole-module-optimizations/) that may impact performance. You can change it manually after installation, or use [cocoapods-wholemodule](https://github.com/jedlewison/cocoapods-wholemodule) plugin.
 Bear in mind that CocoaPods will build CryptoSwift without [Whole-Module Optimization](https://swift.org/blog/whole-module-optimizations/) that may impact performance. You can change it manually after installation, or use [cocoapods-wholemodule](https://github.com/jedlewison/cocoapods-wholemodule) plugin.

+ 1 - 1
config/Project-Shared.xcconfig

@@ -5,7 +5,7 @@
 // https://github.com/dempseyatgithub/BuildSettingExtractor
 // https://github.com/dempseyatgithub/BuildSettingExtractor
 //
 //
 
 
-MARKETING_VERSION = 1.3.3
+MARKETING_VERSION = 1.3.4
 
 
 SUPPORTED_PLATFORMS = iphonesimulator iphoneos macosx appletvos watchos appletvsimulator watchsimulator
 SUPPORTED_PLATFORMS = iphonesimulator iphoneos macosx appletvos watchos appletvsimulator watchsimulator
 
 

+ 1 - 1
scripts/build-framework.sh

@@ -98,7 +98,7 @@ cp -r "${DERIVED_DATA_PATH}/Build/Products/Release-watchsimulator/CryptoSwift.fr
 rm -rf "${DERIVED_DATA_PATH}"
 rm -rf "${DERIVED_DATA_PATH}"
 
 
 # XCFRAMEWORK
 # XCFRAMEWORK
-xcrun xcodebuild -create-xcframework \
+xcrun xcodebuild -quiet -create-xcframework \
 	-framework "${OUTPUT_DIR}/iphoneos/CryptoSwift.framework" \
 	-framework "${OUTPUT_DIR}/iphoneos/CryptoSwift.framework" \
 	-framework "${OUTPUT_DIR}/iphonesimulator/CryptoSwift.framework" \
 	-framework "${OUTPUT_DIR}/iphonesimulator/CryptoSwift.framework" \
 	-framework "${OUTPUT_DIR}/appletvos/CryptoSwift.framework" \
 	-framework "${OUTPUT_DIR}/appletvos/CryptoSwift.framework" \