diff options
| author | kennytm <kennytm@gmail.com> | 2018-03-17 17:20:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-17 17:20:41 +0800 |
| commit | 2a7dac05e7d774c0b2138fbb7139f73f86808cdd (patch) | |
| tree | 88a87b497b4247223cab1518751f237feca85e53 /src/bootstrap | |
| parent | 8cabda4ce8d675868acff69e69250ad0b08d059b (diff) | |
| parent | ec49234f44adbaf858efa646df67a41055fc905d (diff) | |
| download | rust-2a7dac05e7d774c0b2138fbb7139f73f86808cdd.tar.gz rust-2a7dac05e7d774c0b2138fbb7139f73f86808cdd.zip | |
Rollup merge of #48943 - comex:verbose, r=kennytm
Support extra-verbose builds
- The bootstrap crate currently passes -v to Cargo if itself invoked with -vv. But Cargo supports -vv (to show build script output), so make bootstrap pass that if itself invoked with -vvv. (More specifically, pass N '-v's to Cargo if invoked with N+1 of them.)
- bootstrap.py currently tries to pass on up to two '-v's to cargo when building bootstrap, but incorrectly ('-v' is marked as 'store_true', so argparse stores either False or True, ignoring multiple '-v's). Fix this, allow passing any number of '-v's, and make it consistent with bootstrap's invocation of Cargo (i.e. subtract one from the number of '-v's).
- Also improve bootstrap.py's config.toml 'parsing' to support arbitrary verbosity levels, + allow command line to override it.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/bootstrap.py | 13 | ||||
| -rw-r--r-- | src/bootstrap/builder.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/flags.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 4 |
4 files changed, 7 insertions, 14 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index d8f7cd7ed92..11f174a52a6 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -597,10 +597,8 @@ class RustBuild(object): self.cargo())) args = [self.cargo(), "build", "--manifest-path", os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")] - if self.verbose: + for _ in range(1, self.verbose): args.append("--verbose") - if self.verbose > 1: - args.append("--verbose") if self.use_locked_deps: args.append("--locked") if self.use_vendored_sources: @@ -675,7 +673,7 @@ def bootstrap(help_triggered): parser.add_argument('--config') parser.add_argument('--build') parser.add_argument('--clean', action='store_true') - parser.add_argument('-v', '--verbose', action='store_true') + parser.add_argument('-v', '--verbose', action='count', default=0) args = [a for a in sys.argv if a != '-h' and a != '--help'] args, _ = parser.parse_known_args(args) @@ -691,10 +689,9 @@ def bootstrap(help_triggered): except (OSError, IOError): pass - if '\nverbose = 2' in build.config_toml: - build.verbose = 2 - elif '\nverbose = 1' in build.config_toml: - build.verbose = 1 + match = re.search(r'\nverbose = (\d+)', build.config_toml) + if match is not None: + build.verbose = max(build.verbose, int(match.group(1))) build.use_vendored_sources = '\nvendor = true' in build.config_toml diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 46453657ac7..675d3dd437e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -763,7 +763,7 @@ impl<'a> Builder<'a> { cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1"); } - if self.is_very_verbose() { + for _ in 1..self.verbosity { cargo.arg("-v"); } diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index af50ad1e96b..c5af0f8e2e1 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -29,7 +29,7 @@ use cache::{Interned, INTERNER}; /// Deserialized version of all flags for this compile. pub struct Flags { - pub verbose: usize, // verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose + pub verbose: usize, // number of -v args; each extra -v after the first is passed to Cargo pub on_fail: Option<String>, pub stage: Option<u32>, pub keep_stage: Option<u32>, diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 10a2fc7f58a..b778ba33d89 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -606,10 +606,6 @@ impl Build { self.verbosity > 0 } - pub fn is_very_verbose(&self) -> bool { - self.verbosity > 1 - } - /// Prints a message if this build is configured in verbose mode. fn verbose(&self, msg: &str) { if self.is_verbose() { |
