From 36f0ecbf1b95d9606c03792de0dd0df7599f14ed Mon Sep 17 00:00:00 2001 From: Syo Ikeda Date: Mon, 10 Apr 2017 23:15:37 +0900 Subject: [PATCH] Work around SR-4253 by removing RequestType protocol --- .travis.yml | 6 ++++++ Sources/Tentacle/Client.swift | 8 ++++---- Sources/Tentacle/File.swift | 4 +--- Sources/Tentacle/ResourceType.swift | 4 ---- script/cibuild | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57500f4..ba9ba98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,12 @@ matrix: env: XCODE_ACTION="build-for-testing test-without-building" - xcode_scheme: Tentacle-iOS env: XCODE_ACTION="build-for-testing test-without-building" + - xcode_scheme: Tentacle-OSX + env: XCODE_ACTION="build-for-testing test-without-building" + osx_image: xcode8.3 + - xcode_scheme: Tentacle-iOS + env: XCODE_ACTION="build-for-testing test-without-building" + osx_image: xcode8.3 - xcode_scheme: update-test-fixtures env: XCODE_ACTION=build - before_script: true diff --git a/Sources/Tentacle/Client.swift b/Sources/Tentacle/Client.swift index b50c54b..b9107a0 100644 --- a/Sources/Tentacle/Client.swift +++ b/Sources/Tentacle/Client.swift @@ -55,11 +55,11 @@ extension URLRequest { return request } - internal static func create(_ url: URL, _ request: Request, _ method: HTTPMethod, _ credentials: Client.Credentials?, contentType: String? = Client.APIContentType) -> URLRequest { + internal static func create(_ url: URL, _ file: File, _ method: HTTPMethod, _ credentials: Client.Credentials?, contentType: String? = Client.APIContentType) -> URLRequest { var URLRequest = create(url, credentials, contentType: contentType) URLRequest.httpMethod = method.rawValue - let object = request.encode().JSONObject() + let object = file.encode().JSONObject() if let payload = try? JSONSerialization.data(withJSONObject: object, options: []) { URLRequest.httpBody = payload } @@ -435,8 +435,8 @@ public final class Client { } } - internal func send(_ request: Request, to endpoint: Endpoint, using method: HTTPMethod) -> SignalProducer<(Response, Request.Response), Error> where Request.Response == Request.Response.DecodedType { - let urlRequest = URLRequest.create(URL(server, endpoint), request, method, credentials) + internal func send(_ file: File, to endpoint: Endpoint, using method: HTTPMethod) -> SignalProducer<(Response, FileResponse), Error> { + let urlRequest = URLRequest.create(URL(server, endpoint), file, method, credentials) return fetch(urlRequest) .attemptMap { response, JSON in diff --git a/Sources/Tentacle/File.swift b/Sources/Tentacle/File.swift index ceff542..191dff4 100644 --- a/Sources/Tentacle/File.swift +++ b/Sources/Tentacle/File.swift @@ -32,9 +32,7 @@ public struct File { } } -extension File: RequestType { - public typealias Response = FileResponse - +extension File: Encodable, Hashable { public var hashValue: Int { return message.hashValue } diff --git a/Sources/Tentacle/ResourceType.swift b/Sources/Tentacle/ResourceType.swift index 816d338..9c21b15 100644 --- a/Sources/Tentacle/ResourceType.swift +++ b/Sources/Tentacle/ResourceType.swift @@ -12,7 +12,3 @@ import Argo public protocol ResourceType: Decodable, Hashable { static func decode(_ json: JSON) -> Decoded } - -public protocol RequestType: Encodable, Hashable { - associatedtype Response: Decodable -} diff --git a/script/cibuild b/script/cibuild index 554240c..8477925 100755 --- a/script/cibuild +++ b/script/cibuild @@ -6,10 +6,10 @@ my ($WORKSPACE, $SCHEME, $ACTION) = @ARGV; my $buildSettings = qx{xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -showBuildSettings}; -my @args = ("-workspace", $WORKSPACE, "-scheme", $SCHEME, split(/\s+/, $ACTION), "CODE_SIGNING_REQUIRED=NO", "CODE_SIGN_IDENTITY="); +my @args = ("-workspace", $WORKSPACE, "-scheme", $SCHEME, "-configuration", "Release", split(/\s+/, $ACTION), "CODE_SIGNING_REQUIRED=NO", "CODE_SIGN_IDENTITY=", "ENABLE_TESTABILITY=YES"); if ($buildSettings =~ /\bPLATFORM_NAME = iphoneos/i) { - unshift @args, "-destination", "id=31E6604A-19AA-4B68-B560-C33C584BC80D"; # iPhone 6s, iOS 10.2 + unshift @args, "-destination", "name=iPhone 6s"; unshift @args, "-sdk", "iphonesimulator"; }