18
18
19
19
import PackageDescription
20
20
21
+ // needed for CI to test the local version of the library
22
+ import class Foundation. ProcessInfo
23
+ import struct Foundation. URL
24
+
25
+ #if os(macOS)
26
+ let platforms : [ PackageDescription . SupportedPlatform ] ? = [ . macOS( . v15) ]
27
+ #else
28
+ let platforms : [ PackageDescription . SupportedPlatform ] ? = nil
29
+ #endif
30
+
21
31
let package = Package (
22
- name: " aws-swift-app " ,
23
- platforms: [ . macOS ( . v15 ) ] ,
32
+ name: " AWSSDKExample " ,
33
+ platforms: platforms ,
24
34
products: [
25
35
. executable( name: " AWSSDKExample " , targets: [ " AWSSDKExample " ] )
26
36
] ,
27
37
dependencies: [
28
- . package ( url: " https://github.com/swift-server/swift-aws-lambda-runtime " , branch: " main " ) ,
38
+ // dependency on swift-aws-lambda-runtime is added dynamically below
39
+ // .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", branch: "main")
29
40
. package ( url: " https://github.com/swift-server/swift-aws-lambda-events " , branch: " main " ) ,
30
41
. package ( url: " https://github.com/awslabs/aws-sdk-swift " , from: " 1.0.0 " )
31
42
] ,
@@ -40,3 +51,21 @@ let package = Package(
40
51
)
41
52
]
42
53
)
54
+
55
+ if let localDepsPath = ProcessInfo . processInfo. environment [ " LAMBDA_USE_LOCAL_DEPS " ] ,
56
+ localDepsPath != " " ,
57
+ let v = try ? URL ( fileURLWithPath: localDepsPath) . resourceValues ( forKeys: [ . isDirectoryKey] ) ,
58
+ let _ = v. isDirectory
59
+ {
60
+ print ( " [INFO] Compiling against swift-aws-lambda-runtime located at \( localDepsPath) " )
61
+ package . dependencies += [
62
+ . package ( name: " swift-aws-lambda-runtime " , path: localDepsPath)
63
+ ]
64
+
65
+ } else {
66
+ print ( " [INFO] LAMBDA_USE_LOCAL_DEPS is not pointing to your local swift-aws-lambda-runtime code " )
67
+ print ( " [INFO] This project will compile against the main branch of the Lambda Runtime on GitHub " )
68
+ package . dependencies += [
69
+ . package ( url: " https://github.com/swift-server/swift-aws-lambda-runtime.git " , branch: " main " )
70
+ ]
71
+ }
0 commit comments