Skip to content

Commit ffb7ea6

Browse files
committed
Don't strip nightly releases
1 parent d89c189 commit ffb7ea6

File tree

5 files changed

+21
-24
lines changed

5 files changed

+21
-24
lines changed

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ jobs:
5050

5151
- name: Dist
5252
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
5454

5555
- name: Dist
5656
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
5858

5959
- name: Dist
6060
if: matrix.os != 'ubuntu-latest'

xtask/src/dist.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,21 @@ use std::path::PathBuf;
33
use anyhow::Result;
44

55
use crate::{
6-
not_bash::{fs2, pushd, rm_rf, run},
6+
not_bash::{date_iso, fs2, pushd, rm_rf, run},
77
project_root,
88
};
99

10-
pub struct ClientOpts {
11-
pub version: String,
12-
pub release_tag: String,
13-
}
1410

15-
pub fn run_dist(client_opts: Option<ClientOpts>) -> Result<()> {
11+
pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> {
1612
let dist = project_root().join("dist");
1713
rm_rf(&dist)?;
1814
fs2::create_dir_all(&dist)?;
1915

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()? };
2118
dist_client(&version, &release_tag)?;
2219
}
23-
dist_server()?;
20+
dist_server(nightly)?;
2421
Ok(())
2522
}
2623

@@ -50,7 +47,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
5047
Ok(())
5148
}
5249

53-
fn dist_server() -> Result<()> {
50+
fn dist_server(nightly: bool) -> Result<()> {
5451
if cfg!(target_os = "linux") {
5552
std::env::set_var("CC", "clang");
5653
run!(
@@ -60,7 +57,9 @@ fn dist_server() -> Result<()> {
6057
// We'd want to add, but that requires setting the right linker somehow
6158
// --features=jemalloc
6259
)?;
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+
}
6463
} else {
6564
run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?;
6665
}

xtask/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use walkdir::{DirEntry, WalkDir};
2121

2222
use crate::{
2323
codegen::Mode,
24-
not_bash::{fs2, pushd, rm_rf, run},
24+
not_bash::{date_iso, fs2, pushd, rm_rf, run},
2525
};
2626

2727
pub use anyhow::Result;
@@ -180,7 +180,7 @@ pub fn run_release(dry_run: bool) -> Result<()> {
180180
let website_root = project_root().join("../rust-analyzer.github.io");
181181
let changelog_dir = website_root.join("./thisweek/_posts");
182182

183-
let today = run!("date --iso")?;
183+
let today = date_iso()?;
184184
let commit = run!("git rev-parse HEAD")?;
185185
let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
186186

xtask/src/main.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::env;
1313
use pico_args::Arguments;
1414
use xtask::{
1515
codegen::{self, Mode},
16-
dist::{run_dist, ClientOpts},
16+
dist::run_dist,
1717
install::{ClientOpt, InstallCmd, ServerOpt},
1818
not_bash::pushd,
1919
pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
@@ -103,16 +103,10 @@ FLAGS:
103103
run_release(dry_run)
104104
}
105105
"dist" => {
106-
let client_opts = if args.contains("--client") {
107-
Some(ClientOpts {
108-
version: args.value_from_str("--version")?,
109-
release_tag: args.value_from_str("--tag")?,
110-
})
111-
} else {
112-
None
113-
};
106+
let nightly = args.contains("--nightly");
107+
let client_version: Option<String> = args.opt_value_from_str("--client")?;
114108
args.finish()?;
115-
run_dist(client_opts)
109+
run_dist(nightly, client_version)
116110
}
117111
_ => {
118112
eprintln!(

xtask/src/not_bash.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ pub fn run_process(cmd: String, echo: bool) -> Result<String> {
9494
run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd))
9595
}
9696

97+
pub fn date_iso() -> Result<String> {
98+
run!("date --iso --utc")
99+
}
100+
97101
fn run_process_inner(cmd: &str, echo: bool) -> Result<String> {
98102
let mut args = shelx(cmd);
99103
let binary = args.remove(0);

0 commit comments

Comments
 (0)