aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-24 14:59:01 +0100
committerAleksey Kladov <[email protected]>2020-07-24 15:11:24 +0100
commit93dfa39766b7470000e0de32ec2fc1b450c6e2a5 (patch)
tree56a4225ab632818f59c54ded5c5ee13198f36146 /xtask
parent0e5095d3cac11d4b569c6e1594bd07937556c812 (diff)
Minor
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/dist.rs27
-rw-r--r--xtask/src/main.rs7
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
16pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> { 16pub 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 { 21impl 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
29fn dist_client(version: &str, release_tag: &str) -> Result<()> { 36fn 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;
13use pico_args::Arguments; 13use pico_args::Arguments;
14use xtask::{ 14use 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 }