Skip to content

Commit

Permalink
Require Swift 5.3 (Alamofire#3495)
Browse files Browse the repository at this point in the history
* Update to Swift 5.3.

* Use correct target.
  • Loading branch information
jshier authored Nov 3, 2021
1 parent 871483e commit 6de4f23
Show file tree
Hide file tree
Showing 23 changed files with 157 additions and 87 deletions.
71 changes: 23 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,47 @@ concurrency:
group: ci
cancel-in-progress: true
jobs:
macOS_5_1:
name: Build macOS (5.1)
runs-on: macOS-10.15
env:
DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: macOS (5.1)
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean build | xcpretty
macOS_5_2:
name: Test macOS (5.2)
macOS_5_3:
name: Test macOS 10.15 (5.3)
runs-on: macOS-10.15
env:
DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: macOS (5.2)
- name: macOS 10.15 (5.3)
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean test | xcpretty
macOS_5_3:
name: Test macOS (5.3)
runs-on: macOS-10.15
macOS_5_4:
name: Test macOS 11 (5.4)
runs-on: macOS-11
env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_12.5.1.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: macOS (5.3)
- name: macOS 11 (5.4)
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean test | xcpretty
macOS_5_4:
name: Test macOS (5.4)
macOS_5_5:
name: Test macOS 11 (5.5)
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: arch -arch arm64e brew install alamofire/alamofire/firewalk || arch -arch arm64e brew upgrade alamofire/alamofire/firewalk && arch -arch x86_64 firewalk &
- name: macOS (5.4)
- name: macOS 11 (5.5)
run: set -o pipefail && arch -arch arm64e env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean test | xcpretty
Catalyst:
name: Test Catalyst
runs-on: macOS-10.15
runs-on: macOS-11
env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
Expand All @@ -80,25 +70,10 @@ jobs:
- name: Catalyst
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "platform=macOS" clean test | xcpretty
iOS:
name: Test iOS
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer
timeout-minutes: 10
strategy:
matrix:
destination: ["OS=14.5,name=iPhone 12 Pro"]
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: arch -arch arm64e brew install alamofire/alamofire/firewalk || arch -arch arm64e brew upgrade alamofire/alamofire/firewalk && arch -arch x86_64 firewalk &
- name: iOS - ${{ matrix.destination }}
run: set -o pipefail && arch -arch arm64e env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "${{ matrix.destination }}" clean test | xcpretty
iOS_15:
name: Test iOS 15
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
timeout-minutes: 10
strategy:
matrix:
Expand All @@ -113,11 +88,11 @@ jobs:
name: Test tvOS
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
timeout-minutes: 10
strategy:
matrix:
destination: ["OS=14.5,name=Apple TV"]
destination: ["OS=15.0,name=Apple TV"]
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
Expand All @@ -128,11 +103,11 @@ jobs:
name: Test watchOS
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
timeout-minutes: 10
strategy:
matrix:
destination: ["OS=7.4,name=Apple Watch Series 6 - 44mm"]
destination: ["OS=8.0,name=Apple Watch Series 7 - 45mm"]
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
Expand All @@ -143,7 +118,7 @@ jobs:
name: Test with SPM
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
Expand All @@ -155,7 +130,7 @@ jobs:
name: Linux
runs-on: ubuntu-20.04
container:
image: swift:5.4.1-focal
image: swift:5.5.1-focal
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
Expand All @@ -181,7 +156,7 @@ jobs:
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- name: Install Swift
run: |
Install-Binary -Url "https://swift.org/builds/swift-5.4.1-release/windows10/swift-5.4.1-RELEASE/swift-5.4.1-RELEASE-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
Install-Binary -Url "https://swift.org/builds/swift-5.5.1-release/windows10/swift-5.5.1-RELEASE/swift-5.5.1-RELEASE-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
- name: Set Environment Variables
run: |
echo "SDKROOT=C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Expand Down
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# file options

--symlinks ignore
--swiftversion 5.1
--swiftversion 5.3

# rules
--enable isEmpty
Expand Down
2 changes: 1 addition & 1 deletion Alamofire.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'

s.swift_versions = ['5.1', '5.2', '5.3', '5.4', '5.5']
s.swift_versions = ['5.3', '5.4', '5.5']

s.source_files = 'Source/*.swift'

Expand Down
2 changes: 1 addition & 1 deletion Alamofire.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1320;
ORGANIZATIONNAME = Alamofire;
TargetAttributes = {
31293064263E17D600473CEA = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.1
// swift-tools-version:5.5
//
// Package.swift
//
Expand Down Expand Up @@ -34,12 +34,14 @@ let package = Package(name: "Alamofire",
targets: ["Alamofire"])],
targets: [.target(name: "Alamofire",
path: "Source",
exclude: ["Info.plist"],
linkerSettings: [.linkedFramework("CFNetwork",
.when(platforms: [.iOS,
.macOS,
.tvOS,
.watchOS]))]),
.testTarget(name: "AlamofireTests",
dependencies: ["Alamofire"],
path: "Tests")],
path: "Tests",
exclude: ["Resources", "Info.plist"])],
swiftLanguageVersions: [.v5])
47 changes: 47 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// swift-tools-version:5.3
//
// [email protected]
//
// Copyright (c) 2021 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import PackageDescription

let package = Package(name: "Alamofire",
platforms: [.macOS(.v10_12),
.iOS(.v10),
.tvOS(.v10),
.watchOS(.v3)],
products: [.library(name: "Alamofire",
targets: ["Alamofire"])],
targets: [.target(name: "Alamofire",
path: "Source",
exclude: ["Info.plist"],
linkerSettings: [.linkedFramework("CFNetwork",
.when(platforms: [.iOS,
.macOS,
.tvOS,
.watchOS]))]),
.testTarget(name: "AlamofireTests",
dependencies: ["Alamofire"],
path: "Tests",
exclude: ["Resources", "Info.plist"])],
swiftLanguageVersions: [.v5])
47 changes: 47 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// swift-tools-version:5.4
//
// [email protected]
//
// Copyright (c) 2021 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import PackageDescription

let package = Package(name: "Alamofire",
platforms: [.macOS(.v10_12),
.iOS(.v10),
.tvOS(.v10),
.watchOS(.v3)],
products: [.library(name: "Alamofire",
targets: ["Alamofire"])],
targets: [.target(name: "Alamofire",
path: "Source",
exclude: ["Info.plist"],
linkerSettings: [.linkedFramework("CFNetwork",
.when(platforms: [.iOS,
.macOS,
.tvOS,
.watchOS]))]),
.testTarget(name: "AlamofireTests",
dependencies: ["Alamofire"],
path: "Tests",
exclude: ["Resources", "Info.plist"])],
swiftLanguageVersions: [.v5])
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/AlamofireLogo.png)

[![Swift](https://img.shields.io/badge/Swift-5.1_5.2_5.3_5.4-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.1_5.2_5.3_5.4-Orange?style=flat-square)
[![Swift](https://img.shields.io/badge/Swift-5.3_5.4_5.5-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.3_5.4_5.5-Orange?style=flat-square)
[![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_Linux_Windows-yellowgreen?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_Linux_Windows-Green?style=flat-square)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg?style=flat-square)](https://img.shields.io/cocoapods/v/Alamofire.svg)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage)
Expand Down Expand Up @@ -61,7 +61,7 @@ In order to keep Alamofire focused specifically on core networking implementatio

| Platform | Minimum Swift Version | Installation | Status |
| --- | --- | --- | --- |
| iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.1 | [CocoaPods](#cocoapods), [Carthage](#carthage), [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |
| iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.3 | [CocoaPods](#cocoapods), [Carthage](#carthage), [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |
| Linux | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |
| Windows | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |

Expand Down
10 changes: 5 additions & 5 deletions Source/Combine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ public struct DataResponsePublisher<Value>: Publisher {
///
/// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
map { $0.result }.eraseToAnyPublisher()
map(\.result).eraseToAnyPublisher()
}

/// Publishes the `Result` of the `DataResponse` as a single `Value` or fail with the `AFError` instance.
///
/// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
public func value() -> AnyPublisher<Value, AFError> {
setFailureType(to: AFError.self).flatMap { $0.result.publisher }.eraseToAnyPublisher()
setFailureType(to: AFError.self).flatMap(\.result.publisher).eraseToAnyPublisher()
}

public func receive<S>(subscriber: S) where S: Subscriber, DataResponsePublisher.Failure == S.Failure, DataResponsePublisher.Output == S.Input {
Expand Down Expand Up @@ -282,7 +282,7 @@ public struct DataStreamPublisher<Value>: Publisher {
///
/// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
public func value() -> AnyPublisher<Value, AFError> {
result().setFailureType(to: AFError.self).flatMap { $0.publisher }.eraseToAnyPublisher()
result().setFailureType(to: AFError.self).flatMap(\.publisher).eraseToAnyPublisher()
}

public func receive<S>(subscriber: S) where S: Subscriber, DataStreamPublisher.Failure == S.Failure, DataStreamPublisher.Output == S.Input {
Expand Down Expand Up @@ -425,14 +425,14 @@ public struct DownloadResponsePublisher<Value>: Publisher {
///
/// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
map { $0.result }.eraseToAnyPublisher()
map(\.result).eraseToAnyPublisher()
}

/// Publishes the `Result` of the `DownloadResponse` as a single `Value` or fail with the `AFError` instance.
///
/// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
public func value() -> AnyPublisher<Value, AFError> {
setFailureType(to: AFError.self).flatMap { $0.result.publisher }.eraseToAnyPublisher()
setFailureType(to: AFError.self).flatMap(\.result.publisher).eraseToAnyPublisher()
}

public func receive<S>(subscriber: S) where S: Subscriber, DownloadResponsePublisher.Failure == S.Failure, DownloadResponsePublisher.Output == S.Input {
Expand Down
Loading

0 comments on commit 6de4f23

Please sign in to comment.