Skip to content

Commit f0406ab

Browse files
committed
moved gcc config parsing logic to toml/gcc.rs
1 parent 3529ea8 commit f0406ab

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/bootstrap/src/core/config/parsing.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,9 +898,7 @@ impl Config {
898898
};
899899
}
900900

901-
if let Some(t) = toml.target {
902-
for (triple, cfg) in t {
903-
let mut target = Target::from_triple(&triple);
901+
config.apply_gcc_config(toml.gcc);
904902

905903
if let Some(ref s) = cfg.llvm_config {
906904
if config.download_rustc_commit.is_some() && triple == *config.build.triple {
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
use serde::{Deserialize, Deserializer};
22

3+
use crate::core::config::GccCiMode;
34
use crate::core::config::toml::{Merge, ReplaceOpt};
4-
use crate::{HashSet, PathBuf, define_config, exit};
5+
use crate::{Config, HashSet, PathBuf, define_config, exit};
56

67
define_config! {
78
/// TOML representation of how the GCC build is configured.
89
struct Gcc {
910
download_ci_gcc: Option<bool> = "download-ci-gcc",
1011
}
1112
}
13+
14+
impl Config {
15+
pub fn apply_gcc_config(&mut self, toml_gcc: Option<Gcc>) {
16+
if let Some(gcc) = toml_gcc {
17+
self.gcc_ci_mode = match gcc.download_ci_gcc {
18+
Some(value) => match value {
19+
true => GccCiMode::DownloadFromCi,
20+
false => GccCiMode::BuildLocally,
21+
},
22+
None => GccCiMode::default(),
23+
};
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)