diff options
| -rw-r--r-- | src/bootstrap/src/core/build_steps/dist.rs | 23 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/install.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/tests.rs | 2 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index d2308a30c47..0effc037209 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1334,9 +1334,10 @@ impl Step for Cargo { } } +/// Distribute the rust-analyzer component, which is used as a LSP by various IDEs. #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct RustAnalyzer { - pub build_compiler: Compiler, + pub compilers: RustcPrivateCompilers, pub target: TargetSelection, } @@ -1352,21 +1353,14 @@ impl Step for RustAnalyzer { fn make_run(run: RunConfig<'_>) { run.builder.ensure(RustAnalyzer { - build_compiler: run.builder.compiler_for( - run.builder.top_stage, - run.builder.config.host_target, - run.target, - ), + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), target: run.target, }); } fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { let target = self.target; - let compilers = - RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target); - - let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(compilers)); + let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(self.compilers)); let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple); tarball.set_overlay(OverlayKind::RustAnalyzer); @@ -1375,6 +1369,13 @@ impl Step for RustAnalyzer { tarball.add_legal_and_readme_to("share/doc/rust-analyzer"); Some(tarball.generate()) } + + fn metadata(&self) -> Option<StepMetadata> { + Some( + StepMetadata::dist("rust-analyzer", self.target) + .built_by(self.compilers.build_compiler()), + ) + } } #[derive(Debug, Clone, Hash, PartialEq, Eq)] @@ -1672,7 +1673,7 @@ impl Step for Extended { add_component!("rust-json-docs" => JsonDocs { build_compiler: target_compiler, target }); add_component!("cargo" => Cargo { build_compiler: compiler, target }); add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target }); - add_component!("rust-analyzer" => RustAnalyzer { build_compiler: compiler, target }); + add_component!("rust-analyzer" => RustAnalyzer { compilers: RustcPrivateCompilers::from_build_compiler(builder, compiler, target), target }); add_component!("llvm-components" => LlvmTools { target }); add_component!("clippy" => Clippy { build_compiler: compiler, target }); add_component!("miri" => Miri { build_compiler: compiler, target }); diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index d1c93acd789..b155c172e35 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -7,6 +7,7 @@ use std::path::{Component, Path, PathBuf}; use std::{env, fs}; use crate::core::build_steps::dist; +use crate::core::build_steps::tool::RustcPrivateCompilers; use crate::core::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::core::config::{Config, TargetSelection}; use crate::utils::exec::command; @@ -227,7 +228,7 @@ install!((self, builder, _config), }; RustAnalyzer, alias = "rust-analyzer", Self::should_build(_config), IS_HOST: true, { if let Some(tarball) = - builder.ensure(dist::RustAnalyzer { build_compiler: self.compiler, target: self.target }) + builder.ensure(dist::RustAnalyzer { compilers: RustcPrivateCompilers::from_build_compiler(builder, self.compiler, self.target), target: self.target }) { install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball); } else { diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index ab8eeb700eb..05987b95351 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1203,6 +1203,7 @@ mod snapshot { [build] rustc 1 <host> -> cargo 2 <host> [dist] rustc 1 <host> -> cargo 2 <host> [build] rustc 1 <host> -> rust-analyzer 2 <host> + [dist] rustc 1 <host> -> rust-analyzer 2 <host> [build] rustc 1 <host> -> rustfmt 2 <host> [build] rustc 1 <host> -> cargo-fmt 2 <host> [build] rustc 1 <host> -> clippy-driver 2 <host> @@ -1533,6 +1534,7 @@ mod snapshot { [build] rustc 1 <host> -> cargo 2 <target1> [dist] rustc 1 <host> -> cargo 2 <target1> [build] rustc 1 <host> -> rust-analyzer 2 <target1> + [dist] rustc 1 <host> -> rust-analyzer 2 <target1> [build] rustc 1 <host> -> rustfmt 2 <target1> [build] rustc 1 <host> -> cargo-fmt 2 <target1> [build] rustc 1 <host> -> clippy-driver 2 <target1> |
