Skip to content

Commit 1c8f3b0

Browse files
Remove ONLY_BUILD.
All uses are replaced with not accessing run.target/run.host, and instead directly using run.builder.build.build.
1 parent 1191510 commit 1c8f3b0

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

src/bootstrap/builder.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
6060
/// Run this rule for all hosts without cross compiling.
6161
const ONLY_HOSTS: bool = false;
6262

63-
/// Only run this step with the build triple as host and target.
64-
const ONLY_BUILD: bool = false;
65-
6663
/// Primary function to execute this rule. Can call `builder.ensure(...)`
6764
/// with other steps to run those.
6865
fn run(self, builder: &Builder) -> Self::Output;
@@ -98,7 +95,6 @@ pub struct RunConfig<'a> {
9895
struct StepDescription {
9996
default: bool,
10097
only_hosts: bool,
101-
only_build: bool,
10298
should_run: fn(ShouldRun) -> ShouldRun,
10399
make_run: fn(RunConfig),
104100
name: &'static str,
@@ -134,7 +130,6 @@ impl StepDescription {
134130
StepDescription {
135131
default: S::DEFAULT,
136132
only_hosts: S::ONLY_HOSTS,
137-
only_build: S::ONLY_BUILD,
138133
should_run: S::should_run,
139134
make_run: S::make_run,
140135
name: unsafe { ::std::intrinsics::type_name::<S>() },
@@ -150,18 +145,12 @@ impl StepDescription {
150145
self.name, builder.config.exclude);
151146
}
152147
let build = builder.build;
153-
let hosts = if self.only_build {
154-
build.build_triple()
155-
} else {
156-
&build.hosts
157-
};
148+
let hosts = &build.hosts;
158149

159150
// Determine the targets participating in this rule.
160151
let targets = if self.only_hosts {
161152
if build.config.run_host_only {
162153
&[]
163-
} else if self.only_build {
164-
build.build_triple()
165154
} else {
166155
&build.hosts
167156
}

src/bootstrap/install.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,39 @@ install!((self, builder, _config),
225225
});
226226
install_analysis(builder, self.stage, self.target);
227227
};
228-
Src, "src", Self::should_build(_config) , only_hosts: true, {
229-
builder.ensure(dist::Src);
230-
install_src(builder, self.stage);
231-
}, ONLY_BUILD;
232228
Rustc, "src/librustc", true, only_hosts: true, {
233229
builder.ensure(dist::Rustc {
234230
compiler: builder.compiler(self.stage, self.target),
235231
});
236232
install_rustc(builder, self.stage, self.target);
237233
};
238234
);
235+
236+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
237+
pub struct Src {
238+
pub stage: u32,
239+
}
240+
241+
impl Step for Src {
242+
type Output = ();
243+
const DEFAULT: bool = true;
244+
const ONLY_HOSTS: bool = true;
245+
246+
fn should_run(run: ShouldRun) -> ShouldRun {
247+
let config = &run.builder.config;
248+
let cond = config.extended &&
249+
config.tools.as_ref().map_or(true, |t| t.contains("src"));
250+
run.path("src").default_condition(cond)
251+
}
252+
253+
fn make_run(run: RunConfig) {
254+
run.builder.ensure(Src {
255+
stage: run.builder.top_stage,
256+
});
257+
}
258+
259+
fn run(self, builder: &Builder) {
260+
builder.ensure(dist::Src);
261+
install_src(builder, self.stage);
262+
}
263+
}

src/bootstrap/test.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -505,27 +505,23 @@ impl Step for RustdocJS {
505505
}
506506

507507
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
508-
pub struct Tidy {
509-
host: Interned<String>,
510-
}
508+
pub struct Tidy;
511509

512510
impl Step for Tidy {
513511
type Output = ();
514512
const DEFAULT: bool = true;
515513
const ONLY_HOSTS: bool = true;
516-
const ONLY_BUILD: bool = true;
517514

518-
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
515+
/// Runs the `tidy` tool.
519516
///
520517
/// This tool in `src/tools` checks up on various bits and pieces of style and
521518
/// otherwise just implements a few lint-like checks that are specific to the
522519
/// compiler itself.
523520
fn run(self, builder: &Builder) {
524521
let build = builder.build;
525-
let host = self.host;
526522

527523
let _folder = build.fold_output(|| "tidy");
528-
println!("tidy check ({})", host);
524+
println!("tidy check");
529525
let mut cmd = builder.tool_cmd(Tool::Tidy);
530526
cmd.arg(build.src.join("src"));
531527
cmd.arg(&build.initial_cargo);
@@ -543,9 +539,7 @@ impl Step for Tidy {
543539
}
544540

545541
fn make_run(run: RunConfig) {
546-
run.builder.ensure(Tidy {
547-
host: run.builder.build.build,
548-
});
542+
run.builder.ensure(Tidy);
549543
}
550544
}
551545

@@ -1607,7 +1601,6 @@ pub struct Distcheck;
16071601

16081602
impl Step for Distcheck {
16091603
type Output = ();
1610-
const ONLY_BUILD: bool = true;
16111604

16121605
fn should_run(run: ShouldRun) -> ShouldRun {
16131606
run.path("distcheck")
@@ -1673,7 +1666,6 @@ impl Step for Bootstrap {
16731666
type Output = ();
16741667
const DEFAULT: bool = true;
16751668
const ONLY_HOSTS: bool = true;
1676-
const ONLY_BUILD: bool = true;
16771669

16781670
/// Test the build system itself
16791671
fn run(self, builder: &Builder) {

0 commit comments

Comments
 (0)