diff options
| author | bors <bors@rust-lang.org> | 2020-09-22 10:36:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-09-22 10:36:41 +0000 |
| commit | cbc5e4d4d5715cfe111def11bbd1d8afae2ea80e (patch) | |
| tree | 2853a6055e1b540f862a85fb0e11a58a4445d447 /src/bootstrap/bin | |
| parent | c113030f6b7d10cd27ac7091718e6f48ecf56a63 (diff) | |
| parent | fe6fc555acd51bd7ba8755d9fbc7060feb67be25 (diff) | |
Auto merge of #76626 - jyn514:x.py-changelog, r=Mark-Simulacrum
Add a changelog for x.py and nag contributors until they read it Add a changelog for x.py - Add a changelog and instructions for updating it - Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read. There's no way to tie reading the changelog to updating the version, so unfortunately they still have to update `config.toml` manually. Actually reading the changelog is optional, anyone can set `changelog-seen = N` without reading (although it's not recommended). - Nag people if they haven't read the x.py changelog + Print message twice to make sure it's seen - Give different error messages depending on whether the version needs to be updated or added Closes https://github.com/rust-lang/rust/issues/76617 r? `@Mark-Simulacrum`
Diffstat (limited to 'src/bootstrap/bin')
| -rw-r--r-- | src/bootstrap/bin/main.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs index b67486c9628..f7512aa9fce 100644 --- a/src/bootstrap/bin/main.rs +++ b/src/bootstrap/bin/main.rs @@ -12,5 +12,40 @@ use bootstrap::{Build, Config}; fn main() { let args = env::args().skip(1).collect::<Vec<_>>(); let config = Config::parse(&args); + + let changelog_suggestion = check_version(&config); + if let Some(suggestion) = &changelog_suggestion { + println!("{}", suggestion); + } + Build::new(config).build(); + + if let Some(suggestion) = changelog_suggestion { + println!("{}", suggestion); + println!("note: this message was printed twice to make it more likely to be seen"); + } +} + +fn check_version(config: &Config) -> Option<String> { + const VERSION: usize = 1; + + let mut msg = String::new(); + + let suggestion = if let Some(seen) = config.changelog_seen { + if seen != VERSION { + msg.push_str("warning: there have been changes to x.py since you last updated.\n"); + format!("update `config.toml` to use `changelog-seen = {}` instead", VERSION) + } else { + return None; + } + } else { + msg.push_str("warning: x.py has made several changes recently you may want to look at\n"); + format!("add `changelog-seen = {}` to `config.toml`", VERSION) + }; + + msg.push_str("help: consider looking at the changes in `src/bootstrap/CHANGELOG.md`\n"); + msg.push_str("note: to silence this warning, "); + msg.push_str(&suggestion); + + Some(msg) } |
