From 1c9f999157e40b770c60518174355273875bf88d Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Thu, 9 Jan 2020 22:19:33 +0100 Subject: [PATCH 1/3] Add llvm-skip-rebuild to opts --- src/bootstrap/flags.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index ffc24367db6..813e89eef38 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -150,6 +150,14 @@ To learn more about a subcommand, run `./x.py -h`", "VALUE", ); opts.optopt("", "error-format", "rustc error format", "FORMAT"); + opts.optopt( + "", + "llvm-skip-rebuild", + "whether rebuilding llvm should be skipped \ + a VALUE of TRUE indicates that llvm will not be rebuilt \ + VALUE overrides the skip-rebuild option in config.toml.", + "VALUE", + ); // fn usage() let usage = From 0bbbd5d418f764146afdde3460c170db205ba0fa Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Thu, 9 Jan 2020 22:51:38 +0100 Subject: [PATCH 2/3] Match llvm-skip-rebuild flag --- src/bootstrap/flags.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 813e89eef38..1fbdd50a511 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -38,6 +38,8 @@ pub struct Flags { // // true => deny, false => warn pub deny_warnings: Option, + + pub llvm_skip_rebuild: Option, } pub enum Subcommand { @@ -495,6 +497,9 @@ Arguments: .map(|p| p.into()) .collect::>(), deny_warnings: parse_deny_warnings(&matches), + llvm_skip_rebuild: matches.opt_str("llvm-skip-rebuild").map(|s| s.to_lowercase()).map( + |s| s.parse::().expect("`llvm-skip-rebuild` should be either true or false"), + ), } } } From 7e50b599bfeb75f7be1d5a1fa855e37ec6d0e65d Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Thu, 9 Jan 2020 23:13:57 +0100 Subject: [PATCH 3/3] Prefer llvm-skip-rebuild flag value over config.toml --- src/bootstrap/config.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 944df66431f..110c8b844d5 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -493,9 +493,13 @@ impl Config { config.mandir = install.mandir.clone().map(PathBuf::from); } + // We want the llvm-skip-rebuild flag to take precedence over the + // skip-rebuild config.toml option so we store it separately + // so that we can infer the right value + let mut llvm_skip_rebuild = flags.llvm_skip_rebuild; + // Store off these values as options because if they're not provided // we'll infer default values for them later - let mut llvm_skip_rebuild = None; let mut llvm_assertions = None; let mut debug = None; let mut debug_assertions = None; @@ -517,7 +521,7 @@ impl Config { } set(&mut config.ninja, llvm.ninja); llvm_assertions = llvm.assertions; - llvm_skip_rebuild = llvm.skip_rebuild; + llvm_skip_rebuild = llvm_skip_rebuild.or(llvm.skip_rebuild); set(&mut config.llvm_optimize, llvm.optimize); set(&mut config.llvm_thin_lto, llvm.thin_lto); set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);