Skip to content

Commit 89cbad3

Browse files
Merge pull request #3156 from SwiftPackageIndex/swift-6-prep
Adopting Swift 6 language mode
2 parents b8c227c + f09cc24 commit 89cbad3

File tree

76 files changed

+877
-681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+877
-681
lines changed

Sources/App/Commands/TriggerBuilds.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Fluent
1616
import PostgresKit
1717
import SQLKit
1818
import Vapor
19+
@preconcurrency import SPIManifest
1920

2021

2122
struct TriggerBuildsCommand: AsyncCommand {

Sources/App/Controllers/API/API+PackageCollectionController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import Fluent
1616
import PackageCollectionsModel
17+
import PackageCollectionsSigning
1718
import Vapor
1819

1920

@@ -59,7 +60,7 @@ extension API {
5960
}
6061

6162

62-
extension SignedCollection: Content {}
63+
extension PackageCollectionSigning.Model.SignedCollection: Vapor.Content {}
6364

6465

6566
extension API {

Sources/App/Controllers/API/Types+WithExample.swift

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
import Foundation
216

317
import VaporToOpenAPI
418
import DependencyResolution
19+
import PackageCollectionsSigning
20+
521

622
// MARK: - External types
723

8-
extension Date: WithExample {
24+
extension Date: VaporToOpenAPI.WithExample {
925
public static var example: Self { .init(rfc1123: "Sat, 25 Apr 2020 10:55:00 UTC")! }
1026
}
1127

@@ -85,7 +101,7 @@ extension API.PostPackageCollectionDTO: WithExample {
85101
}
86102
}
87103

88-
extension PackageCollectionModel.V1.Collection: WithExample {
104+
extension PackageCollectionModel.V1.Collection: VaporToOpenAPI.WithExample {
89105
public static var example: Self {
90106
.init(name: "Packages by mona",
91107
overview: "A collection of packages authored by mona from the Swift Package Index",
@@ -104,7 +120,7 @@ extension PackageCollectionModel.V1.Collection: WithExample {
104120
}
105121
}
106122

107-
extension PackageCollectionModel.V1.Signature.Certificate: WithExample {
123+
extension PackageCollectionModel.V1.Signature.Certificate: VaporToOpenAPI.WithExample {
108124
public static var example: Self {
109125
.init(subject: .init(userID: "V676TFACYJ",
110126
commonName: "Swift Package Collection: SPI Operations Limited",
@@ -117,13 +133,13 @@ extension PackageCollectionModel.V1.Signature.Certificate: WithExample {
117133
}
118134
}
119135

120-
extension PackageCollectionModel.V1.Signature: WithExample {
136+
extension PackageCollectionModel.V1.Signature: VaporToOpenAPI.WithExample {
121137
public static var example: Self {
122138
.init(signature: "ewogICJhbGciIDogIlJ...<snip>...WD1pXXPrkvVJlv4w", certificate: .example)
123139
}
124140
}
125141

126-
extension SignedCollection: WithExample {
142+
extension PackageCollectionSigning.Model.SignedCollection: VaporToOpenAPI.WithExample {
127143
public static var example: Self {
128144
.init(collection: .example, signature: .example)
129145
}

Sources/App/Controllers/SiteMapController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ import Fluent
1717
import SQLKit
1818
import Plot
1919

20+
2021
enum SiteMapController {
2122

22-
static var staticRoutes: [SiteURL] = [
23+
static let staticRoutes: [SiteURL] = [
2324
.home,
2425
.addAPackage,
2526
.faq,

Sources/App/Core/AppEnvironment.swift

Lines changed: 126 additions & 114 deletions
Large diffs are not rendered by default.

Sources/App/Core/AppMetrics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Vapor
1919

2020
enum AppMetrics {
2121

22-
static var initialized = false
22+
nonisolated(unsafe) static var initialized = false
2323

2424
static func bootstrap() {
2525
// prevent tests from boostrapping multiple times

Sources/App/Core/AsyncDefer.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
16+
@discardableResult
17+
func run<T>(_ operation: () async throws -> T,
18+
defer deferredOperation: () async throws -> Void) async throws -> T {
19+
do {
20+
let result = try await operation()
21+
try await deferredOperation()
22+
return result
23+
} catch {
24+
try await deferredOperation()
25+
throw error
26+
}
27+
}

Sources/App/Core/CurrentReferenceCache.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
import Cache
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
214

15+
import Cache
316

417
typealias CurrentReferenceCache = ExpiringCache<String, String>
518

6-
719
extension CurrentReferenceCache {
820
static let live = CurrentReferenceCache(duration: .minutes(5))
921

Sources/App/Core/DocumentationTarget.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
import Fluent
16+
@preconcurrency import SPIManifest
1617

1718

1819
enum DocumentationTarget: Equatable, Codable {

Sources/App/Core/DocumentationVersion.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import Foundation
1616

1717
import Fluent
1818
import SemanticVersion
19+
@preconcurrency import SPIManifest
20+
1921

2022
struct DocumentationMetadata {
2123
var owner: String?

0 commit comments

Comments
 (0)