-
Notifications
You must be signed in to change notification settings - Fork 1.4k
command plugins: Optionally print build logs during packageManager.build #7255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command plugins: Optionally print build logs during packageManager.build #7255
Conversation
} | ||
|
||
var position: Int { | ||
return 0 // should be related to the downstreams somehow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should 'position' return here? The downstreams might all be at different positions. Should this be the number of bytes which have been passed to write
, or should it be related to positions of the downstreams?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK, the doc comment for that protocol says it's "The current offset within the output stream", if that helps in any way.
4cd3d67
to
ff7a6a0
Compare
@swift-ci test |
@swift-ci test windows |
The Windows test failure doesn't immediately look like it's related to this change:
|
Yeah, that failure looks like something caused by Windows builds not running in complete isolation from each other 😕 |
@swift-ci test windows |
When a plugin asks for a target to be built by calling packageManager.build, SwiftPM accumulates the build log in a buffer and returns the whole log when the build completes. No feedback is printed on the console while the build is running, so if the target is large the user can't tell whether the build is making progress or is stuck. This commit adds the option to echo logs to the console as they are produced, in addition to accumulating them in a buffer. Console echoing is turned off by default.
56a5b02
to
35e5c1b
Compare
@swift-ci test |
@swift-ci test windows |
This commit adds the option for a build run on behalf of a command plugin to echo logs to the console as they are produced, in addition to the current behaviour of accumulating them in a buffer. Console echoing is turned off by default.
Motivation:
When a plugin asks for a target to be built by calling
packageManager.build
, SwiftPM accumulates the build log in a buffer and returns the whole log when the build completes. No feedback is printed on the console while the build is running, so if the target is large the user can't tell whether the build is making progress or is stuck.Modifications:
TeeOutputByteStream
, anOutputByteStream
which copies its inputs to a set of output streamsechoLogs
parameter topackageManager.build
, defaulting tofalse
to match the current behaviour.Result:
A command plugin can ask for build outputs to be echoed as they are produced. The user will have some feedback that a build is happening, rather than the long pause which can happen now.
This change depends on #7254.