Skip to content

Commit

Permalink
Add a check for and add a new change entry in change_tracker.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
default committed Jul 24, 2024
1 parent 61544b8 commit dc50770
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,18 +1107,18 @@ def bootstrap(args):
"git clone nor distributed tarball.\nThis build may fail due to missing submodules "
"unless you put them in place manually.")

# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./bootstrap.toml`
# then `bootstrap.toml`, then `config.toml` in the root directory.
# Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./bootstrap.toml` or `./config.toml`,

Check failure on line 1110 in src/bootstrap/bootstrap.py

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

line longer than 100 chars
# then `bootstrap.toml` or `config.toml` in the root directory.
toml_path = args.config or os.getenv('RUST_BOOTSTRAP_CONFIG')
using_default_path = toml_path is None
if using_default_path:
toml_path = 'bootstrap.toml'
if not os.path.exists(toml_path):
bootstrap_toml_path = os.path.join(rust_root, 'bootstrap.toml')
if not os.path.exists(bootstrap_toml_path):
toml_path = os.path.join(rust_root, 'config.toml')
else:
toml_path = bootstrap_toml_path
toml_path = 'config.toml'
if not os.path.exists(toml_path):
toml_path = os.path.join(rust_root, 'bootstrap.toml')
if not os.path.exists(toml_path):
toml_path = os.path.join(rust_root, 'config.toml')

# Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
# but not if `bootstrap.toml` hasn't been created.
Expand Down
14 changes: 8 additions & 6 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,19 +1305,21 @@ impl Config {

config.stage0_metadata = build_helper::stage0_parser::parse_stage0_file();

// Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./bootstrap.toml`, then `bootstrap.toml`, then `config.toml` in the root directory.
// Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./bootstrap.toml` or `./config.toml`,
// then `bootstrap.toml` or `config.toml` in the root directory.
let toml_path = flags
.config
.clone()
.or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from));
let using_default_path = toml_path.is_none();
let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml"));
if using_default_path && !toml_path.exists() {
let bootstrap_toml_path = config.src.join(toml_path);
if !bootstrap_toml_path.exists() {
toml_path = config.src.join(PathBuf::from("config.toml"));
} else {
toml_path = bootstrap_toml_path;
toml_path = PathBuf::from("config.toml");
if using_default_path && !toml_path.exists() {
toml_path = config.src.join(PathBuf::from("bootstrap.toml"));
if !toml_path.exists() {
toml_path = config.src.join(PathBuf::from("config.toml"));
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/utils/change_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
ChangeInfo {
change_id: 117435,
severity: ChangeSeverity::Info,
summary: "New option `rust.parallel-compiler` added to bootstrap.toml.",
summary: "New option `rust.parallel-compiler` added to config.toml.",
},
ChangeInfo {
change_id: 116881,
Expand Down Expand Up @@ -133,7 +133,7 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
ChangeInfo {
change_id: 120348,
severity: ChangeSeverity::Info,
summary: "New option `target.<triple>.codegen-backends` added to bootstrap.toml.",
summary: "New option `target.<triple>.codegen-backends` added to config.toml.",
},
ChangeInfo {
change_id: 121203,
Expand Down Expand Up @@ -173,7 +173,7 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
ChangeInfo {
change_id: 123711,
severity: ChangeSeverity::Warning,
summary: "The deprecated field `changelog-seen` has been removed. Using that field in `bootstrap.toml` from now on will result in breakage.",
summary: "The deprecated field `changelog-seen` has been removed. Using that field in `config.toml` from now on will result in breakage.",
},
ChangeInfo {
change_id: 124501,
Expand Down

0 comments on commit dc50770

Please sign in to comment.