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