Skip to content

Commit 83b6812

Browse files
Make the message for building rustdoc slightly nicer
1 parent 40dea65 commit 83b6812

File tree

1 file changed

+48
-32
lines changed

1 file changed

+48
-32
lines changed

src/bootstrap/tool.rs

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -93,36 +93,46 @@ impl Step for ToolBuild {
9393
let _folder = build.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
9494
println!("Building stage{} tool {} ({})", compiler.stage, tool, target);
9595

96-
let mut cargo = builder.cargo(compiler, Mode::Tool, target, "build");
97-
let dir = build.src.join("src/tools").join(tool);
98-
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
99-
100-
// We don't want to build tools dynamically as they'll be running across
101-
// stages and such and it's just easier if they're not dynamically linked.
102-
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
103-
104-
if let Some(dir) = build.openssl_install_dir(target) {
105-
cargo.env("OPENSSL_STATIC", "1");
106-
cargo.env("OPENSSL_DIR", dir);
107-
cargo.env("LIBZ_SYS_STATIC", "1");
108-
}
96+
let mut cargo = prepare_tool_cargo(builder, compiler, target, tool);
97+
build.run(&mut cargo);
98+
build.cargo_out(compiler, Mode::Tool, target).join(exe(tool, &compiler.host))
99+
}
100+
}
109101

110-
cargo.env("CFG_RELEASE_CHANNEL", &build.config.channel);
102+
fn prepare_tool_cargo(
103+
builder: &Builder,
104+
compiler: Compiler,
105+
target: Interned<String>,
106+
tool: &'static str,
107+
) -> Command {
108+
let build = builder.build;
109+
let mut cargo = builder.cargo(compiler, Mode::Tool, target, "build");
110+
let dir = build.src.join("src/tools").join(tool);
111+
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
112+
113+
// We don't want to build tools dynamically as they'll be running across
114+
// stages and such and it's just easier if they're not dynamically linked.
115+
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
116+
117+
if let Some(dir) = build.openssl_install_dir(target) {
118+
cargo.env("OPENSSL_STATIC", "1");
119+
cargo.env("OPENSSL_DIR", dir);
120+
cargo.env("LIBZ_SYS_STATIC", "1");
121+
}
111122

112-
let info = GitInfo::new(&build.config, &dir);
113-
if let Some(sha) = info.sha() {
114-
cargo.env("CFG_COMMIT_HASH", sha);
115-
}
116-
if let Some(sha_short) = info.sha_short() {
117-
cargo.env("CFG_SHORT_COMMIT_HASH", sha_short);
118-
}
119-
if let Some(date) = info.commit_date() {
120-
cargo.env("CFG_COMMIT_DATE", date);
121-
}
123+
cargo.env("CFG_RELEASE_CHANNEL", &build.config.channel);
122124

123-
build.run(&mut cargo);
124-
build.cargo_out(compiler, Mode::Tool, target).join(exe(tool, &compiler.host))
125+
let info = GitInfo::new(&build.config, &dir);
126+
if let Some(sha) = info.sha() {
127+
cargo.env("CFG_COMMIT_HASH", sha);
125128
}
129+
if let Some(sha_short) = info.sha_short() {
130+
cargo.env("CFG_SHORT_COMMIT_HASH", sha_short);
131+
}
132+
if let Some(date) = info.commit_date() {
133+
cargo.env("CFG_COMMIT_DATE", date);
134+
}
135+
cargo
126136
}
127137

128138
macro_rules! tool {
@@ -245,7 +255,9 @@ impl Step for Rustdoc {
245255
}
246256

247257
fn run(self, builder: &Builder) -> PathBuf {
258+
let build = builder.build;
248259
let target_compiler = self.target_compiler;
260+
let target = target_compiler.host;
249261
let build_compiler = if target_compiler.stage == 0 {
250262
builder.compiler(0, builder.build.build)
251263
} else {
@@ -255,12 +267,16 @@ impl Step for Rustdoc {
255267
builder.compiler(target_compiler.stage - 1, builder.build.build)
256268
};
257269

258-
let tool_rustdoc = builder.ensure(ToolBuild {
259-
compiler: build_compiler,
260-
target: target_compiler.host,
261-
tool: "rustdoc",
262-
mode: Mode::Librustc,
263-
});
270+
builder.ensure(CleanTools { compiler: build_compiler, target, mode: Mode::Librustc });
271+
builder.ensure(compile::Rustc { compiler: build_compiler, target });
272+
273+
let _folder = build.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));
274+
println!("Building rustdoc for stage{} ({})", target_compiler.stage, target_compiler.host);
275+
276+
let mut cargo = prepare_tool_cargo(builder, build_compiler, target, "rustdoc");
277+
build.run(&mut cargo);
278+
let tool_rustdoc = build.cargo_out(build_compiler, Mode::Tool, target)
279+
.join(exe("rustdoc", &target_compiler.host));
264280

265281
// don't create a stage0-sysroot/bin directory.
266282
if target_compiler.stage > 0 {

0 commit comments

Comments
 (0)