Skip to content

Commit 01a4443

Browse files
committed
move AWSLambdaRuntimeService to a separate module to avoid penalty for functions not using it
1 parent cc89338 commit 01a4443

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

Examples/ServiceLifeCycle/Package.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ let package = Package(
1717
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.6.3"),
1818
],
1919
targets: [
20-
// Targets are the basic building blocks of a package, defining a module or a test suite.
21-
// Targets can depend on other targets in this package and products from dependencies.
2220
.executableTarget(name: "pg", dependencies: [
2321
.product(name: "PostgresNIO", package: "postgres-nio"),
24-
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
22+
.product(name: "AWSLambdaRuntimeService", package: "swift-aws-lambda-runtime"),
2523
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
2624
]),
2725
]

Examples/ServiceLifeCycle/Sources/Lambda.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import AWSLambdaRuntime
1+
import AWSLambdaRuntimeService
22
import Logging
33
import PostgresNIO
44
import ServiceLifecycle

Package.swift

+13-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ let package = Package(
88
products: [
99
// this library exports `AWSLambdaRuntimeCore` and adds Foundation convenience methods
1010
.library(name: "AWSLambdaRuntime", targets: ["AWSLambdaRuntime"]),
11+
12+
// this library exports `AWSLambdaRuntime` and adds conformances to `Service` from Swift Service Lifecycle
13+
.library(name: "AWSLambdaRuntimeService", targets: ["AWSLambdaRuntimeService"]),
14+
1115
// this has all the main functionality for lambda and it does not link Foundation
1216
.library(name: "AWSLambdaRuntimeCore", targets: ["AWSLambdaRuntimeCore"]),
17+
1318
// plugin to package the lambda, creating an archive that can be uploaded to AWS
1419
// requires Linux or at least macOS v15
1520
.plugin(name: "AWSLambdaPackager", targets: ["AWSLambdaPackager"]),
21+
1622
// for testing only
1723
.library(name: "AWSLambdaTesting", targets: ["AWSLambdaTesting"]),
1824
],
@@ -22,12 +28,18 @@ let package = Package(
2228
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.6.3"),
2329
],
2430
targets: [
31+
.target(
32+
name: "AWSLambdaRuntimeService",
33+
dependencies: [
34+
.byName(name: "AWSLambdaRuntime"),
35+
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
36+
]
37+
),
2538
.target(
2639
name: "AWSLambdaRuntime",
2740
dependencies: [
2841
.byName(name: "AWSLambdaRuntimeCore"),
2942
.product(name: "NIOCore", package: "swift-nio"),
30-
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
3143
]
3244
),
3345
.target(

Sources/AWSLambdaRuntime/LambdaRuntime+ServiceLifeCycle.swift renamed to Sources/AWSLambdaRuntimeService/LambdaRuntime+ServiceLifeCycle.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@_exported import AWSLambdaRuntimeCore
16-
import NIOCore
15+
@_exported import AWSLambdaRuntime
1716

1817
import ServiceLifecycle
1918
#if canImport(FoundationEssentials)

0 commit comments

Comments
 (0)