@@ -19,7 +19,8 @@ let package = Package(
1919 . executable( name: " MyLambda " , targets: [ " MyLambda " ] )
2020 ] ,
2121 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")
2324 ] ,
2425 targets: [
2526 . executableTarget(
@@ -32,22 +33,20 @@ let package = Package(
3233 ]
3334)
3435
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+ ]
3845
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- }
5046} 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+ ]
5352}
0 commit comments