Skip to content

Commit

Permalink
Fix platform requirements (#214)
Browse files Browse the repository at this point in the history
- Replace the placeholder platform requirements with `@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)` 
- Bump required dependency versions: `swift-nio`, `swift-log` and `swift-backtrace`
  • Loading branch information
fabianfett authored Jul 21, 2021
1 parent fce7884 commit a9e15b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ let package = Package(
.library(name: "AWSLambdaTesting", targets: ["AWSLambdaTesting"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.28.0")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/swift-server/swift-backtrace.git", .upToNextMajor(from: "1.1.0")),
.package(url: "https://github.com/apple/swift-nio.git", .upToNextMajor(from: "2.30.0")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.4.2")),
.package(url: "https://github.com/swift-server/swift-backtrace.git", .upToNextMajor(from: "1.2.3")),
],
targets: [
.target(name: "AWSLambdaRuntime", dependencies: [
Expand Down
6 changes: 3 additions & 3 deletions Sources/AWSLambdaRuntimeCore/LambdaHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension LambdaHandler {

#if compiler(>=5.5)
/// Strongly typed, processing protocol for a Lambda that takes a user defined `In` and returns a user defined `Out` async.
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
public protocol AsyncLambdaHandler: EventLoopLambdaHandler {
/// The Lambda initialization method
/// Use this method to initialize resources that will be used in every request.
Expand All @@ -110,7 +110,7 @@ public protocol AsyncLambdaHandler: EventLoopLambdaHandler {
func handle(event: In, context: Lambda.Context) async throws -> Out
}

@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
extension AsyncLambdaHandler {
public func handle(context: Lambda.Context, event: In) -> EventLoopFuture<Out> {
let promise = context.eventLoop.makePromise(of: Out.self)
Expand All @@ -121,7 +121,7 @@ extension AsyncLambdaHandler {
}
}

@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
extension AsyncLambdaHandler {
public static func main() {
Lambda.run { context -> EventLoopFuture<ByteBufferLambdaHandler> in
Expand Down
6 changes: 3 additions & 3 deletions Tests/AWSLambdaRuntimeCoreTests/LambdaHandlerTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class LambdaHandlerTest: XCTestCase {

// MARK: - AsyncLambdaHandler

@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
func testAsyncHandlerSuccess() {
let server = MockLambdaServer(behavior: Behavior())
XCTAssertNoThrow(try server.start().wait())
Expand All @@ -106,7 +106,7 @@ class LambdaHandlerTest: XCTestCase {
assertLambdaLifecycleResult(result, shoudHaveRun: maxTimes)
}

@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
func testVoidAsyncHandlerSuccess() {
let server = MockLambdaServer(behavior: Behavior(result: .success(nil)))
XCTAssertNoThrow(try server.start().wait())
Expand All @@ -127,7 +127,7 @@ class LambdaHandlerTest: XCTestCase {
assertLambdaLifecycleResult(result, shoudHaveRun: maxTimes)
}

@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
func testAsyncHandlerFailure() {
let server = MockLambdaServer(behavior: Behavior(result: .failure(TestError("boom"))))
XCTAssertNoThrow(try server.start().wait())
Expand Down

0 comments on commit a9e15b1

Please sign in to comment.