allow mixing llvm.assertions and download-rustc

by using `rustc-builds-alt` if download-rustc is set

this also changes the download code to use a separate build/cache/ directory and .rustc-stamp stamp file depending on whether assertions are enabled.
This commit is contained in:
jyn 2023-07-01 12:03:16 -05:00
parent f7287b9a2c
commit baae59eea3
2 changed files with 22 additions and 22 deletions

View File

@ -39,16 +39,6 @@ macro_rules! check_ci_llvm {
};
}
macro_rules! check_ci_rustc {
($name:expr) => {
assert!(
$name.is_none(),
"setting {} is incompatible with download-ci-rustc.",
stringify!($name)
);
};
}
#[derive(Clone, Default)]
pub enum DryRun {
/// This isn't a dry run.
@ -1518,10 +1508,6 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
check_ci_llvm!(llvm.plugins);
}
if config.download_rustc_commit.is_some() {
check_ci_rustc!(llvm.assertions);
}
// NOTE: can never be hit when downloading from CI, since we call `check_ci_llvm!(thin_lto)` above.
if config.llvm_thin_lto && llvm.link_shared.is_none() {
// If we're building with ThinLTO on, by default we want to link

View File

@ -423,7 +423,7 @@ pub(crate) fn download_ci_rustc(&self, commit: &str) {
self.download_toolchain(
&version,
"ci-rustc",
commit,
&format!("{commit}-{}", self.llvm_assertions),
&extra_components,
Self::download_ci_component,
);
@ -499,8 +499,15 @@ fn download_toolchain(
/// Download a single component of a CI-built toolchain (not necessarily a published nightly).
// NOTE: intentionally takes an owned string to avoid downloading multiple times by accident
fn download_ci_component(&self, filename: String, prefix: &str, commit: &str) {
Self::download_component(self, DownloadSource::CI, filename, prefix, commit, "ci-rustc")
fn download_ci_component(&self, filename: String, prefix: &str, commit_with_assertions: &str) {
Self::download_component(
self,
DownloadSource::CI,
filename,
prefix,
commit_with_assertions,
"ci-rustc",
)
}
fn download_component(
@ -520,11 +527,18 @@ fn download_component(
let bin_root = self.out.join(self.build.triple).join(destination);
let tarball = cache_dir.join(&filename);
let (base_url, url, should_verify) = match mode {
DownloadSource::CI => (
self.stage0_metadata.config.artifacts_server.clone(),
format!("{key}/{filename}"),
false,
),
DownloadSource::CI => {
let dist_server = if self.llvm_assertions {
self.stage0_metadata.config.artifacts_with_llvm_assertions_server.clone()
} else {
self.stage0_metadata.config.artifacts_server.clone()
};
let url = format!(
"{}/{filename}",
key.strip_suffix(&format!("-{}", self.llvm_assertions)).unwrap()
);
(dist_server, url, false)
}
DownloadSource::Dist => {
let dist_server = env::var("RUSTUP_DIST_SERVER")
.unwrap_or(self.stage0_metadata.config.dist_server.to_string());