Skip to content

Commit 4317c53

Browse files
authored
Adopt concurrency adoption guidelines (#230)
Adopt Swift Concurrency adoption guidelines for Swift Server Libraries (swift-server/guides#70). - Use #if compiler(>=5.5) && canImport(_Concurrency) to judge if Concurrency is available - Some clean up
1 parent 39b34a1 commit 4317c53

File tree

12 files changed

+13
-72
lines changed

12 files changed

+13
-72
lines changed

Examples/Deployment/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The SAM template will provide an output labelled `LambdaApiGatewayEndpoint` whic
8787

8888
```
8989
curl <<LambdaApiGatewayEndpoint>>
90-
```
90+
```
9191

9292
***Warning:*** This SAM template is only intended as a sample and creates a publicly accessible HTTP endpoint.
9393

@@ -162,7 +162,7 @@ For example:
162162

163163
```
164164
curl https://r39lvhfng3.execute-api.us-east-1.amazonaws.com/api
165-
```
165+
```
166166

167167
***Warning:*** This Serverless template is only intended as a sample and creates a publicly accessible HTTP endpoint.
168168

Examples/Deployment/scripts/SAM/APIGateway-template.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

Examples/Deployment/scripts/serverless/APIGateway-template.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

Examples/Deployment/scripts/serverless/Benchmark-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ provider:
1212
- logs:CreateLogGroup
1313
- logs:CreateLogStream
1414
- logs:PutLogEvents
15-
Resource: "*"
15+
Resource: "*"
1616

1717
functions:
1818
benchmarkFunction:

Examples/Deployment/scripts/serverless/HelloWorld-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ provider:
1212
- logs:CreateLogGroup
1313
- logs:CreateLogStream
1414
- logs:PutLogEvents
15-
Resource: "*"
15+
Resource: "*"
1616

1717
functions:
1818
hello:

Sources/AWSLambdaRuntimeCore/Lambda.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public enum Lambda {
5353
return String(cString: value)
5454
}
5555

56-
#if swift(>=5.5)
56+
#if compiler(>=5.5) && canImport(_Concurrency)
5757
// for testing and internal use
5858
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
5959
internal static func run<Handler: LambdaHandler>(configuration: Configuration = .init(), handlerType: Handler.Type) -> Result<Int, Error> {

Sources/AWSLambdaRuntimeCore/LambdaHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import NIOCore
1717

1818
// MARK: - LambdaHandler
1919

20-
#if compiler(>=5.5)
20+
#if compiler(>=5.5) && canImport(_Concurrency)
2121
/// Strongly typed, processing protocol for a Lambda that takes a user defined `Event` and returns a user defined `Output` async.
2222
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
2323
public protocol LambdaHandler: EventLoopLambdaHandler {

Sources/AWSLambdaTesting/Lambda+Testing.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
// XCTAssertEqual(result, "echo" + input)
3434
// }
3535

36-
#if swift(>=5.5)
36+
#if compiler(>=5.5) && canImport(_Concurrency)
3737
import AWSLambdaRuntime
38-
import AWSLambdaRuntimeCore
3938
import Dispatch
4039
import Logging
4140
import NIOCore

Tests/AWSLambdaRuntimeCoreTests/LambdaHandlerTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import NIOCore
1717
import XCTest
1818

1919
class LambdaHandlerTest: XCTestCase {
20-
#if compiler(>=5.5)
20+
#if compiler(>=5.5) && canImport(_Concurrency)
2121

2222
// MARK: - LambdaHandler
2323

Tests/AWSLambdaRuntimeTests/Lambda+CodeableTest.swift renamed to Tests/AWSLambdaRuntimeTests/Lambda+CodableTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class CodableLambdaTest: XCTestCase {
8282
XCTAssertEqual(response?.requestId, request.requestId)
8383
}
8484

85-
#if swift(>=5.5)
85+
#if compiler(>=5.5) && canImport(_Concurrency)
8686
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
8787
func testCodableVoidHandler() {
8888
struct Handler: LambdaHandler {
@@ -183,7 +183,7 @@ private struct Response: Codable, Equatable {
183183
}
184184
}
185185

186-
#if swift(>=5.5)
186+
#if compiler(>=5.5) && canImport(_Concurrency)
187187
// NOTE: workaround until we have async test support on linux
188188
// https://github.com/apple/swift-corelibs-xctest/pull/326
189189
extension XCTestCase {

0 commit comments

Comments
 (0)