File tree 1 file changed +30
-0
lines changed
Examples/ResourcesPackaging
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import PackageDescription
5
5
6
+ // needed for CI to test the local version of the library
7
+ import struct Foundation. URL
8
+
6
9
let package = Package (
7
10
name: " ResourcesPackaging " ,
8
11
platforms: [ . macOS( . v15) ] ,
@@ -25,3 +28,30 @@ let package = Package(
25
28
)
26
29
]
27
30
)
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
+ }
You can’t perform that action at this time.
0 commit comments