diff options
| author | Tyler Mandry <tmandry@google.com> | 2020-09-24 01:13:25 +0000 |
|---|---|---|
| committer | Tyler Mandry <tmandry@google.com> | 2020-09-28 19:32:46 +0000 |
| commit | e715c7f234ba25c25b98894c822de9e7cf87558c (patch) | |
| tree | 657b3071c1d2693aba462d1bd3a7d82c7a943086 /src/bootstrap | |
| parent | d62d3f7fa9a91d933213cc10e20e740608983f64 (diff) | |
| download | rust-e715c7f234ba25c25b98894c822de9e7cf87558c.tar.gz rust-e715c7f234ba25c25b98894c822de9e7cf87558c.zip | |
bootstrap: Always build for host, even when target is given
This changes the behavior from *not* building for host whenever an explicit target is specified. I find this much less confusing. You can still disable host steps by passing an explicit empty list for host. Fixes #76990.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/builder/tests.rs | 19 | ||||
| -rw-r--r-- | src/bootstrap/config.rs | 7 |
2 files changed, 9 insertions, 17 deletions
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index 4a9082d3e85..3ca41be0a9f 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -342,31 +342,29 @@ mod dist { } #[test] - fn dist_with_target_flag() { - let mut config = configure(&["B"], &["C"]); - config.skip_only_host_steps = true; // as-if --target=C was passed + fn dist_with_empty_host() { + let mut config = configure(&[], &["C"]); + config.skip_only_host_steps = true; let build = Build::new(config); let mut builder = Builder::new(&build); builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]); let a = TargetSelection::from_user("A"); - let b = TargetSelection::from_user("B"); let c = TargetSelection::from_user("C"); assert_eq!( first(builder.cache.all::<dist::Docs>()), - &[dist::Docs { host: a }, dist::Docs { host: b }, dist::Docs { host: c },] + &[dist::Docs { host: a }, dist::Docs { host: c },] ); assert_eq!( first(builder.cache.all::<dist::Mingw>()), - &[dist::Mingw { host: a }, dist::Mingw { host: b }, dist::Mingw { host: c },] + &[dist::Mingw { host: a }, dist::Mingw { host: c },] ); assert_eq!(first(builder.cache.all::<dist::Rustc>()), &[]); assert_eq!( first(builder.cache.all::<dist::Std>()), &[ dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a }, - dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b }, dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c }, ] ); @@ -464,15 +462,14 @@ mod dist { } #[test] - fn build_with_target_flag() { - let mut config = configure(&["B"], &["C"]); + fn build_with_empty_host() { + let mut config = configure(&[], &["C"]); config.skip_only_host_steps = true; let build = Build::new(config); let mut builder = Builder::new(&build); builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]); let a = TargetSelection::from_user("A"); - let b = TargetSelection::from_user("B"); let c = TargetSelection::from_user("C"); assert_eq!( @@ -481,8 +478,6 @@ mod dist { compile::Std { compiler: Compiler { host: a, stage: 0 }, target: a }, compile::Std { compiler: Compiler { host: a, stage: 1 }, target: a }, compile::Std { compiler: Compiler { host: a, stage: 2 }, target: a }, - compile::Std { compiler: Compiler { host: a, stage: 1 }, target: b }, - compile::Std { compiler: Compiler { host: a, stage: 2 }, target: b }, compile::Std { compiler: Compiler { host: a, stage: 2 }, target: c }, ] ); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index b14746dabb9..942d1178a64 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -586,11 +586,6 @@ impl Config { let build = toml.build.unwrap_or_default(); - // If --target was specified but --host wasn't specified, don't run any host-only tests. - let has_hosts = build.host.is_some() || flags.host.is_some(); - let has_targets = build.target.is_some() || flags.target.is_some(); - config.skip_only_host_steps = !has_hosts && has_targets; - config.hosts = if let Some(arg_host) = flags.host { arg_host } else if let Some(file_host) = build.host { @@ -598,6 +593,8 @@ impl Config { } else { vec![config.build] }; + // If host was explicitly given an empty list, don't run any host-only steps. + config.skip_only_host_steps = config.hosts.is_empty(); config.targets = if let Some(arg_target) = flags.target { arg_target } else if let Some(file_target) = build.target { |
