mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Refactor
This commit is contained in:
parent
97ea2dfc4b
commit
cbc5eb8738
2 changed files with 62 additions and 54 deletions
|
@ -17,7 +17,7 @@ use xtask::{
|
||||||
install::{ClientOpt, InstallCmd, ServerOpt},
|
install::{ClientOpt, InstallCmd, ServerOpt},
|
||||||
not_bash::pushd,
|
not_bash::pushd,
|
||||||
pre_commit, project_root,
|
pre_commit, project_root,
|
||||||
release::run_release,
|
release::ReleaseCmd,
|
||||||
run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result,
|
run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ FLAGS:
|
||||||
"release" => {
|
"release" => {
|
||||||
let dry_run = args.contains("--dry-run");
|
let dry_run = args.contains("--dry-run");
|
||||||
args.finish()?;
|
args.finish()?;
|
||||||
run_release(dry_run)
|
ReleaseCmd { dry_run }.run()
|
||||||
}
|
}
|
||||||
"dist" => {
|
"dist" => {
|
||||||
let nightly = args.contains("--nightly");
|
let nightly = args.contains("--nightly");
|
||||||
|
|
|
@ -4,56 +4,64 @@ use crate::{
|
||||||
project_root, Mode, Result,
|
project_root, Mode, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn run_release(dry_run: bool) -> Result<()> {
|
pub struct ReleaseCmd {
|
||||||
if !dry_run {
|
pub dry_run: bool,
|
||||||
run!("git switch release")?;
|
}
|
||||||
run!("git fetch upstream --tags --force")?;
|
|
||||||
run!("git reset --hard tags/nightly")?;
|
impl ReleaseCmd {
|
||||||
run!("git push")?;
|
pub fn run(self) -> Result<()> {
|
||||||
}
|
if !self.dry_run {
|
||||||
codegen::generate_assists_docs(Mode::Overwrite)?;
|
run!("git switch release")?;
|
||||||
codegen::generate_feature_docs(Mode::Overwrite)?;
|
run!("git fetch upstream --tags --force")?;
|
||||||
|
run!("git reset --hard tags/nightly")?;
|
||||||
let website_root = project_root().join("../rust-analyzer.github.io");
|
run!("git push")?;
|
||||||
let changelog_dir = website_root.join("./thisweek/_posts");
|
}
|
||||||
|
codegen::generate_assists_docs(Mode::Overwrite)?;
|
||||||
let today = date_iso()?;
|
codegen::generate_feature_docs(Mode::Overwrite)?;
|
||||||
let commit = run!("git rev-parse HEAD")?;
|
|
||||||
let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
|
let website_root = project_root().join("../rust-analyzer.github.io");
|
||||||
|
let changelog_dir = website_root.join("./thisweek/_posts");
|
||||||
let contents = format!(
|
|
||||||
"\
|
let today = date_iso()?;
|
||||||
= Changelog #{}
|
let commit = run!("git rev-parse HEAD")?;
|
||||||
:sectanchors:
|
let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
|
||||||
:page-layout: post
|
|
||||||
|
let contents = format!(
|
||||||
Commit: commit:{}[] +
|
"\
|
||||||
Release: release:{}[]
|
= Changelog #{}
|
||||||
|
:sectanchors:
|
||||||
== New Features
|
:page-layout: post
|
||||||
|
|
||||||
* pr:[] .
|
Commit: commit:{}[] +
|
||||||
|
Release: release:{}[]
|
||||||
== Fixes
|
|
||||||
|
== New Features
|
||||||
== Internal Improvements
|
|
||||||
",
|
* pr:[] .
|
||||||
changelog_n, commit, today
|
|
||||||
);
|
== Fixes
|
||||||
|
|
||||||
let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
|
== Internal Improvements
|
||||||
fs2::write(&path, &contents)?;
|
",
|
||||||
|
changelog_n, commit, today
|
||||||
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);
|
let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
|
||||||
fs2::copy(src, dst)?;
|
fs2::write(&path, &contents)?;
|
||||||
}
|
|
||||||
|
for &adoc in ["manual.adoc", "generated_features.adoc", "generated_assists.adoc"].iter() {
|
||||||
let tags = run!("git tag --list"; echo = false)?;
|
let src = project_root().join("./docs/user/").join(adoc);
|
||||||
let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
|
let dst = website_root.join(adoc);
|
||||||
|
fs2::copy(src, dst)?;
|
||||||
println!("\n git log {}..HEAD --merges --reverse", prev_tag);
|
}
|
||||||
|
|
||||||
Ok(())
|
let tags = run!("git tag --list"; echo = false)?;
|
||||||
|
let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
|
||||||
|
|
||||||
|
let git_log = run!("git log {}..HEAD --merges --reverse", prev_tag; echo = false)?;
|
||||||
|
let git_log_dst = website_root.join("git.log");
|
||||||
|
fs2::write(git_log_dst, &git_log)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue