Skip to content

Commit bbe7c08

Browse files
committed
add gcc and dist default implementation
1 parent 222dfcc commit bbe7c08

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

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

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use crate::core::config::toml::TomlConfig;
3838
use crate::core::config::toml::build::{Build, Tool};
3939
use crate::core::config::toml::change_id::ChangeId;
4040
use crate::core::config::toml::dist::Dist;
41+
use crate::core::config::toml::gcc::Gcc;
4142
use crate::core::config::toml::install::Install;
4243
use crate::core::config::toml::llvm::Llvm;
4344
use crate::core::config::toml::rust::{
@@ -774,7 +775,6 @@ impl Config {
774775
let install_libdir = install_libdir.map(PathBuf::from);
775776
let install_mandir = install_mandir.map(PathBuf::from);
776777
let install_datadir = install_datadir.map(PathBuf::from);
777-
778778
config.prefix = install_prefix;
779779
config.sysconfdir = install_sysconfdir;
780780
config.datadir = install_datadir;
@@ -1278,15 +1278,15 @@ impl Config {
12781278
config.llvm_offload = llvm_offload.unwrap_or(false);
12791279
config.llvm_plugins = llvm_plugins.unwrap_or(false);
12801280

1281-
if let Some(gcc) = toml.gcc {
1282-
config.gcc_ci_mode = match gcc.download_ci_gcc {
1283-
Some(value) => match value {
1284-
true => GccCiMode::DownloadFromCi,
1285-
false => GccCiMode::BuildLocally,
1286-
},
1287-
None => GccCiMode::default(),
1288-
};
1289-
}
1281+
let Gcc { download_ci_gcc: gcc_download_ci_gcc } = toml.gcc.unwrap_or_default();
1282+
1283+
config.gcc_ci_mode = match gcc_download_ci_gcc {
1284+
Some(value) => match value {
1285+
true => GccCiMode::DownloadFromCi,
1286+
false => GccCiMode::BuildLocally,
1287+
},
1288+
None => GccCiMode::default(),
1289+
};
12901290

12911291
match ccache {
12921292
Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()),
@@ -1312,28 +1312,26 @@ impl Config {
13121312
Some(ci_llvm_bin.join(exe("FileCheck", config.host_target)));
13131313
}
13141314

1315-
if let Some(dist) = toml.dist {
1316-
let Dist {
1317-
sign_folder,
1318-
upload_addr,
1319-
src_tarball,
1320-
compression_formats,
1321-
compression_profile,
1322-
include_mingw_linker,
1323-
vendor,
1324-
} = dist;
1325-
config.dist_sign_folder = sign_folder.map(PathBuf::from);
1326-
config.dist_upload_addr = upload_addr;
1327-
config.dist_compression_formats = compression_formats;
1328-
set(&mut config.dist_compression_profile, compression_profile);
1329-
set(&mut config.rust_dist_src, src_tarball);
1330-
set(&mut config.dist_include_mingw_linker, include_mingw_linker);
1331-
config.dist_vendor = vendor.unwrap_or_else(|| {
1332-
// If we're building from git or tarball sources, enable it by default.
1333-
config.rust_info.is_managed_git_subrepository()
1334-
|| config.rust_info.is_from_tarball()
1335-
});
1336-
}
1315+
let Dist {
1316+
sign_folder: dist_sign_folder,
1317+
upload_addr: dist_upload_addr,
1318+
src_tarball: dist_src_tarball,
1319+
compression_formats: dist_compression_formats,
1320+
compression_profile: dist_compression_profile,
1321+
include_mingw_linker: dist_include_mingw_linker,
1322+
vendor: dist_vendor,
1323+
} = toml.dist.unwrap_or_default();
1324+
1325+
config.dist_sign_folder = dist_sign_folder.map(PathBuf::from);
1326+
config.dist_upload_addr = dist_upload_addr;
1327+
config.dist_compression_formats = dist_compression_formats;
1328+
set(&mut config.dist_compression_profile, dist_compression_profile);
1329+
set(&mut config.rust_dist_src, dist_src_tarball);
1330+
set(&mut config.dist_include_mingw_linker, dist_include_mingw_linker);
1331+
config.dist_vendor = dist_vendor.unwrap_or_else(|| {
1332+
// If we're building from git or tarball sources, enable it by default.
1333+
config.rust_info.is_managed_git_subrepository() || config.rust_info.is_from_tarball()
1334+
});
13371335

13381336
config.initial_rustfmt = if let Some(r) = rustfmt {
13391337
Some(r)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::core::config::toml::ReplaceOpt;
1212
use crate::{HashSet, PathBuf, define_config, exit};
1313

1414
define_config! {
15+
#[derive(Default)]
1516
struct Dist {
1617
sign_folder: Option<String> = "sign-folder",
1718
upload_addr: Option<String> = "upload-addr",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::{HashSet, PathBuf, define_config, exit};
1212

1313
define_config! {
1414
/// TOML representation of how the GCC build is configured.
15+
#[derive(Default)]
1516
struct Gcc {
1617
download_ci_gcc: Option<bool> = "download-ci-gcc",
1718
}

0 commit comments

Comments
 (0)