Skip to content

Commit 80bf0ab

Browse files
authored
Rollup merge of rust-lang#61621 - Mark-Simulacrum:bootstrap-run-only-hosts, r=alexcrichton
Clarify when we run steps with ONLY_HOSTS Just some simple cleanup, no behavior changes. r? @alexcrichton
2 parents 7db8129 + 367b031 commit 80bf0ab

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/bootstrap/builder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
5959

6060
const DEFAULT: bool = false;
6161

62-
/// Run this rule for all hosts without cross compiling.
62+
/// If true, then this rule should be skipped if --target was specified, but --host was not
6363
const ONLY_HOSTS: bool = false;
6464

6565
/// Primary function to execute this rule. Can call `builder.ensure()`
@@ -163,7 +163,7 @@ impl StepDescription {
163163

164164
// Determine the targets participating in this rule.
165165
let targets = if self.only_hosts {
166-
if !builder.config.run_host_only {
166+
if builder.config.skip_only_host_steps {
167167
return; // don't run anything
168168
} else {
169169
&builder.hosts
@@ -1338,7 +1338,7 @@ mod __test {
13381338
let mut config = Config::default_opts();
13391339
// don't save toolstates
13401340
config.save_toolstates = None;
1341-
config.run_host_only = true;
1341+
config.skip_only_host_steps = false;
13421342
config.dry_run = true;
13431343
// try to avoid spurious failures in dist where we create/delete each others file
13441344
let dir = config.out.join("tmp-rustbuild-tests").join(
@@ -1583,7 +1583,7 @@ mod __test {
15831583
#[test]
15841584
fn dist_with_target_flag() {
15851585
let mut config = configure(&["B"], &["C"]);
1586-
config.run_host_only = false; // as-if --target=C was passed
1586+
config.skip_only_host_steps = true; // as-if --target=C was passed
15871587
let build = Build::new(config);
15881588
let mut builder = Builder::new(&build);
15891589
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]);
@@ -1831,7 +1831,7 @@ mod __test {
18311831
#[test]
18321832
fn build_with_target_flag() {
18331833
let mut config = configure(&["B"], &["C"]);
1834-
config.run_host_only = false;
1834+
config.skip_only_host_steps = true;
18351835
let build = Build::new(config);
18361836
let mut builder = Builder::new(&build);
18371837
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[]);

src/bootstrap/config.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct Config {
5151
pub test_compare_mode: bool,
5252
pub llvm_libunwind: bool,
5353

54-
pub run_host_only: bool,
54+
pub skip_only_host_steps: bool,
5555

5656
pub on_fail: Option<String>,
5757
pub stage: Option<u32>,
@@ -416,7 +416,9 @@ impl Config {
416416
}
417417

418418
// If --target was specified but --host wasn't specified, don't run any host-only tests.
419-
config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty());
419+
let has_hosts = !flags.host.is_empty();
420+
let has_targets = !flags.target.is_empty();
421+
config.skip_only_host_steps = !has_hosts && has_targets;
420422

421423
let toml = file.map(|file| {
422424
let contents = t!(fs::read_to_string(&file));

0 commit comments

Comments
 (0)