Skip to content

Commit

Permalink
Fixed Swift 6 support on linux now that it's been released
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitribouniol committed Oct 8, 2024
1 parent 01fb4cc commit 907a124
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/mochidev/AsyncSequenceReader.git", .upToNextMinor(from: "0.3.0")),
.package(url: "https://github.com/mochidev/AsyncSequenceReader.git", .upToNextMinor(from: "0.3.1")),
.package(url: "https://github.com/mochidev/Bytes.git", .upToNextMinor(from: "0.3.0")),
],
targets: [
Expand Down
10 changes: 2 additions & 8 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/mochidev/AsyncSequenceReader.git", .upToNextMinor(from: "0.3.0")),
.package(url: "https://github.com/mochidev/AsyncSequenceReader.git", .upToNextMinor(from: "0.3.1")),
.package(url: "https://github.com/mochidev/Bytes.git", .upToNextMinor(from: "0.3.0")),
],
targets: [
Expand All @@ -27,17 +27,11 @@ let package = Package(
dependencies: [
"AsyncSequenceReader",
"Bytes"
],
swiftSettings: [
.swiftLanguageVersion(.v6),
]
),
.testTarget(
name: "CodableDatastoreTests",
dependencies: ["CodableDatastore"],
swiftSettings: [
.swiftLanguageVersion(.v6),
]
dependencies: ["CodableDatastore"]
),
]
)
2 changes: 2 additions & 0 deletions Sources/CodableDatastore/Indexes/UUID+Comparable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation

/// Make UUIDs comparable on platforms that shipped without it, so that they can be used transparently as an index.
#if !canImport(FoundationEssentials)
#if swift(<5.9) || os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Windows)
#if compiler(>=6)
extension UUID: @retroactive Comparable {
Expand All @@ -28,6 +29,7 @@ extension UUID: Comparable {
}
#endif
#endif
#endif

/// Make UUIDs comparable, so that they can be used transparently as an index.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import Foundation

extension ISO8601DateFormatter {
#if compiler(>=6)
nonisolated(unsafe)
static let withMilliseconds: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.timeZone = TimeZone(secondsFromGMT: 0)
Expand All @@ -23,20 +21,6 @@ extension ISO8601DateFormatter {
]
return formatter
}()
#else
static let withMilliseconds: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.formatOptions = [
.withInternetDateTime,
.withDashSeparatorInDate,
.withColonSeparatorInTime,
.withTimeZone,
.withFractionalSeconds
]
return formatter
}()
#endif
}

extension JSONDecoder.DateDecodingStrategy {
Expand All @@ -59,8 +43,8 @@ extension JSONEncoder.DateEncodingStrategy {
}
}

#if !canImport(Darwin)
extension ISO8601DateFormatter: @unchecked Sendable {}
#if compiler(>=6)
extension ISO8601DateFormatter: @unchecked @retroactive Sendable {}
extension JSONDecoder.DateDecodingStrategy: @unchecked Sendable {}
extension JSONEncoder.DateEncodingStrategy: @unchecked Sendable {}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import XCTest

fileprivate struct SortError: Error, Equatable {}

final class DiskPersistenceDatastoreIndexTests: XCTestCase {
final class DiskPersistenceDatastoreIndexTests: XCTestCase, @unchecked Sendable {
var temporaryStoreURL: URL = FileManager.default.temporaryDirectory

override func setUp() async throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import XCTest
@testable import CodableDatastore

final class DiskPersistenceDatastoreTests: XCTestCase {
final class DiskPersistenceDatastoreTests: XCTestCase, @unchecked Sendable {
var temporaryStoreURL: URL = FileManager.default.temporaryDirectory

override func setUp() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/CodableDatastoreTests/DiskPersistenceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import XCTest
@testable import CodableDatastore

final class DiskPersistenceTests: XCTestCase {
final class DiskPersistenceTests: XCTestCase, @unchecked Sendable {
var temporaryStoreURL: URL = FileManager.default.temporaryDirectory

override func setUp() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/CodableDatastoreTests/DiskTransactionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import XCTest
@testable import CodableDatastore

final class DiskTransactionTests: XCTestCase {
final class DiskTransactionTests: XCTestCase, @unchecked Sendable {
var temporaryStoreURL: URL = FileManager.default.temporaryDirectory

override func setUp() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/CodableDatastoreTests/SnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import XCTest
@testable import CodableDatastore

final class SnapshotTests: XCTestCase {
final class SnapshotTests: XCTestCase, @unchecked Sendable {
var temporaryStoreURL: URL = FileManager.default.temporaryDirectory

override func setUp() async throws {
Expand Down

0 comments on commit 907a124

Please sign in to comment.