From 2ad6131d08cad85f89d87dfca10cfe451bdb05de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 17 Oct 2021 12:18:07 +0200 Subject: [PATCH] Require canImport(_Concurrency) This fixes the build for macOS 11.5 --- GRDB/Core/DatabaseReader.swift | 2 +- GRDB/Core/DatabaseWriter.swift | 2 +- GRDB/Migration/DatabaseMigrator.swift | 6 +++--- GRDB/ValueObservation/ValueObservation.swift | 2 +- Tests/GRDBCombineTests/Support.swift | 2 +- Tests/GRDBTests/DatabaseMigratorTests.swift | 4 ++-- Tests/GRDBTests/DatabaseReaderTests.swift | 6 +++--- Tests/GRDBTests/DatabaseWriterTests.swift | 12 ++++++------ Tests/GRDBTests/ValueObservationTests.swift | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/GRDB/Core/DatabaseReader.swift b/GRDB/Core/DatabaseReader.swift index 5b1df8d06..185050ba9 100644 --- a/GRDB/Core/DatabaseReader.swift +++ b/GRDB/Core/DatabaseReader.swift @@ -307,7 +307,7 @@ extension DatabaseReader { } } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) extension DatabaseReader { // MARK: - Asynchronous Database Access diff --git a/GRDB/Core/DatabaseWriter.swift b/GRDB/Core/DatabaseWriter.swift index 0d8ed2ac6..840c8a49e 100644 --- a/GRDB/Core/DatabaseWriter.swift +++ b/GRDB/Core/DatabaseWriter.swift @@ -415,7 +415,7 @@ extension DatabaseWriter { } } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) extension DatabaseWriter { // MARK: - Asynchronous Database Access diff --git a/GRDB/Migration/DatabaseMigrator.swift b/GRDB/Migration/DatabaseMigrator.swift index 66357f174..630dafa40 100644 --- a/GRDB/Migration/DatabaseMigrator.swift +++ b/GRDB/Migration/DatabaseMigrator.swift @@ -115,7 +115,7 @@ public struct DatabaseMigrator { try migrate(writer, upTo: lastMigration.identifier) } - #if swift(>=5.5) + #if swift(>=5.5) && canImport(_Concurrency) /// Iterate migrations in the same order as they were registered. If a /// migration has not yet been applied, its block is executed in /// a transaction. @@ -147,7 +147,7 @@ public struct DatabaseMigrator { } } -#if swift(>=5.5) + #if swift(>=5.5) && canImport(_Concurrency) /// Iterate migrations in the same order as they were registered, up to the /// provided target. If a migration has not yet been applied, its block is /// executed in a transaction. @@ -162,7 +162,7 @@ public struct DatabaseMigrator { try migrate(db, upTo: targetIdentifier) } } -#endif + #endif /// Iterate migrations in the same order as they were registered. If a /// migration has not yet been applied, its block is executed in diff --git a/GRDB/ValueObservation/ValueObservation.swift b/GRDB/ValueObservation/ValueObservation.swift index 8baf5aeaa..f619fac4c 100644 --- a/GRDB/ValueObservation/ValueObservation.swift +++ b/GRDB/ValueObservation/ValueObservation.swift @@ -211,7 +211,7 @@ extension ValueObservation: Refinable { } } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) extension ValueObservation { // MARK: - Asynchronous Observation diff --git a/Tests/GRDBCombineTests/Support.swift b/Tests/GRDBCombineTests/Support.swift index f3e21774f..6b78efc6c 100644 --- a/Tests/GRDBCombineTests/Support.swift +++ b/Tests/GRDBCombineTests/Support.swift @@ -51,7 +51,7 @@ final class Test { } } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) final class AsyncTest { // Raise the repeatCount in order to help spotting flaky tests. diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index 913e59cc4..954346ad4 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -98,7 +98,7 @@ class DatabaseMigratorTests : GRDBTestCase { .runAtTemporaryDatabasePath { try DatabasePool(path: $0) } } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_NonEmptyMigratorSync() async throws { func test(writer: DatabaseWriter) async throws { @@ -423,7 +423,7 @@ class DatabaseMigratorTests : GRDBTestCase { .runAtTemporaryDatabasePath { try DatabasePool(path: $0) } } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_MigrateUpTo() async throws { func test(writer: DatabaseWriter) async throws { diff --git a/Tests/GRDBTests/DatabaseReaderTests.swift b/Tests/GRDBTests/DatabaseReaderTests.swift index f478083a1..5ec1fc2b2 100644 --- a/Tests/GRDBTests/DatabaseReaderTests.swift +++ b/Tests/GRDBTests/DatabaseReaderTests.swift @@ -30,7 +30,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabasePool()).makeSnapshot()) } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_ReadCanRead() async throws { func setup(_ dbWriter: T) throws -> T { @@ -68,7 +68,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabasePool().makeSnapshot()) } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_ReadPreventsDatabaseModification() async throws { func test(_ dbReader: DatabaseReader) async throws { @@ -107,7 +107,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabasePool()).makeSnapshot()) } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_UnsafeReadCanRead() async throws { func setup(_ dbWriter: T) throws -> T { diff --git a/Tests/GRDBTests/DatabaseWriterTests.swift b/Tests/GRDBTests/DatabaseWriterTests.swift index cc67a1a47..56bbdaab3 100644 --- a/Tests/GRDBTests/DatabaseWriterTests.swift +++ b/Tests/GRDBTests/DatabaseWriterTests.swift @@ -266,7 +266,7 @@ class DatabaseWriterTests : GRDBTestCase { try DatabaseQueue().backup(to: dbQueue) } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_write() async throws { func setup(_ dbWriter: T) throws -> T { @@ -288,7 +288,7 @@ class DatabaseWriterTests : GRDBTestCase { } #endif -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_writeWithoutTransaction() async throws { func setup(_ dbWriter: T) throws -> T { @@ -313,7 +313,7 @@ class DatabaseWriterTests : GRDBTestCase { } #endif -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_barrierWriteWithoutTransaction() async throws { func setup(_ dbWriter: T) throws -> T { @@ -338,7 +338,7 @@ class DatabaseWriterTests : GRDBTestCase { } #endif -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_erase() async throws { func setup(_ dbWriter: T) throws -> T { @@ -358,7 +358,7 @@ class DatabaseWriterTests : GRDBTestCase { } #endif -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_vacuum() async throws { func setup(_ dbWriter: T) throws -> T { @@ -376,7 +376,7 @@ class DatabaseWriterTests : GRDBTestCase { } #endif -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) func testAsyncAwait_vacuumInto() async throws { func setup(_ dbWriter: T) throws -> T { diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index 1f93de72e..7d11a2b65 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -519,7 +519,7 @@ class ValueObservationTests: GRDBTestCase { try test(makeDatabasePool()) } -#if swift(>=5.5) +#if swift(>=5.5) && canImport(_Concurrency) // MARK: - Async Await @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)