5523: Minor r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-24 14:11:51 +00:00 committed by GitHub
commit 3d799b66df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 12 deletions

View file

@ -13,17 +13,24 @@ use crate::{
project_root, project_root,
}; };
pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> { pub struct DistCmd {
pub nightly: bool,
pub client_version: Option<String>,
}
impl DistCmd {
pub fn run(self) -> Result<()> {
let dist = project_root().join("dist"); let dist = project_root().join("dist");
rm_rf(&dist)?; rm_rf(&dist)?;
fs2::create_dir_all(&dist)?; fs2::create_dir_all(&dist)?;
if let Some(version) = client_version { if let Some(version) = self.client_version {
let release_tag = if nightly { "nightly".to_string() } else { date_iso()? }; let release_tag = if self.nightly { "nightly".to_string() } else { date_iso()? };
dist_client(&version, &release_tag)?; dist_client(&version, &release_tag)?;
} }
dist_server()?; dist_server()?;
Ok(()) Ok(())
}
} }
fn dist_client(version: &str, release_tag: &str) -> Result<()> { fn dist_client(version: &str, release_tag: &str) -> Result<()> {

View file

@ -13,7 +13,7 @@ use std::env;
use pico_args::Arguments; use pico_args::Arguments;
use xtask::{ use xtask::{
codegen::{self, Mode}, codegen::{self, Mode},
dist::run_dist, dist::DistCmd,
install::{ClientOpt, InstallCmd, Malloc, ServerOpt}, install::{ClientOpt, InstallCmd, Malloc, ServerOpt},
not_bash::pushd, not_bash::pushd,
pre_commit, project_root, pre_commit, project_root,
@ -115,7 +115,7 @@ FLAGS:
let nightly = args.contains("--nightly"); let nightly = args.contains("--nightly");
let client_version: Option<String> = args.opt_value_from_str("--client")?; let client_version: Option<String> = args.opt_value_from_str("--client")?;
args.finish()?; args.finish()?;
run_dist(nightly, client_version) DistCmd { nightly, client_version }.run()
} }
_ => { _ => {
eprintln!( eprintln!(
@ -133,7 +133,8 @@ SUBCOMMANDS:
codegen codegen
install install
lint lint
dist" dist
promote"
); );
Ok(()) Ok(())
} }