You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/SPMBuildCore/Plugins/PluginScriptRunner.swift
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ import PackageGraph
20
20
publicprotocolPluginScriptRunner{
21
21
22
22
/// Public protocol function that starts compiling the plugin script to an executable. The name is used as the basename for the executable and auxiliary files. The tools version controls the availability of APIs in PackagePlugin, and should be set to the tools version of the package that defines the plugin (not of the target to which it is being applied). This function returns immediately and then calls the completion handler on the callback queue when compilation ends.
23
+
@available(*, noasync, message:"Use the async alternative")
23
24
func compilePluginScript(
24
25
sourceFiles:[AbsolutePath],
25
26
pluginName:String,
@@ -61,6 +62,29 @@ public protocol PluginScriptRunner {
61
62
varhostTriple:Triple{get throws}
62
63
}
63
64
65
+
publicextensionPluginScriptRunner{
66
+
func compilePluginScript(
67
+
sourceFiles:[AbsolutePath],
68
+
pluginName:String,
69
+
toolsVersion:ToolsVersion,
70
+
observabilityScope:ObservabilityScope,
71
+
callbackQueue:DispatchQueue,
72
+
delegate:PluginScriptCompilerDelegate
73
+
)asyncthrows->PluginCompilationResult{
74
+
tryawaitsafe_async{
75
+
self.compilePluginScript(
76
+
sourceFiles: sourceFiles,
77
+
pluginName: pluginName,
78
+
toolsVersion: toolsVersion,
79
+
observabilityScope: observabilityScope,
80
+
callbackQueue: callbackQueue,
81
+
delegate: delegate,
82
+
completion: $0
83
+
)
84
+
}
85
+
}
86
+
}
87
+
64
88
/// Protocol by which `PluginScriptRunner` communicates back to the caller as it compiles plugins.
65
89
publicprotocolPluginScriptCompilerDelegate{
66
90
/// Called immediately before compiling a plugin. Will not be called if the plugin didn't have to be compiled. This call is always followed by a `didCompilePlugin()` but is mutually exclusive with a `skippedCompilingPlugin()` call.
0 commit comments