-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Build log on the CLI lags behind actual build operations #7948
Comments
You may want to try #7897. I also got annoyed by the progress tracker but took a more aggressive approach than described here. I'm having a little trouble finding time to complete the feature. If you're interested, I'm open to collaborating on it. |
Thanks, that looks fantastic! It appears you already addressed this issue in that WIP pull.
I will build it locally and can give feedback and tweaks, but I doubt much more than that. Did you investigate if llbuild can be made to signal on starting build commands also, not just when they're finished? I notice you're stuck with that same problem for llbuild output, but your seemingly much more detailed build output may not need that info as much. |
While waiting for this bigger feature, I'm going to add finish logs with timings to the verbose mode. I'll get that up on Monday. It was helping me understand Windows builds last week. |
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
I've been building repos with some files that compile slowly lately and the SwiftPM console output never lists the actual file that's slow. I looked into this in the source this weekend, and the issue is that
LLBuildProgressTracker
only prints to the console when a task is finished, but puts out messages likeCompiling SwiftSyntax Tokens.swift
once that compilation is over, ie misleading that the operation is still ongoing.Looking at the source of
Build/LLBuildProgressTracker.swift
and running a few builds after modifying that file, it gets output from two sources, the Swift compiler and llbuild, which handles linking executables and building C and C++. The Swift compiler signals when it starts and finishes an operation, but llbuild only appears to do so when finished. However, SwiftPM ignores when the Swift compiler starts an operation, and only prints "Compiling..." and so on when the operation is finished.I was able to improve this with this small patch, to print the same output when the Swift compiler starts, rather than when it finishes, removing a now unnecessary dictionary in the process:
Trying this modified Sep. 4 trunk snapshot of SwiftPM with the same slow package builds shows that it correctly identifies the slow Swift compilation now.
However, slow C++ builds are still not identified correctly, as that would require llbuild to notify when a build operation started, not when it finished, as the Swift compiler already does.
@hartbit, you added this in #2064 several years ago, let me know what you think of this timing tweak.
@neonichu and @dmbryson from the llbuild side, perhaps either of you has an opinion.
Expected behavior
If you're going to say an action is ongoing, you should trigger the console output at the start of the action, not the finish. Obviously, this doesn't matter most of the time when it flies by so fast that nobody looks at the output, but for the times you need it, it should report the right output.
Actual behavior
Say some build action
Linking giant-exe
is really slow. Rather than SwiftPM saying that is what is doing, it will show the previously completed action outputWrite Objects.LinkFileList
until that slow linking is done.Steps to reproduce
swift build
for any repo with some slow build operation, such asswift-foundation-icu
Swift Package Manager version/commit hash
swift-DEVELOPMENT-SNAPSHOT-2024-09-04-a
Swift & OS version (output of
swift --version ; uname -a
)All Swift versions I've tried on linux and Android
The text was updated successfully, but these errors were encountered: