From ffb7ea678b66c7407671361b1ee77bd9d2d6616c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 8 Apr 2020 11:47:40 +0200 Subject: [PATCH] Don't strip nightly releases --- .github/workflows/release.yaml | 4 ++-- xtask/src/dist.rs | 19 +++++++++---------- xtask/src/lib.rs | 4 ++-- xtask/src/main.rs | 14 ++++---------- xtask/src/not_bash.rs | 4 ++++ 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4db122ec75..2c1192f072 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -50,11 +50,11 @@ jobs: - name: Dist if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release' - run: cargo xtask dist --client --version 0.2.$GITHUB_RUN_NUMBER --tag $(date --iso --utc) + run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER - name: Dist if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/release' - run: cargo xtask dist --client --version 0.3.$GITHUB_RUN_NUMBER-nightly --tag nightly + run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly - name: Dist if: matrix.os != 'ubuntu-latest' diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs index 3255eefb9d..67ae6106ab 100644 --- a/xtask/src/dist.rs +++ b/xtask/src/dist.rs @@ -3,24 +3,21 @@ use std::path::PathBuf; use anyhow::Result; use crate::{ - not_bash::{fs2, pushd, rm_rf, run}, + not_bash::{date_iso, fs2, pushd, rm_rf, run}, project_root, }; -pub struct ClientOpts { - pub version: String, - pub release_tag: String, -} -pub fn run_dist(client_opts: Option) -> Result<()> { +pub fn run_dist(nightly: bool, client_version: Option) -> Result<()> { let dist = project_root().join("dist"); rm_rf(&dist)?; fs2::create_dir_all(&dist)?; - if let Some(ClientOpts { version, release_tag }) = client_opts { + if let Some(version) = client_version { + let release_tag = if nightly { "nightly".to_string() } else { date_iso()? }; dist_client(&version, &release_tag)?; } - dist_server()?; + dist_server(nightly)?; Ok(()) } @@ -50,7 +47,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> { Ok(()) } -fn dist_server() -> Result<()> { +fn dist_server(nightly: bool) -> Result<()> { if cfg!(target_os = "linux") { std::env::set_var("CC", "clang"); run!( @@ -60,7 +57,9 @@ fn dist_server() -> Result<()> { // We'd want to add, but that requires setting the right linker somehow // --features=jemalloc )?; - run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; + if !nightly { + run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; + } } else { run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; } diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index 0b8243f62e..9d087daa24 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -21,7 +21,7 @@ use walkdir::{DirEntry, WalkDir}; use crate::{ codegen::Mode, - not_bash::{fs2, pushd, rm_rf, run}, + not_bash::{date_iso, fs2, pushd, rm_rf, run}, }; pub use anyhow::Result; @@ -180,7 +180,7 @@ pub fn run_release(dry_run: bool) -> Result<()> { let website_root = project_root().join("../rust-analyzer.github.io"); let changelog_dir = website_root.join("./thisweek/_posts"); - let today = run!("date --iso")?; + let today = date_iso()?; let commit = run!("git rev-parse HEAD")?; let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count(); diff --git a/xtask/src/main.rs b/xtask/src/main.rs index a9adcfba47..dff3ce4a1d 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -13,7 +13,7 @@ use std::env; use pico_args::Arguments; use xtask::{ codegen::{self, Mode}, - dist::{run_dist, ClientOpts}, + dist::run_dist, install::{ClientOpt, InstallCmd, ServerOpt}, not_bash::pushd, pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt, @@ -103,16 +103,10 @@ FLAGS: run_release(dry_run) } "dist" => { - let client_opts = if args.contains("--client") { - Some(ClientOpts { - version: args.value_from_str("--version")?, - release_tag: args.value_from_str("--tag")?, - }) - } else { - None - }; + let nightly = args.contains("--nightly"); + let client_version: Option = args.opt_value_from_str("--client")?; args.finish()?; - run_dist(client_opts) + run_dist(nightly, client_version) } _ => { eprintln!( diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs index 2d45e5dff4..ef16999349 100644 --- a/xtask/src/not_bash.rs +++ b/xtask/src/not_bash.rs @@ -94,6 +94,10 @@ pub fn run_process(cmd: String, echo: bool) -> Result { run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd)) } +pub fn date_iso() -> Result { + run!("date --iso --utc") +} + fn run_process_inner(cmd: &str, echo: bool) -> Result { let mut args = shelx(cmd); let binary = args.remove(0);