-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add hide_success and hide_progress options #135
Conversation
Thanks for sending this! Can you add a section to doc/comparison.md with a name like "ninja extensions" that describes these? What do you think about naming "hide_last_line" something more like "hide_progress"? I think that better describes the intent of the feature, and might allow more flexibility for changing details on how the feature works in the future, maybe? For example if you run n2 in a CI pipeline (where there's no terminal, just a stdout logfile) with the hide_last_line flag on, what behavior do you expect, and what behavior do you imagine another user would expect? |
src/load.rs
Outdated
@@ -158,13 +158,17 @@ impl Loader { | |||
}), | |||
_ => bail!("rspfile and rspfile_content need to be both specified"), | |||
}; | |||
let hide_success = lookup("hide_success").as_deref() == Some("1"); |
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.
I guess the precedent for boolean flags in ninja is the "restat = 1" flag, where it is just a presence/absence check rather than requiring an explicit "1", so maybe we should follow that here?
https://github.com/ninja-build/ninja/blob/2a34463e6ec38dab909af94740070d546354b16c/src/graph.cc#L515
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.
In android, we have a |
I love the idea of a separate program for customization progress! But this patch is about a per-build-edge customization of behavior. We had discussed this in the past and I didn’t have any better ideas. I guess you could wrap commands in something else that swallowed their stdout maybe? |
You can do per-build-edge customization based on the information in the EdgeStarted message. In our protobuf the most useful field for that would be the build description, but you could add the ability to add custom fields. One easy way would just be to pass the value of all variables starting with some prefix like "custom_" to the protobuf. Also in case it wasn't clear, the |
frontend_file is certainly the most flexible/generic solution, but for users who are otherwise happy with n2's existing pretty output, requiring them to implement their own frontend is not ideal. I've made the changes requested above. Regarding the non-pretty output case, I don't think hide_progress makes sense there, as that mode doesn't show progress. If you'd like anything else changed, please let me know. |
In general I'm a big fan of the frontend pipe idea (I think I might even have a branch around where I tried some of it, though with json instead of proto). But I also think this change looks good for dae's purposes. |
FYI I fixed CI after this (it was unrelated to your change, just coincidental timing of some github deprecation apparently) |
This is an implementation of the output suppression I mentioned in #68 (comment), and is related to #101. We've been using it in our project for the last year or so (1), and have been very happy with the balance of immediate output without overwhelming amounts of text being shown (2). I present it here not for immediate inclusion, but to rekindle discussion, as functionality like this would be nice to have in a stock n2 in the future.
(1) I've just rebased our version over the latest code
(2) One minor papercut is that certain terminal formatting codes can sometimes cause the progress output to render incorrectly, such as in the wrong color. But that's not an issue introduced by these changes.