diff options
Diffstat (limited to 'xtask/src/install.rs')
-rw-r--r-- | xtask/src/install.rs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/xtask/src/install.rs b/xtask/src/install.rs index 12962bcfa..ea2194248 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs | |||
@@ -6,15 +6,15 @@ use anyhow::{bail, format_err, Context, Result}; | |||
6 | use xshell::{cmd, pushd}; | 6 | use xshell::{cmd, pushd}; |
7 | 7 | ||
8 | // Latest stable, feel free to send a PR if this lags behind. | 8 | // Latest stable, feel free to send a PR if this lags behind. |
9 | const REQUIRED_RUST_VERSION: u32 = 47; | 9 | const REQUIRED_RUST_VERSION: u32 = 50; |
10 | 10 | ||
11 | pub struct InstallCmd { | 11 | pub(crate) struct InstallCmd { |
12 | pub client: Option<ClientOpt>, | 12 | pub(crate) client: Option<ClientOpt>, |
13 | pub server: Option<ServerOpt>, | 13 | pub(crate) server: Option<ServerOpt>, |
14 | } | 14 | } |
15 | 15 | ||
16 | #[derive(Clone, Copy)] | 16 | #[derive(Clone, Copy)] |
17 | pub enum ClientOpt { | 17 | pub(crate) enum ClientOpt { |
18 | VsCode, | 18 | VsCode, |
19 | VsCodeExploration, | 19 | VsCodeExploration, |
20 | VsCodeInsiders, | 20 | VsCodeInsiders, |
@@ -24,7 +24,7 @@ pub enum ClientOpt { | |||
24 | } | 24 | } |
25 | 25 | ||
26 | impl ClientOpt { | 26 | impl ClientOpt { |
27 | pub const fn as_cmds(&self) -> &'static [&'static str] { | 27 | pub(crate) const fn as_cmds(&self) -> &'static [&'static str] { |
28 | match self { | 28 | match self { |
29 | ClientOpt::VsCode => &["code"], | 29 | ClientOpt::VsCode => &["code"], |
30 | ClientOpt::VsCodeExploration => &["code-exploration"], | 30 | ClientOpt::VsCodeExploration => &["code-exploration"], |
@@ -60,17 +60,18 @@ impl std::str::FromStr for ClientOpt { | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | pub struct ServerOpt { | 63 | pub(crate) struct ServerOpt { |
64 | pub malloc: Malloc, | 64 | pub(crate) malloc: Malloc, |
65 | } | 65 | } |
66 | 66 | ||
67 | pub enum Malloc { | 67 | pub(crate) enum Malloc { |
68 | System, | 68 | System, |
69 | Mimalloc, | 69 | Mimalloc, |
70 | Jemalloc, | ||
70 | } | 71 | } |
71 | 72 | ||
72 | impl InstallCmd { | 73 | impl InstallCmd { |
73 | pub fn run(self) -> Result<()> { | 74 | pub(crate) fn run(self) -> Result<()> { |
74 | if cfg!(target_os = "macos") { | 75 | if cfg!(target_os = "macos") { |
75 | fix_path_for_mac().context("Fix path for mac")? | 76 | fix_path_for_mac().context("Fix path for mac")? |
76 | } | 77 | } |
@@ -128,7 +129,7 @@ fn install_client(client_opt: ClientOpt) -> Result<()> { | |||
128 | 129 | ||
129 | let installed_extensions = if cfg!(unix) { | 130 | let installed_extensions = if cfg!(unix) { |
130 | cmd!("npm --version").run().context("`npm` is required to build the VS Code plugin")?; | 131 | cmd!("npm --version").run().context("`npm` is required to build the VS Code plugin")?; |
131 | cmd!("npm install").run()?; | 132 | cmd!("npm ci").run()?; |
132 | 133 | ||
133 | cmd!("npm run package --scripts-prepend-node-path").run()?; | 134 | cmd!("npm run package --scripts-prepend-node-path").run()?; |
134 | 135 | ||
@@ -139,7 +140,7 @@ fn install_client(client_opt: ClientOpt) -> Result<()> { | |||
139 | cmd!("cmd.exe /c npm --version") | 140 | cmd!("cmd.exe /c npm --version") |
140 | .run() | 141 | .run() |
141 | .context("`npm` is required to build the VS Code plugin")?; | 142 | .context("`npm` is required to build the VS Code plugin")?; |
142 | cmd!("cmd.exe /c npm install").run()?; | 143 | cmd!("cmd.exe /c npm ci").run()?; |
143 | 144 | ||
144 | cmd!("cmd.exe /c npm run package").run()?; | 145 | cmd!("cmd.exe /c npm run package").run()?; |
145 | 146 | ||
@@ -176,9 +177,10 @@ fn install_server(opts: ServerOpt) -> Result<()> { | |||
176 | let features = match opts.malloc { | 177 | let features = match opts.malloc { |
177 | Malloc::System => &[][..], | 178 | Malloc::System => &[][..], |
178 | Malloc::Mimalloc => &["--features", "mimalloc"], | 179 | Malloc::Mimalloc => &["--features", "mimalloc"], |
180 | Malloc::Jemalloc => &["--features", "jemalloc"], | ||
179 | }; | 181 | }; |
180 | 182 | ||
181 | let cmd = cmd!("cargo install --path crates/rust-analyzer --locked --force {features...}"); | 183 | let cmd = cmd!("cargo install --path crates/rust-analyzer --locked --force --features force-always-assert {features...}"); |
182 | let res = cmd.run(); | 184 | let res = cmd.run(); |
183 | 185 | ||
184 | if res.is_err() && old_rust { | 186 | if res.is_err() && old_rust { |