Skip to content

Commit 1d720a2

Browse files
committed
cleaner fix for --static-swift-stdlib issue on linux
1 parent 464fd01 commit 1d720a2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Examples/SAM/Package.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616

1717
import PackageDescription
1818

19-
var deploymentDescriptorDependency : [Target.Dependency] = []
20-
#if !os(Linux)
21-
deploymentDescriptorDependency = [.product(name: "AWSLambdaDeploymentDescriptor", package: "swift-aws-lambda-runtime")]
22-
#endif
23-
2419
let package = Package(
2520
name: "swift-aws-lambda-runtime-example",
2621
platforms: [
@@ -44,16 +39,22 @@ let package = Package(
4439
name: "HttpApiLambda",
4540
dependencies: [
4641
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
47-
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events")
48-
] + deploymentDescriptorDependency,
42+
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"),
43+
// linking the dynamic library does not work on Linux with --static-swift-stdlib because it is a dynamic library,
44+
// but we don't need it for packaging. Making it conditional will generate smaller ZIP files
45+
.product(name: "AWSLambdaDeploymentDescriptor", package: "swift-aws-lambda-runtime", condition: .when(platforms: [.macOS]))
46+
],
4947
path: "./HttpApiLambda"
5048
),
5149
.executableTarget(
5250
name: "SQSLambda",
5351
dependencies: [
5452
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"),
55-
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events")
56-
] + deploymentDescriptorDependency,
53+
.product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"),
54+
// linking the dynamic library does not work on Linux with --static-swift-stdlib because it is a dynamic library,
55+
// but we don't need it for packaging. Making it conditional will generate smaller ZIP files
56+
.product(name: "AWSLambdaDeploymentDescriptor", package: "swift-aws-lambda-runtime", condition: .when(platforms: [.macOS]))
57+
] ,
5758
path: "./SQSLambda"
5859
),
5960
.testTarget(

0 commit comments

Comments
 (0)