Add build script warnings, streaming output from build scripts to the console #2630

Merged
merged 3 commits into from Jun 14, 2016

Conversation

Projects
None yet
6 participants
@alexcrichton
Member

alexcrichton commented Apr 30, 2016

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

This comment has been minimized.

Show comment
Hide comment
Member

alexcrichton commented Apr 30, 2016

r? @brson

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

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Apr 30, 2016

r? @huonw

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

r? @huonw

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

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors May 11, 2016

Contributor

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

Contributor

bors commented May 11, 2016

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

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton May 18, 2016

Member

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)

Member

alexcrichton commented May 18, 2016

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

This comment has been minimized.

Show comment
Hide comment
@bors

bors May 18, 2016

Contributor

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

Contributor

bors commented May 18, 2016

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

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors May 20, 2016

Contributor

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

Contributor

bors commented May 20, 2016

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

@mystor mystor referenced this pull request in alexcrichton/cc-rs May 20, 2016

Closed

(optionally) emit warning messages from C(++) compiler #81

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors May 23, 2016

Contributor

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

Contributor

bors commented May 23, 2016

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

@tomaka tomaka referenced this pull request in vulkano-rs/vulkano May 25, 2016

Open

Show warnings generated by glslang #117

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors May 26, 2016

Contributor

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

Contributor

bors commented May 26, 2016

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

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
Member

alexcrichton commented Jun 9, 2016

ping r? @brson

@brson

This comment has been minimized.

Show comment
Hide comment
@brson

brson Jun 11, 2016

Contributor

@bors r+

Contributor

brson commented Jun 11, 2016

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 11, 2016

Contributor

📌 Commit 19ad24c has been approved by brson

Contributor

bors commented Jun 11, 2016

📌 Commit 19ad24c has been approved by brson

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 11, 2016

Contributor

⌛️ Testing commit 19ad24c with merge cd590ad...

Contributor

bors commented Jun 11, 2016

⌛️ Testing commit 19ad24c with merge cd590ad...

bors added a commit that referenced this pull request Jun 11, 2016

Auto merge of #2630 - alexcrichton:build-script-warnings, r=brson
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

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 11, 2016

Contributor

💔 Test failed - cargo-win-msvc-32

Contributor

bors commented Jun 11, 2016

💔 Test failed - cargo-win-msvc-32

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jun 12, 2016

Member

@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
.

Member

alexcrichton commented Jun 12, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 12, 2016

Contributor

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

Contributor

bors commented Jun 12, 2016

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

bors added a commit that referenced this pull request Jun 12, 2016

Auto merge of #2630 - alexcrichton:build-script-warnings, r=brson
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

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 12, 2016

Contributor

💔 Test failed - cargo-cross-linux

Contributor

bors commented Jun 12, 2016

💔 Test failed - cargo-cross-linux

alexcrichton added some commits Apr 12, 2016

Forward warnings from build scripts
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 #1106
Allow specifying -v multiple times
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.
Stream build script output to the console
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 #1106
@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jun 14, 2016

Member

@bors: r=brson

Member

alexcrichton commented Jun 14, 2016

@bors: r=brson

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 14, 2016

Contributor

📌 Commit 26690d3 has been approved by brson

Contributor

bors commented Jun 14, 2016

📌 Commit 26690d3 has been approved by brson

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Jun 14, 2016

Contributor

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

Contributor

bors commented Jun 14, 2016

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

bors added a commit that referenced this pull request Jun 14, 2016

Auto merge of #2630 - alexcrichton:build-script-warnings, r=brson
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 bors merged commit 26690d3 into rust-lang:master Jun 14, 2016

2 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@alexcrichton alexcrichton deleted the alexcrichton:build-script-warnings branch Jun 16, 2016

@jedireza jedireza referenced this pull request in neon-bindings/neon Dec 26, 2016

Merged

Windows npm issues #159

@gnzlbg

This comment has been minimized.

Show comment
Hide comment
@gnzlbg

gnzlbg Nov 17, 2017

Does this still work?

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

gnzlbg commented Nov 17, 2017

Does this still work?

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

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Nov 17, 2017

Member

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

Member

alexcrichton commented Nov 17, 2017

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