aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/main.rs
diff options
context:
space:
mode:
authorIvan Kozik <[email protected]>2020-07-14 01:12:49 +0100
committerIvan Kozik <[email protected]>2020-07-14 21:57:51 +0100
commit6710856c1098f71168c47451af53bac9a33b49dd (patch)
tree46a514e5fd86dd33f16f9abca6ab14f5063c9696 /xtask/src/main.rs
parent46d4487b8900324fc6a523c8b6ebe036d28fd0fb (diff)
Add opt-in mimalloc feature
Diffstat (limited to 'xtask/src/main.rs')
-rw-r--r--xtask/src/main.rs15
1 files changed, 12 insertions, 3 deletions
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 }