about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2024-06-12 11:10:50 +0200
committerJakub Beránek <jakub.beranek@vsb.cz>2024-06-12 20:25:16 +0200
commitfd44aca2aa37fb95d337a61cf733996cb05e9bba (patch)
treeb0906e753d239f8fb0c698d1296274790ea5c439
parent9e0b76201bce536d19cf4e5190b3ac0341838b45 (diff)
downloadrust-fd44aca2aa37fb95d337a61cf733996cb05e9bba.tar.gz
rust-fd44aca2aa37fb95d337a61cf733996cb05e9bba.zip
Copy `rustc-fake` binary when building the `rustc-perf` tool
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index ab79166367e..03e77c46b60 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -129,10 +129,7 @@ impl Step for ToolBuild {
             if tool == "tidy" {
                 tool = "rust-tidy";
             }
-            let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, target));
-            let bin = builder.tools_dir(compiler).join(exe(tool, target));
-            builder.copy_link(&cargo_out, &bin);
-            bin
+            copy_tool_bin(builder, self.compiler, self.target, self.mode, tool)
         }
     }
 }
@@ -217,6 +214,21 @@ pub fn prepare_tool_cargo(
     cargo
 }
 
+/// Copies a built tool binary with the given `name` from the build directory to the
+/// tools directory.
+fn copy_tool_bin(
+    builder: &Builder<'_>,
+    compiler: Compiler,
+    target: TargetSelection,
+    mode: Mode,
+    name: &str,
+) -> PathBuf {
+    let cargo_out = builder.cargo_out(compiler, mode, target).join(exe(name, target));
+    let bin = builder.tools_dir(compiler).join(exe(name, target));
+    builder.copy_link(&cargo_out, &bin);
+    bin
+}
+
 macro_rules! bootstrap_tool {
     ($(
         $name:ident, $path:expr, $tool_name:expr
@@ -385,7 +397,7 @@ impl Step for RustcPerf {
         // We need to ensure the rustc-perf submodule is initialized.
         builder.update_submodule(Path::new("src/tools/rustc-perf"));
 
-        let target = builder.ensure(ToolBuild {
+        let tool = ToolBuild {
             compiler: self.compiler,
             target: self.target,
             tool: "collector",
@@ -397,8 +409,13 @@ impl Step for RustcPerf {
             // Only build the collector package, which is used for benchmarking through
             // a CLI.
             cargo_args: vec!["-p".to_string(), "collector".to_string()],
-        });
-        target
+        };
+        let collector_bin = builder.ensure(tool.clone());
+        // We also need to symlink the `rustc-fake` binary to the corresponding directory,
+        // because `collector` expects it in the same directory.
+        copy_tool_bin(builder, tool.compiler, tool.target, tool.mode, "rustc-fake");
+
+        collector_bin
     }
 }