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)] #[derive(Clone, Default)]
pub enum DryRun { pub enum DryRun {
/// This isn't a dry run. /// 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); 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. // 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 config.llvm_thin_lto && llvm.link_shared.is_none() {
// If we're building with ThinLTO on, by default we want to link // 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( self.download_toolchain(
&version, &version,
"ci-rustc", "ci-rustc",
commit, &format!("{commit}-{}", self.llvm_assertions),
&extra_components, &extra_components,
Self::download_ci_component, 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). /// 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 // NOTE: intentionally takes an owned string to avoid downloading multiple times by accident
fn download_ci_component(&self, filename: String, prefix: &str, commit: &str) { fn download_ci_component(&self, filename: String, prefix: &str, commit_with_assertions: &str) {
Self::download_component(self, DownloadSource::CI, filename, prefix, commit, "ci-rustc") Self::download_component(
self,
DownloadSource::CI,
filename,
prefix,
commit_with_assertions,
"ci-rustc",
)
} }
fn download_component( fn download_component(
@ -520,11 +527,18 @@ fn download_component(
let bin_root = self.out.join(self.build.triple).join(destination); let bin_root = self.out.join(self.build.triple).join(destination);
let tarball = cache_dir.join(&filename); let tarball = cache_dir.join(&filename);
let (base_url, url, should_verify) = match mode { let (base_url, url, should_verify) = match mode {
DownloadSource::CI => ( DownloadSource::CI => {
self.stage0_metadata.config.artifacts_server.clone(), let dist_server = if self.llvm_assertions {
format!("{key}/{filename}"), self.stage0_metadata.config.artifacts_with_llvm_assertions_server.clone()
false, } 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 => { DownloadSource::Dist => {
let dist_server = env::var("RUSTUP_DIST_SERVER") let dist_server = env::var("RUSTUP_DIST_SERVER")
.unwrap_or(self.stage0_metadata.config.dist_server.to_string()); .unwrap_or(self.stage0_metadata.config.dist_server.to_string());