mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
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.
This commit is contained in:
parent
691c96e36a
commit
869ec5f97a
4 changed files with 18 additions and 28 deletions
7
.github/workflows/release.yaml
vendored
7
.github/workflows/release.yaml
vendored
|
@ -109,12 +109,7 @@ jobs:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
- name: Dist
|
- name: Dist
|
||||||
if: github.ref == 'refs/heads/release'
|
run: cargo xtask dist --client-patch-version $GITHUB_RUN_NUMBER
|
||||||
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
|
|
||||||
|
|
||||||
- name: Run analysis-stats on rust-analyzer
|
- name: Run analysis-stats on rust-analyzer
|
||||||
run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
|
run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
|
||||||
|
|
|
@ -9,24 +9,28 @@ use anyhow::Result;
|
||||||
use flate2::{write::GzEncoder, Compression};
|
use flate2::{write::GzEncoder, Compression};
|
||||||
use xshell::{cmd, cp, mkdir_p, pushd, pushenv, read_file, rm_rf, write_file};
|
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 {
|
impl flags::Dist {
|
||||||
pub(crate) nightly: bool,
|
|
||||||
pub(crate) client_version: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DistCmd {
|
|
||||||
pub(crate) fn run(self) -> Result<()> {
|
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");
|
let dist = project_root().join("dist");
|
||||||
rm_rf(&dist)?;
|
rm_rf(&dist)?;
|
||||||
mkdir_p(&dist)?;
|
mkdir_p(&dist)?;
|
||||||
|
|
||||||
if let Some(version) = self.client_version {
|
if let Some(patch_version) = self.client_patch_version {
|
||||||
let release_tag = if self.nightly { "nightly".to_string() } else { date_iso()? };
|
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)?;
|
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)?;
|
dist_server(release_channel)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,7 @@ xflags::xflags! {
|
||||||
optional --dry-run
|
optional --dry-run
|
||||||
}
|
}
|
||||||
cmd dist {
|
cmd dist {
|
||||||
optional --nightly
|
optional --client-patch-version version: String
|
||||||
optional --client version: String
|
|
||||||
}
|
}
|
||||||
cmd metrics {
|
cmd metrics {
|
||||||
optional --dry-run
|
optional --dry-run
|
||||||
|
@ -85,9 +84,6 @@ pub struct Install {
|
||||||
pub jemalloc: bool,
|
pub jemalloc: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Lint;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FuzzTests;
|
pub struct FuzzTests;
|
||||||
|
|
||||||
|
@ -106,8 +102,7 @@ pub struct Promote {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Dist {
|
pub struct Dist {
|
||||||
pub nightly: bool,
|
pub client_patch_version: Option<String>,
|
||||||
pub client: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -28,8 +28,6 @@ use std::{
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
use xshell::{cmd, cp, pushd, pushenv};
|
use xshell::{cmd, cp, pushd, pushenv};
|
||||||
|
|
||||||
use crate::dist::DistCmd;
|
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let _d = pushd(project_root())?;
|
let _d = pushd(project_root())?;
|
||||||
|
|
||||||
|
@ -44,9 +42,7 @@ fn main() -> Result<()> {
|
||||||
flags::XtaskCmd::PreCache(cmd) => cmd.run(),
|
flags::XtaskCmd::PreCache(cmd) => cmd.run(),
|
||||||
flags::XtaskCmd::Release(cmd) => cmd.run(),
|
flags::XtaskCmd::Release(cmd) => cmd.run(),
|
||||||
flags::XtaskCmd::Promote(cmd) => cmd.run(),
|
flags::XtaskCmd::Promote(cmd) => cmd.run(),
|
||||||
flags::XtaskCmd::Dist(flags) => {
|
flags::XtaskCmd::Dist(cmd) => cmd.run(),
|
||||||
DistCmd { nightly: flags.nightly, client_version: flags.client }.run()
|
|
||||||
}
|
|
||||||
flags::XtaskCmd::Metrics(cmd) => cmd.run(),
|
flags::XtaskCmd::Metrics(cmd) => cmd.run(),
|
||||||
flags::XtaskCmd::Bb(cmd) => {
|
flags::XtaskCmd::Bb(cmd) => {
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue