From c577ba265f6ff5de0cb9d4df8ed1c4320fad479d Mon Sep 17 00:00:00 2001 From: Maxim Kolesnik Date: Thu, 25 Jul 2019 15:12:23 +0300 Subject: [PATCH 1/2] Add KITURA_IOS CCurl dependencies append only for Linux or Mac --- Package.swift | 5 ++++- Sources/KituraNet/ClientRequest.swift | 7 +++++-- Sources/KituraNet/HTTP/HTTP.swift | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 27fc348..1e26139 100644 --- a/Package.swift +++ b/Package.swift @@ -29,10 +29,13 @@ var kituraNetDependencies: [Target.Dependency] = [ .byName(name: "CHTTPParser"), .byName(name: "LoggerAPI"), .byName(name: "Socket"), - .target(name: "CCurl"), .byName(name: "SSLService") ] +if ProcessInfo.processInfo.environment["KITURA_IOS"] == nil { + kituraNetDependencies.append(.target(name: "CCurl")) +} + #if os(Linux) dependencies.append(contentsOf: [ .package(url: "https://github.com/IBM-Swift/BlueSignals.git", from: "1.0.0") diff --git a/Sources/KituraNet/ClientRequest.swift b/Sources/KituraNet/ClientRequest.swift index d1819af..c6393a8 100644 --- a/Sources/KituraNet/ClientRequest.swift +++ b/Sources/KituraNet/ClientRequest.swift @@ -14,10 +14,12 @@ * limitations under the License. */ + + +#if os(Linux) || os(macOS) import LoggerAPI -import CCurl import Socket - +import CCurl import Foundation // The public API for ClientRequest erroneously defines the port as an Int16, which is @@ -805,3 +807,4 @@ private struct OneTimeInitializations { } } +#endif diff --git a/Sources/KituraNet/HTTP/HTTP.swift b/Sources/KituraNet/HTTP/HTTP.swift index 2c1db86..a0576ea 100644 --- a/Sources/KituraNet/HTTP/HTTP.swift +++ b/Sources/KituraNet/HTTP/HTTP.swift @@ -92,7 +92,7 @@ public class HTTP { public static func createServer() -> HTTPServer { return HTTPServer() } - + #if os(Linux) || os(macOS) /** Create a new `ClientRequest` using URL. @@ -153,6 +153,7 @@ public class HTTP { req.end() return req } + #endif /// A set of characters that are valid in requests. private static let allowedCharacterSet = NSCharacterSet(charactersIn:"\"#%/<>?@\\^`{|} ").inverted From bd26144135a105c096a982b2eba999442d633e67 Mon Sep 17 00:00:00 2001 From: Maxim Kolesnik Date: Thu, 25 Jul 2019 15:19:22 +0300 Subject: [PATCH 2/2] Update Package.swift --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 1e26139..8c7485f 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,7 @@ **/ import PackageDescription +import Foundation var dependencies: [Package.Dependency] = [ .package(url: "https://github.com/IBM-Swift/LoggerAPI.git", from: "1.7.3"),