diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/dist.rs | 24 | ||||
-rw-r--r-- | xtask/src/flags.rs | 9 | ||||
-rw-r--r-- | xtask/src/main.rs | 8 |
3 files changed, 18 insertions, 23 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; | |||
9 | use flate2::{write::GzEncoder, Compression}; | 9 | use flate2::{write::GzEncoder, Compression}; |
10 | use xshell::{cmd, cp, mkdir_p, pushd, pushenv, read_file, rm_rf, write_file}; | 10 | use xshell::{cmd, cp, mkdir_p, pushd, pushenv, read_file, rm_rf, write_file}; |
11 | 11 | ||
12 | use crate::{date_iso, project_root}; | 12 | use crate::{date_iso, flags, project_root}; |
13 | 13 | ||
14 | pub(crate) struct DistCmd { | 14 | impl flags::Dist { |
15 | pub(crate) nightly: bool, | ||
16 | pub(crate) client_version: Option<String>, | ||
17 | } | ||
18 | |||
19 | impl 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)] |
89 | pub struct Lint; | ||
90 | |||
91 | #[derive(Debug)] | ||
92 | pub struct FuzzTests; | 88 | pub 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)] |
108 | pub struct Dist { | 104 | pub 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..01bf6e70d 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -28,8 +28,6 @@ use std::{ | |||
28 | use walkdir::{DirEntry, WalkDir}; | 28 | use walkdir::{DirEntry, WalkDir}; |
29 | use xshell::{cmd, cp, pushd, pushenv}; | 29 | use xshell::{cmd, cp, pushd, pushenv}; |
30 | 30 | ||
31 | use crate::dist::DistCmd; | ||
32 | |||
33 | fn main() -> Result<()> { | 31 | fn 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 | { |
@@ -112,7 +108,7 @@ fn run_fuzzer() -> Result<()> { | |||
112 | } | 108 | } |
113 | 109 | ||
114 | fn date_iso() -> Result<String> { | 110 | fn date_iso() -> Result<String> { |
115 | let res = cmd!("date --iso --utc").read()?; | 111 | let res = cmd!("date --utc +%Y-%m-%d").read()?; |
116 | Ok(res) | 112 | Ok(res) |
117 | } | 113 | } |
118 | 114 | ||