diff options
| author | Joshua Nelson <jnelson@cloudflare.com> | 2022-05-28 23:55:42 -0500 |
|---|---|---|
| committer | Joshua Nelson <jnelson@cloudflare.com> | 2022-06-07 10:18:23 -0500 |
| commit | 6115f4eba458e763370119b2a10a73ef595583bc (patch) | |
| tree | 6ddbf816fb3cb436b9441a5345485fc103450750 /src/bootstrap/lib.rs | |
| parent | a9ca4b95295ce84ec1ba89a657647e2de03bb132 (diff) | |
| download | rust-6115f4eba458e763370119b2a10a73ef595583bc.tar.gz rust-6115f4eba458e763370119b2a10a73ef595583bc.zip | |
Add a `DownloadSource` enum
This simplifies the arguments to `download_component` in config.rs. It also moves stage0.json metadata handling to `Build::new`, making it easier to download the stage0 compiler in rustbuild later if necessary.
Diffstat (limited to 'src/bootstrap/lib.rs')
| -rw-r--r-- | src/bootstrap/lib.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 4974a1c5b7b..022f2e0fc13 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -118,6 +118,7 @@ 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,6 +295,7 @@ pub struct Build { 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, @@ -320,6 +322,18 @@ 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>, @@ -468,7 +482,11 @@ 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, |
