diff options
Diffstat (limited to 'xtask/src/lib.rs')
-rw-r--r-- | xtask/src/lib.rs | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index 739f49f7b..747654c1f 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | pub mod not_bash; | 5 | pub mod not_bash; |
6 | pub mod install; | 6 | pub mod install; |
7 | pub mod release; | ||
7 | pub mod dist; | 8 | pub mod dist; |
8 | pub mod pre_commit; | 9 | pub mod pre_commit; |
9 | 10 | ||
@@ -19,7 +20,7 @@ use walkdir::{DirEntry, WalkDir}; | |||
19 | 20 | ||
20 | use crate::{ | 21 | use crate::{ |
21 | codegen::Mode, | 22 | codegen::Mode, |
22 | not_bash::{date_iso, fs2, pushd, pushenv, rm_rf, run}, | 23 | not_bash::{fs2, pushd, pushenv, rm_rf, run}, |
23 | }; | 24 | }; |
24 | 25 | ||
25 | pub use anyhow::{bail, Context as _, Result}; | 26 | pub use anyhow::{bail, Context as _, Result}; |
@@ -153,60 +154,6 @@ pub fn run_pre_cache() -> Result<()> { | |||
153 | Ok(()) | 154 | Ok(()) |
154 | } | 155 | } |
155 | 156 | ||
156 | pub fn run_release(dry_run: bool) -> Result<()> { | ||
157 | if !dry_run { | ||
158 | run!("git switch release")?; | ||
159 | run!("git fetch upstream --tags --force")?; | ||
160 | run!("git reset --hard tags/nightly")?; | ||
161 | run!("git push")?; | ||
162 | } | ||
163 | codegen::generate_assists_docs(Mode::Overwrite)?; | ||
164 | codegen::generate_feature_docs(Mode::Overwrite)?; | ||
165 | |||
166 | let website_root = project_root().join("../rust-analyzer.github.io"); | ||
167 | let changelog_dir = website_root.join("./thisweek/_posts"); | ||
168 | |||
169 | let today = date_iso()?; | ||
170 | let commit = run!("git rev-parse HEAD")?; | ||
171 | let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count(); | ||
172 | |||
173 | let contents = format!( | ||
174 | "\ | ||
175 | = Changelog #{} | ||
176 | :sectanchors: | ||
177 | :page-layout: post | ||
178 | |||
179 | Commit: commit:{}[] + | ||
180 | Release: release:{}[] | ||
181 | |||
182 | == New Features | ||
183 | |||
184 | * pr:[] . | ||
185 | |||
186 | == Fixes | ||
187 | |||
188 | == Internal Improvements | ||
189 | ", | ||
190 | changelog_n, commit, today | ||
191 | ); | ||
192 | |||
193 | let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); | ||
194 | fs2::write(&path, &contents)?; | ||
195 | |||
196 | for &adoc in ["manual.adoc", "generated_features.adoc", "generated_assists.adoc"].iter() { | ||
197 | let src = project_root().join("./docs/user/").join(adoc); | ||
198 | let dst = website_root.join(adoc); | ||
199 | fs2::copy(src, dst)?; | ||
200 | } | ||
201 | |||
202 | let tags = run!("git tag --list"; echo = false)?; | ||
203 | let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap(); | ||
204 | |||
205 | println!("\n git log {}..HEAD --merges --reverse", prev_tag); | ||
206 | |||
207 | Ok(()) | ||
208 | } | ||
209 | |||
210 | fn is_release_tag(tag: &str) -> bool { | 157 | fn is_release_tag(tag: &str) -> bool { |
211 | tag.len() == "2020-02-24".len() && tag.starts_with(|c: char| c.is_ascii_digit()) | 158 | tag.len() == "2020-02-24".len() && tag.starts_with(|c: char| c.is_ascii_digit()) |
212 | } | 159 | } |