diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2024-06-12 09:54:08 +0200 |
|---|---|---|
| committer | Jakub Beránek <jakub.beranek@vsb.cz> | 2024-06-12 20:25:16 +0200 |
| commit | 9e0b76201bce536d19cf4e5190b3ac0341838b45 (patch) | |
| tree | 1d1093ebb06dc92009b194acf3f4c433350fe744 | |
| parent | 9ec178df0b7f0aa7f1f6e9ca80237933f1230dd7 (diff) | |
| download | rust-9e0b76201bce536d19cf4e5190b3ac0341838b45.tar.gz rust-9e0b76201bce536d19cf4e5190b3ac0341838b45.zip | |
Add `RustcPerf` bootstrap tool
So that it is easier to use `rustc-perf` with `rustc` directly.
| -rw-r--r-- | src/bootstrap/src/core/build_steps/tool.rs | 44 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 3 |
2 files changed, 46 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 20b17863bef..ab79166367e 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -358,6 +358,50 @@ impl Step for OptimizedDist { } } +/// The [rustc-perf](https://github.com/rust-lang/rustc-perf) benchmark suite, which is added +/// as a submodule at `src/tools/rustc-perf`. +#[derive(Debug, Clone, Hash, PartialEq, Eq)] +pub struct RustcPerf { + pub compiler: Compiler, + pub target: TargetSelection, +} + +impl Step for RustcPerf { + /// Path to the built `collector` binary. + type Output = PathBuf; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/rustc-perf") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(RustcPerf { + compiler: run.builder.compiler(0, run.builder.config.build), + target: run.target, + }); + } + + fn run(self, builder: &Builder<'_>) -> PathBuf { + // We need to ensure the rustc-perf submodule is initialized. + builder.update_submodule(Path::new("src/tools/rustc-perf")); + + let target = builder.ensure(ToolBuild { + compiler: self.compiler, + target: self.target, + tool: "collector", + mode: Mode::ToolBootstrap, + path: "src/tools/rustc-perf", + source_type: SourceType::Submodule, + extra_features: Vec::new(), + allow_features: "", + // Only build the collector package, which is used for benchmarking through + // a CLI. + cargo_args: vec!["-p".to_string(), "collector".to_string()], + }); + target + } +} + #[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] pub struct ErrorIndex { pub compiler: Compiler, diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 12d2bb18ab7..55d998dc83c 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -750,7 +750,8 @@ impl<'a> Builder<'a> { tool::RustdocGUITest, tool::OptimizedDist, tool::CoverageDump, - tool::LlvmBitcodeLinker + tool::LlvmBitcodeLinker, + tool::RustcPerf, ), Kind::Clippy => describe!( clippy::Std, |
