Skip to content

Commit c013607

Browse files
committed
Add cargo xtask install proc-macro-server
1 parent e846c04 commit c013607

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

crates/ide/src/hover.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fn hover_simple(
240240
.flatten()
241241
.unique_by(|&(def, _, _)| def)
242242
.map(|(def, macro_arm, node)| {
243-
dbg!(hover_for_definition(sema, file_id, def, &node, macro_arm, config))
243+
hover_for_definition(sema, file_id, def, &node, macro_arm, config)
244244
})
245245
.reduce(|mut acc: HoverResult, HoverResult { markup, actions }| {
246246
acc.actions.extend(actions);

xtask/src/flags.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::{fmt, str::FromStr};
44

5-
use crate::install::{ClientOpt, ServerOpt};
5+
use crate::install::{ClientOpt, ProcMacroServerOpt, ServerOpt};
66

77
xflags::xflags! {
88
src "./src/flags.rs"
@@ -23,6 +23,10 @@ xflags::xflags! {
2323
optional --mimalloc
2424
/// Use jemalloc allocator for server.
2525
optional --jemalloc
26+
27+
/// Install the proc-macro server.
28+
optional --proc-macro-server
29+
2630
/// build in release with debug info set to 2.
2731
optional --dev-rel
2832
}
@@ -109,6 +113,7 @@ pub struct Install {
109113
pub client: bool,
110114
pub code_bin: Option<String>,
111115
pub server: bool,
116+
pub proc_macro_server: bool,
112117
pub mimalloc: bool,
113118
pub jemalloc: bool,
114119
pub dev_rel: bool,
@@ -284,7 +289,7 @@ impl Malloc {
284289

285290
impl Install {
286291
pub(crate) fn server(&self) -> Option<ServerOpt> {
287-
if self.client && !self.server {
292+
if !self.server {
288293
return None;
289294
}
290295
let malloc = if self.mimalloc {
@@ -296,8 +301,14 @@ impl Install {
296301
};
297302
Some(ServerOpt { malloc, dev_rel: self.dev_rel })
298303
}
304+
pub(crate) fn proc_macro_server(&self) -> Option<ProcMacroServerOpt> {
305+
if !self.proc_macro_server {
306+
return None;
307+
}
308+
Some(ProcMacroServerOpt { dev_rel: self.dev_rel })
309+
}
299310
pub(crate) fn client(&self) -> Option<ClientOpt> {
300-
if !self.client && self.server {
311+
if !self.client {
301312
return None;
302313
}
303314
Some(ClientOpt { code_bin: self.code_bin.clone() })

xtask/src/install.rs

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ impl flags::Install {
1515
if let Some(server) = self.server() {
1616
install_server(sh, server).context("install server")?;
1717
}
18+
if let Some(server) = self.proc_macro_server() {
19+
install_proc_macro_server(sh, server).context("install proc-macro server")?;
20+
}
1821
if let Some(client) = self.client() {
1922
install_client(sh, client).context("install client")?;
2023
}
@@ -34,6 +37,10 @@ pub(crate) struct ServerOpt {
3437
pub(crate) dev_rel: bool,
3538
}
3639

40+
pub(crate) struct ProcMacroServerOpt {
41+
pub(crate) dev_rel: bool,
42+
}
43+
3744
fn fix_path_for_mac(sh: &Shell) -> anyhow::Result<()> {
3845
let mut vscode_path: Vec<PathBuf> = {
3946
const COMMON_APP_PATH: &str =
@@ -132,3 +139,11 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
132139
cmd.run()?;
133140
Ok(())
134141
}
142+
143+
fn install_proc_macro_server(sh: &Shell, opts: ProcMacroServerOpt) -> anyhow::Result<()> {
144+
let profile = if opts.dev_rel { "dev-rel" } else { "release" };
145+
146+
let cmd = cmd!(sh, "cargo +nightly install --path crates/proc-macro-srv-cli --profile={profile} --locked --force --features sysroot-abi");
147+
cmd.run()?;
148+
Ok(())
149+
}

0 commit comments

Comments
 (0)