Skip to content
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

Merged
merged 3 commits into from
Jun 14, 2016

Conversation

alexcrichton
Copy link
Member

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

@alexcrichton
Copy link
Member Author

r? @brson

@rust-highfive rust-highfive assigned brson and unassigned huonw Apr 30, 2016
@rust-highfive
Copy link

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

@bors
Copy link
Collaborator

bors commented May 11, 2016

☔ The latest upstream changes (presumably #2670) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton alexcrichton force-pushed the build-script-warnings branch 2 times, most recently from 7efba6e to ed02fd9 Compare May 18, 2016 17:02
@alexcrichton
Copy link
Member Author

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)

@bors
Copy link
Collaborator

bors commented May 18, 2016

☔ The latest upstream changes (presumably #2703) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented May 20, 2016

☔ The latest upstream changes (presumably #2722) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented May 23, 2016

☔ The latest upstream changes (presumably #2730) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented May 26, 2016

☔ The latest upstream changes (presumably #2743) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member Author

ping r? @brson

@brson
Copy link
Contributor

brson commented Jun 11, 2016

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 11, 2016

📌 Commit 19ad24c has been approved by brson

@bors
Copy link
Collaborator

bors commented Jun 11, 2016

⌛ Testing commit 19ad24c with merge cd590ad...

@bors
Copy link
Collaborator

bors commented Jun 11, 2016

💔 Test failed - cargo-win-msvc-32

@alexcrichton
Copy link
Member Author

@bors: retry

On Sat, Jun 11, 2016 at 2:26 AM, bors notifications@github.com wrote:

💔 Test failed - cargo-win-msvc-32
http://buildbot.rust-lang.org/builders/cargo-win-msvc-32/builds/469


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2630 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAD95FCP_J_Ee2Mp5J5Gt5PBhz5cywrmks5qKgCwgaJpZM4ITftI
.

@bors
Copy link
Collaborator

bors commented Jun 12, 2016

⌛ Testing commit 19ad24c with merge 4c6a4ac...

@bors
Copy link
Collaborator

bors commented Jun 12, 2016

💔 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
@alexcrichton
Copy link
Member Author

@bors: r=brson

@bors
Copy link
Collaborator

bors commented Jun 14, 2016

📌 Commit 26690d3 has been approved by brson

@bors
Copy link
Collaborator

bors commented Jun 14, 2016

⌛ Testing commit 26690d3 with merge 5a26b65...

bors added a commit that referenced this pull request Jun 14, 2016
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
@bors
Copy link
Collaborator

bors commented Jun 14, 2016

@gnzlbg
Copy link
Contributor

gnzlbg commented Nov 17, 2017

Does this still work?

I am trying to debug a build script by passing -vv without any luck :/

@alexcrichton
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants