diff options
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/dist.rs | 27 | ||||
-rw-r--r-- | xtask/src/main.rs | 7 |
2 files changed, 21 insertions, 13 deletions
diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs index c198c0907..01d903cde 100644 --- a/xtask/src/dist.rs +++ b/xtask/src/dist.rs | |||
@@ -13,17 +13,24 @@ use crate::{ | |||
13 | project_root, | 13 | project_root, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> { | 16 | pub struct DistCmd { |
17 | let dist = project_root().join("dist"); | 17 | pub nightly: bool, |
18 | rm_rf(&dist)?; | 18 | pub client_version: Option<String>, |
19 | fs2::create_dir_all(&dist)?; | 19 | } |
20 | 20 | ||
21 | if let Some(version) = client_version { | 21 | impl DistCmd { |
22 | let release_tag = if nightly { "nightly".to_string() } else { date_iso()? }; | 22 | pub fn run(self) -> Result<()> { |
23 | dist_client(&version, &release_tag)?; | 23 | let dist = project_root().join("dist"); |
24 | rm_rf(&dist)?; | ||
25 | fs2::create_dir_all(&dist)?; | ||
26 | |||
27 | if let Some(version) = self.client_version { | ||
28 | let release_tag = if self.nightly { "nightly".to_string() } else { date_iso()? }; | ||
29 | dist_client(&version, &release_tag)?; | ||
30 | } | ||
31 | dist_server()?; | ||
32 | Ok(()) | ||
24 | } | 33 | } |
25 | dist_server()?; | ||
26 | Ok(()) | ||
27 | } | 34 | } |
28 | 35 | ||
29 | fn dist_client(version: &str, release_tag: &str) -> Result<()> { | 36 | fn dist_client(version: &str, release_tag: &str) -> Result<()> { |
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 53d3ce3e7..fab984fc0 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, | 16 | dist::DistCmd, |
17 | install::{ClientOpt, InstallCmd, Malloc, 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, |
@@ -115,7 +115,7 @@ FLAGS: | |||
115 | let nightly = args.contains("--nightly"); | 115 | let nightly = args.contains("--nightly"); |
116 | let client_version: Option<String> = args.opt_value_from_str("--client")?; | 116 | let client_version: Option<String> = args.opt_value_from_str("--client")?; |
117 | args.finish()?; | 117 | args.finish()?; |
118 | run_dist(nightly, client_version) | 118 | DistCmd { nightly, client_version }.run() |
119 | } | 119 | } |
120 | _ => { | 120 | _ => { |
121 | eprintln!( | 121 | eprintln!( |
@@ -133,7 +133,8 @@ SUBCOMMANDS: | |||
133 | codegen | 133 | codegen |
134 | install | 134 | install |
135 | lint | 135 | lint |
136 | dist" | 136 | dist |
137 | promote" | ||
137 | ); | 138 | ); |
138 | Ok(()) | 139 | Ok(()) |
139 | } | 140 | } |