PluginAPI: Optionally animate build progress in console #8383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a way to animate build progress in console triggered by PackagePlugin API.
Motivation:
When a package plugin asks SwiftPM to build a target, SwiftPM captures the whole build output including the progress messages and compiler diagnostics into a non-TTY output buffer stream. Use of the non-TTY output buffer stream makes the
[n/N] Compiling ...
progress messages always to be newlined. This is not ideal when building a large scale project as it consumes a lot of space in the terminal buffer.Modifications:
This commit introduces a new parameter
progressToConsole
to theBuildParameters
to allow the package plugin to decide whether to write the progress messages to the console or capture them intologText
buffer.Compiler diagnostics are still "tee"ed and they are not colored and are included in
logText
.Result:
Package plugin developers will be able to provide a better build output to plugin users.
progressToConsole: false
progressToConsole: true
Screen.Recording.2025-03-19.at.22.40.31.mov
Screen.Recording.2025-03-19.at.22.41.14.mov