Skip to content

Commit

Permalink
move AWSLambdaRuntimeService to a separate module to avoid penalty fo…
Browse files Browse the repository at this point in the history
…r functions not using it
  • Loading branch information
sebsto committed Jan 9, 2025
1 parent cc89338 commit 01a4443
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 1 addition & 3 deletions Examples/ServiceLifeCycle/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ let package = Package(
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.6.3"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.executableTarget(name: "pg", dependencies: [
.product(name: "PostgresNIO", package: "postgres-nio"),
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
.product(name: "AWSLambdaRuntimeService", package: "swift-aws-lambda-runtime"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
]),
]
Expand Down
2 changes: 1 addition & 1 deletion Examples/ServiceLifeCycle/Sources/Lambda.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AWSLambdaRuntime
import AWSLambdaRuntimeService
import Logging
import PostgresNIO
import ServiceLifecycle
Expand Down
14 changes: 13 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ let package = Package(
products: [
// this library exports `AWSLambdaRuntimeCore` and adds Foundation convenience methods
.library(name: "AWSLambdaRuntime", targets: ["AWSLambdaRuntime"]),

// this library exports `AWSLambdaRuntime` and adds conformances to `Service` from Swift Service Lifecycle
.library(name: "AWSLambdaRuntimeService", targets: ["AWSLambdaRuntimeService"]),

// this has all the main functionality for lambda and it does not link Foundation
.library(name: "AWSLambdaRuntimeCore", targets: ["AWSLambdaRuntimeCore"]),

// plugin to package the lambda, creating an archive that can be uploaded to AWS
// requires Linux or at least macOS v15
.plugin(name: "AWSLambdaPackager", targets: ["AWSLambdaPackager"]),

// for testing only
.library(name: "AWSLambdaTesting", targets: ["AWSLambdaTesting"]),
],
Expand All @@ -22,12 +28,18 @@ let package = Package(
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.6.3"),
],
targets: [
.target(
name: "AWSLambdaRuntimeService",
dependencies: [
.byName(name: "AWSLambdaRuntime"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
]
),
.target(
name: "AWSLambdaRuntime",
dependencies: [
.byName(name: "AWSLambdaRuntimeCore"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
]
),
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
//
//===----------------------------------------------------------------------===//

@_exported import AWSLambdaRuntimeCore
import NIOCore
@_exported import AWSLambdaRuntime

import ServiceLifecycle
#if canImport(FoundationEssentials)
Expand Down

0 comments on commit 01a4443

Please sign in to comment.