Skip to content

Commit 570b416

Browse files
committed
adjust for local CI
1 parent bd07401 commit 570b416

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

Examples/AWSSDK/Package.swift

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,25 @@
1818

1919
import PackageDescription
2020

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+
2131
let package = Package(
22-
name: "aws-swift-app",
23-
platforms: [.macOS(.v15)],
32+
name: "AWSSDKExample",
33+
platforms: platforms,
2434
products: [
2535
.executable(name: "AWSSDKExample", targets: ["AWSSDKExample"])
2636
],
2737
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")
2940
.package(url: "https://github.com/swift-server/swift-aws-lambda-events", branch: "main"),
3041
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.0.0")
3142
],
@@ -40,3 +51,21 @@ let package = Package(
4051
)
4152
]
4253
)
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

Comments
 (0)