forked from vapor/sqlite-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: NativeConcurrency package trait — NIO/AsyncKit-free SQLiteKit #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
scottmarchant
wants to merge
3
commits into
feat/khasmPAL-2026
Choose a base branch
from
feat/native-concurrency-trait
base: feat/khasmPAL-2026
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
7653778
feat(embedded): rebase the embedded port onto feat/khasmPAL-2026 (kha…
scottmarchant 1618ed2
feat: NativeConcurrency package trait — NIO/AsyncKit-free SQLiteKit
scottmarchant 8ea0931
build(traits): resolve the trait-forwarded sqlite-nio/sql-kit deps fr…
scottmarchant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // swift-tools-version:6.1 | ||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "sqlite-kit", | ||
| platforms: [ | ||
| .macOS(.v10_15), | ||
| .iOS(.v13), | ||
| .watchOS(.v6), | ||
| .tvOS(.v13), | ||
| ], | ||
| products: [ | ||
| .library(name: "SQLiteKit", targets: ["SQLiteKit"]), | ||
| ], | ||
| traits: [ | ||
| .default(enabledTraits: ["NIO"]), | ||
| .trait( | ||
| name: "NIO", | ||
| description: "Default backend: SwiftNIO + AsyncKit (EventLoopFuture surface and the connection-pool source)." | ||
| ), | ||
| .trait( | ||
| name: "NativeConcurrency", | ||
| description: "NIO-free build on Swift concurrency: no AsyncKit connection pool, async-only query surface over sqlite-nio's NativeConcurrency driver. Build with `--traits NativeConcurrency` (replaces the default NIO trait)." | ||
| ), | ||
| .trait( | ||
| name: "Freestanding", | ||
| description: "Embedded/freestanding flavor (implies NativeConcurrency). No additional source effect in this package beyond NativeConcurrency; declared so a root's `--traits Freestanding` configuration names a known trait when this package is wired by path.", | ||
| enabledTraits: ["NativeConcurrency"] | ||
| ), | ||
| ], | ||
| dependencies: [ | ||
| // TODO: SM: Update swift-nio version once NIOAsyncRuntime is available from swift-nio | ||
| // .package(url: "https://github.com/apple/swift-nio.git", from: "2.89.0"), | ||
| .package(url: "https://github.com/PassiveLogic/swift-nio.git", branch: "feat/khasmPAL-2026"), | ||
|
|
||
| // TODO: SM: Update below once everything is merged and release to the proper repositories | ||
| // .package(url: "https://github.com/vapor/sqlite-nio.git", from: "1.9.0"), | ||
| .package(url: "https://github.com/PassiveLogic/sqlite-nio.git", branch: "feat/native-concurrency-trait", traits: [ | ||
| .trait(name: "default", condition: .when(traits: ["NIO"])), | ||
| .trait(name: "NativeConcurrency", condition: .when(traits: ["NativeConcurrency"])), | ||
| ]), | ||
| // .package(url: "https://github.com/vapor/sql-kit.git", from: "3.33.1"), | ||
| .package(url: "https://github.com/PassiveLogic/sql-kit.git", branch: "feat/native-concurrency-trait", traits: [ | ||
| .trait(name: "default", condition: .when(traits: ["NIO"])), | ||
| .trait(name: "NativeConcurrency", condition: .when(traits: ["NativeConcurrency"])), | ||
| ]), | ||
| // .package(url: "https://github.com/vapor/async-kit.git", from: "1.19.0"), | ||
| .package(url: "https://github.com/PassiveLogic/async-kit.git", branch: "feat/khasmPAL-2026"), | ||
| ], | ||
| targets: [ | ||
| .target( | ||
| name: "SQLiteKit", | ||
| dependencies: [ | ||
| .product(name: "SQLiteNIO", package: "sqlite-nio"), | ||
| .product(name: "SQLKit", package: "sql-kit"), | ||
| // The SwiftNIO/AsyncKit stack rides the default `NIO` trait; with | ||
| // `NativeConcurrency` enabled instead, SQLiteKit is NIO-free (no pool), | ||
| // gated in source with `#if NativeConcurrency`. | ||
| .product(name: "NIOFoundationCompat", package: "swift-nio", condition: .when(traits: ["NIO"])), | ||
| .product(name: "NIOAsyncRuntime", package: "swift-nio", condition: .when(platforms: [.wasi], traits: ["NIO"])), | ||
| .product(name: "NIOPosix", package: "swift-nio", condition: .when(traits: ["NIO"])), | ||
| .product(name: "AsyncKit", package: "async-kit", condition: .when(traits: ["NIO"])), | ||
| ], | ||
| swiftSettings: swiftSettings | ||
| ), | ||
| .testTarget( | ||
| name: "SQLiteKitTests", | ||
| dependencies: [ | ||
| .product(name: "SQLKitBenchmark", package: "sql-kit"), | ||
| .target(name: "SQLiteKit"), | ||
| ], | ||
| swiftSettings: swiftSettings | ||
| ), | ||
| ] | ||
| ) | ||
|
|
||
| var swiftSettings: [SwiftSetting] { [ | ||
| // This manifest raises the tools-version to 6.1 (for package traits); the package sources | ||
| // stay in the Swift 5 language mode of the earlier manifests. | ||
| .swiftLanguageMode(.v5), | ||
| .enableUpcomingFeature("ExistentialAny"), | ||
| .enableUpcomingFeature("ConciseMagicFile"), | ||
| .enableUpcomingFeature("ForwardTrailingClosures"), | ||
| .enableUpcomingFeature("DisableOutwardActorInference"), | ||
| .enableExperimentalFeature("StrictConcurrency=complete"), | ||
| ] } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| @_documentation(visibility: internal) @_exported import SQLKit | ||
| @_documentation(visibility: internal) @_exported import SQLiteNIO | ||
| #if !NativeConcurrency // AsyncKit (connection pool) is elided on the NIO-free NativeConcurrency build. | ||
| @_documentation(visibility: internal) @_exported import AsyncKit | ||
| #endif | ||
| @_documentation(visibility: internal) @_exported import struct Logging.Logger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, update todo's before review. And rebase on main. Try to revise/revert the package.swift change here, though it might be required for the traits.