Skip to content

Commit

Permalink
Merge branch 'development' into feature/update_result
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinejr committed Jun 8, 2018
2 parents 4cbeaf8 + 94119c4 commit 29ee038
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 40 deletions.
63 changes: 44 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,55 @@
version: 2
defaults: &defaults
macos:
xcode: '9.3.0'
parallelism: 1
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
LANG: en_US.UTF-8
BUNDLE_PATH: vendor/bundle
jobs:
carthage_without_swiftlint_integration:
<<: *defaults
working_directory: ~/Moya/Moya_Carthage_1
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- restore_cache:
keys:
- v1-carthage-no-swiftlint-deps-{{ checksum "Cartfile.resolved" }}
- run:
name: Set Ruby Version
command: echo "ruby-2.4" > ~/.ruby-version
- run:
name: Update Homebrew
command: brew update
- run:
name: Carthage checkout
command: carthage checkout
- run:
name: Test Carthage Build before installing SwiftLint
command: carthage build --no-skip-current --cache-builds --no-use-binaries --verbose
- save_cache:
key: v1-carthage-no-swiftlint-deps-{{ checksum "Cartfile.resolved" }}
paths:
- Carthage
build:
<<: *defaults
working_directory: ~/Moya/Moya
parallelism: 1
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
LANG: en_US.UTF-8
BUNDLE_PATH: vendor/bundle
macos:
xcode: '9.2.0'
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- restore_cache:
keys:
- v1-dep-{{ .Branch }}-
- v1-dep-master-
- v1-dep-
- v1-dep-{{ checksum "Cartfile.resolved" }}
- run:
name: Set Ruby Version
command: echo "ruby-2.4" > ~/.ruby-version
- run:
name: Fetch CocoaPods Specs
command: curl -sS https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash
- run:
name: Update Homebrew
command: brew update
- run:
name: Test Carthage Build before installing SwiftLint
command: carthage build --no-skip-current --cache-builds
- run:
name: Install Swiftlint
command: brew install swiftlint
Expand All @@ -44,7 +63,7 @@ jobs:
name: Bootstrap Carthage
command: scripts/bootstrap-if-needed.sh
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
key: v1-dep-{{ checksum "Cartfile.resolved" }}
paths:
- vendor/bundle
- Carthage
Expand Down Expand Up @@ -78,3 +97,9 @@ jobs:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
workflows:
version: 2
pr_build:
jobs:
- build
- carthage_without_swiftlint_integration
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

2 changes: 2 additions & 0 deletions Moya.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'
s.source = { :git => "https://github.com/Moya/Moya.git", :tag => s.version }
s.default_subspec = "Core"
s.swift_version = '4.0'
s.cocoapods_version = '>= 1.4.0'

s.subspec "Core" do |ss|
ss.source_files = "Sources/Moya/", "Sources/Moya/Plugins/"
Expand Down
20 changes: 10 additions & 10 deletions Moya.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
149749431F8923EC00FA4900 /* AnyEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 149749421F8923EC00FA4900 /* AnyEncodable.swift */; };
149749451F892E2F00FA4900 /* URLRequest+Encoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 149749441F892E2F00FA4900 /* URLRequest+Encoding.swift */; };
15D3A2BD1223B59E2BBE09F0 /* MoyaError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D47F3DC51C28D950491FAAB /* MoyaError.swift */; };
1F8AA0BC1FE0630300C9D7B6 /* ValidationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F8AA0BB1FE0630300C9D7B6 /* ValidationType.swift */; };
1F24393320125F8200C9D813 /* EndpointClosureSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F24393220125F8200C9D813 /* EndpointClosureSpec.swift */; };
1F8AA0BC1FE0630300C9D7B6 /* ValidationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F8AA0BB1FE0630300C9D7B6 /* ValidationType.swift */; };
1FD44D9E21CEA6B6221807EF /* NetworkLoggerPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4553E5591EE96535C5310C02 /* NetworkLoggerPlugin.swift */; };
2ADDFC96D7F7912333534C46 /* SignalProducer+Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 269C64D1ABED61A91DD873D3 /* SignalProducer+Response.swift */; };
2C7132B56A7B129E12BAACAC /* EndpointSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = E825A32256FC030B8BA2684D /* EndpointSpec.swift */; };
Expand Down Expand Up @@ -150,8 +150,8 @@
149749421F8923EC00FA4900 /* AnyEncodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyEncodable.swift; sourceTree = "<group>"; };
149749441F892E2F00FA4900 /* URLRequest+Encoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLRequest+Encoding.swift"; sourceTree = "<group>"; };
14FB7A3E1F3E089900308949 /* Single+Response.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Single+Response.swift"; sourceTree = "<group>"; };
1F8AA0BB1FE0630300C9D7B6 /* ValidationType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidationType.swift; sourceTree = "<group>"; };
1F24393220125F8200C9D813 /* EndpointClosureSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EndpointClosureSpec.swift; sourceTree = "<group>"; };
1F8AA0BB1FE0630300C9D7B6 /* ValidationType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidationType.swift; sourceTree = "<group>"; };
225C397C03E17F7DFBCA2848 /* MoyaProvider+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "MoyaProvider+Internal.swift"; sourceTree = "<group>"; };
269C64D1ABED61A91DD873D3 /* SignalProducer+Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "SignalProducer+Response.swift"; sourceTree = "<group>"; };
2AD20F6A819D899E3278E903 /* NetworkActivityPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NetworkActivityPlugin.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -981,7 +981,7 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1032,7 +1032,7 @@
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1077,7 +1077,7 @@
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
Expand Down Expand Up @@ -1173,7 +1173,7 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1386,7 +1386,7 @@
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1492,7 +1492,7 @@
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1534,7 +1534,7 @@
SDKROOT = macosx;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
Expand Down Expand Up @@ -1582,7 +1582,7 @@
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down
2 changes: 1 addition & 1 deletion Sources/Moya/Image.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if os(iOS) || os(watchOS) || os(tvOS)
import UIKit.UIImage
public typealias ImageType = UIImage
#elseif os(OSX)
#elseif os(macOS)
import AppKit.NSImage
public typealias ImageType = NSImage
#endif
Expand Down
2 changes: 1 addition & 1 deletion Sources/Moya/Plugins/AccessTokenPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public struct AccessTokenPlugin: PluginType {

let authorizationType = authorizable.authorizationType
var request = request

switch authorizationType {
case .basic, .bearer, .custom:
if let value = authorizationType.value {
Expand Down
7 changes: 7 additions & 0 deletions Sources/ReactiveMoya/SignalProducer+Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import ReactiveSwift
import Moya
#endif

// just to try if this fixes the build
#if os(iOS) || os(watchOS) || os(tvOS)
import UIKit.UIImage
#elseif os(macOS)
import AppKit.NSImage
#endif

/// Extension for processing raw NSData generated by network access.
extension SignalProducerProtocol where Value == Response, Error == MoyaError {

Expand Down
7 changes: 7 additions & 0 deletions Sources/RxMoya/Observable+Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import RxSwift
import Moya
#endif

// just to try if this fixes the build
#if os(iOS) || os(watchOS) || os(tvOS)
import UIKit.UIImage
#elseif os(macOS)
import AppKit.NSImage
#endif

/// Extension for processing raw NSData generated by network access.
extension ObservableType where E == Response {

Expand Down
7 changes: 7 additions & 0 deletions Sources/RxMoya/Single+Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import RxSwift
import Moya
#endif

// just to try if this fixes the build
#if os(iOS) || os(watchOS) || os(tvOS)
import UIKit.UIImage
#elseif os(macOS)
import AppKit.NSImage
#endif

/// Extension for processing raw NSData generated by network access.
extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Response {

Expand Down
2 changes: 1 addition & 1 deletion Tests/MoyaProviderIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ final class MoyaProviderIntegrationTests: QuickSpec {

plugin = NetworkLoggerPlugin(verbose: true, output: { (_, _, printing: Any...) in
//mapping the Any... from items to a string that can be compared
let stringArray: [String] = printing.map { $0 as? String }.flatMap { $0 }
let stringArray: [String] = printing.map { $0 as? String }.compactMap { $0 }
let string: String = stringArray.reduce("") { $0 + $1 + " " }
log += string
})
Expand Down
8 changes: 4 additions & 4 deletions Tests/NetworkLoggerPluginSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ final class NetworkLoggerPluginSpec: QuickSpec {
var log = ""
let plugin = NetworkLoggerPlugin(verbose: true, output: { (_, _, printing: Any...) in
//mapping the Any... from items to a string that can be compared
let stringArray: [String] = printing.map { $0 as? String }.flatMap { $0 }
let stringArray: [String] = printing.map { $0 as? String }.compactMap { $0 }
let string: String = stringArray.reduce("") { $0 + $1 + " " }
log += string
})

let pluginWithCurl = NetworkLoggerPlugin(verbose: true, cURL: true, output: { (_, _, printing: Any...) in
//mapping the Any... from items to a string that can be compared
let stringArray: [String] = printing.map { $0 as? String }.flatMap { $0 }
let stringArray: [String] = printing.map { $0 as? String }.compactMap { $0 }
let string: String = stringArray.reduce("") { $0 + $1 + " " }
log += string
})

let pluginWithRequestDataFormatter = NetworkLoggerPlugin(verbose: true, output: { (_, _, printing: Any...) in
//mapping the Any... from items to a string that can be compared
let stringArray: [String] = printing.map { $0 as? String }.flatMap { $0 }
let stringArray: [String] = printing.map { $0 as? String }.compactMap { $0 }
let string: String = stringArray.reduce("") { $0 + $1 + " " }
log += string
}, responseDataFormatter: { _ in
Expand All @@ -33,7 +33,7 @@ final class NetworkLoggerPluginSpec: QuickSpec {

let pluginWithResponseDataFormatter = NetworkLoggerPlugin(verbose: true, output: { (_, _, printing: Any...) in
//mapping the Any... from items to a string that can be compared
let stringArray: [String] = printing.map { $0 as? String }.flatMap { $0 }
let stringArray: [String] = printing.map { $0 as? String }.compactMap { $0 }
let string: String = stringArray.reduce("") { $0 + $1 + " " }
log += string
}, responseDataFormatter: { _ in
Expand Down
6 changes: 3 additions & 3 deletions Tests/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Moya
#if os(iOS) || os(watchOS) || os(tvOS)
import UIKit
import Foundation
#elseif os(OSX)
#elseif os(macOS)
import AppKit
#endif

Expand Down Expand Up @@ -239,11 +239,11 @@ extension ImageType {
func asJPEGRepresentation(_ compression: CGFloat) -> Data? {
return UIImageJPEGRepresentation(self, compression)
}
#elseif os(OSX)
#elseif os(macOS)
func asJPEGRepresentation(_ compression: CGFloat) -> Data? {
var imageRect = CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height)
let imageRep = NSBitmapImageRep(cgImage: self.cgImage(forProposedRect: &imageRect, context: nil, hints: nil)!)
return imageRep.representation(using: .JPEG, properties: [:])
return imageRep.representation(using: .jpeg, properties: [:])
}
#endif
}
Expand Down

0 comments on commit 29ee038

Please sign in to comment.