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
Split out compilation of package plugins so it can be done separately from invoking them (typically for collecting diagnostics up-front) and add a PluginCompilationResult type that can be returned to clients. (#3841)
/// Public protocol function that compiles and runs the plugin as a subprocess. 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).
/// Helper function that compiles a plugin script as an executable and returns the path of the executable, any emitted diagnostics, etc. This function only throws an error if it wasn't even possible to start compiling the plugin — any regular compilation errors or warnings will be reflected in the returned compilation result.
@@ -210,9 +227,24 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner {
210
227
}
211
228
}
212
229
230
+
/// The result of compiling a plugin. The executable path will only be present if the compilation succeeds, while the other properties are present in all cases.
231
+
publicstructPluginCompilationResult{
232
+
/// Path of the compiled executable, or .none if compilation failed.
233
+
publicvarcompiledExecutable:AbsolutePath?
234
+
235
+
/// Path of the libClang diagnostics file emitted by the compiler (even if compilation succeded, it might contain warnings).
236
+
publicvardiagnosticsFile:AbsolutePath
237
+
238
+
/// Process result of invoking the Swift compiler to produce the executable (contains command line, environment, exit status, and any output).
239
+
publicvarcompilerResult:ProcessResult
240
+
}
241
+
213
242
214
243
/// An error encountered by the default plugin runner.
215
244
publicenumDefaultPluginScriptRunnerError:Error{
245
+
/// Failed to compile the plugin script, so it cannot be run.
246
+
case compilationFailed(PluginCompilationResult)
247
+
216
248
/// Failed to start running the compiled plugin script as a subprocess. The message describes the error, and the
217
249
/// command is the full command line that the runner tried to launch.
218
250
case subprocessDidNotStart(_ message:String, command:[String])
@@ -230,6 +262,8 @@ public enum DefaultPluginScriptRunnerError: Error {
0 commit comments