@@ -23,23 +23,40 @@ let appleOS = false
23
23
let useLocalDependencies = Context . environment [ " SWIFTCI_USE_LOCAL_DEPS " ] != nil
24
24
let useLLBuildFramework = Context . environment [ " SWIFTBUILD_LLBUILD_FWK " ] != nil
25
25
26
- let swiftSettings : [ SwiftSetting ] = [
27
- // Upcoming Swift 6.0 features
28
- . enableUpcomingFeature( " ConciseMagicFile " ) ,
29
- . enableUpcomingFeature( " DeprecateApplicationMain " ) ,
30
- . enableUpcomingFeature( " DisableOutwardActorInference " ) ,
31
- . enableUpcomingFeature( " ForwardTrailingClosures " ) ,
32
- . enableUpcomingFeature( " GlobalConcurrency " ) ,
33
- . enableUpcomingFeature( " ImplicitOpenExistentials " ) ,
34
- . enableUpcomingFeature( " ImportObjcForwardDeclarations " ) ,
35
- . enableUpcomingFeature( " InferSendableFromCaptures " ) ,
36
- . enableUpcomingFeature( " IsolatedDefaultValues " ) ,
37
- //.enableUpcomingFeature("RegionBasedIsolation"), // rdar://137809703
26
+ func swiftSettings( languageMode: SwiftLanguageMode ) -> [ SwiftSetting ] {
27
+ switch languageMode {
28
+ case . v5:
29
+ return [
30
+ // Upcoming Swift 6.0 features
31
+ . enableUpcomingFeature( " ConciseMagicFile " ) ,
32
+ . enableUpcomingFeature( " DeprecateApplicationMain " ) ,
33
+ . enableUpcomingFeature( " DisableOutwardActorInference " ) ,
34
+ . enableUpcomingFeature( " ForwardTrailingClosures " ) ,
35
+ . enableUpcomingFeature( " GlobalConcurrency " ) ,
36
+ . enableUpcomingFeature( " ImplicitOpenExistentials " ) ,
37
+ . enableUpcomingFeature( " ImportObjcForwardDeclarations " ) ,
38
+ . enableUpcomingFeature( " InferSendableFromCaptures " ) ,
39
+ . enableUpcomingFeature( " IsolatedDefaultValues " ) ,
40
+ //.enableUpcomingFeature("RegionBasedIsolation"), // rdar://137809703
38
41
39
- // Future Swift features
40
- . enableUpcomingFeature( " ExistentialAny " ) ,
41
- . enableUpcomingFeature( " InternalImportsByDefault " ) ,
42
- ]
42
+ // Future Swift features
43
+ . enableUpcomingFeature( " ExistentialAny " ) ,
44
+ . enableUpcomingFeature( " InternalImportsByDefault " ) ,
45
+
46
+ . swiftLanguageMode( . v5)
47
+ ]
48
+ case . v6:
49
+ return [
50
+ // Future Swift features
51
+ . enableUpcomingFeature( " ExistentialAny " ) ,
52
+ . enableUpcomingFeature( " InternalImportsByDefault " ) ,
53
+
54
+ . swiftLanguageMode( . v6)
55
+ ]
56
+ default :
57
+ fatalError ( " unexpected language mode " )
58
+ }
59
+ }
43
60
44
61
let package = Package (
45
62
name: " SwiftBuild " ,
@@ -62,19 +79,19 @@ let package = Package(
62
79
" SwiftBuild " ,
63
80
" SWBBuildServiceBundle " , // the CLI needs to launch the service bundle
64
81
] ,
65
- swiftSettings: swiftSettings) ,
82
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
66
83
. executableTarget(
67
84
name: " SWBBuildServiceBundle " ,
68
85
dependencies: [
69
86
" SWBBuildService " , " SWBBuildSystem " , " SWBServiceCore " , " SWBUtil " , " SWBCore " ,
70
87
] ,
71
- swiftSettings: swiftSettings) ,
88
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
72
89
73
90
// Libraries
74
91
. target(
75
92
name: " SwiftBuild " ,
76
93
dependencies: [ " SWBCSupport " , " SWBCore " , " SWBProtocol " , " SWBUtil " , " SWBProjectModel " ] ,
77
- swiftSettings: swiftSettings) ,
94
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
78
95
. target(
79
96
name: " SWBBuildService " ,
80
97
dependencies: [
@@ -83,11 +100,11 @@ let package = Package(
83
100
" SWBTaskExecution " ,
84
101
. product( name: " SystemPackage " , package : " swift-system " , condition: . when( platforms: [ . linux, . android, . windows] ) ) ,
85
102
] ,
86
- swiftSettings: swiftSettings) ,
103
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
87
104
. target(
88
105
name: " SWBBuildSystem " ,
89
106
dependencies: [ " SWBCore " , " SWBTaskConstruction " , " SWBTaskExecution " ] ,
90
- swiftSettings: swiftSettings) ,
107
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
91
108
. target(
92
109
name: " SWBCore " ,
93
110
dependencies: [
@@ -99,7 +116,7 @@ let package = Package(
99
116
. product( name: " SwiftDriver " , package : " swift-driver " ) ,
100
117
" SWBLLBuild " ,
101
118
] ,
102
- swiftSettings: swiftSettings,
119
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ,
103
120
plugins: [
104
121
. plugin( name: " SWBSpecificationsPlugin " )
105
122
] ) ,
@@ -110,16 +127,16 @@ let package = Package(
110
127
. define( " _CRT_SECURE_NO_WARNINGS " , . when( platforms: [ . windows] ) ) ,
111
128
. define( " _CRT_NONSTDC_NO_WARNINGS " , . when( platforms: [ . windows] ) ) ,
112
129
] ,
113
- swiftSettings: swiftSettings) ,
130
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
114
131
. target(
115
132
name: " SWBCLibc " ,
116
133
exclude: [ " README.md " ] ,
117
134
publicHeadersPath: " . " ,
118
- swiftSettings: swiftSettings) ,
135
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
119
136
. target(
120
137
name: " SWBLibc " ,
121
138
dependencies: [ " SWBCLibc " ] ,
122
- swiftSettings: swiftSettings) ,
139
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
123
140
. target(
124
141
name: " SWBLLBuild " ,
125
142
dependencies: [
@@ -128,34 +145,34 @@ let package = Package(
128
145
. product( name: " libllbuild " , package : useLocalDependencies ? " llbuild " : " swift-llbuild " ) ,
129
146
. product( name: " llbuildSwift " , package : useLocalDependencies ? " llbuild " : " swift-llbuild " ) ,
130
147
] ) ,
131
- swiftSettings: swiftSettings) ,
148
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
132
149
. target(
133
150
name: " SWBMacro " ,
134
151
dependencies: [
135
152
" SWBUtil " ,
136
153
. product( name: " SwiftDriver " , package : " swift-driver " ) ,
137
154
] ,
138
- swiftSettings: swiftSettings) ,
155
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
139
156
. target(
140
157
name: " SWBProjectModel " ,
141
158
dependencies: [ " SWBProtocol " ] ,
142
- swiftSettings: swiftSettings) ,
159
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
143
160
. target(
144
161
name: " SWBProtocol " ,
145
162
dependencies: [ " SWBUtil " ] ,
146
- swiftSettings: swiftSettings) ,
163
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
147
164
. target(
148
165
name: " SWBServiceCore " ,
149
166
dependencies: [ " SWBProtocol " ] ,
150
- swiftSettings: swiftSettings) ,
167
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
151
168
. target(
152
169
name: " SWBTaskConstruction " ,
153
170
dependencies: [ " SWBCore " , " SWBUtil " ] ,
154
- swiftSettings: swiftSettings) ,
171
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
155
172
. target(
156
173
name: " SWBTaskExecution " ,
157
174
dependencies: [ " SWBCore " , " SWBUtil " , " SWBCAS " , " SWBLLBuild " , " SWBTaskConstruction " ] ,
158
- swiftSettings: swiftSettings) ,
175
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
159
176
. target(
160
177
name: " SWBUtil " ,
161
178
dependencies: [
@@ -165,41 +182,41 @@ let package = Package(
165
182
. product( name: " Crypto " , package : " swift-crypto " , condition: . when( platforms: [ . linux, . android] ) ) ,
166
183
. product( name: " SystemPackage " , package : " swift-system " , condition: . when( platforms: [ . linux, . android, . windows] ) ) ,
167
184
] ,
168
- swiftSettings: swiftSettings) ,
185
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
169
186
. target(
170
187
name: " SWBCAS " ,
171
188
dependencies: [ " SWBUtil " , " SWBCSupport " ] ,
172
- swiftSettings: swiftSettings) ,
189
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
173
190
174
191
. target(
175
192
name: " SWBAndroidPlatform " ,
176
193
dependencies: [ " SWBCore " ] ,
177
- swiftSettings: swiftSettings) ,
194
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
178
195
. target(
179
196
name: " SWBApplePlatform " ,
180
197
dependencies: [ " SWBCore " , " SWBTaskConstruction " ] ,
181
- swiftSettings: swiftSettings) ,
198
+ swiftSettings: swiftSettings ( languageMode : . v5 ) ) ,
182
199
. target(
183
200
name: " SWBGenericUnixPlatform " ,
184
201
dependencies: [ " SWBCore " ] ,
185
- swiftSettings: swiftSettings) ,
202
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
186
203
. target(
187
204
name: " SWBQNXPlatform " ,
188
205
dependencies: [ " SWBCore " ] ,
189
- swiftSettings: swiftSettings) ,
206
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
190
207
. target(
191
208
name: " SWBUniversalPlatform " ,
192
209
dependencies: [ " SWBCore " ] ,
193
- swiftSettings: swiftSettings) ,
210
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
194
211
. target(
195
212
name: " SWBWindowsPlatform " ,
196
213
dependencies: [ " SWBCore " ] ,
197
- swiftSettings: swiftSettings) ,
214
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
198
215
199
216
// Helper targets for SwiftPM
200
217
. executableTarget(
201
218
name: " SWBSpecificationsCompiler " ,
202
- swiftSettings: swiftSettings) ,
219
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
203
220
. plugin(
204
221
name: " SWBSpecificationsPlugin " ,
205
222
capability: . buildTool( ) ,
@@ -209,11 +226,11 @@ let package = Package(
209
226
. target(
210
227
name: " SwiftBuildTestSupport " ,
211
228
dependencies: [ " SwiftBuild " , " SWBTestSupport " , " SWBUtil " ] ,
212
- swiftSettings: swiftSettings) ,
229
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
213
230
. target(
214
231
name: " SWBTestSupport " ,
215
232
dependencies: [ " SwiftBuild " , " SWBBuildSystem " , " SWBCore " , " SWBTaskConstruction " , " SWBTaskExecution " , " SWBUtil " , " SWBLLBuild " , " SWBMacro " ] ,
216
- swiftSettings: swiftSettings + [
233
+ swiftSettings: swiftSettings ( languageMode : . v5 ) + [
217
234
// Temporary until swift-testing introduces replacement for this SPI
218
235
. define( " DONT_HAVE_CUSTOM_EXECUTION_TRAIT " , . when( platforms: [ . macOS, . macCatalyst, . iOS, . tvOS, . watchOS, . visionOS, . windows] ) )
219
236
] ) ,
@@ -222,118 +239,118 @@ let package = Package(
222
239
. testTarget(
223
240
name: " SWBAndroidPlatformTests " ,
224
241
dependencies: [ " SWBAndroidPlatform " , " SWBTestSupport " ] ,
225
- swiftSettings: swiftSettings) ,
242
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
226
243
. testTarget(
227
244
name: " SWBApplePlatformTests " ,
228
245
dependencies: [ " SWBApplePlatform " , " SWBTestSupport " ] ,
229
- swiftSettings: swiftSettings) ,
246
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
230
247
. testTarget(
231
248
name: " SWBGenericUnixPlatformTests " ,
232
249
dependencies: [ " SWBGenericUnixPlatform " , " SWBTestSupport " ] ,
233
- swiftSettings: swiftSettings) ,
250
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
234
251
. testTarget(
235
252
name: " SWBQNXPlatformTests " ,
236
253
dependencies: [ " SWBQNXPlatform " , " SWBTestSupport " ] ,
237
- swiftSettings: swiftSettings) ,
254
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
238
255
. testTarget(
239
256
name: " SWBUniversalPlatformTests " ,
240
257
dependencies: [ " SWBUniversalPlatform " , " SWBTestSupport " ] ,
241
- swiftSettings: swiftSettings) ,
258
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
242
259
. testTarget(
243
260
name: " SWBWindowsPlatformTests " ,
244
261
dependencies: [ " SWBWindowsPlatform " , " SWBTestSupport " ] ,
245
- swiftSettings: swiftSettings) ,
262
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
246
263
. testTarget(
247
264
name: " SwiftBuildTests " ,
248
265
dependencies: [ " SwiftBuild " , " SWBBuildService " , " SwiftBuildTestSupport " ] ,
249
266
resources: [
250
267
. copy( " TestData " )
251
268
] ,
252
- swiftSettings: swiftSettings) ,
269
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
253
270
. testTarget(
254
271
name: " SWBProjectModelTests " ,
255
272
dependencies: [ " SWBProjectModel " ] ,
256
- swiftSettings: swiftSettings) ,
273
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
257
274
. testTarget(
258
275
name: " SWBProtocolTests " ,
259
276
dependencies: [ " SWBProtocol " , " SWBUtil " ] ,
260
- swiftSettings: swiftSettings) ,
277
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
261
278
. testTarget(
262
279
name: " SWBUtilTests " ,
263
280
dependencies: [ " SWBTestSupport " , " SWBUtil " ] ,
264
- swiftSettings: swiftSettings) ,
281
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
265
282
. testTarget(
266
283
name: " SWBCASTests " ,
267
284
dependencies: [ " SWBTestSupport " , " SWBCAS " , " SWBUtil " ] ,
268
- swiftSettings: swiftSettings) ,
285
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
269
286
. testTarget(
270
287
name: " SWBMacroTests " ,
271
288
dependencies: [ " SWBTestSupport " , " SWBMacro " ] ,
272
- swiftSettings: swiftSettings) ,
289
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
273
290
. testTarget(
274
291
name: " SWBServiceCoreTests " ,
275
292
dependencies: [ " SWBServiceCore " ] ,
276
- swiftSettings: swiftSettings) ,
293
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
277
294
. testTarget(
278
295
name: " SWBCoreTests " ,
279
296
dependencies: [ " SWBCore " , " SWBTestSupport " , " SWBUtil " , " SWBLLBuild " ] ,
280
- swiftSettings: swiftSettings) ,
297
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
281
298
. testTarget(
282
299
name: " SWBTaskConstructionTests " ,
283
300
dependencies: [ " SWBTaskConstruction " , " SWBCore " , " SWBTestSupport " , " SWBProtocol " , " SWBUtil " ] ,
284
- swiftSettings: swiftSettings) ,
301
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
285
302
. testTarget(
286
303
name: " SWBTaskExecutionTests " ,
287
304
dependencies: [ " SWBTaskExecution " , " SWBTestSupport " ] ,
288
305
resources: [
289
306
. copy( " TestData " )
290
307
] ,
291
- swiftSettings: swiftSettings) ,
308
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
292
309
. testTarget(
293
310
name: " SWBLLBuildTests " ,
294
311
dependencies: [ " SWBLLBuild " , " SWBTestSupport " ] ,
295
- swiftSettings: swiftSettings) ,
312
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
296
313
. testTarget(
297
314
name: " SWBBuildSystemTests " ,
298
315
dependencies: [ " SWBBuildService " , " SWBBuildSystem " , " SwiftBuildTestSupport " , " SWBTestSupport " ] ,
299
316
resources: [
300
317
. copy( " TestData " )
301
318
] ,
302
- swiftSettings: swiftSettings) ,
319
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
303
320
. testTarget(
304
321
name: " SWBBuildServiceTests " ,
305
322
dependencies: [ " SwiftBuild " , " SWBBuildService " , " SWBTestSupport " ] ,
306
- swiftSettings: swiftSettings) ,
323
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
307
324
. testTarget(
308
325
name: " SWBTestSupportTests " ,
309
326
dependencies: [ " SWBTestSupport " ] ,
310
- swiftSettings: swiftSettings) ,
327
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
311
328
312
329
// Perf tests
313
330
. testTarget(
314
331
name: " SWBBuildSystemPerfTests " ,
315
332
dependencies: [ " SWBBuildSystem " , " SWBTestSupport " ] ,
316
- swiftSettings: swiftSettings) ,
333
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
317
334
. testTarget(
318
335
name: " SWBCASPerfTests " ,
319
336
dependencies: [ " SWBCAS " , " SWBTestSupport " ] ,
320
- swiftSettings: swiftSettings) ,
337
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
321
338
. testTarget(
322
339
name: " SWBCorePerfTests " ,
323
340
dependencies: [ " SWBCore " , " SWBTestSupport " ] ,
324
- swiftSettings: swiftSettings) ,
341
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
325
342
. testTarget(
326
343
name: " SWBTaskConstructionPerfTests " ,
327
344
dependencies: [ " SWBTaskConstruction " , " SWBTestSupport " ] ,
328
- swiftSettings: swiftSettings) ,
345
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
329
346
. testTarget(
330
347
name: " SWBUtilPerfTests " ,
331
348
dependencies: [ " SWBUtil " , " SWBTestSupport " ] ,
332
- swiftSettings: swiftSettings) ,
349
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
333
350
. testTarget(
334
351
name: " SwiftBuildPerfTests " ,
335
352
dependencies: [ " SwiftBuild " , " SWBTestSupport " , " SwiftBuildTestSupport " ] ,
336
- swiftSettings: swiftSettings) ,
353
+ swiftSettings: swiftSettings ( languageMode : . v6 ) ) ,
337
354
338
355
// Commands
339
356
. plugin(
@@ -344,7 +361,7 @@ let package = Package(
344
361
) )
345
362
)
346
363
] ,
347
- swiftLanguageModes: [ . v5 ] ,
364
+ swiftLanguageModes: [ . v6 ] ,
348
365
cxxLanguageStandard: . cxx20
349
366
)
350
367
0 commit comments