Unnamed repository; edit this file 'description' to name the repository.
Add cargo xtask install proc-macro-server
Lukas Wirth 2024-07-15
parent e846c04 · commit c013607
-rw-r--r--crates/ide/src/hover.rs2
-rw-r--r--xtask/src/flags.rs17
-rw-r--r--xtask/src/install.rs15
3 files changed, 30 insertions, 4 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 701374616a..2006baa30a 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -240,7 +240,7 @@ fn hover_simple(
.flatten()
.unique_by(|&(def, _, _)| def)
.map(|(def, macro_arm, node)| {
- dbg!(hover_for_definition(sema, file_id, def, &node, macro_arm, config))
+ hover_for_definition(sema, file_id, def, &node, macro_arm, config)
})
.reduce(|mut acc: HoverResult, HoverResult { markup, actions }| {
acc.actions.extend(actions);
diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs
index cf4a22d476..fd4291de9e 100644
--- a/xtask/src/flags.rs
+++ b/xtask/src/flags.rs
@@ -2,7 +2,7 @@
use std::{fmt, str::FromStr};
-use crate::install::{ClientOpt, ServerOpt};
+use crate::install::{ClientOpt, ProcMacroServerOpt, ServerOpt};
xflags::xflags! {
src "./src/flags.rs"
@@ -23,6 +23,10 @@ xflags::xflags! {
optional --mimalloc
/// Use jemalloc allocator for server.
optional --jemalloc
+
+ /// Install the proc-macro server.
+ optional --proc-macro-server
+
/// build in release with debug info set to 2.
optional --dev-rel
}
@@ -109,6 +113,7 @@ pub struct Install {
pub client: bool,
pub code_bin: Option<String>,
pub server: bool,
+ pub proc_macro_server: bool,
pub mimalloc: bool,
pub jemalloc: bool,
pub dev_rel: bool,
@@ -284,7 +289,7 @@ impl Malloc {
impl Install {
pub(crate) fn server(&self) -> Option<ServerOpt> {
- if self.client && !self.server {
+ if !self.server {
return None;
}
let malloc = if self.mimalloc {
@@ -296,8 +301,14 @@ impl Install {
};
Some(ServerOpt { malloc, dev_rel: self.dev_rel })
}
+ pub(crate) fn proc_macro_server(&self) -> Option<ProcMacroServerOpt> {
+ if !self.proc_macro_server {
+ return None;
+ }
+ Some(ProcMacroServerOpt { dev_rel: self.dev_rel })
+ }
pub(crate) fn client(&self) -> Option<ClientOpt> {
- if !self.client && self.server {
+ if !self.client {
return None;
}
Some(ClientOpt { code_bin: self.code_bin.clone() })
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index 72e612f9e1..eb33d6f9be 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -15,6 +15,9 @@ impl flags::Install {
if let Some(server) = self.server() {
install_server(sh, server).context("install server")?;
}
+ if let Some(server) = self.proc_macro_server() {
+ install_proc_macro_server(sh, server).context("install proc-macro server")?;
+ }
if let Some(client) = self.client() {
install_client(sh, client).context("install client")?;
}
@@ -34,6 +37,10 @@ pub(crate) struct ServerOpt {
pub(crate) dev_rel: bool,
}
+pub(crate) struct ProcMacroServerOpt {
+ pub(crate) dev_rel: bool,
+}
+
fn fix_path_for_mac(sh: &Shell) -> anyhow::Result<()> {
let mut vscode_path: Vec<PathBuf> = {
const COMMON_APP_PATH: &str =
@@ -132,3 +139,11 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
cmd.run()?;
Ok(())
}
+
+fn install_proc_macro_server(sh: &Shell, opts: ProcMacroServerOpt) -> anyhow::Result<()> {
+ let profile = if opts.dev_rel { "dev-rel" } else { "release" };
+
+ let cmd = cmd!(sh, "cargo +nightly install --path crates/proc-macro-srv-cli --profile={profile} --locked --force --features sysroot-abi");
+ cmd.run()?;
+ Ok(())
+}