mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
Move to a dedicated file
This commit is contained in:
parent
6e4fca5882
commit
97ea2dfc4b
3 changed files with 64 additions and 57 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
pub mod not_bash;
|
||||
pub mod install;
|
||||
pub mod release;
|
||||
pub mod dist;
|
||||
pub mod pre_commit;
|
||||
|
||||
|
@ -19,7 +20,7 @@ use walkdir::{DirEntry, WalkDir};
|
|||
|
||||
use crate::{
|
||||
codegen::Mode,
|
||||
not_bash::{date_iso, fs2, pushd, pushenv, rm_rf, run},
|
||||
not_bash::{fs2, pushd, pushenv, rm_rf, run},
|
||||
};
|
||||
|
||||
pub use anyhow::{bail, Context as _, Result};
|
||||
|
@ -153,60 +154,6 @@ pub fn run_pre_cache() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_release(dry_run: bool) -> Result<()> {
|
||||
if !dry_run {
|
||||
run!("git switch release")?;
|
||||
run!("git fetch upstream --tags --force")?;
|
||||
run!("git reset --hard tags/nightly")?;
|
||||
run!("git push")?;
|
||||
}
|
||||
codegen::generate_assists_docs(Mode::Overwrite)?;
|
||||
codegen::generate_feature_docs(Mode::Overwrite)?;
|
||||
|
||||
let website_root = project_root().join("../rust-analyzer.github.io");
|
||||
let changelog_dir = website_root.join("./thisweek/_posts");
|
||||
|
||||
let today = date_iso()?;
|
||||
let commit = run!("git rev-parse HEAD")?;
|
||||
let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
|
||||
|
||||
let contents = format!(
|
||||
"\
|
||||
= Changelog #{}
|
||||
:sectanchors:
|
||||
:page-layout: post
|
||||
|
||||
Commit: commit:{}[] +
|
||||
Release: release:{}[]
|
||||
|
||||
== New Features
|
||||
|
||||
* pr:[] .
|
||||
|
||||
== Fixes
|
||||
|
||||
== Internal Improvements
|
||||
",
|
||||
changelog_n, commit, today
|
||||
);
|
||||
|
||||
let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
|
||||
fs2::write(&path, &contents)?;
|
||||
|
||||
for &adoc in ["manual.adoc", "generated_features.adoc", "generated_assists.adoc"].iter() {
|
||||
let src = project_root().join("./docs/user/").join(adoc);
|
||||
let dst = website_root.join(adoc);
|
||||
fs2::copy(src, dst)?;
|
||||
}
|
||||
|
||||
let tags = run!("git tag --list"; echo = false)?;
|
||||
let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
|
||||
|
||||
println!("\n git log {}..HEAD --merges --reverse", prev_tag);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn is_release_tag(tag: &str) -> bool {
|
||||
tag.len() == "2020-02-24".len() && tag.starts_with(|c: char| c.is_ascii_digit())
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ use xtask::{
|
|||
dist::run_dist,
|
||||
install::{ClientOpt, InstallCmd, ServerOpt},
|
||||
not_bash::pushd,
|
||||
pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
|
||||
Result,
|
||||
pre_commit, project_root,
|
||||
release::run_release,
|
||||
run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result,
|
||||
};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
|
59
xtask/src/release.rs
Normal file
59
xtask/src/release.rs
Normal file
|
@ -0,0 +1,59 @@
|
|||
use crate::{
|
||||
codegen, is_release_tag,
|
||||
not_bash::{date_iso, fs2, run},
|
||||
project_root, Mode, Result,
|
||||
};
|
||||
|
||||
pub fn run_release(dry_run: bool) -> Result<()> {
|
||||
if !dry_run {
|
||||
run!("git switch release")?;
|
||||
run!("git fetch upstream --tags --force")?;
|
||||
run!("git reset --hard tags/nightly")?;
|
||||
run!("git push")?;
|
||||
}
|
||||
codegen::generate_assists_docs(Mode::Overwrite)?;
|
||||
codegen::generate_feature_docs(Mode::Overwrite)?;
|
||||
|
||||
let website_root = project_root().join("../rust-analyzer.github.io");
|
||||
let changelog_dir = website_root.join("./thisweek/_posts");
|
||||
|
||||
let today = date_iso()?;
|
||||
let commit = run!("git rev-parse HEAD")?;
|
||||
let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
|
||||
|
||||
let contents = format!(
|
||||
"\
|
||||
= Changelog #{}
|
||||
:sectanchors:
|
||||
:page-layout: post
|
||||
|
||||
Commit: commit:{}[] +
|
||||
Release: release:{}[]
|
||||
|
||||
== New Features
|
||||
|
||||
* pr:[] .
|
||||
|
||||
== Fixes
|
||||
|
||||
== Internal Improvements
|
||||
",
|
||||
changelog_n, commit, today
|
||||
);
|
||||
|
||||
let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
|
||||
fs2::write(&path, &contents)?;
|
||||
|
||||
for &adoc in ["manual.adoc", "generated_features.adoc", "generated_assists.adoc"].iter() {
|
||||
let src = project_root().join("./docs/user/").join(adoc);
|
||||
let dst = website_root.join(adoc);
|
||||
fs2::copy(src, dst)?;
|
||||
}
|
||||
|
||||
let tags = run!("git tag --list"; echo = false)?;
|
||||
let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
|
||||
|
||||
println!("\n git log {}..HEAD --merges --reverse", prev_tag);
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in a new issue