Skip to content

Commit

Permalink
Enable Swift 6 mode when available, sync QueryEngine sources (swift…
Browse files Browse the repository at this point in the history
…lang#136)

As SwiftPM is more actively developed, let's consider it to be the source of truth and vendor `QueryEngine` back into `swift-sdk-generator` together with more fresh `AsyncFileSystem` code, storing all those files in `Source/Helpers/Vendor` subdirectory.

All this allows us to fix concurrency errors that prevent it from building in Swift 6 mode.
  • Loading branch information
MaxDesiatov authored Aug 29, 2024
1 parent 13c0c51 commit ea3e824
Show file tree
Hide file tree
Showing 40 changed files with 986 additions and 710 deletions.
24 changes: 10 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ let package = Package(
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "Logging", package: "swift-log"),
.product(name: "SystemPackage", package: "swift-system"),
"GeneratorEngine",
"Helpers",
],
exclude: ["Dockerfiles"],
Expand All @@ -51,24 +50,20 @@ let package = Package(
.enableExperimentalFeature("StrictConcurrency=complete"),
]
),
.target(
name: "GeneratorEngine",
dependencies: [
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "Logging", package: "swift-log"),
.product(name: "SystemPackage", package: "swift-system"),
"Helpers",
"SystemSQLite",
]
),
.testTarget(
name: "GeneratorEngineTests",
dependencies: [
"GeneratorEngine",
"Helpers",
]
),
.target(
name: "Helpers",
dependencies: [
"SystemSQLite",
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "Logging", package: "swift-log"),
.product(name: "SystemPackage", package: "swift-system"),
],
exclude: ["Vendor/README.md"],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
Expand Down Expand Up @@ -103,7 +98,8 @@ let package = Package(
.product(name: "Logging", package: "swift-log"),
]
),
]
],
swiftLanguageVersions: [.v5, .version("6")]
)

struct Configuration {
Expand All @@ -124,7 +120,7 @@ if configuration.useAsyncHttpClient {
package.dependencies.append(
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.19.0")
)
let targetsToAppend: Set<String> = ["SwiftSDKGenerator"]
let targetsToAppend: Set<String> = ["SwiftSDKGenerator", "Helpers"]
for target in package.targets.filter({ targetsToAppend.contains($0.name) }) {
target.dependencies.append(
.product(name: "AsyncHTTPClient", package: "async-http-client")
Expand Down
6 changes: 3 additions & 3 deletions Sources/AsyncProcess/ProcessExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ private struct OutputConsumptionState: OptionSet {
}

/// Type-erasing type analogous to `AnySequence` from the Swift standard library.
private struct AnyAsyncSequence<Element>: AsyncSequence {
private let iteratorFactory: () -> AsyncIterator
private struct AnyAsyncSequence<Element>: AsyncSequence & Sendable where Element: Sendable {
private let iteratorFactory: @Sendable () -> AsyncIterator

init<S: AsyncSequence>(_ asyncSequence: S) where S.Element == Element {
init<S: AsyncSequence & Sendable>(_ asyncSequence: S) where S.Element == Element {
self.iteratorFactory = {
var iterator = asyncSequence.makeAsyncIterator()
return AsyncIterator { try await iterator.next() }
Expand Down
38 changes: 0 additions & 38 deletions Sources/GeneratorEngine/Cache/FileCacheRecord.swift

This file was deleted.

36 changes: 0 additions & 36 deletions Sources/GeneratorEngine/FileSystem/FileSystem.swift

This file was deleted.

53 changes: 0 additions & 53 deletions Sources/GeneratorEngine/FileSystem/OpenReadableFile.swift

This file was deleted.

31 changes: 0 additions & 31 deletions Sources/GeneratorEngine/FileSystem/OpenWritableFile.swift

This file was deleted.

103 changes: 0 additions & 103 deletions Sources/GeneratorEngine/FileSystem/ReadableFileStream.swift

This file was deleted.

45 changes: 0 additions & 45 deletions Sources/GeneratorEngine/FileSystem/VirtualFileSystem.swift

This file was deleted.

Loading

0 comments on commit ea3e824

Please sign in to comment.