use if-unchanged only when ci rustc is available
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
b21949b962
commit
eb5e6239aa
@ -22,6 +22,7 @@
|
|||||||
use crate::core::build_steps::llvm;
|
use crate::core::build_steps::llvm;
|
||||||
pub use crate::core::config::flags::Subcommand;
|
pub use crate::core::config::flags::Subcommand;
|
||||||
use crate::core::config::flags::{Color, Flags, Warnings};
|
use crate::core::config::flags::{Color, Flags, Warnings};
|
||||||
|
use crate::core::download::is_download_ci_available;
|
||||||
use crate::utils::cache::{INTERNER, Interned};
|
use crate::utils::cache::{INTERNER, Interned};
|
||||||
use crate::utils::channel::{self, GitInfo};
|
use crate::utils::channel::{self, GitInfo};
|
||||||
use crate::utils::helpers::{self, exe, output, t};
|
use crate::utils::helpers::{self, exe, output, t};
|
||||||
@ -1627,9 +1628,11 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
config.mandir = mandir.map(PathBuf::from);
|
config.mandir = mandir.map(PathBuf::from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.llvm_assertions =
|
||||||
|
toml.llvm.as_ref().map_or(false, |llvm| llvm.assertions.unwrap_or(false));
|
||||||
|
|
||||||
// Store off these values as options because if they're not provided
|
// Store off these values as options because if they're not provided
|
||||||
// we'll infer default values for them later
|
// we'll infer default values for them later
|
||||||
let mut llvm_assertions = None;
|
|
||||||
let mut llvm_tests = None;
|
let mut llvm_tests = None;
|
||||||
let mut llvm_enzyme = None;
|
let mut llvm_enzyme = None;
|
||||||
let mut llvm_plugins = None;
|
let mut llvm_plugins = None;
|
||||||
@ -1712,7 +1715,8 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
is_user_configured_rust_channel = channel.is_some();
|
is_user_configured_rust_channel = channel.is_some();
|
||||||
set(&mut config.channel, channel.clone());
|
set(&mut config.channel, channel.clone());
|
||||||
|
|
||||||
config.download_rustc_commit = config.download_ci_rustc_commit(download_rustc);
|
config.download_rustc_commit =
|
||||||
|
config.download_ci_rustc_commit(download_rustc, config.llvm_assertions);
|
||||||
|
|
||||||
debug = debug_toml;
|
debug = debug_toml;
|
||||||
debug_assertions = debug_assertions_toml;
|
debug_assertions = debug_assertions_toml;
|
||||||
@ -1848,7 +1852,7 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
optimize: optimize_toml,
|
optimize: optimize_toml,
|
||||||
thin_lto,
|
thin_lto,
|
||||||
release_debuginfo,
|
release_debuginfo,
|
||||||
assertions,
|
assertions: _,
|
||||||
tests,
|
tests,
|
||||||
enzyme,
|
enzyme,
|
||||||
plugins,
|
plugins,
|
||||||
@ -1882,7 +1886,6 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
Some(StringOrBool::Bool(false)) | None => {}
|
Some(StringOrBool::Bool(false)) | None => {}
|
||||||
}
|
}
|
||||||
set(&mut config.ninja_in_file, ninja);
|
set(&mut config.ninja_in_file, ninja);
|
||||||
llvm_assertions = assertions;
|
|
||||||
llvm_tests = tests;
|
llvm_tests = tests;
|
||||||
llvm_enzyme = enzyme;
|
llvm_enzyme = enzyme;
|
||||||
llvm_plugins = plugins;
|
llvm_plugins = plugins;
|
||||||
@ -1911,8 +1914,8 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
config.llvm_enable_warnings = enable_warnings.unwrap_or(false);
|
config.llvm_enable_warnings = enable_warnings.unwrap_or(false);
|
||||||
config.llvm_build_config = build_config.clone().unwrap_or(Default::default());
|
config.llvm_build_config = build_config.clone().unwrap_or(Default::default());
|
||||||
|
|
||||||
let asserts = llvm_assertions.unwrap_or(false);
|
config.llvm_from_ci =
|
||||||
config.llvm_from_ci = config.parse_download_ci_llvm(download_ci_llvm, asserts);
|
config.parse_download_ci_llvm(download_ci_llvm, config.llvm_assertions);
|
||||||
|
|
||||||
if config.llvm_from_ci {
|
if config.llvm_from_ci {
|
||||||
let warn = |option: &str| {
|
let warn = |option: &str| {
|
||||||
@ -2080,7 +2083,6 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
// Now that we've reached the end of our configuration, infer the
|
// Now that we've reached the end of our configuration, infer the
|
||||||
// default values for all options that we haven't otherwise stored yet.
|
// default values for all options that we haven't otherwise stored yet.
|
||||||
|
|
||||||
config.llvm_assertions = llvm_assertions.unwrap_or(false);
|
|
||||||
config.llvm_tests = llvm_tests.unwrap_or(false);
|
config.llvm_tests = llvm_tests.unwrap_or(false);
|
||||||
config.llvm_enzyme = llvm_enzyme.unwrap_or(false);
|
config.llvm_enzyme = llvm_enzyme.unwrap_or(false);
|
||||||
config.llvm_plugins = llvm_plugins.unwrap_or(false);
|
config.llvm_plugins = llvm_plugins.unwrap_or(false);
|
||||||
@ -2711,12 +2713,18 @@ pub fn check_stage0_version(&self, program_path: &Path, component_name: &'static
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the commit to download, or `None` if we shouldn't download CI artifacts.
|
/// Returns the commit to download, or `None` if we shouldn't download CI artifacts.
|
||||||
fn download_ci_rustc_commit(&self, download_rustc: Option<StringOrBool>) -> Option<String> {
|
fn download_ci_rustc_commit(
|
||||||
|
&self,
|
||||||
|
download_rustc: Option<StringOrBool>,
|
||||||
|
llvm_assertions: bool,
|
||||||
|
) -> Option<String> {
|
||||||
// If `download-rustc` is not set, default to rebuilding.
|
// If `download-rustc` is not set, default to rebuilding.
|
||||||
let if_unchanged = match download_rustc {
|
let if_unchanged = match download_rustc {
|
||||||
None | Some(StringOrBool::Bool(false)) => return None,
|
None | Some(StringOrBool::Bool(false)) => return None,
|
||||||
Some(StringOrBool::Bool(true)) => false,
|
Some(StringOrBool::Bool(true)) => false,
|
||||||
Some(StringOrBool::String(s)) if s == "if-unchanged" => true,
|
Some(StringOrBool::String(s)) if s == "if-unchanged" => {
|
||||||
|
is_download_ci_available(&self.build.triple, llvm_assertions)
|
||||||
|
}
|
||||||
Some(StringOrBool::String(other)) => {
|
Some(StringOrBool::String(other)) => {
|
||||||
panic!("unrecognized option for download-rustc: {other}")
|
panic!("unrecognized option for download-rustc: {other}")
|
||||||
}
|
}
|
||||||
|
@ -832,3 +832,43 @@ fn path_is_dylib(path: &Path) -> bool {
|
|||||||
// The .so is not necessarily the extension, it might be libLLVM.so.18.1
|
// The .so is not necessarily the extension, it might be libLLVM.so.18.1
|
||||||
path.to_str().map_or(false, |path| path.contains(".so"))
|
path.to_str().map_or(false, |path| path.contains(".so"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks whether the CI rustc is available for the given target triple.
|
||||||
|
pub(crate) fn is_download_ci_available(target_triple: &str, llvm_assertions: bool) -> bool {
|
||||||
|
// All tier 1 targets and tier 2 targets with host tools.
|
||||||
|
const SUPPORTED_PLATFORMS: &[&str] = &[
|
||||||
|
"aarch64-apple-darwin",
|
||||||
|
"aarch64-pc-windows-msvc",
|
||||||
|
"aarch64-unknown-linux-gnu",
|
||||||
|
"aarch64-unknown-linux-musl",
|
||||||
|
"arm-unknown-linux-gnueabi",
|
||||||
|
"arm-unknown-linux-gnueabihf",
|
||||||
|
"armv7-unknown-linux-gnueabihf",
|
||||||
|
"i686-pc-windows-gnu",
|
||||||
|
"i686-pc-windows-msvc",
|
||||||
|
"i686-unknown-linux-gnu",
|
||||||
|
"loongarch64-unknown-linux-gnu",
|
||||||
|
"powerpc-unknown-linux-gnu",
|
||||||
|
"powerpc64-unknown-linux-gnu",
|
||||||
|
"powerpc64le-unknown-linux-gnu",
|
||||||
|
"riscv64gc-unknown-linux-gnu",
|
||||||
|
"s390x-unknown-linux-gnu",
|
||||||
|
"x86_64-apple-darwin",
|
||||||
|
"x86_64-pc-windows-gnu",
|
||||||
|
"x86_64-pc-windows-msvc",
|
||||||
|
"x86_64-unknown-freebsd",
|
||||||
|
"x86_64-unknown-illumos",
|
||||||
|
"x86_64-unknown-linux-gnu",
|
||||||
|
"x86_64-unknown-linux-musl",
|
||||||
|
"x86_64-unknown-netbsd",
|
||||||
|
];
|
||||||
|
|
||||||
|
const SUPPORTED_PLATFORMS_WITH_ASSERTIONS: &[&str] =
|
||||||
|
&["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"];
|
||||||
|
|
||||||
|
if llvm_assertions {
|
||||||
|
SUPPORTED_PLATFORMS_WITH_ASSERTIONS.contains(&target_triple)
|
||||||
|
} else {
|
||||||
|
SUPPORTED_PLATFORMS.contains(&target_triple)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user