-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 build script warnings, streaming output from build scripts to the console #2630
Conversation
r? @brson |
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #2670) made this pull request unmergeable. Please resolve the merge conflicts. |
7efba6e
to
ed02fd9
Compare
Discussed during the tools triage yesterday, it was concluded that this seems like good functionality to have, but it also shows more need to targeting configuration at certain portions of the dependency graph (perhaps in the form of command line arguments) |
☔ The latest upstream changes (presumably #2703) made this pull request unmergeable. Please resolve the merge conflicts. |
ed02fd9
to
6512c72
Compare
☔ The latest upstream changes (presumably #2722) made this pull request unmergeable. Please resolve the merge conflicts. |
6512c72
to
8087d0b
Compare
☔ The latest upstream changes (presumably #2730) made this pull request unmergeable. Please resolve the merge conflicts. |
8087d0b
to
0c4c8e5
Compare
☔ The latest upstream changes (presumably #2743) made this pull request unmergeable. Please resolve the merge conflicts. |
0c4c8e5
to
19ad24c
Compare
ping r? @brson |
@bors r+ |
📌 Commit 19ad24c has been approved by |
⌛ Testing commit 19ad24c with merge cd590ad... |
💔 Test failed - cargo-win-msvc-32 |
@bors: retry On Sat, Jun 11, 2016 at 2:26 AM, bors [email protected] wrote:
|
⌛ Testing commit 19ad24c with merge 4c6a4ac... |
💔 Test failed - cargo-cross-linux |
This adds support for forwarding warnings from build scripts to the main console for diagnosis. A new `warning` metadata key is recognized by Cargo and is printed after a build script has finished executing. The purpose of this key is for build dependencies to try to produce useful warnings for local crates being developed. For example a parser generator could emit warnings about ambiguous grammars or the gcc crate could print warnings about the C/C++ code that's compiled. Warnings are only emitted for path dependencies by default (like lints) so warnings printed in crates.io crates are suppressed. cc rust-lang#1106
This commit modifies the CLI interface to allow the verbose (-v) flag to be specified multiple times. This'll be used soon to have `-vv` indicate that more output should be generated than `-v` during a normal build. Currently this commit changes the behavior of whether warnings are printed to print warnings for the **entire DAG of dependencies** if `-vv` is specified. That is, `--cap-lints` is never passed nor is any warning from build scripts if `-vv` is specified.
This commit alters Cargo's behavior when the `-vv` option is passed (two verbose flags) to stream output of all build scripts to the console. Cargo makes not attempt to prevent interleaving or indicate *which* build script is producing output, rather it simply forwards all output to one to the console. Cargo still acts as a middle-man, capturing the output, to parse build script output and interpret the results. The parsing is still deferred to completion but the stream output happens while the build script is running. On Unix this is implemented via `select` and on Windows this is implemented via IOCP. Closes rust-lang#1106
19ad24c
to
26690d3
Compare
@bors: r=brson |
📌 Commit 26690d3 has been approved by |
Add build script warnings, streaming output from build scripts to the console These commits add a few features to Cargo: * Cargo now recognizes the `warning` key in build scripts and will print warnings *after a build script has completed* if the build script is for a path dependency. That is, if a build script prints `cargo:warning=foo` then Cargo will forward that to the console if the crate's being developed. * Cargo now accepts multiple `-v` flags for all commands. The `-vv` flag prints warnings for *all* upstream crates, not just the local ones. * When the `-vv` flag is passed Cargo will stream the output of all build scripts to the console, allowing more easy debugging of what happened if the build fails later on. More details can be found in each commit, and otherwise this Closes #1106
☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64 |
Does this still work? I am trying to debug a build script by passing |
This PR is over a year old at this point so it's best to open an issue with a reproduction if it's not working |
These commits add a few features to Cargo:
warning
key in build scripts and will print warnings after a build script has completed if the build script is for a path dependency. That is, if a build script printscargo:warning=foo
then Cargo will forward that to the console if the crate's being developed.-v
flags for all commands. The-vv
flag prints warnings for all upstream crates, not just the local ones.-vv
flag is passed Cargo will stream the output of all build scripts to the console, allowing more easy debugging of what happened if the build fails later on.More details can be found in each commit, and otherwise this
Closes #1106