@@ -92,6 +92,55 @@ extension PackageDescription.Target.PluginUsage {
9292 }
9393}
9494
95+ // MARK: - SwiftSetting extension
96+ extension PackageDescription . SwiftSetting {
97+ /// Forward-scan matching for trailing closures
98+ /// - Version: Swift 5.3
99+ /// - Since: SwiftPM 5.8
100+ /// - SeeAlso: [SE-0286: Forward-scan matching for trailing closures](https://github.com/apple/swift-evolution/blob/main/proposals/0286-forward-scan-trailing-closures.md)
101+ static let forwardTrailingClosures : Self = . enableUpcomingFeature( " ForwardTrailingClosures " )
102+ /// Introduce existential `any`
103+ /// - Version: Swift 5.6
104+ /// - Since: SwiftPM 5.8
105+ /// - SeeAlso: [SE-0335: Introduce existential `any`](https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md)
106+ static let existentialAny : Self = . enableUpcomingFeature( " ExistentialAny " )
107+ /// Regex Literals
108+ /// - Version: Swift 5.7
109+ /// - Since: SwiftPM 5.8
110+ /// - SeeAlso: [SE-0354: Regex Literals](https://github.com/apple/swift-evolution/blob/main/proposals/0354-regex-literals.md)
111+ static let bareSlashRegexLiterals : Self = . enableUpcomingFeature( " BareSlashRegexLiterals " )
112+ /// Concise magic file names
113+ /// - Version: Swift 5.8
114+ /// - Since: SwiftPM 5.8
115+ /// - SeeAlso: [SE-0274: Concise magic file names](https://github.com/apple/swift-evolution/blob/main/proposals/0274-magic-file.md)
116+ static let conciseMagicFile : Self = . enableUpcomingFeature( " ConciseMagicFile " )
117+ /// Importing Forward Declared Objective-C Interfaces and Protocols
118+ /// - Version: Swift 5.9
119+ /// - Since: SwiftPM 5.9
120+ /// - SeeAlso: [SE-0384: Importing Forward Declared Objective-C Interfaces and Protocols](https://github.com/apple/swift-evolution/blob/main/proposals/0384-importing-forward-declared-objc-interfaces-and-protocols.md)
121+ static let importObjcForwardDeclarations : Self = . enableUpcomingFeature( " ImportObjcForwardDeclarations " )
122+ /// Remove Actor Iscolation Inference caused by Property Wrappers
123+ /// - Version: Swift 5.9
124+ /// - Since: SwiftPM 5.9
125+ /// - SeeAlso: [SE-0401: Remove Actor Isolation Inference caused by Property Wrappers](https://github.com/apple/swift-evolution/blob/main/proposals/0401-remove-property-wrapper-isolation.md)
126+ static let disableOutwardActorInference : Self = . enableUpcomingFeature( " DisableOutwardActorInference " )
127+ /// Deprecate `@UIApplicationMain` and `@NSApplicationMain`
128+ /// - Version: Swift 5.10
129+ /// - Since: SwiftPM 5.10
130+ /// - SeeAlso: [SE-0383: Deprecate `@UIApplicationMain` and `@NSApplicationMain`](https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md)
131+ static let deprecateApplicationMain : Self = . enableUpcomingFeature( " DeprecateApplicationMain " )
132+ /// Isolated default value expressions
133+ /// - Version: Swift 5.10
134+ /// - Since: SwiftPM 5.10
135+ /// - SeeAlso: [SE-0411: Isolated default value expressions](https://github.com/apple/swift-evolution/blob/main/proposals/0411-isolated-default-values.md)
136+ static let isolatedDefaultValues : Self = . enableUpcomingFeature( " IsolatedDefaultValues " )
137+ /// Strict concurrency for global variables
138+ /// - Version: Swift 5.10
139+ /// - Since: SwiftPM 5.10
140+ /// - SeeAlso: [SE-0412: Strict concurrency for global variables](https://github.com/apple/swift-evolution/blob/main/proposals/0412-strict-concurrency-for-global-variables.md)
141+ static let globalConcurrency : Self = . enableUpcomingFeature( " GlobalConcurrency " )
142+ }
143+
95144let package = Package (
96145 name: . packageName,
97146 platforms: [
@@ -238,17 +287,28 @@ let debugOtherSwiftFlags = [
238287 " -strict-concurrency=complete " ,
239288 " -enable-actor-data-race-checks " ,
240289]
290+ let upcomingFeatures : [ PackageDescription . SwiftSetting ] = [
291+ . forwardTrailingClosures,
292+ . existentialAny,
293+ . bareSlashRegexLiterals,
294+ . conciseMagicFile,
295+ . importObjcForwardDeclarations,
296+ . disableOutwardActorInference,
297+ . deprecateApplicationMain,
298+ . isolatedDefaultValues,
299+ . globalConcurrency,
300+ ]
241301
242- for package in package . targets {
302+ for target in package . targets {
243303 // swiftSettings
244- package . swiftSettings = [
304+ target . swiftSettings = [
245305 . unsafeFlags( debugOtherSwiftFlags, . when( configuration: . debug) ) ,
246- ]
306+ ] + upcomingFeatures
247307 // plugins
248- if let plugins = package . plugins {
249- package . plugins = plugins + [ . swiftLintPlugin]
308+ if let plugins = target . plugins {
309+ target . plugins = plugins + [ . swiftLintPlugin]
250310 } else {
251- package . plugins = [ . swiftLintPlugin]
311+ target . plugins = [ . swiftLintPlugin]
252312 }
253313}
254314
0 commit comments