Skip to content

Commit

Permalink
Auto merge of #2630 - alexcrichton:build-script-warnings, r=brson
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors authored Jun 14, 2016
2 parents 941f488 + 26690d3 commit 5a26b65
Show file tree
Hide file tree
Showing 41 changed files with 667 additions and 117 deletions.
38 changes: 38 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ glob = "0.2"
kernel32-sys = "0.2"
libc = "0.2"
log = "0.3"
miow = "0.1"
num_cpus = "0.2"
regex = "0.1"
rustc-serialize = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions src/bin/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Options {
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_lib: bool,
Expand Down Expand Up @@ -42,7 +42,7 @@ Options:
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to build benchmarks for
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Options {
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
Expand Down Expand Up @@ -44,7 +44,7 @@ Options:
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to compile
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use cargo::util::process_builder::process;
pub struct Flags {
flag_list: bool,
flag_version: bool,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_explain: Option<String>,
Expand All @@ -41,7 +41,7 @@ Options:
-V, --version Print version info and exit
--list List installed commands
--explain CODE Run `rustc --explain CODE`
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Options {
flag_package: Vec<String>,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
Expand All @@ -27,7 +27,7 @@ Options:
--manifest-path PATH Path to the manifest to the package to clean
--target TRIPLE Target triple to clean output for (default all)
--release Whether or not to clean release artifacts
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Options {
flag_no_deps: bool,
flag_open: bool,
flag_release: bool,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_package: Vec<String>,
Expand All @@ -39,7 +39,7 @@ Options:
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to document
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cargo::util::important_paths::find_root_manifest_for_wd;
#[derive(RustcDecodable)]
pub struct Options {
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Expand All @@ -19,7 +19,7 @@ Usage:
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to fetch dependencies for
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use cargo::util::important_paths::find_root_manifest_for_wd;
#[derive(RustcDecodable)]
pub struct Options {
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Expand All @@ -21,7 +21,7 @@ Usage:
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to generate a lockfile for
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
Expand Down
4 changes: 2 additions & 2 deletions src/bin/git_checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use cargo::util::{Config, CliResult, CliError, human, ToUrl};
pub struct Options {
flag_url: String,
flag_reference: String,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Expand All @@ -20,7 +20,7 @@ Usage:
Options:
-h, --help Print this message
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
Expand Down
4 changes: 2 additions & 2 deletions src/bin/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cargo::util::{CliResult, Config};

#[derive(RustcDecodable)]
pub struct Options {
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_bin: bool,
Expand All @@ -28,7 +28,7 @@ Options:
control at all (none) overriding a global configuration.
--bin Use a binary instead of a library template
--name NAME Set the resulting package name
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
Expand Down
4 changes: 2 additions & 2 deletions src/bin/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Options {
flag_debug: bool,
flag_bin: Vec<String>,
flag_example: Vec<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_root: Option<String>,
Expand Down Expand Up @@ -53,7 +53,7 @@ Build and install options:
--bin NAME Only install the binary NAME
--example EXAMPLE Install the example EXAMPLE instead of binaries
--root DIR Directory to install packages into
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet Less output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cargo::util::{CliResult, Config, human, ChainError};
pub struct Options {
flag_host: Option<String>,
arg_token: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
}
Expand All @@ -24,7 +24,7 @@ Usage:
Options:
-h, --help Print this message
--host HOST Host to set the token for
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct Options {
flag_no_default_features: bool,
flag_no_deps: bool,
flag_quiet: Option<bool>,
flag_verbose: Option<bool>,
flag_verbose: u32,
}

pub const USAGE: &'static str = "
Expand All @@ -35,7 +35,7 @@ Options:
--manifest-path PATH Path to the manifest
--format-version VERSION Format version [default: 1]
Valid values: 1
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
Expand Down
4 changes: 2 additions & 2 deletions src/bin/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cargo::util::{CliResult, Config};

#[derive(RustcDecodable)]
pub struct Options {
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_bin: bool,
Expand All @@ -28,7 +28,7 @@ Options:
control at all (none) overriding a global configuration.
--bin Use a binary instead of a library template
--name NAME Set the resulting package name
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
";
Expand Down
4 changes: 2 additions & 2 deletions src/bin/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct Options {
flag_add: Option<Vec<String>>,
flag_remove: Option<Vec<String>>,
flag_index: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_list: bool,
Expand All @@ -27,7 +27,7 @@ Options:
-l, --list List owners of a crate
--index INDEX Registry index to modify owners for
--token TOKEN API token to use when authenticating
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cargo::util::important_paths::find_root_manifest_for_wd;

#[derive(RustcDecodable)]
pub struct Options {
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_manifest_path: Option<String>,
Expand All @@ -27,7 +27,7 @@ Options:
--no-metadata Ignore warnings about a lack of human-usable metadata
--allow-dirty Allow dirty working directories to be packaged
--manifest-path PATH Path to the manifest to compile
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/pkgid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cargo::util::important_paths::{find_root_manifest_for_wd};

#[derive(RustcDecodable)]
pub struct Options {
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_manifest_path: Option<String>,
Expand All @@ -20,7 +20,7 @@ Usage:
Options:
-h, --help Print this message
--manifest-path PATH Path to the manifest to the package to clean
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Options {
flag_host: Option<String>,
flag_token: Option<String>,
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_no_verify: bool,
Expand All @@ -27,7 +27,7 @@ Options:
--no-verify Don't verify package tarball before publish
--allow-dirty Allow publishing with a dirty source directory
--manifest-path PATH Path to the manifest of the package to publish
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
4 changes: 2 additions & 2 deletions src/bin/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Options {
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
flag_verbose: Option<bool>,
flag_verbose: u32,
flag_quiet: Option<bool>,
flag_color: Option<String>,
flag_release: bool,
Expand All @@ -34,7 +34,7 @@ Options:
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to execute
-v, --verbose Use verbose output
-v, --verbose ... Use verbose output
-q, --quiet No output printed to stdout
--color WHEN Coloring: auto, always, never
Expand Down
Loading

0 comments on commit 5a26b65

Please sign in to comment.