Skip to content

Commit 0c325fc

Browse files
authored
Fix build error with NIO 2.86.1 and bump minimum Swift version (#142)
* Correctly use the underscored import of NIOFileSystem, fixes compatibility with NIO 2.86.1 * Bump minimum Swift version to 6.0. Update CI and docs accordingly. * Fix compliance with InternalImportsByDefault * Fix compliance with MemberImportVisibility
1 parent 743b1a9 commit 0c325fc

File tree

17 files changed

+48
-37
lines changed

17 files changed

+48
-37
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
version: 2
2-
enable-beta-ecosystems: true
32
updates:
43
- package-ecosystem: "github-actions"
54
directory: "/"

Package.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22
import PackageDescription
33

44
let package = Package(
@@ -40,8 +40,9 @@ let package = Package(
4040

4141
var swiftSettings: [SwiftSetting] { [
4242
.enableUpcomingFeature("ExistentialAny"),
43-
.enableUpcomingFeature("ConciseMagicFile"),
44-
.enableUpcomingFeature("ForwardTrailingClosures"),
45-
.enableUpcomingFeature("DisableOutwardActorInference"),
46-
.enableExperimentalFeature("StrictConcurrency=complete"),
43+
.enableUpcomingFeature("InternalImportsByDefault"),
44+
.enableUpcomingFeature("MemberImportVisibility"),
45+
.enableUpcomingFeature("InferIsolatedConformances"),
46+
.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
47+
.enableUpcomingFeature("ImmutableWeakCaptures"),
4748
] }

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<a href="https://discord.gg/vapor"><img src="https://design.vapor.codes/images/discordchat.svg" alt="Team Chat"></a>
77
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
88
<a href="https://github.com/vapor/leaf-kit/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/vapor/leaf-kit/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration"></a>
9-
<a href="https://codecov.io/github/vapor/leaf-kit"><img src="https://img.shields.io/codecov/c/github/vapor/leaf-kit?style=plastic&logo=codecov&label=codecov"></a>
10-
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift510up.svg" alt="Swift 5.10+"></a>
9+
<a href="https://codecov.io/github/vapor/leaf-kit"><img src="https://img.shields.io/codecov/c/github/vapor/leaf-kit?style=plastic&logo=codecov&label=codecov" alt="Code Coverage"></a>
10+
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift60up.svg" alt="Swift 6.0+"></a>
1111
</p>
1212

1313
<br>

Sources/LeafKit/Docs.docc/theme-settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"theme": {
3-
"aside": { "border-radius": "16px", "border-style": "double", "border-width": "3px" },
3+
"aside": { "border-radius": "16px", "border-width": "3px", "border-style": "double" },
44
"border-radius": "0",
55
"button": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
66
"code": { "border-radius": "16px", "border-width": "1px", "border-style": "solid" },
77
"color": {
88
"leaf": { "dark": "hsl(136, 43%, 53%)", "light": "hsl(136, 33%, 48%)" },
99
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-leaf) 30%, #000 100%)",
1010
"documentation-intro-accent": "var(--color-leaf)",
11-
"documentation-intro-eyebrow": "white",
11+
"hero-eyebrow": "white",
1212
"documentation-intro-figure": "white",
13-
"documentation-intro-title": "white",
13+
"hero-title": "white",
1414
"logo-base": { "dark": "#fff", "light": "#000" },
1515
"logo-shape": { "dark": "#000", "light": "#fff" },
1616
"fill": { "dark": "#000", "light": "#fff" }
1717
},
18-
"icons": { "technology": "/leafkit/images/vapor-leafkit-logo.svg" }
18+
"icons": { "technology": "/leafkit/images/LeafKit/vapor-leafkit-logo.svg" }
1919
},
2020
"features": {
2121
"quickNavigation": { "enable": true },

Sources/LeafKit/LeafCache/DefaultLeafCache.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import NIOCore
1+
public import protocol NIOCore.EventLoop
2+
public import class NIOCore.EventLoopFuture
23
import NIOConcurrencyHelpers
34

45
public final class DefaultLeafCache: SynchronousLeafCache {

Sources/LeafKit/LeafCache/LeafCache.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import NIOCore
1+
public import protocol NIOCore.EventLoop
2+
public import class NIOCore.EventLoopFuture
23

34
/// `LeafCache` provides blind storage for compiled `LeafAST` objects.
45
///

Sources/LeafKit/LeafConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Foundation
1+
public import Foundation // there is no syntax to allow importing only String.Encoding
22
import NIOConcurrencyHelpers
33

44
/// General configuration of Leaf

Sources/LeafKit/LeafData/LeafData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Foundation
1+
public import struct Foundation.Data
22
import NIOCore
33

44
/// `LeafData` is a "pseudo-protocol" wrapping the physically storable Swift data types

Sources/LeafKit/LeafData/LeafDataRepresentable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import Foundation
1+
public import struct Foundation.Date
2+
public import struct Foundation.UUID
23

34
/// Capable of being encoded as `LeafData`.
45
public protocol LeafDataRepresentable {

Sources/LeafKit/LeafLexer/LeafLexer.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,12 @@ struct LeafLexer {
223223

224224
let next = self.src.peek()!
225225
let peekRaw = String(current) + (self.src.peekWhile { $0.isValidInNumeric })
226-
#if swift(>=6.0)
227-
var peekNum = peekRaw.replacing(String(.underscore), with: "")
228-
#else
229-
var peekNum = peekRaw.replacingOccurrences(of: String(.underscore), with: "")
230-
#endif
226+
var peekNum: String
227+
if #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) {
228+
peekNum = peekRaw.replacing(String(.underscore), with: "")
229+
} else {
230+
peekNum = peekRaw.replacingOccurrences(of: String(.underscore), with: "")
231+
}
231232
// We must be immediately preceeded by a minus to flip the sign
232233
// And only flip back if immediately preceeded by a const, tag or variable
233234
// (which we assume will provide a numeric). Grammatical errors in the

0 commit comments

Comments
 (0)