Skip to content

Commit 799af6a

Browse files
committed
fix ci
1 parent 466f46e commit 799af6a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Examples/ResourcesPackaging/Package.swift

+30
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
import PackageDescription
55

6+
// needed for CI to test the local version of the library
7+
import struct Foundation.URL
8+
69
let package = Package(
710
name: "ResourcesPackaging",
811
platforms: [.macOS(.v15)],
@@ -25,3 +28,30 @@ let package = Package(
2528
)
2629
]
2730
)
31+
32+
if let localDepsPath = Context.environment["LAMBDA_USE_LOCAL_DEPS"],
33+
localDepsPath != "",
34+
let v = try? URL(fileURLWithPath: localDepsPath).resourceValues(forKeys: [.isDirectoryKey]),
35+
v.isDirectory == true
36+
{
37+
// when we use the local runtime as deps, let's remove the dependency added above
38+
let indexToRemove = package.dependencies.firstIndex { dependency in
39+
if case .sourceControl(
40+
name: _,
41+
location: "https://github.com/swift-server/swift-aws-lambda-runtime.git",
42+
requirement: _
43+
) = dependency.kind {
44+
return true
45+
}
46+
return false
47+
}
48+
if let indexToRemove {
49+
package.dependencies.remove(at: indexToRemove)
50+
}
51+
52+
// then we add the dependency on LAMBDA_USE_LOCAL_DEPS' path (typically ../..)
53+
print("[INFO] Compiling against swift-aws-lambda-runtime located at \(localDepsPath)")
54+
package.dependencies += [
55+
.package(name: "swift-aws-lambda-runtime", path: localDepsPath)
56+
]
57+
}

0 commit comments

Comments
 (0)