diff options
-rw-r--r-- | .github/workflows/release.yaml | 4 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs | 8 | ||||
-rw-r--r-- | crates/ra_proc_macro_srv/src/proc_macro/mod.rs | 4 | ||||
-rw-r--r-- | xtask/src/dist.rs | 20 | ||||
-rw-r--r-- | xtask/src/lib.rs | 4 | ||||
-rw-r--r-- | xtask/src/main.rs | 14 | ||||
-rw-r--r-- | xtask/src/not_bash.rs | 4 |
7 files changed, 28 insertions, 30 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/crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs b/crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs index 9029f8815..55d93917c 100644 --- a/crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs +++ b/crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs | |||
@@ -54,12 +54,14 @@ pub struct Diagnostic { | |||
54 | } | 54 | } |
55 | 55 | ||
56 | macro_rules! diagnostic_child_methods { | 56 | macro_rules! diagnostic_child_methods { |
57 | ($spanned:ident, $regular:ident, $level:expr) => ( | 57 | ($spanned:ident, $regular:ident, $level:expr) => { |
58 | /// Adds a new child diagnostic message to `self` with the level | 58 | /// Adds a new child diagnostic message to `self` with the level |
59 | /// identified by this method's name with the given `spans` and | 59 | /// identified by this method's name with the given `spans` and |
60 | /// `message`. | 60 | /// `message`. |
61 | pub fn $spanned<S, T>(mut self, spans: S, message: T) -> Diagnostic | 61 | pub fn $spanned<S, T>(mut self, spans: S, message: T) -> Diagnostic |
62 | where S: MultiSpan, T: Into<String> | 62 | where |
63 | S: MultiSpan, | ||
64 | T: Into<String>, | ||
63 | { | 65 | { |
64 | self.children.push(Diagnostic::spanned(spans, $level, message)); | 66 | self.children.push(Diagnostic::spanned(spans, $level, message)); |
65 | self | 67 | self |
@@ -71,7 +73,7 @@ macro_rules! diagnostic_child_methods { | |||
71 | self.children.push(Diagnostic::new($level, message)); | 73 | self.children.push(Diagnostic::new($level, message)); |
72 | self | 74 | self |
73 | } | 75 | } |
74 | ) | 76 | }; |
75 | } | 77 | } |
76 | 78 | ||
77 | /// Iterator over the children diagnostics of a `Diagnostic`. | 79 | /// Iterator over the children diagnostics of a `Diagnostic`. |
diff --git a/crates/ra_proc_macro_srv/src/proc_macro/mod.rs b/crates/ra_proc_macro_srv/src/proc_macro/mod.rs index e35a6ff8b..ee0dc9722 100644 --- a/crates/ra_proc_macro_srv/src/proc_macro/mod.rs +++ b/crates/ra_proc_macro_srv/src/proc_macro/mod.rs | |||
@@ -169,13 +169,13 @@ pub mod token_stream { | |||
169 | pub struct Span(bridge::client::Span); | 169 | pub struct Span(bridge::client::Span); |
170 | 170 | ||
171 | macro_rules! diagnostic_method { | 171 | macro_rules! diagnostic_method { |
172 | ($name:ident, $level:expr) => ( | 172 | ($name:ident, $level:expr) => { |
173 | /// Creates a new `Diagnostic` with the given `message` at the span | 173 | /// Creates a new `Diagnostic` with the given `message` at the span |
174 | /// `self`. | 174 | /// `self`. |
175 | pub fn $name<T: Into<String>>(self, message: T) -> Diagnostic { | 175 | pub fn $name<T: Into<String>>(self, message: T) -> Diagnostic { |
176 | Diagnostic::spanned(self, $level, message) | 176 | Diagnostic::spanned(self, $level, message) |
177 | } | 177 | } |
178 | ) | 178 | }; |
179 | } | 179 | } |
180 | 180 | ||
181 | impl Span { | 181 | impl Span { |
diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs index 3255eefb9..a56eeef8d 100644 --- a/xtask/src/dist.rs +++ b/xtask/src/dist.rs | |||
@@ -3,24 +3,20 @@ use std::path::PathBuf; | |||
3 | use anyhow::Result; | 3 | use anyhow::Result; |
4 | 4 | ||
5 | use crate::{ | 5 | use 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 | ||
10 | pub struct ClientOpts { | 10 | pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> { |
11 | pub version: String, | ||
12 | pub release_tag: String, | ||
13 | } | ||
14 | |||
15 | pub fn run_dist(client_opts: Option<ClientOpts>) -> Result<()> { | ||
16 | let dist = project_root().join("dist"); | 11 | let dist = project_root().join("dist"); |
17 | rm_rf(&dist)?; | 12 | rm_rf(&dist)?; |
18 | fs2::create_dir_all(&dist)?; | 13 | fs2::create_dir_all(&dist)?; |
19 | 14 | ||
20 | if let Some(ClientOpts { version, release_tag }) = client_opts { | 15 | if let Some(version) = client_version { |
16 | let release_tag = if nightly { "nightly".to_string() } else { date_iso()? }; | ||
21 | dist_client(&version, &release_tag)?; | 17 | dist_client(&version, &release_tag)?; |
22 | } | 18 | } |
23 | dist_server()?; | 19 | dist_server(nightly)?; |
24 | Ok(()) | 20 | Ok(()) |
25 | } | 21 | } |
26 | 22 | ||
@@ -50,7 +46,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> { | |||
50 | Ok(()) | 46 | Ok(()) |
51 | } | 47 | } |
52 | 48 | ||
53 | fn dist_server() -> Result<()> { | 49 | fn dist_server(nightly: bool) -> Result<()> { |
54 | if cfg!(target_os = "linux") { | 50 | if cfg!(target_os = "linux") { |
55 | std::env::set_var("CC", "clang"); | 51 | std::env::set_var("CC", "clang"); |
56 | run!( | 52 | run!( |
@@ -60,7 +56,9 @@ fn dist_server() -> Result<()> { | |||
60 | // We'd want to add, but that requires setting the right linker somehow | 56 | // We'd want to add, but that requires setting the right linker somehow |
61 | // --features=jemalloc | 57 | // --features=jemalloc |
62 | )?; | 58 | )?; |
63 | run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; | 59 | if !nightly { |
60 | run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; | ||
61 | } | ||
64 | } else { | 62 | } else { |
65 | run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; | 63 | run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; |
66 | } | 64 | } |
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 | ||
22 | use crate::{ | 22 | use 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 | ||
27 | pub use anyhow::Result; | 27 | pub 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; | |||
13 | use pico_args::Arguments; | 13 | use pico_args::Arguments; |
14 | use xtask::{ | 14 | use 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 | ||
97 | pub fn date_iso() -> Result<String> { | ||
98 | run!("date --iso --utc") | ||
99 | } | ||
100 | |||
97 | fn run_process_inner(cmd: &str, echo: bool) -> Result<String> { | 101 | fn 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); |