You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor the Swift Settings in Package.swift (#558)
- Use the new Swift 6 `@available` macro to remove requirement on
`.platform` in Package.swift.
- DRY: define the swift settings once for all in `Package.swift`
### Motivation:
- Remove the requirement to build on macOS 15 in `Package.swift`. This
allows library builders and end users to be more flexible on their
dependency requirements.
- The code is optionally compiled on macOS 15 and Linux, but SPM don't
enforce it anymore.
- Avoid repeating ourself. Be sure the same settings are applied on all
targets.
### Modifications:
- Create a `var swiftSetting: [SwiftSettings]` and reuse it for all
targets.
- Use `AvailabilityMacro=LambdaSwift 2.0:macOS 15.0`
- Add this on top of the majority struct / classes
```swift
#if swift(>=6.1)
@available(LambdaSwift 2.0, *)
#endif
```
### Result:
When using Swift 6.1, there is no more SPM dependency on macOS 15
Copy file name to clipboardExpand all lines: Sources/AWSLambdaRuntime/Lambda+LocalServer.swift
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ import Synchronization
37
37
// )
38
38
// }
39
39
// }
40
+
@available(LambdaSwift 2.0,*)
40
41
extensionLambda{
41
42
/// Execute code in the context of a mock Lambda server.
42
43
///
@@ -84,6 +85,7 @@ extension Lambda {
84
85
/// 1. POST /invoke - the client posts the event to the lambda function
85
86
///
86
87
/// This server passes the data received from /invoke POST request to the lambda function (GET /next) and then forwards the response back to the client.
0 commit comments