-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Indicate compilation progress in a form useful to end users #24335
Comments
Yes this would be so cool. |
I'm brand new to contributing, but I'd like to take a crack at this one. I'm pretty sure I can do the pretty terminal bits, but I would probably need help keeping the spinner running. |
I don't understand the relationship between the term repo and the libterm folder in this repo. But over in the term repo, I am working on an already-extant issue to add more features to the |
I'm not so sure myself, but my understanding is that since rustc doesn't use cargo, they embed the crate directly into this source tree. |
Quick update: the needed terminal stuff landed in the standalone term crate, but there is some work needed to get the version in In the mean time, I also started working on the substance of this issue in my progress branch. I think I can finish off the pretty-printing stuff, but I will still need helping figuring out how to get the spinner animation to work while other long-running compile phases are going on. |
@asolove You should be able to just add the required definitions to the |
What happens when things other than the progress notifications are printed to the screen? I like how
|
@dcampbell24 Yup, that's how this will work too. I think the practical way to get that behavior is to print out and then do a carriage return to move back to the beginning of the line you just printed to. Other output will overwrite it and add a newline and then we'll print the next status update to the bottom of the output. |
@asolove Don't forget that you have to delete the entire line before writing more output, because if the live message is shorter than the line that is printed out, some will remain. For example ideally:
And if you forget to delete the line first
|
Yup, left that out. My current plan is: delete the current line, write a line of status, then carriage return to end up at the beginning of the line again. In that scheme, only the last line of status output is ever displayed in the console. I don't understand how apt manages to leave behind its old status lines when other parts of the program write output. |
What about multiple |
Had not thought about that at all. What do you think is the desired behavior there? |
What I really want is an option for |
That sounds super cool and I have no idea how to do it... (Spends a few minutes looking through the cargo source.) It looks like right now we're shelling out to separate rustc processes that don't know about each other and would have a hard time collaborating in this kind of animation. Each process could potentially save the cursor position as of when it started and always write to that line. But any other output from the compiler would potentially overwrite other lines of the animation until they redraw. Alternately, we could redirect the output of those processes somewhere else, parse it, and have the actual final animation driven inside cargo. |
My 2c (with really no basis) What you probably want is a --status-pipe or somesuch, that causes rustc to I'm happy to chat more about this approach, although I'm not convinced it's On Tue, May 5, 2015 at 11:23 AM, Adam Solove [email protected]
|
Spent some time making a prototype to see what the end result could look like: see the video or try the code I assume if we got error output from any of the compilations, we'd mark that in red and show the errors underneath. |
@asolove that's dope. |
@asolove: woah. That is some quality console eye candy. |
@asolove holy cat! 👍 Very cool. As a side note, little things like these probably indicate how badly |
@asolove Maybe you could try actually using the functions you added to |
@retep998 the latest release on crates doesn't have them yet and I wanted others to be able to run the code directly. If there's a way to configure it to use master on that repo, I'd love to know. |
[dependencies.term]
git = "https://github.com/rust-lang/term.git" |
Aha, yay for learning things. |
Jeez, how big are the test crates? I've never seen "Parsing" take multiple seconds even on a huge crate. |
Yeah, this is a simulation! I'm just walking things through the states at random intervals. |
Ah, okay :) The output looks really nice! |
Thread is looking a little dead, so going to put in a vote of support for anyone still interested in working on this. I'm not familiar enough with rust yet, but my compile times are really long and I have no insight into why. This would really help! |
I don't even need pretty animations. Any kind of indication of what's going on would be appreciated. |
I discovered the following which gives me what I need: |
This could have given me a clue earlier! |
Doesn't rustc now have an unstable option to emit errors as json? That should probably help with this somewhat. |
Errors don't indicate compilation progress though, unless I'm misunderstanding something... |
I was playing around a week or so with an idea that I had, and I came up with a |
Still a worthy goal, but not "easy" since there is no agreed upon design. Accounting for the entire cargo pipeline like @alexcrichton did will be important for real use. |
So I'm not entirely sure that this is a good idea for rustc itself, especially since it seems that tools like |
I agree rustc itself shouldn't do the animation, and @richo's idea of "printing to a pipe" is better. Writing to stdout or stderr will cause bugs for tools which have strict requirement on the output format of rustc. Probably related to #42678. |
Triage: cargo now has a progress bar to show progress, but at the granularity of x/y crates, not for the compilation process of each crate. |
This seems hard to do today and even harder to do over time as we're slowly moving towards not having "phases" of compilation. We do emit a notification when we move to codegen today and there's an issue on Cargo rust-lang/cargo#7265 about actually displaying that. I think further improvements here are likely of the scope that prior discussion on internals and maybe even a compiler team planning meeting are necessary (i.e., how to architect useful progress in a query-based compiler). As such I'm going to close this issue. |
Was #22227, closed due to vandalism.
@sanxiyn said:
To which I replied:
+1. We can use control codes to update parts of the terminal without spewing output.
I will think about how to integrate this with
--color
and the drawing characters.I'm imagining that rustc in whiz-bang fancy terminal mode would display progress on a single line, updated at each stage:
And just that last "success" message will remain in your terminal buffer.
The spinner has a constant speed in wall-clock terms. Long-running parts of rustc will call
sess.update_spinner()
now and then to keep it going.After we pass the "rest easy" point, the spinner turns into a calming
+
and the first part of the message turns green.The text was updated successfully, but these errors were encountered: