|
1 | 1 | use std::env;
|
2 | 2 | use std::fs;
|
3 |
| -use std::path::PathBuf; |
| 3 | +use std::path::{Path, PathBuf}; |
4 | 4 | use std::process::Command;
|
5 | 5 |
|
6 | 6 | use crate::core::build_steps::compile;
|
@@ -313,10 +313,47 @@ bootstrap_tool!(
|
313 | 313 | SuggestTests, "src/tools/suggest-tests", "suggest-tests";
|
314 | 314 | GenerateWindowsSys, "src/tools/generate-windows-sys", "generate-windows-sys";
|
315 | 315 | RustdocGUITest, "src/tools/rustdoc-gui-test", "rustdoc-gui-test", is_unstable_tool = true, allow_features = "test";
|
316 |
| - OptimizedDist, "src/tools/opt-dist", "opt-dist"; |
317 | 316 | CoverageDump, "src/tools/coverage-dump", "coverage-dump";
|
318 | 317 | );
|
319 | 318 |
|
| 319 | +#[derive(Debug, Clone, Hash, PartialEq, Eq)] |
| 320 | +pub struct OptimizedDist { |
| 321 | + pub compiler: Compiler, |
| 322 | + pub target: TargetSelection, |
| 323 | +} |
| 324 | + |
| 325 | +impl Step for OptimizedDist { |
| 326 | + type Output = PathBuf; |
| 327 | + |
| 328 | + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { |
| 329 | + run.path("src/tools/opt-dist") |
| 330 | + } |
| 331 | + |
| 332 | + fn make_run(run: RunConfig<'_>) { |
| 333 | + run.builder.ensure(OptimizedDist { |
| 334 | + compiler: run.builder.compiler(0, run.builder.config.build), |
| 335 | + target: run.target, |
| 336 | + }); |
| 337 | + } |
| 338 | + |
| 339 | + fn run(self, builder: &Builder<'_>) -> PathBuf { |
| 340 | + // We need to ensure the rustc-perf submodule is initialized when building opt-dist since |
| 341 | + // the tool requires it to be in place to run. |
| 342 | + builder.update_submodule(Path::new("src/tools/rustc-perf")); |
| 343 | + |
| 344 | + builder.ensure(ToolBuild { |
| 345 | + compiler: self.compiler, |
| 346 | + target: self.target, |
| 347 | + tool: "opt-dist", |
| 348 | + mode: Mode::ToolBootstrap, |
| 349 | + path: "src/tools/opt-dist", |
| 350 | + source_type: SourceType::InTree, |
| 351 | + extra_features: Vec::new(), |
| 352 | + allow_features: "", |
| 353 | + }) |
| 354 | + } |
| 355 | +} |
| 356 | + |
320 | 357 | #[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
|
321 | 358 | pub struct ErrorIndex {
|
322 | 359 | pub compiler: Compiler,
|
|
0 commit comments