Rollup merge of #97828 - ferrocene:pa-config-artifacts, r=jyn514
Allow configuring where artifacts are downloaded from Bootstrap has support for downloading prebuilt LLVM and rustc artifacts to speed up local builds, but that currently works only for users working on `rust-lang/rust`. Forks of the repository (for example Ferrocene) might have different URLs to download artifacts from, or might use a different email address on merge commits, breaking both LLVM and rustc artifact downloads. This PR refactors bootstrap to load the download URLs and other constants from `src/stage0.json`, allowing downstream forks to tweak those values. It also future-proofs the download code to easily allow forks to add their own custom protocols (like `s3://`). This PR is best reviewed commit-by-commit.
This commit is contained in:
@@ -118,7 +118,6 @@ use std::os::windows::fs::symlink_file;
|
||||
|
||||
use filetime::FileTime;
|
||||
use once_cell::sync::OnceCell;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::builder::Kind;
|
||||
use crate::config::{LlvmLibunwind, TargetSelection};
|
||||
@@ -294,8 +293,6 @@ pub struct Build {
|
||||
hosts: Vec<TargetSelection>,
|
||||
targets: Vec<TargetSelection>,
|
||||
|
||||
// Stage 0 (downloaded) compiler, lld and cargo or their local rust equivalents
|
||||
stage0_metadata: Stage0Metadata,
|
||||
initial_rustc: PathBuf,
|
||||
initial_cargo: PathBuf,
|
||||
initial_lld: PathBuf,
|
||||
@@ -322,18 +319,6 @@ pub struct Build {
|
||||
metrics: metrics::BuildMetrics,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Stage0Metadata {
|
||||
dist_server: String,
|
||||
checksums_sha256: HashMap<String, String>,
|
||||
rustfmt: Option<RustfmtMetadata>,
|
||||
}
|
||||
#[derive(Deserialize)]
|
||||
struct RustfmtMetadata {
|
||||
date: String,
|
||||
version: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Crate {
|
||||
name: Interned<String>,
|
||||
@@ -482,11 +467,7 @@ impl Build {
|
||||
bootstrap_out
|
||||
};
|
||||
|
||||
let stage0_json = t!(std::fs::read_to_string(&src.join("src").join("stage0.json")));
|
||||
let stage0_metadata = t!(serde_json::from_str::<Stage0Metadata>(&stage0_json));
|
||||
|
||||
let mut build = Build {
|
||||
stage0_metadata,
|
||||
initial_rustc: config.initial_rustc.clone(),
|
||||
initial_cargo: config.initial_cargo.clone(),
|
||||
initial_lld,
|
||||
|
||||
Reference in New Issue
Block a user