Skip to content

Commit 8dcb7d8

Browse files
authored
Unrolled build for rust-lang#118220
Rollup merge of rust-lang#118220 - onur-ozkan:followups, r=Mark-Simulacrum general improvements/fixes on bootstrap - adds rust-lang#117813 into change tracker rust-lang@6d9b92f - fixes a bug in change tracker rust-lang@63a4410 - relocates `CONFIG_CHANGE_HISTORY` rust-lang@a7dcb98
2 parents fad6bb8 + 576a17e commit 8dcb7d8

File tree

8 files changed

+115
-92
lines changed

8 files changed

+115
-92
lines changed

config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#
3131
# If `change-id` does not match the version that is currently running,
3232
# `x.py` will prompt you to update it and check the related PR for more details.
33-
change-id = 116881
33+
change-id = 117813
3434

3535
# =============================================================================
3636
# Tweaking how LLVM is compiled

src/bootstrap/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Some general areas that you may be interested in modifying are:
183183

184184
If you make a major change on bootstrap configuration, please remember to:
185185

186-
+ Update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/lib.rs`.
186+
+ Update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/utils/change_tracker.rs`.
187187
* Update `change-id = {pull-request-id}` in `config.example.toml`.
188188

189189
A 'major change' includes

src/bootstrap/src/bin/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn check_version(config: &Config) -> Option<String> {
120120
}
121121

122122
if let Ok(last_warned_id) = fs::read_to_string(&warned_id_path) {
123-
if id.to_string() == last_warned_id {
123+
if latest_change_id.to_string() == last_warned_id {
124124
return None;
125125
}
126126
}
@@ -144,7 +144,7 @@ fn check_version(config: &Config) -> Option<String> {
144144
));
145145

146146
if io::stdout().is_terminal() {
147-
t!(fs::write(warned_id_path, id.to_string()));
147+
t!(fs::write(warned_id_path, latest_change_id.to_string()));
148148
}
149149
}
150150
} else {

src/bootstrap/src/core/build_steps/setup.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
2+
use crate::t;
3+
use crate::utils::change_tracker::CONFIG_CHANGE_HISTORY;
24
use crate::Config;
3-
use crate::{t, CONFIG_CHANGE_HISTORY};
45
use sha2::Digest;
56
use std::env::consts::EXE_SUFFIX;
67
use std::fmt::Write as _;

src/bootstrap/src/lib.rs

+4-84
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ use crate::utils::helpers::{self, dir_is_empty, exe, libdir, mtime, output, syml
4747
mod core;
4848
mod utils;
4949

50-
pub use crate::core::builder::PathSet;
51-
pub use crate::core::config::flags::Subcommand;
52-
pub use crate::core::config::Config;
50+
pub use core::builder::PathSet;
51+
pub use core::config::flags::Subcommand;
52+
pub use core::config::Config;
53+
pub use utils::change_tracker::{find_recent_config_change_ids, CONFIG_CHANGE_HISTORY};
5354

5455
const LLVM_TOOLS: &[&str] = &[
5556
"llvm-cov", // used to generate coverage report
@@ -70,62 +71,6 @@ const LLVM_TOOLS: &[&str] = &[
7071
/// LLD file names for all flavors.
7172
const LLD_FILE_NAMES: &[&str] = &["ld.lld", "ld64.lld", "lld-link", "wasm-ld"];
7273

73-
#[derive(Clone, Debug)]
74-
pub struct ChangeInfo {
75-
/// Represents the ID of PR caused major change on bootstrap.
76-
pub change_id: usize,
77-
pub severity: ChangeSeverity,
78-
/// Provides a short summary of the change that will guide developers
79-
/// on "how to handle/behave" in response to the changes.
80-
pub summary: &'static str,
81-
}
82-
83-
#[derive(Clone, Debug)]
84-
pub enum ChangeSeverity {
85-
/// Used when build configurations continue working as before.
86-
Info,
87-
/// Used when the default value of an option changes, or support for an option is removed entirely,
88-
/// potentially requiring developers to update their build configurations.
89-
Warning,
90-
}
91-
92-
impl ToString for ChangeSeverity {
93-
fn to_string(&self) -> String {
94-
match self {
95-
ChangeSeverity::Info => "INFO".to_string(),
96-
ChangeSeverity::Warning => "WARNING".to_string(),
97-
}
98-
}
99-
}
100-
101-
/// Keeps track of major changes made to the bootstrap configuration.
102-
///
103-
/// If you make any major changes (such as adding new values or changing default values),
104-
/// please ensure adding `ChangeInfo` to the end(because the list must be sorted by the merge date)
105-
/// of this list.
106-
pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
107-
ChangeInfo {
108-
change_id: 115898,
109-
severity: ChangeSeverity::Info,
110-
summary: "Implementation of this change-tracking system. Ignore this.",
111-
},
112-
ChangeInfo {
113-
change_id: 116998,
114-
severity: ChangeSeverity::Info,
115-
summary: "Removed android-ndk r15 support in favor of android-ndk r25b.",
116-
},
117-
ChangeInfo {
118-
change_id: 117435,
119-
severity: ChangeSeverity::Info,
120-
summary: "New option `rust.parallel-compiler` added to config.toml.",
121-
},
122-
ChangeInfo {
123-
change_id: 116881,
124-
severity: ChangeSeverity::Warning,
125-
summary: "Default value of `download-ci-llvm` was changed for `codegen` profile.",
126-
},
127-
];
128-
12974
/// Extra --check-cfg to add when building
13075
/// (Mode restriction, config name, config values (if any))
13176
const EXTRA_CHECK_CFGS: &[(Option<Mode>, &str, Option<&[&'static str]>)] = &[
@@ -1895,31 +1840,6 @@ fn envify(s: &str) -> String {
18951840
.collect()
18961841
}
18971842

1898-
pub fn find_recent_config_change_ids(current_id: usize) -> Vec<ChangeInfo> {
1899-
if !CONFIG_CHANGE_HISTORY.iter().any(|config| config.change_id == current_id) {
1900-
// If the current change-id is greater than the most recent one, return
1901-
// an empty list (it may be due to switching from a recent branch to an
1902-
// older one); otherwise, return the full list (assuming the user provided
1903-
// the incorrect change-id by accident).
1904-
if let Some(config) = CONFIG_CHANGE_HISTORY.iter().max_by_key(|config| config.change_id) {
1905-
if &current_id > &config.change_id {
1906-
return Vec::new();
1907-
}
1908-
}
1909-
1910-
return CONFIG_CHANGE_HISTORY.to_vec();
1911-
}
1912-
1913-
let index =
1914-
CONFIG_CHANGE_HISTORY.iter().position(|config| config.change_id == current_id).unwrap();
1915-
1916-
CONFIG_CHANGE_HISTORY
1917-
.iter()
1918-
.skip(index + 1) // Skip the current_id and IDs before it
1919-
.cloned()
1920-
.collect()
1921-
}
1922-
19231843
/// Computes a hash representing the state of a repository/submodule and additional input.
19241844
///
19251845
/// It uses `git diff` for the actual changes, and `git status` for including the untracked
+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
//! This module facilitates the tracking system for major changes made to the bootstrap,
2+
//! with the goal of keeping developers synchronized with important modifications in
3+
//! the bootstrap.
4+
5+
#[derive(Clone, Debug)]
6+
pub struct ChangeInfo {
7+
/// Represents the ID of PR caused major change on bootstrap.
8+
pub change_id: usize,
9+
pub severity: ChangeSeverity,
10+
/// Provides a short summary of the change that will guide developers
11+
/// on "how to handle/behave" in response to the changes.
12+
pub summary: &'static str,
13+
}
14+
15+
#[derive(Clone, Debug)]
16+
pub enum ChangeSeverity {
17+
/// Used when build configurations continue working as before.
18+
Info,
19+
/// Used when the default value of an option changes, or support for an option is removed entirely,
20+
/// potentially requiring developers to update their build configurations.
21+
Warning,
22+
}
23+
24+
impl ToString for ChangeSeverity {
25+
fn to_string(&self) -> String {
26+
match self {
27+
ChangeSeverity::Info => "INFO".to_string(),
28+
ChangeSeverity::Warning => "WARNING".to_string(),
29+
}
30+
}
31+
}
32+
33+
pub fn find_recent_config_change_ids(current_id: usize) -> Vec<ChangeInfo> {
34+
if !CONFIG_CHANGE_HISTORY.iter().any(|config| config.change_id == current_id) {
35+
// If the current change-id is greater than the most recent one, return
36+
// an empty list (it may be due to switching from a recent branch to an
37+
// older one); otherwise, return the full list (assuming the user provided
38+
// the incorrect change-id by accident).
39+
if let Some(config) = CONFIG_CHANGE_HISTORY.iter().max_by_key(|config| config.change_id) {
40+
if &current_id > &config.change_id {
41+
return Vec::new();
42+
}
43+
}
44+
45+
return CONFIG_CHANGE_HISTORY.to_vec();
46+
}
47+
48+
let index =
49+
CONFIG_CHANGE_HISTORY.iter().position(|config| config.change_id == current_id).unwrap();
50+
51+
CONFIG_CHANGE_HISTORY
52+
.iter()
53+
.skip(index + 1) // Skip the current_id and IDs before it
54+
.cloned()
55+
.collect()
56+
}
57+
58+
/// Keeps track of major changes made to the bootstrap configuration.
59+
///
60+
/// If you make any major changes (such as adding new values or changing default values),
61+
/// please ensure adding `ChangeInfo` to the end(because the list must be sorted by the merge date)
62+
/// of this list.
63+
pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
64+
ChangeInfo {
65+
change_id: 115898,
66+
severity: ChangeSeverity::Info,
67+
summary: "Implementation of this change-tracking system. Ignore this.",
68+
},
69+
ChangeInfo {
70+
change_id: 116998,
71+
severity: ChangeSeverity::Info,
72+
summary: "Removed android-ndk r15 support in favor of android-ndk r25b.",
73+
},
74+
ChangeInfo {
75+
change_id: 117435,
76+
severity: ChangeSeverity::Info,
77+
summary: "New option `rust.parallel-compiler` added to config.toml.",
78+
},
79+
ChangeInfo {
80+
change_id: 116881,
81+
severity: ChangeSeverity::Warning,
82+
summary: "Default value of `download-ci-llvm` was changed for `codegen` profile.",
83+
},
84+
ChangeInfo {
85+
change_id: 117813,
86+
severity: ChangeSeverity::Info,
87+
summary: "Use of the `if-available` value for `download-ci-llvm` is deprecated; prefer using the new `if-unchanged` value.",
88+
},
89+
];

src/bootstrap/src/utils/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
pub(crate) mod cache;
66
pub(crate) mod cc_detect;
7+
pub(crate) mod change_tracker;
78
pub(crate) mod channel;
89
pub(crate) mod dylib;
910
pub(crate) mod exec;

triagebot.toml

+15-3
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,23 @@ message = "The list of allowed third-party dependencies may have been modified!
583583
cc = ["@davidtwco", "@wesleywiser"]
584584

585585
[mentions."src/bootstrap/src/core/config"]
586-
message = "This PR modifies `src/bootstrap/src/core/config`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/lib.rs` and `change-id` in `config.example.toml`."
586+
message = """
587+
This PR modifies `src/bootstrap/src/core/config`.
588+
589+
If appropriate, please update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/utils/change_tracker.rs` and `change-id` in `config.example.toml`.
590+
"""
587591
[mentions."src/bootstrap/defaults"]
588-
message = "This PR modifies `src/bootstrap/defaults`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/lib.rs` and `change-id` in `config.example.toml`."
592+
message = """
593+
This PR modifies `src/bootstrap/defaults`.
594+
595+
If appropriate, please update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/utils/change_tracker.rs` and `change-id` in `config.example.toml`.
596+
"""
589597
[mentions."config.example.toml"]
590-
message = "This PR changes `config.example.toml`. If appropriate, please also update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/lib.rs` and `change-id` in `config.example.toml`."
598+
message = """
599+
This PR modifies `config.example.toml`.
600+
601+
If appropriate, please update `CONFIG_CHANGE_HISTORY` in `src/bootstrap/src/utils/change_tracker.rs` and `change-id` in `config.example.toml`.
602+
"""
591603

592604
[mentions."src/bootstrap/defaults/config.compiler.toml"]
593605
message = "This PR changes src/bootstrap/defaults/config.compiler.toml. If appropriate, please also update `config.codegen.toml` so the defaults are in sync."

0 commit comments

Comments
 (0)