diff options
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/dist.rs | 19 | ||||
-rw-r--r-- | xtask/src/lib.rs | 4 | ||||
-rw-r--r-- | xtask/src/main.rs | 14 | ||||
-rw-r--r-- | xtask/src/not_bash.rs | 4 |
4 files changed, 19 insertions, 22 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 | } |
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index 0b8243f62..9d087daa2 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs | |||
@@ -21,7 +21,7 @@ use walkdir::{DirEntry, WalkDir}; | |||
21 | 21 | ||
22 | use crate::{ | 22 | use crate::{ |
23 | codegen::Mode, | 23 | codegen::Mode, |
24 | not_bash::{fs2, pushd, rm_rf, run}, | 24 | not_bash::{date_iso, fs2, pushd, rm_rf, run}, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | pub use anyhow::Result; | 27 | pub use anyhow::Result; |
@@ -180,7 +180,7 @@ pub fn run_release(dry_run: bool) -> Result<()> { | |||
180 | let website_root = project_root().join("../rust-analyzer.github.io"); | 180 | let website_root = project_root().join("../rust-analyzer.github.io"); |
181 | let changelog_dir = website_root.join("./thisweek/_posts"); | 181 | let changelog_dir = website_root.join("./thisweek/_posts"); |
182 | 182 | ||
183 | let today = run!("date --iso")?; | 183 | let today = date_iso()?; |
184 | let commit = run!("git rev-parse HEAD")?; | 184 | let commit = run!("git rev-parse HEAD")?; |
185 | let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count(); | 185 | let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count(); |
186 | 186 | ||
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index a9adcfba4..dff3ce4a1 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -13,7 +13,7 @@ use std::env; | |||
13 | use pico_args::Arguments; | 13 | use pico_args::Arguments; |
14 | use xtask::{ | 14 | use xtask::{ |
15 | codegen::{self, Mode}, | 15 | codegen::{self, Mode}, |
16 | dist::{run_dist, ClientOpts}, | 16 | dist::run_dist, |
17 | install::{ClientOpt, InstallCmd, ServerOpt}, | 17 | install::{ClientOpt, InstallCmd, ServerOpt}, |
18 | not_bash::pushd, | 18 | not_bash::pushd, |
19 | pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt, | 19 | pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt, |
@@ -103,16 +103,10 @@ FLAGS: | |||
103 | run_release(dry_run) | 103 | run_release(dry_run) |
104 | } | 104 | } |
105 | "dist" => { | 105 | "dist" => { |
106 | let client_opts = if args.contains("--client") { | 106 | let nightly = args.contains("--nightly"); |
107 | Some(ClientOpts { | 107 | let client_version: Option<String> = args.opt_value_from_str("--client")?; |
108 | version: args.value_from_str("--version")?, | ||
109 | release_tag: args.value_from_str("--tag")?, | ||
110 | }) | ||
111 | } else { | ||
112 | None | ||
113 | }; | ||
114 | args.finish()?; | 108 | args.finish()?; |
115 | run_dist(client_opts) | 109 | run_dist(nightly, client_version) |
116 | } | 110 | } |
117 | _ => { | 111 | _ => { |
118 | eprintln!( | 112 | eprintln!( |
diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs index 2d45e5dff..ef1699934 100644 --- a/xtask/src/not_bash.rs +++ b/xtask/src/not_bash.rs | |||
@@ -94,6 +94,10 @@ pub fn run_process(cmd: String, echo: bool) -> Result<String> { | |||
94 | run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd)) | 94 | run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd)) |
95 | } | 95 | } |
96 | 96 | ||
97 | pub fn date_iso() -> Result<String> { | ||
98 | run!("date --iso --utc") | ||
99 | } | ||
100 | |||
97 | fn run_process_inner(cmd: &str, echo: bool) -> Result<String> { | 101 | fn run_process_inner(cmd: &str, echo: bool) -> Result<String> { |
98 | let mut args = shelx(cmd); | 102 | let mut args = shelx(cmd); |
99 | let binary = args.remove(0); | 103 | let binary = args.remove(0); |