aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src/lib.rs')
-rw-r--r--xtask/src/lib.rs57
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
5pub mod not_bash; 5pub mod not_bash;
6pub mod install; 6pub mod install;
7pub mod release;
7pub mod dist; 8pub mod dist;
8pub mod pre_commit; 9pub mod pre_commit;
9 10
@@ -19,7 +20,7 @@ use walkdir::{DirEntry, WalkDir};
19 20
20use crate::{ 21use 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
25pub use anyhow::{bail, Context as _, Result}; 26pub use anyhow::{bail, Context as _, Result};
@@ -153,60 +154,6 @@ pub fn run_pre_cache() -> Result<()> {
153 Ok(()) 154 Ok(())
154} 155}
155 156
156pub 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
179Commit: commit:{}[] +
180Release: 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
210fn is_release_tag(tag: &str) -> bool { 157fn 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}