bootstrap/core/config/toml/
gcc.rs

1//! This module defines the `Gcc` struct, which represents the `[gcc]` table
2//! in the `bootstrap.toml` configuration file.
3//!
4//! The `[gcc]` table contains options specifically related to building or
5//! acquiring the GCC compiler for use within the Rust build process.
6
7use serde::{Deserialize, Deserializer};
8
9use crate::core::config::toml::ReplaceOpt;
10use crate::core::config::{GccCiMode, Merge};
11use crate::{Config, HashSet, PathBuf, define_config, exit};
12
13define_config! {
14    /// TOML representation of how the GCC build is configured.
15    struct Gcc {
16        download_ci_gcc: Option<bool> = "download-ci-gcc",
17    }
18}
19
20impl Config {
21    /// Applies GCC-related configuration from the `TomlGcc` struct to the
22    /// global `Config` structure.
23    pub fn apply_gcc_config(&mut self, toml_gcc: Option<Gcc>) {
24        if let Some(gcc) = toml_gcc {
25            self.gcc_ci_mode = match gcc.download_ci_gcc {
26                Some(value) => match value {
27                    true => GccCiMode::DownloadFromCi,
28                    false => GccCiMode::BuildLocally,
29                },
30                None => GccCiMode::default(),
31            };
32        }
33    }
34}