Skip to content

Commit ec71d58

Browse files
committed
Make the entry point async. This is somewhat preliminary, since I'm trying to find a way to do this without requiring macOS 12 for any use of plugins.
1 parent 59bd4d3 commit ec71d58

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/PackagePlugin/Implementation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
extension Plugin {
2929

30-
public static func main() throws {
30+
public static func main() async throws {
3131
// Look for the input JSON as the last argument of the invocation.
3232
guard let inputData = ProcessInfo.processInfo.arguments.last?.data(using: .utf8) else {
3333
fputs("Expected last argument to contain JSON input data in UTF-8 encoding, but didn't find it.", stderr)
@@ -57,7 +57,7 @@ extension Plugin {
5757
guard let plugin = plugin as? BuildToolPlugin else {
5858
throw PluginDeserializationError.malformedInputJSON("Plugin declared with `buildTool` capability but doesn't conform to `BuildToolPlugin` protocol")
5959
}
60-
let commands = try plugin.createBuildCommands(context: context)
60+
let commands = try await plugin.createBuildCommands(context: context)
6161

6262
// Convert the commands to the encodable output representation SwiftPM currently expects.
6363
output.buildCommands = commands.compactMap {

Sources/PackagePlugin/PublicAPI/Protocols.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ public protocol BuildToolPlugin: Plugin {
3131
/// commands, configured based on the information in the context.
3232
func createBuildCommands(
3333
context: TargetBuildContext
34-
) throws -> [Command]
34+
) async throws -> [Command]
3535
}

0 commit comments

Comments
 (0)