mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 04:23:25 +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
|
||||
|
||||
- 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 .
|
||||
|
|
|
@ -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) => {
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue