This commit is contained in:
Aleksey Kladov 2020-07-24 15:59:01 +02:00
parent 0e5095d3ca
commit 93dfa39766
2 changed files with 20 additions and 12 deletions

View file

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

View file

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