Skip to content

Commit 3f9bf57

Browse files
committed
move dist to parse_inner
1 parent f95edbe commit 3f9bf57

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use crate::core::config::target_selection::TargetSelectionList;
3737
use crate::core::config::toml::TomlConfig;
3838
use crate::core::config::toml::build::{Build, Tool};
3939
use crate::core::config::toml::change_id::ChangeId;
40+
use crate::core::config::toml::dist::Dist;
4041
use crate::core::config::toml::rust::{
4142
LldMode, RustOptimize, check_incompatible_options_for_ci_rustc,
4243
};
@@ -1013,7 +1014,28 @@ impl Config {
10131014
Some(ci_llvm_bin.join(exe("FileCheck", config.host_target)));
10141015
}
10151016

1016-
config.apply_dist_config(toml.dist);
1017+
if let Some(dist) = toml.dist {
1018+
let Dist {
1019+
sign_folder,
1020+
upload_addr,
1021+
src_tarball,
1022+
compression_formats,
1023+
compression_profile,
1024+
include_mingw_linker,
1025+
vendor,
1026+
} = dist;
1027+
config.dist_sign_folder = sign_folder.map(PathBuf::from);
1028+
config.dist_upload_addr = upload_addr;
1029+
config.dist_compression_formats = compression_formats;
1030+
set(&mut config.dist_compression_profile, compression_profile);
1031+
set(&mut config.rust_dist_src, src_tarball);
1032+
set(&mut config.dist_include_mingw_linker, include_mingw_linker);
1033+
config.dist_vendor = vendor.unwrap_or_else(|| {
1034+
// If we're building from git or tarball sources, enable it by default.
1035+
config.rust_info.is_managed_git_subrepository()
1036+
|| config.rust_info.is_from_tarball()
1037+
});
1038+
}
10171039

10181040
config.initial_rustfmt = if let Some(r) = rustfmt {
10191041
Some(r)

src/bootstrap/src/core/config/toml/dist.rs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
88
use serde::{Deserialize, Deserializer};
99

10+
use crate::core::config::Merge;
1011
use crate::core::config::toml::ReplaceOpt;
11-
use crate::core::config::{Merge, set};
12-
use crate::{Config, HashSet, PathBuf, define_config, exit};
12+
use crate::{HashSet, PathBuf, define_config, exit};
1313

1414
define_config! {
1515
struct Dist {
@@ -22,31 +22,3 @@ define_config! {
2222
vendor: Option<bool> = "vendor",
2323
}
2424
}
25-
26-
impl Config {
27-
/// Applies distribution-related configuration from the `Dist` struct
28-
/// to the global `Config` structure.
29-
pub fn apply_dist_config(&mut self, toml_dist: Option<Dist>) {
30-
if let Some(dist) = toml_dist {
31-
let Dist {
32-
sign_folder,
33-
upload_addr,
34-
src_tarball,
35-
compression_formats,
36-
compression_profile,
37-
include_mingw_linker,
38-
vendor,
39-
} = dist;
40-
self.dist_sign_folder = sign_folder.map(PathBuf::from);
41-
self.dist_upload_addr = upload_addr;
42-
self.dist_compression_formats = compression_formats;
43-
set(&mut self.dist_compression_profile, compression_profile);
44-
set(&mut self.rust_dist_src, src_tarball);
45-
set(&mut self.dist_include_mingw_linker, include_mingw_linker);
46-
self.dist_vendor = vendor.unwrap_or_else(|| {
47-
// If we're building from git or tarball sources, enable it by default.
48-
self.rust_info.is_managed_git_subrepository() || self.rust_info.is_from_tarball()
49-
});
50-
}
51-
}
52-
}

0 commit comments

Comments
 (0)