diff --git a/.swift-version b/.swift-version deleted file mode 100644 index bf77d5496..000000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -4.2 diff --git a/.travis.yml b/.travis.yml index f6972ac35..73d09176a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ os: osx -osx_image: xcode10.1 +osx_image: xcode10.2 branches: only: - master @@ -15,15 +15,15 @@ env: - WATCHOS_FRAMEWORK_SCHEME="Alamofire watchOS" - EXAMPLE_SCHEME="iOS Example" matrix: - - DESTINATION="OS=5.1,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO" + - DESTINATION="OS=5.2,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO" - DESTINATION="OS=4.2,name=Apple Watch Series 3 - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO" - DESTINATION="OS=3.2,name=Apple Watch Series 2 - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO" - - DESTINATION="OS=12.1,name=iPhone XS" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=12.2,name=iPhone XS" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=11.4,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=10.3.1,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - - DESTINATION="OS=12.1,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" + - DESTINATION="OS=12.2,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" - DESTINATION="OS=11.4,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" - DESTINATION="OS=10.2,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" diff --git a/Alamofire.podspec b/Alamofire.podspec index e9213d5f3..90fe31905 100644 --- a/Alamofire.podspec +++ b/Alamofire.podspec @@ -14,6 +14,8 @@ Pod::Spec.new do |s| s.tvos.deployment_target = '10.0' s.watchos.deployment_target = '3.0' + s.swift_version = '5.0' + s.source_files = 'Source/*.swift' s.frameworks = 'CFNetwork' diff --git a/Alamofire.xcodeproj/project.pbxproj b/Alamofire.xcodeproj/project.pbxproj index e80db46b1..2e6d9cadb 100644 --- a/Alamofire.xcodeproj/project.pbxproj +++ b/Alamofire.xcodeproj/project.pbxproj @@ -1071,7 +1071,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = Alamofire; TargetAttributes = { 4CCB207C1D45563900C64D5B = { @@ -1099,12 +1099,12 @@ }; F8111E3219A95C8B0040E7D1 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; F8111E3D19A95C8B0040E7D1 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; F829C6B11A7A94F100A2CD59 = { @@ -1116,10 +1116,11 @@ }; buildConfigurationList = F8111E2D19A95C8B0040E7D1 /* Build configuration list for PBXProject "Alamofire" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = F8111E2919A95C8B0040E7D1; productRefGroup = F8111E3419A95C8B0040E7D1 /* Products */; @@ -1718,6 +1719,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1776,7 +1778,7 @@ PRODUCT_NAME = Alamofire; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 10.0; VERSIONING_SYSTEM = "apple-generic"; WATCHOS_DEPLOYMENT_TARGET = 3.0; @@ -1788,6 +1790,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; APPLICATION_EXTENSION_API_ONLY = YES; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1838,7 +1841,7 @@ PRODUCT_NAME = Alamofire; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 10.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme b/Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme index 60dc2b734..e64738b50 100644 --- a/Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme +++ b/Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme @@ -1,6 +1,6 @@ 1.6.0.beta.2" +gem "cocoapods", "~> 1.6" gem "xcpretty" gem "jazzy" diff --git a/Gemfile.lock b/Gemfile.lock index c292cb2bd..c1eaa8647 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.0) - activesupport (4.2.11) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -32,7 +32,7 @@ GEM activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.3) + cocoapods-deintegrate (1.0.4) cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap @@ -43,7 +43,7 @@ GEM netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) escape (0.0.4) ffi (1.10.0) fourflusher (2.2.0) @@ -98,7 +98,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6.0.beta.2) + cocoapods (~> 1.6) jazzy xcpretty diff --git a/Package.swift b/Package.swift index 3c3c47bcb..74a579fda 100644 --- a/Package.swift +++ b/Package.swift @@ -43,5 +43,5 @@ let package = Package( name: "Alamofire", path: "Source") ], - swiftLanguageVersions: [.v4] + swiftLanguageVersions: [.v5] ) diff --git a/Source/ServerTrustEvaluation.swift b/Source/ServerTrustEvaluation.swift index 6ee0d4033..3f90e9c07 100644 --- a/Source/ServerTrustEvaluation.swift +++ b/Source/ServerTrustEvaluation.swift @@ -519,7 +519,7 @@ public extension AlamofireExtension where ExtendedType == Array } /// All public `SecKey` values for the contained `SecCertificate`s. - public var publicKeys: [SecKey] { + var publicKeys: [SecKey] { return type.compactMap { $0.af.publicKey } } } diff --git a/Tests/ParameterEncoderTests.swift b/Tests/ParameterEncoderTests.swift index 5fd2cc4e5..55e0fa937 100644 --- a/Tests/ParameterEncoderTests.swift +++ b/Tests/ParameterEncoderTests.swift @@ -370,7 +370,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { // Then let expected = "four%5B%5D=1&four%5B%5D=2&four%5B%5D=3&three=1&one=one&two=2&five%5Ba%5D=a&six%5Ba%5D%5Bb%5D=b&seven%5Ba%5D=a" - XCTAssertEqual(result.value, expected) + XCTAssertQueryEqual(result.value, expected) } func testThatManuallyEncodableStructCanBeEncoded() { @@ -383,7 +383,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { // Then let expected = "root%5B%5D%5B%5D=1&root%5B%5D%5B%5D=2&root%5B%5D%5B%5D=3&root%5B%5D%5Ba%5D%5Bstring%5D=string&root%5B%5D%5B%5D%5B%5D=1&root%5B%5D%5B%5D%5B%5D=2&root%5B%5D%5B%5D%5B%5D=3" - XCTAssertEqual(result.value, expected) + XCTAssertQueryEqual(result.value, expected) } func testThatEncodableClassWithNoInheritanceCanBeEncoded() { @@ -395,7 +395,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { let result = Result { try encoder.encode(parameters) } // Then - XCTAssertEqual(result.value, "two=2&one=one&three=1") + XCTAssertQueryEqual(result.value, "two=2&one=one&three=1") } func testThatEncodableSubclassCanBeEncoded() { @@ -408,7 +408,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { // Then let expected = "four%5B%5D=1&four%5B%5D=2&four%5B%5D=3&two=2&five%5Ba%5D=a&five%5Bb%5D=b&three=1&one=one" - XCTAssertEqual(result.value, expected) + XCTAssertQueryEqual(result.value, expected) } func testThatManuallyEncodableSubclassCanBeEncoded() { @@ -421,7 +421,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { // Then let expected = "five%5Ba%5D=a&five%5Bb%5D=b&four%5Bfour%5D=one&four%5Bfive%5D=2" - XCTAssertEqual(result.value, expected) + XCTAssertQueryEqual(result.value, expected) } func testThatARootArrayCannotBeEncoded() { @@ -481,7 +481,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { let result = Result { try encoder.encode(parameters) } // Then - XCTAssertEqual(result.value, "array=1&array=2") + XCTAssertQueryEqual(result.value, "array=1&array=2") } func testThatSpacesCanBeEncodedAsPluses() { @@ -521,7 +521,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { let result = Result { try encoder.encode(parameters) } // Then - XCTAssertEqual(result.value, + XCTAssertQueryEqual(result.value, "uppercase=ABCDEFGHIJKLMNOPQRSTUVWXYZ&numbers=0123456789&lowercase=abcdefghijklmnopqrstuvwxyz") } @@ -560,7 +560,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { let result = Result { try encoder.encode(parameters) } // Then - XCTAssertEqual(result.value, "foobar=bazqux&foo%26bar=baz%26qux") + XCTAssertQueryEqual(result.value, "foobar=bazqux&foo%26bar=baz%26qux") } func testThatQuestionMarksInKeysAndValuesAreNotPercentEscaped() { @@ -643,7 +643,7 @@ final class URLEncodedFormEncoderTests: BaseTestCase { "french=fran%C3%A7ais", "emoji=%F0%9F%98%83" ].joined(separator: "&") - XCTAssertEqual(result.value, expectedParameterValues) + XCTAssertQueryEqual(result.value, expectedParameterValues) } func testStringWithThousandsOfChineseCharactersIsPercentEscaped() { @@ -780,3 +780,10 @@ private struct FailingOptionalStruct: Encodable { } } } + +private func XCTAssertQueryEqual(_ query1: String?, _ query2: String?) { + let items1 = query1?.split(separator: "&").sorted() + let items2 = query2?.split(separator: "&").sorted() + + XCTAssertEqual(items1, items2) +} diff --git a/Tests/SessionTests.swift b/Tests/SessionTests.swift index e2ccfebfc..81c5dd187 100644 --- a/Tests/SessionTests.swift +++ b/Tests/SessionTests.swift @@ -306,8 +306,9 @@ class SessionTestCase: BaseTestCase { return "Alamofire/\(build)" }() - let expectedUserAgent = "Unknown/Unknown (Unknown; build:Unknown; \(osNameVersion)) \(alamofireVersion)" - XCTAssertEqual(userAgent, expectedUserAgent) + XCTAssertTrue(userAgent?.contains(alamofireVersion) == true) + XCTAssertTrue(userAgent?.contains(osNameVersion) == true) + XCTAssertTrue(userAgent?.contains("Unknown/Unknown") == true) } // MARK: Tests - Supported Accept-Encodings