Skip to content

Commit

Permalink
Adopt Swift 5.9 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Nov 29, 2023
1 parent 9f2311f commit 0b6dbe1
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 83 deletions.
44 changes: 4 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,9 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Lint Podspec
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=5.8
spm-14:
name: Build Xcode 14
runs-on: macos-13
strategy:
matrix:
platforms: [
'iOS_16,watchOS_9',
'macOS_13,tvOS_16',
]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }}
- name: Prepare Coverage Reports
run: ./Scripts/prepare-coverage-reports.sh
- name: Upload Coverage Reports
if: success()
uses: codecov/codecov-action@v3
spm-14-swift:
name: Swift Build Xcode 14
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Build and Test Framework
run: xcrun swift test -c release -Xswiftc -enable-testing
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=5.9
spm-15:
name: Build Xcode 15
runs-on: macos-13
Expand All @@ -71,7 +35,7 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }}
- name: Prepare Coverage Reports
Expand All @@ -88,6 +52,6 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build and Test Framework
run: xcrun swift test -c release -Xswiftc -enable-testing
4 changes: 2 additions & 2 deletions AsyncQueue.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = 'AsyncQueue'
s.version = '0.4.0'
s.version = '0.5.0'
s.license = 'MIT'
s.summary = 'A queue that enables ordered sending of events from synchronous to asynchronous code.'
s.homepage = 'https://github.com/dfed/swift-async-queue'
s.authors = 'Dan Federman'
s.source = { :git => 'https://github.com/dfed/swift-async-queue.git', :tag => s.version }
s.swift_version = '5.8'
s.swift_version = '5.9'
s.source_files = 'Sources/**/*.{swift}'
s.ios.deployment_target = '13.0'
s.tvos.deployment_target = '13.0'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ruby '3.0.6'

source 'https://rubygems.org'

gem 'cocoapods', '~> 1.12.0'
gem 'cocoapods', '~> 1.14.0'
40 changes: 26 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.0.7.2)
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.4)
claide (1.1.0)
cocoapods (1.12.0)
cocoapods (1.14.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.12.0)
cocoapods-core (= 1.14.3)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
Expand All @@ -32,8 +39,8 @@ GEM
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.12.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.3)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -44,7 +51,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -54,30 +61,35 @@ GEM
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
drb (2.2.0)
ruby2_keywords
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
minitest (5.19.0)
minitest (5.20.0)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.5)
rexml (3.2.6)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ruby2_keywords (0.0.5)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -89,7 +101,7 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.12.0)
cocoapods (~> 1.14.0)

RUBY VERSION
ruby 3.0.6p216
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ func testMainActorQueueOrdering() async {

## Requirements

* Xcode 14.3 or later.
* Xcode 15.0 or later.
* iOS 13 or later.
* tvOS 13 or later.
* watchOS 6 or later.
* macOS 10.15 or later.
* Swift 5.8 or later.
* Swift 5.9 or later.

## Installation

Expand All @@ -183,7 +183,7 @@ To install swift-async-queue in your iOS project with [Swift Package Manager](ht

```swift
dependencies: [
.package(url: "https://github.com/dfed/swift-async-queue", from: "0.4.0"),
.package(url: "https://github.com/dfed/swift-async-queue", from: "0.5.0"),
]
```

Expand All @@ -193,7 +193,7 @@ To install swift-async-queue in your iOS project with [CocoaPods](http://cocoapo

```
platform :ios, '13.0'
pod 'AsyncQueue', '~> 0.4.0'
pod 'AsyncQueue', '~> 0.5.0'
```

## Contributing
Expand Down
9 changes: 2 additions & 7 deletions Sources/AsyncQueue/ActorQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,8 @@ public final class ActorQueue<ActorType: Actor>: @unchecked Sendable {

/// Instantiates an actor queue.
public init() {
var capturedTaskStreamContinuation: AsyncStream<ActorTask>.Continuation? = nil
let taskStream = AsyncStream<ActorTask> { continuation in
capturedTaskStreamContinuation = continuation
}
// Continuation will be captured during stream creation, so it is safe to force unwrap here.
// If this force-unwrap fails, something is fundamentally broken in the Swift runtime.
taskStreamContinuation = capturedTaskStreamContinuation!
let (taskStream, taskStreamContinuation) = AsyncStream<ActorTask>.makeStream()
self.taskStreamContinuation = taskStreamContinuation

Task.detached {
for await actorTask in taskStream {
Expand Down
9 changes: 2 additions & 7 deletions Sources/AsyncQueue/FIFOQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ public final class FIFOQueue: Sendable {
/// Instantiates a FIFO queue.
/// - Parameter priority: The baseline priority of the tasks added to the asynchronous queue.
public init(priority: TaskPriority? = nil) {
var capturedTaskStreamContinuation: AsyncStream<@Sendable () async -> Void>.Continuation? = nil
let taskStream = AsyncStream<@Sendable () async -> Void> { continuation in
capturedTaskStreamContinuation = continuation
}
// Continuation will be captured during stream creation, so it is safe to force unwrap here.
// If this force-unwrap fails, something is fundamentally broken in the Swift runtime.
taskStreamContinuation = capturedTaskStreamContinuation!
let (taskStream, taskStreamContinuation) = AsyncStream<@Sendable () async -> Void>.makeStream()
self.taskStreamContinuation = taskStreamContinuation

Task.detached(priority: priority) {
for await task in taskStream {
Expand Down
9 changes: 2 additions & 7 deletions Sources/AsyncQueue/MainActorQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ public final class MainActorQueue: Sendable {

/// Instantiates a main actor queue.
init() {
var capturedTaskStreamContinuation: AsyncStream<@Sendable @MainActor () async -> Void>.Continuation? = nil
let taskStream = AsyncStream<@Sendable @MainActor () async -> Void> { continuation in
capturedTaskStreamContinuation = continuation
}
// Continuation will be captured during stream creation, so it is safe to force unwrap here.
// If this force-unwrap fails, something is fundamentally broken in the Swift runtime.
taskStreamContinuation = capturedTaskStreamContinuation!
let (taskStream, taskStreamContinuation) = AsyncStream<@Sendable @MainActor () async -> Void>.makeStream()
self.taskStreamContinuation = taskStreamContinuation

Task.detached { @MainActor in
for await task in taskStream {
Expand Down

0 comments on commit 0b6dbe1

Please sign in to comment.