Merge #8666
8666: fix: correct version string on windows and mac r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
eee50b6921
7
.github/workflows/release.yaml
vendored
7
.github/workflows/release.yaml
vendored
@ -109,12 +109,7 @@ jobs:
|
||||
node-version: 12.x
|
||||
|
||||
- name: Dist
|
||||
if: github.ref == 'refs/heads/release'
|
||||
run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
|
||||
|
||||
- name: Dist
|
||||
if: github.ref != 'refs/heads/release'
|
||||
run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
|
||||
run: cargo xtask dist --client-patch-version $GITHUB_RUN_NUMBER
|
||||
|
||||
- name: Run analysis-stats on rust-analyzer
|
||||
run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
|
||||
|
@ -55,7 +55,7 @@ fn commit_hash() -> Option<String> {
|
||||
}
|
||||
|
||||
fn build_date() -> Option<String> {
|
||||
output_to_string("date --iso --utc")
|
||||
output_to_string("date --utc +%Y-%m-%d")
|
||||
}
|
||||
|
||||
fn output_to_string(command: &str) -> Option<String> {
|
||||
|
@ -9,24 +9,28 @@ use anyhow::Result;
|
||||
use flate2::{write::GzEncoder, Compression};
|
||||
use xshell::{cmd, cp, mkdir_p, pushd, pushenv, read_file, rm_rf, write_file};
|
||||
|
||||
use crate::{date_iso, project_root};
|
||||
use crate::{date_iso, flags, project_root};
|
||||
|
||||
pub(crate) struct DistCmd {
|
||||
pub(crate) nightly: bool,
|
||||
pub(crate) client_version: Option<String>,
|
||||
}
|
||||
|
||||
impl DistCmd {
|
||||
impl flags::Dist {
|
||||
pub(crate) fn run(self) -> Result<()> {
|
||||
let stable =
|
||||
std::env::var("GITHUB_REF").unwrap_or_default().as_str() == "refs/heads/release";
|
||||
|
||||
let dist = project_root().join("dist");
|
||||
rm_rf(&dist)?;
|
||||
mkdir_p(&dist)?;
|
||||
|
||||
if let Some(version) = self.client_version {
|
||||
let release_tag = if self.nightly { "nightly".to_string() } else { date_iso()? };
|
||||
if let Some(patch_version) = self.client_patch_version {
|
||||
let version = if stable {
|
||||
format!("0.2.{}", patch_version)
|
||||
} else {
|
||||
// A hack to make VS Code prefer nightly over stable.
|
||||
format!("0.3.{}", patch_version)
|
||||
};
|
||||
let release_tag = if stable { date_iso()? } else { "nightly".to_string() };
|
||||
dist_client(&version, &release_tag)?;
|
||||
}
|
||||
let release_channel = if self.nightly { "nightly" } else { "stable" };
|
||||
let release_channel = if stable { "stable" } else { "nightly" };
|
||||
dist_server(release_channel)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -37,8 +37,7 @@ xflags::xflags! {
|
||||
optional --dry-run
|
||||
}
|
||||
cmd dist {
|
||||
optional --nightly
|
||||
optional --client version: String
|
||||
optional --client-patch-version version: String
|
||||
}
|
||||
cmd metrics {
|
||||
optional --dry-run
|
||||
@ -85,9 +84,6 @@ pub struct Install {
|
||||
pub jemalloc: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Lint;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FuzzTests;
|
||||
|
||||
@ -106,8 +102,7 @@ pub struct Promote {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Dist {
|
||||
pub nightly: bool,
|
||||
pub client: Option<String>,
|
||||
pub client_patch_version: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -28,8 +28,6 @@ use std::{
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
use xshell::{cmd, cp, pushd, pushenv};
|
||||
|
||||
use crate::dist::DistCmd;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let _d = pushd(project_root())?;
|
||||
|
||||
@ -44,9 +42,7 @@ fn main() -> Result<()> {
|
||||
flags::XtaskCmd::PreCache(cmd) => cmd.run(),
|
||||
flags::XtaskCmd::Release(cmd) => cmd.run(),
|
||||
flags::XtaskCmd::Promote(cmd) => cmd.run(),
|
||||
flags::XtaskCmd::Dist(flags) => {
|
||||
DistCmd { nightly: flags.nightly, client_version: flags.client }.run()
|
||||
}
|
||||
flags::XtaskCmd::Dist(cmd) => cmd.run(),
|
||||
flags::XtaskCmd::Metrics(cmd) => cmd.run(),
|
||||
flags::XtaskCmd::Bb(cmd) => {
|
||||
{
|
||||
@ -112,7 +108,7 @@ fn run_fuzzer() -> Result<()> {
|
||||
}
|
||||
|
||||
fn date_iso() -> Result<String> {
|
||||
let res = cmd!("date --iso --utc").read()?;
|
||||
let res = cmd!("date --utc +%Y-%m-%d").read()?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user