aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-04-26 13:17:02 +0100
committerAleksey Kladov <[email protected]>2021-04-26 13:17:02 +0100
commit869ec5f97ace736fdbf765d143c9634fd1b558ef (patch)
tree38ea5bf7f9d5dc0f5ec35912ffecfc8d0c795b74 /xtask
parent691c96e36a9e760d8e6f035377d03223e2f93277 (diff)
fix: dont' misundentify nightly as stable in --version on Mac&Win
We used to set `--nightly` in CI, and only for linux. Let's detect this in xtask instead.
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/dist.rs24
-rw-r--r--xtask/src/flags.rs9
-rw-r--r--xtask/src/main.rs6
3 files changed, 17 insertions, 22 deletions
diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs
index d1c005954..12a7fea1e 100644
--- a/xtask/src/dist.rs
+++ b/xtask/src/dist.rs
@@ -9,24 +9,28 @@ use anyhow::Result;
9use flate2::{write::GzEncoder, Compression}; 9use flate2::{write::GzEncoder, Compression};
10use xshell::{cmd, cp, mkdir_p, pushd, pushenv, read_file, rm_rf, write_file}; 10use xshell::{cmd, cp, mkdir_p, pushd, pushenv, read_file, rm_rf, write_file};
11 11
12use crate::{date_iso, project_root}; 12use crate::{date_iso, flags, project_root};
13 13
14pub(crate) struct DistCmd { 14impl flags::Dist {
15 pub(crate) nightly: bool,
16 pub(crate) client_version: Option<String>,
17}
18
19impl DistCmd {
20 pub(crate) fn run(self) -> Result<()> { 15 pub(crate) fn run(self) -> Result<()> {
16 let stable =
17 std::env::var("GITHUB_REF").unwrap_or_default().as_str() == "refs/heads/release";
18
21 let dist = project_root().join("dist"); 19 let dist = project_root().join("dist");
22 rm_rf(&dist)?; 20 rm_rf(&dist)?;
23 mkdir_p(&dist)?; 21 mkdir_p(&dist)?;
24 22
25 if let Some(version) = self.client_version { 23 if let Some(patch_version) = self.client_patch_version {
26 let release_tag = if self.nightly { "nightly".to_string() } else { date_iso()? }; 24 let version = if stable {
25 format!("0.2.{}", patch_version)
26 } else {
27 // A hack to make VS Code prefer nightly over stable.
28 format!("0.3.{}", patch_version)
29 };
30 let release_tag = if stable { date_iso()? } else { "nightly".to_string() };
27 dist_client(&version, &release_tag)?; 31 dist_client(&version, &release_tag)?;
28 } 32 }
29 let release_channel = if self.nightly { "nightly" } else { "stable" }; 33 let release_channel = if stable { "stable" } else { "nightly" };
30 dist_server(release_channel)?; 34 dist_server(release_channel)?;
31 Ok(()) 35 Ok(())
32 } 36 }
diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs
index 4cd2b1ddb..f80a5dd16 100644
--- a/xtask/src/flags.rs
+++ b/xtask/src/flags.rs
@@ -37,8 +37,7 @@ xflags::xflags! {
37 optional --dry-run 37 optional --dry-run
38 } 38 }
39 cmd dist { 39 cmd dist {
40 optional --nightly 40 optional --client-patch-version version: String
41 optional --client version: String
42 } 41 }
43 cmd metrics { 42 cmd metrics {
44 optional --dry-run 43 optional --dry-run
@@ -86,9 +85,6 @@ pub struct Install {
86} 85}
87 86
88#[derive(Debug)] 87#[derive(Debug)]
89pub struct Lint;
90
91#[derive(Debug)]
92pub struct FuzzTests; 88pub struct FuzzTests;
93 89
94#[derive(Debug)] 90#[derive(Debug)]
@@ -106,8 +102,7 @@ pub struct Promote {
106 102
107#[derive(Debug)] 103#[derive(Debug)]
108pub struct Dist { 104pub struct Dist {
109 pub nightly: bool, 105 pub client_patch_version: Option<String>,
110 pub client: Option<String>,
111} 106}
112 107
113#[derive(Debug)] 108#[derive(Debug)]
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 960927fc0..e0e620c76 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -28,8 +28,6 @@ use std::{
28use walkdir::{DirEntry, WalkDir}; 28use walkdir::{DirEntry, WalkDir};
29use xshell::{cmd, cp, pushd, pushenv}; 29use xshell::{cmd, cp, pushd, pushenv};
30 30
31use crate::dist::DistCmd;
32
33fn main() -> Result<()> { 31fn main() -> Result<()> {
34 let _d = pushd(project_root())?; 32 let _d = pushd(project_root())?;
35 33
@@ -44,9 +42,7 @@ fn main() -> Result<()> {
44 flags::XtaskCmd::PreCache(cmd) => cmd.run(), 42 flags::XtaskCmd::PreCache(cmd) => cmd.run(),
45 flags::XtaskCmd::Release(cmd) => cmd.run(), 43 flags::XtaskCmd::Release(cmd) => cmd.run(),
46 flags::XtaskCmd::Promote(cmd) => cmd.run(), 44 flags::XtaskCmd::Promote(cmd) => cmd.run(),
47 flags::XtaskCmd::Dist(flags) => { 45 flags::XtaskCmd::Dist(cmd) => cmd.run(),
48 DistCmd { nightly: flags.nightly, client_version: flags.client }.run()
49 }
50 flags::XtaskCmd::Metrics(cmd) => cmd.run(), 46 flags::XtaskCmd::Metrics(cmd) => cmd.run(),
51 flags::XtaskCmd::Bb(cmd) => { 47 flags::XtaskCmd::Bb(cmd) => {
52 { 48 {