Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc1aca6

Browse files
committedSep 30, 2024·
swift format
1 parent 0423c23 commit fc1aca6

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed
 

‎Package.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ let package = Package(
5757
"Archive the Lambda binary and prepare it for uploading to AWS. Requires docker on macOS or non Amazonlinux 2 distributions."
5858
),
5959
permissions: [
60-
.allowNetworkConnections(scope: .docker, reason: "The archiver plugin needs docker to build the executable that can be run in AWS Lambda.")
60+
.allowNetworkConnections(
61+
scope: .docker,
62+
reason:
63+
"The archiver plugin needs docker to build the executable that can be run in AWS Lambda."
64+
)
6165
]
6266
)
6367
),

‎Plugins/AWSLambdaPackager/Plugin.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import PackagePlugin
1615
import Foundation
16+
import PackagePlugin
1717

1818
@main
1919
@available(macOS 15.0, *)
@@ -112,7 +112,9 @@ struct AWSLambdaPackager: CommandPlugin {
112112
guard let buildPathOutput = dockerBuildOutputPath.split(separator: "\n").last else {
113113
throw Errors.failedParsingDockerOutput(dockerBuildOutputPath)
114114
}
115-
let buildOutputPath = URL(string: buildPathOutput.replacingOccurrences(of: "/workspace/", with: packageDirectory.description))!
115+
let buildOutputPath = URL(
116+
string: buildPathOutput.replacingOccurrences(of: "/workspace/", with: packageDirectory.description)
117+
)!
116118

117119
// build the products
118120
var builtProducts = [LambdaProduct: URL]()
@@ -126,7 +128,7 @@ struct AWSLambdaPackager: CommandPlugin {
126128
// just like Package.swift's examples assume ../.., we assume we are two levels below the root project
127129
let slice = packageDirectory.pathComponents.suffix(2)
128130
let beforeLastComponent = packageDirectory.pathComponents[slice.startIndex]
129-
let lastComponent = packageDirectory.pathComponents[slice.endIndex-1]
131+
let lastComponent = packageDirectory.pathComponents[slice.endIndex - 1]
130132
try Utils.execute(
131133
executable: dockerToolPath,
132134
arguments: [
@@ -302,7 +304,7 @@ private struct Configuration: CustomStringConvertible {
302304
var isDirectory: Bool = false
303305
#else
304306
var isDirectory: ObjCBool = false
305-
#endif
307+
#endif
306308
guard FileManager.default.fileExists(atPath: outputPath, isDirectory: &isDirectory)
307309
else {
308310
throw Errors.invalidArgument("invalid output directory '\(outputPath)'")
@@ -447,7 +449,9 @@ private struct LambdaProduct: Hashable {
447449
extension PackageManager.BuildResult {
448450
// find the executable produced by the build
449451
func executableArtifact(for product: Product) -> PackageManager.BuildResult.BuiltArtifact? {
450-
let executables = self.builtArtifacts.filter { $0.kind == .executable && $0.url.lastPathComponent == product.name }
452+
let executables = self.builtArtifacts.filter {
453+
$0.kind == .executable && $0.url.lastPathComponent == product.name
454+
}
451455
guard !executables.isEmpty else {
452456
return nil
453457
}

‎Plugins/AWSLambdaPackager/PluginUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Dispatch
16+
import Foundation
1617
import PackagePlugin
1718
import Synchronization
18-
import Foundation
1919

2020
@available(macOS 15.0, *)
2121
struct Utils {

‎Sources/AWSLambdaRuntimeCore/LambdaRuntime.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
import Foundation
1616
import Logging
17-
import NIOCore
1817
import NIOConcurrencyHelpers
18+
import NIOCore
1919

2020
// We need `@unchecked` Sendable here, as `NIOLockedValueBox` does not understand `sending` today.
2121
// We don't want to use `NIOLockedValueBox` here anyway. We would love to use Mutex here, but this
2222
// sadly crashes the compiler today.
2323
public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: StreamingLambdaHandler {
2424
// TODO: We want to change this to Mutex as soon as this doesn't crash the Swift compiler on Linux anymore
25-
let handlerMutex: NIOLockedValueBox<Optional<Handler>>
25+
let handlerMutex: NIOLockedValueBox<Handler?>
2626
let logger: Logger
2727
let eventLoop: EventLoop
2828

0 commit comments

Comments
 (0)
Please sign in to comment.