|
| 1 | +// swift-tools-version:6.0 |
| 2 | + |
| 3 | +import PackageDescription |
| 4 | + |
| 5 | +let package = Package( |
| 6 | + name: "swift-aws-lambda-runtime", |
| 7 | + platforms: [.macOS(.v15)], |
| 8 | + products: [ |
| 9 | + .library(name: "AWSLambdaRuntime", targets: ["AWSLambdaRuntime"]), |
| 10 | + // plugin to package the lambda, creating an archive that can be uploaded to AWS |
| 11 | + // requires Linux or at least macOS v15 |
| 12 | + .plugin(name: "AWSLambdaPackager", targets: ["AWSLambdaPackager"]), |
| 13 | + // for testing only |
| 14 | + .library(name: "AWSLambdaTesting", targets: ["AWSLambdaTesting"]), |
| 15 | + ], |
| 16 | + dependencies: [ |
| 17 | + .package(url: "https://github.com/apple/swift-nio.git", from: "2.81.0"), |
| 18 | + .package(url: "https://github.com/apple/swift-log.git", from: "1.5.4"), |
| 19 | + .package(url: "https://github.com/apple/swift-collections.git", from: "1.1.4"), |
| 20 | + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.6.3"), |
| 21 | + ], |
| 22 | + targets: [ |
| 23 | + .target( |
| 24 | + name: "AWSLambdaRuntime", |
| 25 | + dependencies: [ |
| 26 | + .product(name: "NIOCore", package: "swift-nio"), |
| 27 | + .product(name: "DequeModule", package: "swift-collections"), |
| 28 | + .product(name: "Logging", package: "swift-log"), |
| 29 | + .product(name: "NIOHTTP1", package: "swift-nio"), |
| 30 | + .product(name: "NIOPosix", package: "swift-nio"), |
| 31 | + .product(name: "ServiceLifecycle", package: "swift-service-lifecycle"), |
| 32 | + ], |
| 33 | + swiftSettings: [ |
| 34 | + .define("FoundationJSONSupport"), |
| 35 | + .define("ServiceLifecycleSupport"), |
| 36 | + .define("LocalServerSupport"), |
| 37 | + ] |
| 38 | + ), |
| 39 | + .plugin( |
| 40 | + name: "AWSLambdaPackager", |
| 41 | + capability: .command( |
| 42 | + intent: .custom( |
| 43 | + verb: "archive", |
| 44 | + description: |
| 45 | + "Archive the Lambda binary and prepare it for uploading to AWS. Requires docker on macOS or non Amazonlinux 2 distributions." |
| 46 | + ), |
| 47 | + permissions: [ |
| 48 | + .allowNetworkConnections( |
| 49 | + scope: .docker, |
| 50 | + reason: "This plugin uses Docker to create the AWS Lambda ZIP package." |
| 51 | + ) |
| 52 | + ] |
| 53 | + ) |
| 54 | + ), |
| 55 | + .testTarget( |
| 56 | + name: "AWSLambdaRuntimeCoreTests", |
| 57 | + dependencies: [ |
| 58 | + .byName(name: "AWSLambdaRuntime"), |
| 59 | + .product(name: "NIOTestUtils", package: "swift-nio"), |
| 60 | + .product(name: "NIOFoundationCompat", package: "swift-nio"), |
| 61 | + ] |
| 62 | + ), |
| 63 | + .testTarget( |
| 64 | + name: "AWSLambdaRuntimeTests", |
| 65 | + dependencies: [ |
| 66 | + .byName(name: "AWSLambdaRuntime") |
| 67 | + ] |
| 68 | + ), |
| 69 | + // testing helper |
| 70 | + .target( |
| 71 | + name: "AWSLambdaTesting", |
| 72 | + dependencies: [ |
| 73 | + .byName(name: "AWSLambdaRuntime"), |
| 74 | + .product(name: "NIOCore", package: "swift-nio"), |
| 75 | + .product(name: "NIOPosix", package: "swift-nio"), |
| 76 | + ] |
| 77 | + ), |
| 78 | + .testTarget( |
| 79 | + name: "AWSLambdaTestingTests", |
| 80 | + dependencies: [ |
| 81 | + .byName(name: "AWSLambdaTesting") |
| 82 | + ] |
| 83 | + ), |
| 84 | + // for perf testing |
| 85 | + .executableTarget( |
| 86 | + name: "MockServer", |
| 87 | + dependencies: [ |
| 88 | + .product(name: "Logging", package: "swift-log"), |
| 89 | + .product(name: "NIOHTTP1", package: "swift-nio"), |
| 90 | + .product(name: "NIOCore", package: "swift-nio"), |
| 91 | + .product(name: "NIOPosix", package: "swift-nio"), |
| 92 | + ] |
| 93 | + ), |
| 94 | + ] |
| 95 | +) |
0 commit comments