File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Examples/ResourcesPackaging Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 33
44import PackageDescription
55
6+ // needed for CI to test the local version of the library
7+ import struct Foundation. URL
8+
69let 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+ }
You can’t perform that action at this time.
0 commit comments