aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/install.rs16
-rw-r--r--xtask/src/main.rs15
2 files changed, 25 insertions, 6 deletions
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index 9ba77a3aa..a0dc0c9c2 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -19,7 +19,13 @@ pub enum ClientOpt {
19} 19}
20 20
21pub struct ServerOpt { 21pub struct ServerOpt {
22 pub jemalloc: bool, 22 pub malloc: Malloc,
23}
24
25pub enum Malloc {
26 System,
27 Jemalloc,
28 Mimalloc,
23} 29}
24 30
25impl InstallCmd { 31impl InstallCmd {
@@ -130,8 +136,12 @@ fn install_server(opts: ServerOpt) -> Result<()> {
130 ) 136 )
131 } 137 }
132 138
133 let jemalloc = if opts.jemalloc { "--features jemalloc" } else { "" }; 139 let malloc_feature = match opts.malloc {
134 let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", jemalloc); 140 Malloc::System => "",
141 Malloc::Jemalloc => "--features jemalloc",
142 Malloc::Mimalloc => "--features mimalloc",
143 };
144 let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", malloc_feature);
135 145
136 if res.is_err() && old_rust { 146 if res.is_err() && old_rust {
137 eprintln!( 147 eprintln!(
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index f447613d4..399ff7204 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -14,7 +14,7 @@ use pico_args::Arguments;
14use xtask::{ 14use xtask::{
15 codegen::{self, Mode}, 15 codegen::{self, Mode},
16 dist::run_dist, 16 dist::run_dist,
17 install::{ClientOpt, InstallCmd, ServerOpt}, 17 install::{ClientOpt, InstallCmd, Malloc, ServerOpt},
18 not_bash::pushd, 18 not_bash::pushd,
19 pre_commit, project_root, 19 pre_commit, project_root,
20 release::{PromoteCmd, ReleaseCmd}, 20 release::{PromoteCmd, ReleaseCmd},
@@ -46,6 +46,7 @@ FLAGS:
46 --client-code Install only VS Code plugin 46 --client-code Install only VS Code plugin
47 --server Install only the language server 47 --server Install only the language server
48 --jemalloc Use jemalloc for server 48 --jemalloc Use jemalloc for server
49 --mimalloc Use mimalloc for server
49 -h, --help Prints help information 50 -h, --help Prints help information
50 " 51 "
51 ); 52 );
@@ -61,13 +62,21 @@ FLAGS:
61 return Ok(()); 62 return Ok(());
62 } 63 }
63 64
64 let jemalloc = args.contains("--jemalloc"); 65 let malloc = match (args.contains("--jemalloc"), args.contains("--mimalloc")) {
66 (false, false) => Malloc::System,
67 (true, false) => Malloc::Jemalloc,
68 (false, true) => Malloc::Mimalloc,
69 (true, true) => {
70 eprintln!("error: Cannot use both `--jemalloc` and `--mimalloc`");
71 return Ok(());
72 }
73 };
65 74
66 args.finish()?; 75 args.finish()?;
67 76
68 InstallCmd { 77 InstallCmd {
69 client: if server { None } else { Some(ClientOpt::VsCode) }, 78 client: if server { None } else { Some(ClientOpt::VsCode) },
70 server: if client_code { None } else { Some(ServerOpt { jemalloc }) }, 79 server: if client_code { None } else { Some(ServerOpt { malloc }) },
71 } 80 }
72 .run() 81 .run()
73 } 82 }