@@ -19,7 +19,8 @@ let package = Package(
19
19
. executable( name: " MyLambda " , targets: [ " MyLambda " ] )
20
20
] ,
21
21
dependencies: [
22
- . package ( url: " https://github.com/swift-server/swift-aws-lambda-runtime.git " , branch: " main " )
22
+ // dependency on swift-aws-lambda-runtime is added dynamically below
23
+ // .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", branch: "main")
23
24
] ,
24
25
targets: [
25
26
. executableTarget(
@@ -32,22 +33,20 @@ let package = Package(
32
33
]
33
34
)
34
35
35
- if let localDepsPath = ProcessInfo . processInfo. environment [ " LAMBDA_USE_LOCAL_DEPS " ] , localDepsPath != " " {
36
-
37
- print ( " ++++++++ \( localDepsPath) " )
36
+ if let localDepsPath = ProcessInfo . processInfo. environment [ " LAMBDA_USE_LOCAL_DEPS " ] ,
37
+ localDepsPath != " " ,
38
+ let v = try ? URL ( fileURLWithPath: localDepsPath) . resourceValues ( forKeys: [ . isDirectoryKey] ) ,
39
+ let _ = v. isDirectory
40
+ {
41
+ print ( " [INFO] Compiling against swift-aws-lambda-runtime located at \( localDepsPath) " )
42
+ package . dependencies += [
43
+ . package ( name: " swift-aws-lambda-runtime " , path: localDepsPath)
44
+ ]
38
45
39
- // check if directory exists
40
- let u = URL ( fileURLWithPath: localDepsPath)
41
- if let v = try ? u. resourceValues ( forKeys: [ . isDirectoryKey] ) , v. isDirectory! {
42
- print ( " Compiling against swift-aws-lambda-runtime located at \( localDepsPath) " )
43
- package . dependencies = [
44
- . package ( name: " swift-aws-lambda-runtime " , path: localDepsPath)
45
- ]
46
- } else {
47
- print ( " LAMBDA_USE_LOCAL_DEPS is not pointing to your local swift-aws-lambda-runtime code " )
48
- print ( " This project will compile against the main branch of the Lambda Runtime on GitHub " )
49
- }
50
46
} else {
51
- print ( " ++++++++ NO ENV VAR " )
52
-
47
+ print ( " [INFO] LAMBDA_USE_LOCAL_DEPS is not pointing to your local swift-aws-lambda-runtime code " )
48
+ print ( " [INFO] This project will compile against the main branch of the Lambda Runtime on GitHub " )
49
+ package . dependencies += [
50
+ . package ( url: " https://github.com/swift-server/swift-aws-lambda-runtime.git " , branch: " main " )
51
+ ]
53
52
}
0 commit comments