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
- use clearer names for callback queues to clarify that this queue is only used for callbacks
- use `Result.tryMap` where appropriate
Also:
- simplify how any final `stderr` data after process termination is read
- get rid of two warnings to a `default` clause in a switch that already covered all the cases
- extend a unit test to cover both errors when compiling package plugin and then fixing it but still having a warning
- when done with the plugin, just close the input channel (not need for a 'quit' mesage)
Copy file name to clipboardExpand all lines: Sources/Workspace/DefaultPluginScriptRunner.swift
+72-71Lines changed: 72 additions & 71 deletions
Original file line number
Diff line number
Diff line change
@@ -32,47 +32,60 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner {
32
32
self.enableSandbox = enableSandbox
33
33
}
34
34
35
+
/// Public protocol function that starts compiling the plugin script to an exectutable. 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 callbackq queue when compilation ends.
/// Public protocol function that starting evaluating a plugin by compiling it and running it 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). This function returns immediately and then calls the output handler as plain-text output is received from the plugin, and calls the completion handler once it finishes running.
52
+
/// Public protocol function that starts evaluating a plugin by compiling it and running it 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). This function returns immediately and then calls the output handler on the given callback queue when any plain-text output is received from the plugin, and calls the completion handler once it finishes running.
/// 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.
329
328
publicstructPluginCompilationResult{
330
-
/// Path of the compiled executable, or .none if compilation failed.
331
-
publicvarcompiledExecutable:AbsolutePath?
329
+
/// Process result of invoking the Swift compiler to produce the executable (contains command line, environment, exit status, and any output).
330
+
publicvarcompilerResult:ProcessResult
332
331
333
332
/// Path of the libClang diagnostics file emitted by the compiler (even if compilation succeded, it might contain warnings).
334
333
publicvardiagnosticsFile:AbsolutePath
335
334
336
-
/// Process result of invoking the Swift compiler to produce the executable (contains command line, environment, exit status, and any output).
337
-
publicvarcompilerResult:ProcessResult
335
+
/// Path of the compiled executable.
336
+
publicvarcompiledExecutable:AbsolutePath
338
337
}
339
338
340
339
341
340
/// An error encountered by the default plugin runner.
342
341
publicenumDefaultPluginScriptRunnerError:Error{
342
+
case compilationSetupFailed(error:Error)
343
343
case compilationFailed(PluginCompilationResult)
344
344
case invocationFailed(_ error:Error, command:[String])
0 commit comments