diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-09-11 22:55:16 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-09-21 09:08:18 -0400 |
| commit | fe6fc555acd51bd7ba8755d9fbc7060feb67be25 (patch) | |
| tree | a2a1ff084475103530f9199c9460157ed76ee423 /src/bootstrap/bin | |
| parent | 956e06c6c85e918524b67503c4d65c7baf539585 (diff) | |
| download | rust-fe6fc555acd51bd7ba8755d9fbc7060feb67be25.tar.gz rust-fe6fc555acd51bd7ba8755d9fbc7060feb67be25.zip | |
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 - 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
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) } |
