google / cargo-raze

Generate Bazel BUILD from Cargo dependencies!
Apache License 2.0
479 stars 104 forks source link

Suppress stderr output of `build.rs` #39

Open SirVer opened 6 years ago

SirVer commented 6 years ago

My fellow engineers at Lyft complain that building the rust stuff generates a ton of noisy output on the command line. The reason is that when cargo-raze runs build.rs, it still echos all the stderr these scripts generate - though of course bazel is ignoring them entirely.

Can we suppress the output of stderr/stdout when we run these scripts?

acmcarther commented 6 years ago

Something like this would work, but I'm not sure if this is exactly what we'd want.

Have you done the mental legwork to make sure we'd never want to see output from the build script? That's not rhetorical, I'm genuinely not sure....

EDIT: Well, we could just pipe everything to stdout. I think Bazel eats stdout unless the step fails.

EDIT EDIT: Do you have an example third party crate handy so I could see what it looks like?

SirVer commented 6 years ago

Have you done the mental legwork to make sure we'd never want to see output from the build script? That's not rhetorical, I'm genuinely not sure....

I doubt we ever want to, since the stderr output is meant for cargo. So it has merit when you need to thinker the build rules, but for regular building it is definitely not required.

EDIT: Well, we could just pipe everything to stdout. I think Bazel eats stdout unless the step fails.

I think this is the best approach. The output is then available when you ask for verbose build failures and hidden otherwise.

EDIT EDIT: Do you have an example third party crate handy so I could see what it looks like?

libsdl2-sys outputs a few lines. I think ring is the most spammy.

SirVer commented 6 years ago

Actually, I just realized that cargo build scripts actually use stdout. So bazel is actually echoing stdout. I was playing around with 1>&2, but that did not make the text go away. In the end, I needed to do > /dev/null.