Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,14 +745,18 @@ impl Step for RustAnalyzerProcMacroSrv {

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.path("src/tools/rust-analyzer").default_condition(
builder.config.extended
&& builder
.config
.tools
.as_ref()
.map_or(true, |tools| tools.iter().any(|tool| tool == "rust-analyzer")),
)

// Allow building `rust-analyzer-proc-macro-srv` both as part of the `rust-analyzer` and as a stand-alone tool.
run.path("src/tools/rust-analyzer")
.path("src/tools/rust-analyzer/crates/proc-macro-srv-cli")
.default_condition(
builder.config.extended
&& builder.config.tools.as_ref().map_or(true, |tools| {
tools.iter().any(|tool| {
tool == "rust-analyzer" || tool == "rust-analyzer-proc-macro-srv"
})
}),
)
}

fn make_run(run: RunConfig<'_>) {
Expand All @@ -763,7 +767,7 @@ impl Step for RustAnalyzerProcMacroSrv {
}

fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
builder.ensure(ToolBuild {
let path = builder.ensure(ToolBuild {
compiler: self.compiler,
target: self.target,
tool: "rust-analyzer-proc-macro-srv",
Expand All @@ -772,7 +776,15 @@ impl Step for RustAnalyzerProcMacroSrv {
extra_features: vec!["proc-macro-srv/sysroot-abi".to_owned()],
is_optional_tool: false,
source_type: SourceType::InTree,
})
})?;

// Copy `rust-analyzer-proc-macro-srv` to `<sysroot>/libexec/`
// so that r-a can use it.
let libexec_path = builder.sysroot(self.compiler).join("libexec");
t!(fs::create_dir_all(&libexec_path));
builder.copy(&path, &libexec_path.join("rust-analyzer-proc-macro-srv"));

Some(path)
}
}

Expand Down