diff options
Diffstat (limited to 'xtask/src/dist.rs')
-rw-r--r-- | xtask/src/dist.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs index 3255eefb9..67ae6106a 100644 --- a/xtask/src/dist.rs +++ b/xtask/src/dist.rs | |||
@@ -3,24 +3,21 @@ use std::path::PathBuf; | |||
3 | use anyhow::Result; | 3 | use anyhow::Result; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | not_bash::{fs2, pushd, rm_rf, run}, | 6 | not_bash::{date_iso, fs2, pushd, rm_rf, run}, |
7 | project_root, | 7 | project_root, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | pub struct ClientOpts { | ||
11 | pub version: String, | ||
12 | pub release_tag: String, | ||
13 | } | ||
14 | 10 | ||
15 | pub fn run_dist(client_opts: Option<ClientOpts>) -> Result<()> { | 11 | pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> { |
16 | let dist = project_root().join("dist"); | 12 | let dist = project_root().join("dist"); |
17 | rm_rf(&dist)?; | 13 | rm_rf(&dist)?; |
18 | fs2::create_dir_all(&dist)?; | 14 | fs2::create_dir_all(&dist)?; |
19 | 15 | ||
20 | if let Some(ClientOpts { version, release_tag }) = client_opts { | 16 | if let Some(version) = client_version { |
17 | let release_tag = if nightly { "nightly".to_string() } else { date_iso()? }; | ||
21 | dist_client(&version, &release_tag)?; | 18 | dist_client(&version, &release_tag)?; |
22 | } | 19 | } |
23 | dist_server()?; | 20 | dist_server(nightly)?; |
24 | Ok(()) | 21 | Ok(()) |
25 | } | 22 | } |
26 | 23 | ||
@@ -50,7 +47,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> { | |||
50 | Ok(()) | 47 | Ok(()) |
51 | } | 48 | } |
52 | 49 | ||
53 | fn dist_server() -> Result<()> { | 50 | fn dist_server(nightly: bool) -> Result<()> { |
54 | if cfg!(target_os = "linux") { | 51 | if cfg!(target_os = "linux") { |
55 | std::env::set_var("CC", "clang"); | 52 | std::env::set_var("CC", "clang"); |
56 | run!( | 53 | run!( |
@@ -60,7 +57,9 @@ fn dist_server() -> Result<()> { | |||
60 | // We'd want to add, but that requires setting the right linker somehow | 57 | // We'd want to add, but that requires setting the right linker somehow |
61 | // --features=jemalloc | 58 | // --features=jemalloc |
62 | )?; | 59 | )?; |
63 | run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; | 60 | if !nightly { |
61 | run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; | ||
62 | } | ||
64 | } else { | 63 | } else { |
65 | run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; | 64 | run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; |
66 | } | 65 | } |