Skip to content

bootstrap: Describe build_steps modules #124242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 28, 2024
Prev Previous commit
Next Next commit
bootstrap: Demagic a repeating path
  • Loading branch information
workingjubilee committed Apr 21, 2024
commit ce27ea935edd4cc04455e6abfdc8ba8ed86be451
6 changes: 4 additions & 2 deletions src/bootstrap/src/core/build_steps/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub enum Profile {
None,
}

static PROFILE_DIR: &str = "src/bootstrap/defaults";

/// A list of historical hashes of `src/etc/rust_analyzer_settings.json`.
/// New entries should be appended whenever this is updated so we can detect
/// outdated vs. user-modified settings files.
Expand All @@ -47,7 +49,7 @@ static RUST_ANALYZER_SETTINGS: &str = include_str!("../../../../etc/rust_analyze

impl Profile {
fn include_path(&self, src_path: &Path) -> PathBuf {
PathBuf::from(format!("{}/src/bootstrap/defaults/config.{}.toml", src_path.display(), self))
PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self))
}

pub fn all() -> impl Iterator<Item = Self> {
Expand Down Expand Up @@ -227,7 +229,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {

let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id;
let settings = format!(
"# Includes one of the default files in src/bootstrap/defaults\n\
"# Includes one of the default files in {PROFILE_DIR}\n\
profile = \"{profile}\"\n\
change-id = {latest_change_id}\n"
);
Expand Down