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