Skip to content

Commit 9e0b762

Browse files
committed
Add RustcPerf bootstrap tool
So that it is easier to use `rustc-perf` with `rustc` directly.
1 parent 9ec178d commit 9e0b762

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,50 @@ impl Step for OptimizedDist {
358358
}
359359
}
360360

361+
/// The [rustc-perf](https://github.com/rust-lang/rustc-perf) benchmark suite, which is added
362+
/// as a submodule at `src/tools/rustc-perf`.
363+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
364+
pub struct RustcPerf {
365+
pub compiler: Compiler,
366+
pub target: TargetSelection,
367+
}
368+
369+
impl Step for RustcPerf {
370+
/// Path to the built `collector` binary.
371+
type Output = PathBuf;
372+
373+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
374+
run.path("src/tools/rustc-perf")
375+
}
376+
377+
fn make_run(run: RunConfig<'_>) {
378+
run.builder.ensure(RustcPerf {
379+
compiler: run.builder.compiler(0, run.builder.config.build),
380+
target: run.target,
381+
});
382+
}
383+
384+
fn run(self, builder: &Builder<'_>) -> PathBuf {
385+
// We need to ensure the rustc-perf submodule is initialized.
386+
builder.update_submodule(Path::new("src/tools/rustc-perf"));
387+
388+
let target = builder.ensure(ToolBuild {
389+
compiler: self.compiler,
390+
target: self.target,
391+
tool: "collector",
392+
mode: Mode::ToolBootstrap,
393+
path: "src/tools/rustc-perf",
394+
source_type: SourceType::Submodule,
395+
extra_features: Vec::new(),
396+
allow_features: "",
397+
// Only build the collector package, which is used for benchmarking through
398+
// a CLI.
399+
cargo_args: vec!["-p".to_string(), "collector".to_string()],
400+
});
401+
target
402+
}
403+
}
404+
361405
#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
362406
pub struct ErrorIndex {
363407
pub compiler: Compiler,

src/bootstrap/src/core/builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ impl<'a> Builder<'a> {
750750
tool::RustdocGUITest,
751751
tool::OptimizedDist,
752752
tool::CoverageDump,
753-
tool::LlvmBitcodeLinker
753+
tool::LlvmBitcodeLinker,
754+
tool::RustcPerf,
754755
),
755756
Kind::Clippy => describe!(
756757
clippy::Std,

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