Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
260 lines (231 loc) · 11.8 KB
/
Copy pathPackage.swift
File metadata and controls
260 lines (231 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
import CompilerPluginSupport
// swift-tools-version:6.4
import PackageDescription
let package = Package(
name: "vapor",
platforms: [
.macOS("26.2"),
.iOS("26.2"),
.tvOS("26.2"),
.watchOS("26.2"),
],
products: [
.library(name: "Vapor", targets: ["Vapor"]),
.library(name: "VaporTesting", targets: ["VaporTesting"]),
.library(name: "VaporMacros", targets: ["VaporMacros"]),
],
traits: [
.trait(name: "WebSockets"),
.trait(name: "HTTPClient"),
.trait(name: "Multipart"),
.trait(name: "MacroRouting"),
.default(enabledTraits: [
"WebSockets",
"HTTPClient",
"Multipart",
"MacroRouting",
]),
],
dependencies: [
// HTTP client library built on SwiftNIO
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.24.0"),
// 💻 APIs for creating interactive CLI tools.
.package(url: "https://github.com/vapor/console-kit.git", from: "5.0.0-beta"),
// API package for reading configuration.
.package(url: "https://github.com/apple/swift-configuration.git", from: "1.0.0", traits: ["CommandLineArguments"]),
// 🔑 Hashing (SHA2, HMAC), encryption (AES), public-key (RSA), and random data generation.
.package(url: "https://github.com/apple/swift-crypto.git", "4.0.0"..<"6.0.0"),
// 🚍 High-performance trie-node router.
.package(url: "https://github.com/vapor/routing-kit.git", from: "5.0.0-beta"),
// Event-driven network application framework for high performance protocol servers & clients, non-blocking.
.package(url: "https://github.com/apple/swift-nio.git", from: "2.101.3"),
// Bindings to OpenSSL-compatible libraries for TLS support in SwiftNIO.
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.37.2"),
// Useful code around SwiftNIO.
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.35.1"),
// Swift logging API
.package(url: "https://github.com/apple/swift-log.git", from: "1.14.0"),
// Swift metrics API
.package(url: "https://github.com/apple/swift-metrics.git", from: "2.5.0"),
// Swift tracing API
.package(url: "https://github.com/apple/swift-distributed-tracing.git", from: "1.1.0"),
// Swift service context
.package(url: "https://github.com/apple/swift-service-context.git", from: "1.0.0"),
// Common algorithms
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.0.0"),
// WebSocket client library built on SwiftNIO
// Disable until websockets are working
// .package(url: "https://github.com/vapor/websocket-kit.git", from: "2.13.0"),
// MultipartKit, Multipart encoding and decoding
.package(url: "https://github.com/vapor/multipart-kit.git", from: "5.0.0-beta.1"),
// Low-level atomic operations
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
// Service Lifecycle Management
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.6.3"),
// Swift Types for HTTP Requests
.package(url: "https://github.com/apple/swift-http-types", from: "1.7.0"),
// Common data structures
// Pin until Async Algorithms releases a fix for the Collections 1.7.0 preview APIs.
.package(url: "https://github.com/apple/swift-collections", exact: "1.6.0"),
// X509 certificate types for the Swift ecosystem
.package(url: "https://github.com/apple/swift-certificates.git", from: "1.14.0"),
// Work with certificate encoding schemes
.package(url: "https://github.com/apple/swift-asn1.git", from: "1.0.0"),
// Idiomatic Swift interfaces to system calls and low-level types
.package(url: "https://github.com/apple/swift-system.git", from: "1.8.0"),
// Swift syntax parsing and generation
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "602.0.0"),
// HTTP Server for low level request and response handling
.package(url: "https://github.com/swift-server/swift-http-server.git", .upToNextMinor(from: "0.3.0")),
],
targets: [
// Vapor
.target(
name: "Vapor",
dependencies: [
.product(name: "AsyncHTTPClient", package: "async-http-client", condition: .when(traits: ["HTTPClient"])),
.product(name: "ConsoleLogger", package: "console-kit"),
.product(name: "Configuration", package: "swift-configuration"),
.product(name: "Logging", package: "swift-log"),
.product(name: "Metrics", package: "swift-metrics"),
.product(name: "Tracing", package: "swift-distributed-tracing"),
.product(name: "ServiceContextModule", package: "swift-service-context"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOFoundationEssentialsCompat", package: "swift-nio"),
.product(name: "NIOCertificateReloading", package: "swift-nio-extras"),
.product(name: "NIOHTTPCompression", package: "swift-nio-extras"),
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "NIOWebSocket", package: "swift-nio", condition: .when(traits: ["WebSockets"])),
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "Algorithms", package: "swift-algorithms"),
.product(name: "BasicContainers", package: "swift-collections"),
.product(name: "RoutingKit", package: "routing-kit"),
// Disable until websockets are working
//.product(name: "WebSocketKit", package: "websocket-kit", condition: .when(traits: ["WebSockets"])),
.product(name: "MultipartKit", package: "multipart-kit", condition: .when(traits: ["Multipart"])),
.product(name: "Atomics", package: "swift-atomics"),
.product(name: "_NIOFileSystem", package: "swift-nio"),
.product(name: "_NIOFileSystemFoundationCompat", package: "swift-nio"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "X509", package: "swift-certificates"),
.product(name: "SwiftASN1", package: "swift-asn1"),
.product(name: "NIOHTTPServer", package: "swift-http-server"),
.product(name: "SystemPackage", package: "swift-system"),
],
swiftSettings: swiftSettings
),
.macro(
name: "VaporMacrosPlugin",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "Algorithms", package: "swift-algorithms"),
],
swiftSettings: swiftSettings
),
.target(
name: "VaporMacros",
dependencies: [
.target(name: "VaporMacrosPlugin", condition: .when(traits: ["MacroRouting"])),
"Vapor",
.product(name: "HTTPTypes", package: "swift-http-types"),
],
swiftSettings: swiftSettings
),
// Development
.executableTarget(
name: "Development",
dependencies: [
.target(name: "Vapor"),
.product(name: "X509", package: "swift-certificates"),
"VaporMacros",
.product(name: "SwiftASN1", package: "swift-asn1"),
],
resources: [.copy("Resources")],
swiftSettings: swiftSettings
),
// Testing
.target(
name: "VaporTesting",
dependencies: [
.target(name: "Vapor"),
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "AsyncHTTPClient", package: "async-http-client"),
.product(name: "NIOSSL", package: "swift-nio-ssl"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "MetricsTestKit", package: "swift-metrics"),
.product(name: "InMemoryTracing", package: "swift-distributed-tracing"),
.product(name: "Instrumentation", package: "swift-distributed-tracing"),
.product(name: "InMemoryLogging", package: "swift-log"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "VaporTests",
dependencies: [
.product(name: "NIOSSL", package: "swift-nio-ssl"),
.product(name: "NIOCertificateReloading", package: "swift-nio-extras"),
.product(name: "SwiftASN1", package: "swift-asn1"),
.target(name: "VaporTesting"),
.target(name: "Vapor"),
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "AsyncHTTPClient", package: "async-http-client"),
.product(name: "MetricsTestKit", package: "swift-metrics"),
.product(name: "InMemoryTracing", package: "swift-distributed-tracing"),
],
resources: [
.copy("Utilities/foo.txt"),
.copy("Utilities/index.html"),
.copy("Utilities/SubUtilities/"),
.copy("Utilities/foo bar.html"),
.copy("Utilities/my-secret-env-content"),
.copy("Utilities/expired.crt"),
.copy("Utilities/expired.key"),
.copy("Utilities/localhost.crt"),
.copy("Utilities/localhost.key"),
.copy("Utilities/long-test-file.txt"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "VaporMacroTests",
dependencies: [
.target(name: "VaporMacrosPlugin", condition: .when(traits: ["MacroRouting"])),
.product(name: "SwiftSyntaxMacrosGenericTestSupport", package: "swift-syntax", condition: .when(traits: ["MacroRouting"])),
.product(name: "SwiftSyntaxMacroExpansion", package: "swift-syntax", condition: .when(traits: ["MacroRouting"])),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "VaporMacroIntegrationTests",
dependencies: [
.target(name: "Vapor"),
.target(name: "VaporMacros"),
.target(name: "VaporTesting"),
.product(name: "HTTPTypes", package: "swift-http-types"),
],
swiftSettings: swiftSettings
),
]
)
var swiftSettings: [SwiftSetting] {
[
.strictMemorySafety(),
// .treatAllWarnings(as: .error),
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("InternalImportsByDefault"),
.enableUpcomingFeature("MemberImportVisibility"),
.enableUpcomingFeature("InferIsolatedConformances"),
.enableUpcomingFeature("NonisolatedNonsendingByDefault"),
.enableUpcomingFeature("ImmutableWeakCaptures"),
.enableExperimentalFeature("SuppressedAssociatedTypesWithDefaults"),
.enableExperimentalFeature("LifetimeDependence"),
.enableExperimentalFeature("Lifetimes"),
.enableUpcomingFeature("LifetimeDependence"),
.enableUpcomingFeature("ImmutableWeakCaptures"),
]
}