aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-08 10:47:40 +0100
committerAleksey Kladov <[email protected]>2020-04-08 10:47:40 +0100
commitffb7ea678b66c7407671361b1ee77bd9d2d6616c (patch)
treef8bd9f6d012ffe1c4bf94021ddeb037422af8a63
parentd89c189ad1efe87e54855e6488184d7a3825a534 (diff)
Don't strip nightly releases
-rw-r--r--.github/workflows/release.yaml4
-rw-r--r--xtask/src/dist.rs19
-rw-r--r--xtask/src/lib.rs4
-rw-r--r--xtask/src/main.rs14
-rw-r--r--xtask/src/not_bash.rs4
5 files changed, 21 insertions, 24 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 4db122ec7..2c1192f07 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -50,11 +50,11 @@ jobs:
50 50
51 - name: Dist 51 - name: Dist
52 if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release' 52 if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release'
53 run: cargo xtask dist --client --version 0.2.$GITHUB_RUN_NUMBER --tag $(date --iso --utc) 53 run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
54 54
55 - name: Dist 55 - name: Dist
56 if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/release' 56 if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/release'
57 run: cargo xtask dist --client --version 0.3.$GITHUB_RUN_NUMBER-nightly --tag nightly 57 run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
58 58
59 - name: Dist 59 - name: Dist
60 if: matrix.os != 'ubuntu-latest' 60 if: matrix.os != 'ubuntu-latest'
diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs
index 3255eefb9..67ae6106a 100644
--- a/xtask/src/dist.rs
+++ b/xtask/src/dist.rs
@@ -3,24 +3,21 @@ use std::path::PathBuf;
3use anyhow::Result; 3use anyhow::Result;
4 4
5use crate::{ 5use crate::{
6 not_bash::{fs2, pushd, rm_rf, run}, 6 not_bash::{date_iso, fs2, pushd, rm_rf, run},
7 project_root, 7 project_root,
8}; 8};
9 9
10pub struct ClientOpts {
11 pub version: String,
12 pub release_tag: String,
13}
14 10
15pub fn run_dist(client_opts: Option<ClientOpts>) -> Result<()> { 11pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> {
16 let dist = project_root().join("dist"); 12 let dist = project_root().join("dist");
17 rm_rf(&dist)?; 13 rm_rf(&dist)?;
18 fs2::create_dir_all(&dist)?; 14 fs2::create_dir_all(&dist)?;
19 15
20 if let Some(ClientOpts { version, release_tag }) = client_opts { 16 if let Some(version) = client_version {
17 let release_tag = if nightly { "nightly".to_string() } else { date_iso()? };
21 dist_client(&version, &release_tag)?; 18 dist_client(&version, &release_tag)?;
22 } 19 }
23 dist_server()?; 20 dist_server(nightly)?;
24 Ok(()) 21 Ok(())
25} 22}
26 23
@@ -50,7 +47,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
50 Ok(()) 47 Ok(())
51} 48}
52 49
53fn dist_server() -> Result<()> { 50fn dist_server(nightly: bool) -> Result<()> {
54 if cfg!(target_os = "linux") { 51 if cfg!(target_os = "linux") {
55 std::env::set_var("CC", "clang"); 52 std::env::set_var("CC", "clang");
56 run!( 53 run!(
@@ -60,7 +57,9 @@ fn dist_server() -> Result<()> {
60 // We'd want to add, but that requires setting the right linker somehow 57 // We'd want to add, but that requires setting the right linker somehow
61 // --features=jemalloc 58 // --features=jemalloc
62 )?; 59 )?;
63 run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; 60 if !nightly {
61 run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?;
62 }
64 } else { 63 } else {
65 run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; 64 run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?;
66 } 65 }
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs
index 0b8243f62..9d087daa2 100644
--- a/xtask/src/lib.rs
+++ b/xtask/src/lib.rs
@@ -21,7 +21,7 @@ use walkdir::{DirEntry, WalkDir};
21 21
22use crate::{ 22use crate::{
23 codegen::Mode, 23 codegen::Mode,
24 not_bash::{fs2, pushd, rm_rf, run}, 24 not_bash::{date_iso, fs2, pushd, rm_rf, run},
25}; 25};
26 26
27pub use anyhow::Result; 27pub use anyhow::Result;
@@ -180,7 +180,7 @@ pub fn run_release(dry_run: bool) -> Result<()> {
180 let website_root = project_root().join("../rust-analyzer.github.io"); 180 let website_root = project_root().join("../rust-analyzer.github.io");
181 let changelog_dir = website_root.join("./thisweek/_posts"); 181 let changelog_dir = website_root.join("./thisweek/_posts");
182 182
183 let today = run!("date --iso")?; 183 let today = date_iso()?;
184 let commit = run!("git rev-parse HEAD")?; 184 let commit = run!("git rev-parse HEAD")?;
185 let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count(); 185 let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
186 186
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index a9adcfba4..dff3ce4a1 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -13,7 +13,7 @@ use std::env;
13use pico_args::Arguments; 13use pico_args::Arguments;
14use xtask::{ 14use xtask::{
15 codegen::{self, Mode}, 15 codegen::{self, Mode},
16 dist::{run_dist, ClientOpts}, 16 dist::run_dist,
17 install::{ClientOpt, InstallCmd, ServerOpt}, 17 install::{ClientOpt, InstallCmd, ServerOpt},
18 not_bash::pushd, 18 not_bash::pushd,
19 pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt, 19 pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
@@ -103,16 +103,10 @@ FLAGS:
103 run_release(dry_run) 103 run_release(dry_run)
104 } 104 }
105 "dist" => { 105 "dist" => {
106 let client_opts = if args.contains("--client") { 106 let nightly = args.contains("--nightly");
107 Some(ClientOpts { 107 let client_version: Option<String> = args.opt_value_from_str("--client")?;
108 version: args.value_from_str("--version")?,
109 release_tag: args.value_from_str("--tag")?,
110 })
111 } else {
112 None
113 };
114 args.finish()?; 108 args.finish()?;
115 run_dist(client_opts) 109 run_dist(nightly, client_version)
116 } 110 }
117 _ => { 111 _ => {
118 eprintln!( 112 eprintln!(
diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs
index 2d45e5dff..ef1699934 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<String> {
94 run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd)) 94 run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd))
95} 95}
96 96
97pub fn date_iso() -> Result<String> {
98 run!("date --iso --utc")
99}
100
97fn run_process_inner(cmd: &str, echo: bool) -> Result<String> { 101fn run_process_inner(cmd: &str, echo: bool) -> Result<String> {
98 let mut args = shelx(cmd); 102 let mut args = shelx(cmd);
99 let binary = args.remove(0); 103 let binary = args.remove(0);