mirror of
https://github.com/swift-server/swift-aws-lambda-runtime.git
synced 2026-05-03 07:22:27 +00:00
dee635267b
Change Examples, README, and doc to refer to https://github.org/awslabs instead of https://github.org/swift-server --------- Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
52 lines
1.8 KiB
Swift
52 lines
1.8 KiB
Swift
// swift-tools-version: 6.2
|
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
|
|
|
import PackageDescription
|
|
|
|
import struct Foundation.URL
|
|
|
|
let package = Package(
|
|
name: "Palindrome",
|
|
platforms: [.macOS(.v15)],
|
|
dependencies: [
|
|
.package(url: "https://github.com/awslabs/swift-aws-lambda-runtime.git", from: "2.0.0")
|
|
],
|
|
targets: [
|
|
// Targets are the basic building blocks of a package, defining a module or a test suite.
|
|
// Targets can depend on other targets in this package and products from dependencies.
|
|
.executableTarget(
|
|
name: "Palindrome",
|
|
dependencies: [
|
|
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime")
|
|
]
|
|
)
|
|
]
|
|
)
|
|
|
|
if let localDepsPath = Context.environment["LAMBDA_USE_LOCAL_DEPS"],
|
|
localDepsPath != "",
|
|
let v = try? URL(fileURLWithPath: localDepsPath).resourceValues(forKeys: [.isDirectoryKey]),
|
|
v.isDirectory == true
|
|
{
|
|
// when we use the local runtime as deps, let's remove the dependency added above
|
|
let indexToRemove = package.dependencies.firstIndex { dependency in
|
|
if case .sourceControl(
|
|
name: _,
|
|
location: "https://github.com/awslabs/swift-aws-lambda-runtime.git",
|
|
requirement: _
|
|
) = dependency.kind {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
if let indexToRemove {
|
|
package.dependencies.remove(at: indexToRemove)
|
|
}
|
|
|
|
// then we add the dependency on LAMBDA_USE_LOCAL_DEPS' path (typically ../..)
|
|
print("[INFO] Compiling against swift-aws-lambda-runtime located at \(localDepsPath)")
|
|
package.dependencies += [
|
|
.package(name: "swift-aws-lambda-runtime", path: localDepsPath)
|
|
]
|
|
}
|