read repository information configs at an earlier stage

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-11-08 16:23:07 +03:00
parent e1fb288562
commit 76b6090df5

View File

@ -1663,10 +1663,26 @@ impl Config {
let mut debuginfo_level_tools = None; let mut debuginfo_level_tools = None;
let mut debuginfo_level_tests = None; let mut debuginfo_level_tests = None;
let mut optimize = None; let mut optimize = None;
let mut omit_git_hash = None;
let mut lld_enabled = None; let mut lld_enabled = None;
let mut std_features = None; let mut std_features = None;
let default = config.channel == "dev";
config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default);
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
config.cargo_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/cargo"));
config.rust_analyzer_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/rust-analyzer"));
config.clippy_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/clippy"));
config.miri_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/miri"));
config.rustfmt_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/rustfmt"));
config.enzyme_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/enzyme"));
config.in_tree_llvm_info = GitInfo::new(false, &config.src.join("src/llvm-project"));
config.in_tree_gcc_info = GitInfo::new(false, &config.src.join("src/gcc"));
let mut is_user_configured_rust_channel = false; let mut is_user_configured_rust_channel = false;
if let Some(rust) = toml.rust { if let Some(rust) = toml.rust {
@ -1697,7 +1713,7 @@ impl Config {
verbose_tests, verbose_tests,
optimize_tests, optimize_tests,
codegen_tests, codegen_tests,
omit_git_hash: omit_git_hash_toml, omit_git_hash: _, // already handled above
dist_src, dist_src,
save_toolstates, save_toolstates,
codegen_backends, codegen_backends,
@ -1748,7 +1764,6 @@ impl Config {
std_features = std_features_toml; std_features = std_features_toml;
optimize = optimize_toml; optimize = optimize_toml;
omit_git_hash = omit_git_hash_toml;
config.rust_new_symbol_mangling = new_symbol_mangling; config.rust_new_symbol_mangling = new_symbol_mangling;
set(&mut config.rust_optimize_tests, optimize_tests); set(&mut config.rust_optimize_tests, optimize_tests);
set(&mut config.codegen_tests, codegen_tests); set(&mut config.codegen_tests, codegen_tests);
@ -1824,24 +1839,6 @@ impl Config {
config.reproducible_artifacts = flags.reproducible_artifact; config.reproducible_artifacts = flags.reproducible_artifact;
// rust_info must be set before is_ci_llvm_available() is called.
let default = config.channel == "dev";
config.omit_git_hash = omit_git_hash.unwrap_or(default);
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
config.cargo_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/cargo"));
config.rust_analyzer_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/rust-analyzer"));
config.clippy_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/clippy"));
config.miri_info = GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/miri"));
config.rustfmt_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/rustfmt"));
config.enzyme_info =
GitInfo::new(config.omit_git_hash, &config.src.join("src/tools/enzyme"));
config.in_tree_llvm_info = GitInfo::new(false, &config.src.join("src/llvm-project"));
config.in_tree_gcc_info = GitInfo::new(false, &config.src.join("src/gcc"));
// We need to override `rust.channel` if it's manually specified when using the CI rustc. // We need to override `rust.channel` if it's manually specified when using the CI rustc.
// This is because if the compiler uses a different channel than the one specified in config.toml, // This is because if the compiler uses a different channel than the one specified in config.toml,
// tests may fail due to using a different channel than the one used by the compiler during tests. // tests may fail due to using a different channel than the one used by the compiler during tests.