Skip to content

Commit fd44aca

Browse files
committed
Copy rustc-fake binary when building the rustc-perf tool
1 parent 9e0b762 commit fd44aca

File tree

1 file changed

+24
-7
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+24
-7
lines changed

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ impl Step for ToolBuild {
129129
if tool == "tidy" {
130130
tool = "rust-tidy";
131131
}
132-
let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, target));
133-
let bin = builder.tools_dir(compiler).join(exe(tool, target));
134-
builder.copy_link(&cargo_out, &bin);
135-
bin
132+
copy_tool_bin(builder, self.compiler, self.target, self.mode, tool)
136133
}
137134
}
138135
}
@@ -217,6 +214,21 @@ pub fn prepare_tool_cargo(
217214
cargo
218215
}
219216

217+
/// Copies a built tool binary with the given `name` from the build directory to the
218+
/// tools directory.
219+
fn copy_tool_bin(
220+
builder: &Builder<'_>,
221+
compiler: Compiler,
222+
target: TargetSelection,
223+
mode: Mode,
224+
name: &str,
225+
) -> PathBuf {
226+
let cargo_out = builder.cargo_out(compiler, mode, target).join(exe(name, target));
227+
let bin = builder.tools_dir(compiler).join(exe(name, target));
228+
builder.copy_link(&cargo_out, &bin);
229+
bin
230+
}
231+
220232
macro_rules! bootstrap_tool {
221233
($(
222234
$name:ident, $path:expr, $tool_name:expr
@@ -385,7 +397,7 @@ impl Step for RustcPerf {
385397
// We need to ensure the rustc-perf submodule is initialized.
386398
builder.update_submodule(Path::new("src/tools/rustc-perf"));
387399

388-
let target = builder.ensure(ToolBuild {
400+
let tool = ToolBuild {
389401
compiler: self.compiler,
390402
target: self.target,
391403
tool: "collector",
@@ -397,8 +409,13 @@ impl Step for RustcPerf {
397409
// Only build the collector package, which is used for benchmarking through
398410
// a CLI.
399411
cargo_args: vec!["-p".to_string(), "collector".to_string()],
400-
});
401-
target
412+
};
413+
let collector_bin = builder.ensure(tool.clone());
414+
// We also need to symlink the `rustc-fake` binary to the corresponding directory,
415+
// because `collector` expects it in the same directory.
416+
copy_tool_bin(builder, tool.compiler, tool.target, tool.mode, "rustc-fake");
417+
418+
collector_bin
402419
}
403420
}
404421

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy