mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add test step for rust-analyzer, run it by default
This commit is contained in:
parent
d59abcf9b3
commit
4ea2f8e48f
@ -649,6 +649,7 @@ impl<'a> Builder<'a> {
|
||||
test::Cargotest,
|
||||
test::Cargo,
|
||||
test::Rls,
|
||||
test::RustAnalyzer,
|
||||
test::ErrorIndex,
|
||||
test::Distcheck,
|
||||
test::RunMakeFullDeps,
|
||||
|
@ -352,6 +352,55 @@ impl Step for Rls {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RustAnalyzer {
|
||||
stage: u32,
|
||||
host: TargetSelection,
|
||||
}
|
||||
|
||||
impl Step for RustAnalyzer {
|
||||
type Output = ();
|
||||
const ONLY_HOSTS: bool = true;
|
||||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.path("src/tools/rust-analyzer")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
run.builder.ensure(Self { stage: run.builder.top_stage, host: run.target });
|
||||
}
|
||||
|
||||
/// Runs `cargo test` for rust-analyzer
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
builder.ensure(tool::RustAnalyzer { compiler, target: self.host }).expect("in-tree tool");
|
||||
|
||||
let path = "src/tools/rust-analyzer";
|
||||
let mut cargo = tool::prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
Mode::ToolStd,
|
||||
host,
|
||||
"test",
|
||||
path,
|
||||
SourceType::InTree,
|
||||
&["rust-analyzer/in-rust-tree".to_owned()],
|
||||
);
|
||||
|
||||
let dir = builder.src.join(path);
|
||||
cargo.env("CARGO_WORKSPACE_DIR", &dir);
|
||||
|
||||
cargo.add_rustc_lib_path(builder, compiler);
|
||||
cargo.arg("--").args(builder.config.cmd.test_args());
|
||||
|
||||
builder.run(&mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Rustfmt {
|
||||
stage: u32,
|
||||
|
Loading…
Reference in New Issue
Block a user