Skip to content

Commit 3879bde

Browse files
committed
remove .platform dependency on package
1 parent 66bf6a3 commit 3879bde

34 files changed

+164
-6
lines changed

Package.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ import PackageDescription
44

55
let defaultSwiftSettings: [SwiftSetting] =
66
[
7-
.swiftLanguageMode(.v6)
8-
// .enableExperimentalFeature(
9-
// "AvailabilityMacro=LambdaSwift 2.0:macOS 15.0"
10-
// ),
11-
//
7+
.swiftLanguageMode(.v6),
8+
.enableExperimentalFeature(
9+
"AvailabilityMacro=LambdaSwift 2.0:macOS 15.0"
10+
)
11+
1212
// then, in code, use
1313
// @available(LambdaSwift 2.0, *)
1414
]
1515

1616
let package = Package(
1717
name: "swift-aws-lambda-runtime",
18-
platforms: [.macOS(.v15)],
1918
products: [
2019
.library(name: "AWSLambdaRuntime", targets: ["AWSLambdaRuntime"]),
2120
// plugin to package the lambda, creating an archive that can be uploaded to AWS

Sources/AWSLambdaRuntime/ControlPlaneRequest.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,29 @@
1515
import NIOCore
1616
import NIOHTTP1
1717

18+
#if swift(>=6.1)
19+
@available(LambdaSwift 2.0, *)
20+
#endif
1821
enum ControlPlaneRequest: Hashable {
1922
case next
2023
case invocationResponse(String, ByteBuffer?)
2124
case invocationError(String, ErrorResponse)
2225
case initializationError(ErrorResponse)
2326
}
2427

28+
#if swift(>=6.1)
29+
@available(LambdaSwift 2.0, *)
30+
#endif
2531
enum ControlPlaneResponse: Hashable {
2632
case next(InvocationMetadata, ByteBuffer)
2733
case accepted
2834
case error(ErrorResponse)
2935
}
3036

3137
@usableFromInline
38+
#if swift(>=6.1)
39+
@available(LambdaSwift 2.0, *)
40+
#endif
3241
package struct InvocationMetadata: Hashable, Sendable {
3342
@usableFromInline
3443
package let requestID: String

Sources/AWSLambdaRuntime/ControlPlaneRequestEncoder.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
import NIOCore
1616

17+
#if swift(>=6.1)
18+
@available(LambdaSwift 2.0, *)
19+
#endif
1720
struct ControlPlaneRequestEncoder: _EmittingChannelHandler {
1821
typealias OutboundOut = ByteBuffer
1922

Sources/AWSLambdaRuntime/FoundationSupport/Context+Foundation.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import FoundationEssentials
1919
import struct Foundation.Date
2020
#endif
2121

22+
#if swift(>=6.1)
23+
@available(LambdaSwift 2.0, *)
24+
#endif
2225
extension LambdaContext {
2326
/// Returns the deadline as a Date for the Lambda function execution.
2427
/// I'm not sure how usefull it is to have this as a Date, with only seconds precision,

Sources/AWSLambdaRuntime/FoundationSupport/Lambda+JSON.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public struct LambdaJSONOutputEncoder<Output: Encodable>: LambdaOutputEncoder {
5959
}
6060
}
6161

62+
#if swift(>=6.1)
63+
@available(LambdaSwift 2.0, *)
64+
#endif
6265
extension LambdaCodableAdapter {
6366
/// Initializes an instance given an encoder, decoder, and a handler with a non-`Void` output.
6467
/// - Parameters:
@@ -84,6 +87,9 @@ extension LambdaCodableAdapter {
8487
}
8588
}
8689

90+
#if swift(>=6.1)
91+
@available(LambdaSwift 2.0, *)
92+
#endif
8793
extension LambdaRuntime {
8894
/// Initialize an instance with a `LambdaHandler` defined in the form of a closure **with a non-`Void` return type**.
8995
/// - Parameters:

Sources/AWSLambdaRuntime/Lambda+Codable.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public struct VoidEncoder: LambdaOutputEncoder {
4848
}
4949

5050
/// Adapts a ``LambdaHandler`` conforming handler to conform to ``LambdaWithBackgroundProcessingHandler``.
51+
#if swift(>=6.1)
52+
@available(LambdaSwift 2.0, *)
53+
#endif
5154
public struct LambdaHandlerAdapter<
5255
Event: Decodable,
5356
Output,
@@ -80,6 +83,9 @@ public struct LambdaHandlerAdapter<
8083
}
8184

8285
/// Adapts a ``LambdaWithBackgroundProcessingHandler`` conforming handler to conform to ``StreamingLambdaHandler``.
86+
#if swift(>=6.1)
87+
@available(LambdaSwift 2.0, *)
88+
#endif
8389
public struct LambdaCodableAdapter<
8490
Handler: LambdaWithBackgroundProcessingHandler,
8591
Event: Decodable,

Sources/AWSLambdaRuntime/Lambda+LocalServer.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ import Synchronization
3737
// )
3838
// }
3939
// }
40+
#if swift(>=6.1)
41+
@available(LambdaSwift 2.0, *)
42+
#endif
4043
extension Lambda {
4144
/// Execute code in the context of a mock Lambda server.
4245
///
@@ -84,6 +87,9 @@ extension Lambda {
8487
/// 1. POST /invoke - the client posts the event to the lambda function
8588
///
8689
/// 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.
90+
#if swift(>=6.1)
91+
@available(LambdaSwift 2.0, *)
92+
#endif
8793
internal struct LambdaHTTPServer {
8894
private let invocationEndpoint: String
8995

Sources/AWSLambdaRuntime/Lambda.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import ucrt
2929
#error("Unsupported platform")
3030
#endif
3131

32+
#if swift(>=6.1)
33+
@available(LambdaSwift 2.0, *)
34+
#endif
3235
public enum Lambda {
3336
@inlinable
3437
package static func runLoop<RuntimeClient: LambdaRuntimeClientProtocol, Handler>(
@@ -98,6 +101,9 @@ public enum Lambda {
98101

99102
// MARK: - Public API
100103

104+
#if swift(>=6.1)
105+
@available(LambdaSwift 2.0, *)
106+
#endif
101107
extension Lambda {
102108
/// Utility to access/read environment variables
103109
public static func env(_ name: String) -> String? {

Sources/AWSLambdaRuntime/LambdaClock.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ import ucrt
5151
/// The Lambda execution environment uses UTC as a timezone,
5252
/// `LambdaClock` operates in UTC and does not account for time zones.
5353
/// see: TZ in https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html
54+
#if swift(>=6.1)
55+
@available(LambdaSwift 2.0, *)
56+
#endif
5457
public struct LambdaClock: Clock {
5558
public typealias Duration = Swift.Duration
5659

Sources/AWSLambdaRuntime/LambdaContext.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ public struct ClientContext: Codable, Sendable {
8383

8484
/// Lambda runtime context.
8585
/// The Lambda runtime generates and passes the `LambdaContext` to the Lambda handler as an argument.
86+
#if swift(>=6.1)
87+
@available(LambdaSwift 2.0, *)
88+
#endif
8689
public struct LambdaContext: CustomDebugStringConvertible, Sendable {
8790
final class _Storage: Sendable {
8891
let requestID: String

0 commit comments

Comments
 (0)